summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-03-21 23:35:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:09 -0500
commit13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a (patch)
tree8eddfcb0dd18a9cee4c1de4fbd3ee98f05cd27e6 /source4/lib
parent05bc2d7b2c11a3583a6d1221cfbd618eb6730518 (diff)
downloadsamba-13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a.tar.gz
samba-13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a.tar.bz2
samba-13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a.zip
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)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/cmdline/popt_common.c5
-rw-r--r--source4/lib/credentials.c13
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;
+}