From 13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Mar 2005 23:35:58 +0000 Subject: r5929: Use cli_credentials for the SMB functions as well. Fix a couple of bugs in the new cli_credentials code (This used to be commit 4ad481cfe5cde514d2ef9646147239f3faaa6173) --- source4/lib/cmdline/popt_common.c | 5 ++--- source4/lib/credentials.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'source4/lib') 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; +} -- cgit