r6483: fix anonymous connections, '-U %' or '-U ""%""' can be used for this
authorStefan Metzmacher <metze@samba.org>
Tue, 26 Apr 2005 07:10:43 +0000 (07:10 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:16:19 +0000 (13:16 -0500)
metze

source/lib/cmdline/popt_common.c
source/lib/credentials.c

index 68f491a1885d0c18407cff518e64b678716d7693..94b72c520d39f073679cf2410cdb1d5a7d559f14 100644 (file)
@@ -197,7 +197,7 @@ static void popt_common_credentials_callback(poptContext con,
 
                        cli_credentials_parse_string(cmdline_credentials, arg, CRED_SPECIFIED);
 
-                       if ((lp=strchr_m(arg,'%'))) {
+                       if (cmdline_credentials->password && (lp=strchr_m(arg,'%'))) {
                                memset(lp,0,strlen(cmdline_credentials->password));
                        }
                }
index f5ce886ed0b2f5bf82b3face30961ae13959cb24..db796cde3543549100c3cb88fbcff4c4fe39006c 100644 (file)
@@ -363,6 +363,11 @@ void cli_credentials_parse_string(struct cli_credentials *credentials, const cha
 {
        char *uname, *p;
 
+       if (strcmp("%",data) == 0) {
+               cli_credentials_set_anonymous(credentials);
+               return;
+       }
+
        uname = talloc_strdup(credentials, data); 
        if ((p = strchr_m(uname,'%'))) {
                *p = 0;