Missed a couple of files from the client-side kerberos merge
authorAndrew Bartlett <abartlet@samba.org>
Mon, 24 Feb 2003 03:06:45 +0000 (03:06 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 24 Feb 2003 03:06:45 +0000 (03:06 +0000)
source/torture/locktest.c
source/torture/masktest.c
source/utils/net_ads.c

index 5f9a63802b31d351ed0b343c5ee87e6af0e4f9a0..63b9590dd61639605633ff0714623d50b89b347b 100644 (file)
@@ -24,6 +24,7 @@
 
 static fstring password[2];
 static fstring username[2];
+static int got_user;
 static int got_pass;
 static BOOL use_kerberos;
 static int numops = 1000;
@@ -602,13 +603,13 @@ static void usage(void)
                case 'k':
 #ifdef HAVE_KRB5
                        use_kerberos = True;
-                       got_pass = True;
 #else
                        d_printf("No kerberos support compiled in\n");
                        exit(1);
 #endif
                        break;
                case 'U':
+                       got_user = 1;
                        if (got_pass == 2) {
                                d_printf("Max of 2 usernames\n");
                                exit(1);
@@ -663,6 +664,8 @@ static void usage(void)
                }
        }
 
+       if(use_kerberos && !got_user) got_pass = True;
+
        argc -= optind;
        argv += optind;
 
index df0a047aff32eb5461a1c734f045cab37679711a..7d751fb789ae5f537f59d2335be6b371b5060615 100644 (file)
@@ -254,7 +254,7 @@ struct cli_state *connect_one(char *share)
 static char *resultp;
 static file_info *f_info;
 
-void listfn(file_info *f, const char *s, void *state)
+static void listfn(file_info *f, const char *s, void *state)
 {
        if (strcmp(f->name,".") == 0) {
                resultp[0] = '+';
index 867252c95f2ac9743b1d44ad0e7e271510892eae..75bb29f213072cc262de11bb4340b5de489cbbdf 100644 (file)
@@ -110,6 +110,11 @@ static int net_ads_info(int argc, const char **argv)
        return 0;
 }
 
+static void use_in_memory_ccache(void) {
+       /* Use in-memory credentials cache so we do not interfere with
+        * existing credentials */
+       setenv(KRB5_ENV_CCNAME, "MEMORY:net_ads", 1);
+}
 
 static ADS_STRUCT *ads_startup(void)
 {
@@ -124,8 +129,10 @@ static ADS_STRUCT *ads_startup(void)
                opt_user_name = "administrator";
        }
 
-       if (opt_user_specified)
+       if (opt_user_specified) {
                need_password = True;
+               use_in_memory_ccache();
+       }
 
 retry:
        if (!opt_password && need_password) {
@@ -601,6 +608,8 @@ static int net_ads_join_ok(void)
  */
 int net_ads_testjoin(int argc, const char **argv)
 {
+       use_in_memory_ccache();
+
        /* Display success or failure */
        if (net_ads_join_ok() != 0) {
                fprintf(stderr,"Join to domain is not valid\n");
@@ -878,7 +887,8 @@ static int net_ads_password(int argc, const char **argv)
        (strchr(argv[0], '@') == NULL)) {
        return net_ads_usage(argc, argv);
     }
-    
+
+    use_in_memory_ccache();    
     c = strchr(auth_principal, '@');
     realm = ++c;
 
@@ -925,6 +935,8 @@ static int net_ads_change_localhost_pass(int argc, const char **argv)
 
     opt_password = secrets_fetch_machine_password();
 
+    use_in_memory_ccache();
+
     if (!(ads = ads_startup())) {
            return -1;
     }