]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Fixed command parameter handling for doveadm-server.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 26 Feb 2016 14:21:38 +0000 (16:21 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 26 Feb 2016 14:22:50 +0000 (16:22 +0200)
src/doveadm/client-connection.c

index ce08f7a66c417e4492adf4207cff824f33cee8b0..ec113dc1a83caf14c05422ad4b664bfe1d4d03f7 100644 (file)
@@ -282,8 +282,9 @@ static bool client_handle_command(struct client_connection *conn, char **args)
                return FALSE;
        }
        memset(&attrs, 0, sizeof(attrs));
-       attrs.argv = (const char **)args;
-       attrs.argc = argc;
+       /* leave the command name as args[0] so getopt() works */
+       attrs.argv = (const char **)args + 2;
+       attrs.argc = argc - 2;
 
        attrs.local_ip = conn->local_ip;
        attrs.remote_ip = conn->remote_ip;
@@ -292,11 +293,7 @@ static bool client_handle_command(struct client_connection *conn, char **args)
 
        flags = args[0];
        attrs.username = args[1];
-
        cmd_name = args[2];
-       /* leave the command name as args[0] so getopt() works */
-       args += 2;
-       argc -= 2;
 
        doveadm_debug = FALSE;
        doveadm_verbose = FALSE;