]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
clarify tab_expand
authorAlan T. DeKok <aland@freeradius.org>
Mon, 9 Jul 2018 19:43:16 +0000 (15:43 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 9 Jul 2018 19:43:16 +0000 (15:43 -0400)
src/main/command.c

index 3178a3313ee5b9500f6365a5d28d7c32dfe4d4a3..b840e79f69464fc316e2bc572e1dc18a2f663766 100644 (file)
@@ -1310,22 +1310,28 @@ int fr_command_tab_expand(TALLOC_CTX *ctx, fr_cmd_t *head, fr_cmd_info_t *info,
                        return fr_command_tab_expand_partial(start, info->argv[i], max_expansions, expansions);
                }
 
+               if (cmd->intermediate) {
+                       rad_assert(cmd->child != NULL);
+                       start = cmd->child;
+                       continue;
+               }
+
+               if (!cmd->syntax) {
+                       if ((i + 1) == info->argc) return 0;
+
+                       return -1;
+               }
+
                if (!cmd->live) return 0;
 
                /*
                 *      If there is a syntax, the command MUST be a
                 *      leaf node.
+                *
+                *      Skip the name
                 */
-               if (cmd->syntax) {
-                       /*
-                        *      Skip the name
-                        */
-                       rad_assert(cmd->child == NULL);
-                       return fr_command_tab_expand_syntax(ctx, cmd, i + 1, info, max_expansions, expansions);
-               }
-
-               rad_assert(cmd->child != NULL);
-               start = cmd->child;
+               rad_assert(cmd->func != NULL);
+               return fr_command_tab_expand_syntax(ctx, cmd, i + 1, info, max_expansions, expansions);
        }
 
        cmd = start;