]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow help for commands with callbacks
authorAlan T. DeKok <aland@freeradius.org>
Sun, 8 Jul 2018 19:21:05 +0000 (15:21 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 8 Jul 2018 19:21:05 +0000 (15:21 -0400)
which just prints the syntax for now

src/main/command.c

index 1a6c7d8cc4db19ff6f7463b43b25a3f8de1438c9..b9b01f8b4cfd564c58e2cbd0355c5ff8fe05e2b5 100644 (file)
@@ -698,11 +698,6 @@ int fr_command_add(TALLOC_CTX *talloc_ctx, fr_cmd_t **head, char const *name, vo
                return -1;
        }
 
-       if (!table->func) {
-               fr_strerror_printf("Command tables MUST define a callback function.");
-               return -1;
-       }
-
        start = head;
        syntax_argv = NULL;
 
@@ -1504,7 +1499,12 @@ void fr_command_list(FILE *fp, int max_depth, fr_cmd_t *head, bool is_head)
        if (max_depth > CMD_MAX_ARGV) max_depth = CMD_MAX_ARGV;
 
        if (!is_head) {
-               if (!head->child) return;
+               if (!head->child) {
+                       rad_assert(head->func != NULL);
+                       // @todo - skip syntax_argv as necessary
+                       fr_command_list_node(fp, head, 0, argv);
+                       return;
+               }
                head = head->child;
        }