summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-07-08 20:28:17 +0000
committerAndrew Tridgell <tridge@samba.org>2001-07-08 20:28:17 +0000
commit282d295a376cff8f1d038ff7fc129f2f91cba6b8 (patch)
treedb83e399a13701818b419e3de4ddba3fb6817a80
parent81393e6fda13f6a7f3eb2397dae114f039519140 (diff)
downloadsamba-282d295a376cff8f1d038ff7fc129f2f91cba6b8.tar.gz
samba-282d295a376cff8f1d038ff7fc129f2f91cba6b8.tar.bz2
samba-282d295a376cff8f1d038ff7fc129f2f91cba6b8.zip
fixed anonymous login in rpcclient
(This used to be commit b2a4a62b5ed581bf89fe20cdf427c1740fd73266)
-rw-r--r--source3/rpcclient/rpcclient.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index decad75c87..6420dbbdb5 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -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, "");