]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm user: If user isn't found, exit with status 2.
authorTimo Sirainen <tss@iki.fi>
Thu, 30 Dec 2010 09:51:59 +0000 (11:51 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 30 Dec 2010 09:51:59 +0000 (11:51 +0200)
src/doveadm/doveadm-auth.c

index efc4eafd7226b1afee197f3a53f79ed67dd3d332..a7c02cddd69f26112c9d9d01cb389782994d8f0a 100644 (file)
@@ -65,7 +65,7 @@ cmd_user_input(const char *auth_socket_path, const struct authtest_input *input)
                }
        }
        auth_master_deinit(&conn);
-       return ret == 0 ? 1 : 0;
+       return ret;
 }
 
 static void
@@ -250,15 +250,23 @@ auth_cmd_common(const struct doveadm_cmd *cmd, int argc, char *argv[])
                cmd_user_list(auth_socket_path, argv + optind);
        } else {
                bool first = TRUE;
+               bool notfound = FALSE;
 
                while ((input.username = argv[optind++]) != NULL) {
                        if (first)
                                first = FALSE;
                        else
                                putchar('\n');
-                       if (cmd_user_input(auth_socket_path, &input) < 0)
+                       switch (cmd_user_input(auth_socket_path, &input)) {
+                       case -1:
                                exit(1);
+                       case 0:
+                               notfound = TRUE;
+                               break;
+                       }
                }
+               if (notfound)
+                       exit(2);
        }
 }