diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/cmdline/popt_common.c | 5 | ||||
-rw-r--r-- | source4/lib/credentials.c | 13 |
2 files changed, 13 insertions, 5 deletions
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c index 0792a16b3d..b0b5073e62 100644 --- a/source4/lib/cmdline/popt_common.c +++ b/source4/lib/cmdline/popt_common.c @@ -195,11 +195,10 @@ static void popt_common_credentials_callback(poptContext con, { char *lp; - cli_credentials_parse_string(cmdline_credentials,arg, CRED_SPECIFIED); + cli_credentials_parse_string(cmdline_credentials, arg, CRED_SPECIFIED); if ((lp=strchr_m(arg,'%'))) { - *lp = 0; - memset(strchr_m(arg,'%')+1,'X',strlen(cmdline_credentials->password)); + memset(lp,0,strlen(cmdline_credentials->password)); } } break; diff --git a/source4/lib/credentials.c b/source4/lib/credentials.c index 1c65bd2aff..2601028e7e 100644 --- a/source4/lib/credentials.c +++ b/source4/lib/credentials.c @@ -298,8 +298,7 @@ void cli_credentials_guess(struct cli_credentials *cred) if (getenv("USER")) { cli_credentials_parse_string(cred, getenv("USER"), CRED_GUESSED); if ((p = strchr_m(getenv("USER"),'%'))) { - *p = 0; - memset(strchr_m(getenv("USER"),'%')+1,'X',strlen(cred->password)); + memset(p,0,strlen(cred->password)); } } @@ -319,3 +318,13 @@ void cli_credentials_guess(struct cli_credentials *cred) cli_credentials_parse_password_file(cred, getenv("PASSWD_FILE"), CRED_GUESSED); } } + +BOOL cli_credentials_is_anonymous(struct cli_credentials *credentials) +{ + const char *username = cli_credentials_get_username(credentials); + + if (!username || !username[0]) + return True; + + return False; +} |