diff options
-rw-r--r-- | source3/smbd/server.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 01f9006a42..1d3c2e144c 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -3353,11 +3353,25 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de if (*user && Get_Pwnam(user,True)) return(make_connection(user,user,password,pwlen,dev,vuid)); - if (validated_username(vuid)) - { - strcpy(user,validated_username(vuid)); - return(make_connection(user,user,password,pwlen,dev,vuid)); - } + if(lp_security() != SEC_SHARE) + { + if (validated_username(vuid)) + { + strcpy(user,validated_username(vuid)); + return(make_connection(user,user,password,pwlen,dev,vuid)); + } + } + else + { + /* + * Security = share. Try with sesssetup_user as the username. + */ + if(*sesssetup_user) + { + strcpy(user,sesssetup_user); + return(make_connection(user,user,password,pwlen,dev,vuid)); + } + } } if (!lp_snum_ok(snum) || !check_access(snum)) { |