]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
fixed anonymous login in rpcclient
authorAndrew Tridgell <tridge@samba.org>
Sun, 8 Jul 2001 20:28:17 +0000 (20:28 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 8 Jul 2001 20:28:17 +0000 (20:28 +0000)
source/rpcclient/rpcclient.c

index decad75c8715a20dba8fae97b1f9d18ca669ae2b..6420dbbdb5276453d4b54ed895e6cc9eee7d7dee 100644 (file)
@@ -246,7 +246,7 @@ void init_rpcclient_creds(struct ntuser_creds *creds, char* username,
                          char* domain, char* password)
 {
        ZERO_STRUCTP(creds);
-       
+
        if (lp_encrypted_passwords()) {
                pwd_make_lm_nt_16(&creds->pwd, password);
        } else {
@@ -255,6 +255,10 @@ void init_rpcclient_creds(struct ntuser_creds *creds, char* username,
 
        fstrcpy(creds->user_name, username);
        fstrcpy(creds->domain, domain);
+
+       if (! *username) {
+               creds->pwd.null_pwd = True;
+       }
 }
 
 
@@ -577,7 +581,6 @@ static void usage(void)
                case 'U': {
                        char *lp;
                        pstrcpy(username,optarg);
-                       printf("got user=%s\n", username);
                        if ((lp=strchr_m(username,'%'))) {
                                *lp = 0;
                                pstrcpy(password,lp+1);
@@ -634,8 +637,8 @@ static void usage(void)
         * initialize the credentials struct.  Get password
         * from stdin if necessary
         */
-       if (!strlen(username))
-               get_username (username);
+       if (!strlen(username) && !got_pass)
+               get_username(username);
                
        if (!got_pass) {
                init_rpcclient_creds (&creds, username, domain, "");