s4: popt: Global replace of cmdline_credentials -> popt_get_cmdline_credentials().
[gd/samba-autobuild/.git] / source4 / torture / shell.c
index 4c098a97486b3e74918383dfdab66aacb7723cb5..5a4eb5c1d6a1b60482ffaf8704e5bab66ee94ef4 100644 (file)
@@ -110,10 +110,8 @@ void torture_shell(struct torture_context *tctx)
         * stops the credentials system prompting when we use the "auth"
         * command to display the current auth parameters.
         */
-       if (cmdline_credentials->password_obtained != CRED_SPECIFIED) {
-           cli_credentials_set_password(cmdline_credentials, "",
-                   CRED_SPECIFIED);
-       }
+       cli_credentials_set_password(popt_get_cmdline_credentials(),
+                       "", CRED_GUESS_ENV);
 
        while (1) {
                cline = smb_readline("torture> ", NULL, NULL);
@@ -215,7 +213,7 @@ static void shell_list(const struct shell_command * command,
        return;
     }
 
-    torture_print_tests(true);
+    torture_print_testsuites(true);
 }
 
 static void shell_auth(const struct shell_command * command,
@@ -229,11 +227,14 @@ static void shell_auth(const struct shell_command * command,
            const char * password;
            const char * principal;
 
-           username = cli_credentials_get_username(cmdline_credentials);
-           principal = cli_credentials_get_principal(cmdline_credentials, tctx);
-           domain = cli_credentials_get_domain(cmdline_credentials);
-           realm = cli_credentials_get_realm(cmdline_credentials);
-           password = cli_credentials_get_password(cmdline_credentials);
+           username = cli_credentials_get_username(
+                       popt_get_cmdline_credentials());
+           principal = cli_credentials_get_principal(
+                               popt_get_cmdline_credentials(), tctx);
+           domain = cli_credentials_get_domain(popt_get_cmdline_credentials());
+           realm = cli_credentials_get_realm(popt_get_cmdline_credentials());
+           password = cli_credentials_get_password(
+                               popt_get_cmdline_credentials());
 
            printf("Username: %s\n", username ? username : "");
            printf("User Principal: %s\n", principal ? principal : "");
@@ -245,19 +246,24 @@ static void shell_auth(const struct shell_command * command,
 
            if (!strcmp(argv[0], "username")) {
                    result = cli_credentials_set_username(
-                       cmdline_credentials, argv[1], CRED_SPECIFIED);
+                       popt_get_cmdline_credentials(),
+                       argv[1], CRED_SPECIFIED);
            } else if (!strcmp(argv[0], "principal")) {
                    result = cli_credentials_set_principal(
-                       cmdline_credentials, argv[1], CRED_SPECIFIED);
+                       popt_get_cmdline_credentials(),
+                       argv[1], CRED_SPECIFIED);
            } else if (!strcmp(argv[0], "domain")) {
                    result = cli_credentials_set_domain(
-                       cmdline_credentials, argv[1], CRED_SPECIFIED);
+                       popt_get_cmdline_credentials(),
+                       argv[1], CRED_SPECIFIED);
            } else if (!strcmp(argv[0], "realm")) {
                    result = cli_credentials_set_realm(
-                       cmdline_credentials, argv[1], CRED_SPECIFIED);
+                       popt_get_cmdline_credentials(),
+                       argv[1], CRED_SPECIFIED);
            } else if (!strcmp(argv[0], "password")) {
                    result = cli_credentials_set_password(
-                       cmdline_credentials, argv[1], CRED_SPECIFIED);
+                       popt_get_cmdline_credentials(),
+                       argv[1], CRED_SPECIFIED);
            } else {
                    shell_usage(command);
                    return;
@@ -288,7 +294,7 @@ static void shell_target(const struct shell_command *command,
                printf("Target share: %s\n", share ? share : "");
                printf("Target binding: %s\n", binding ? binding : "");
        } else if (argc == 1) {
-               torture_parse_target(tctx->lp_ctx, argv[0]);
+               torture_parse_target(tctx, tctx->lp_ctx, argv[0]);
        } else {
                shell_usage(command);
        }