diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-05-10 14:48:33 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-05-10 14:48:33 +0000 |
commit | 43a3faab0831a866559ca56e70c81be582047d0b (patch) | |
tree | 260d1729096068494759dce1743d44da61499671 /source3/smbd | |
parent | 1c0cfff309be9360fa55ca2c72f6efd093f5a062 (diff) | |
download | samba-43a3faab0831a866559ca56e70c81be582047d0b.tar.gz samba-43a3faab0831a866559ca56e70c81be582047d0b.tar.xz samba-43a3faab0831a866559ca56e70c81be582047d0b.zip |
- changed smb_getpwnam() to use winbind style usernames
- finished ntdom -> winbind rename in head
(This used to be commit ada483cb56453afc6df4ec4be18bfe5e943c7150)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/password.c | 2 | ||||
-rw-r--r-- | source3/smbd/reply.c | 27 | ||||
-rw-r--r-- | source3/smbd/service.c | 2 |
3 files changed, 21 insertions, 10 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 3953c5b0e3c..314b3dd3c70 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -493,7 +493,7 @@ BOOL pass_check_smb(char *user, char *domain, } else { - pass = smb_getpwnam(user,domain,True); + pass = smb_getpwnam(user,True); } if (pass == NULL) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 0d099a7b4c1..1fc377f3622 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -572,7 +572,7 @@ static BOOL check_server_security(char *orig_user, char *domain, char *unix_user * level security as we never know if it was a failure * due to a bad password, or the user really doesn't exist. */ - if(lp_adduser_script() && !smb_getpwnam(unix_user,domain, True)) { + if(lp_adduser_script() && !smb_getpwnam(unix_user,True)) { smb_create_user(unix_user); } } @@ -608,7 +608,7 @@ static BOOL check_domain_security(char *orig_user, char *domain, char *unix_user * If the admin wants us to try and create a UNIX * user on the fly, do so. */ - if(user_exists && lp_adduser_script() && !smb_getpwnam(unix_user,domain,True)) { + if(user_exists && lp_adduser_script() && !smb_getpwnam(unix_user,True)) { smb_create_user(unix_user); } } else { @@ -618,7 +618,7 @@ static BOOL check_domain_security(char *orig_user, char *domain, char *unix_user * wants us to try and delete that UNIX user on the fly, * do so. */ - if(!user_exists && lp_deluser_script() && smb_getpwnam(unix_user,domain,True)) { + if(!user_exists && lp_deluser_script() && smb_getpwnam(unix_user,True)) { smb_delete_user(unix_user); } } @@ -853,6 +853,17 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int pstrcpy( orig_user, user); + /* if the username exists as a domain/username pair on the unix system then use + that */ + if (!Get_Pwnam(user, False)) { + pstring user2; + slprintf(user2,sizeof(user2),"%s/%s", domain, user); + if (Get_Pwnam(user2, True)) { + DEBUG(3,("Using unix username %s\n", user2)); + pstrcpy(user, user2); + } + } + /* * Pass the user through the NT -> unix user mapping * function. @@ -863,7 +874,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int /* * Do any UNIX username case mangling. */ - smb_getpwnam(user, domain, True); + smb_getpwnam(user, True); add_session_user(user); @@ -920,7 +931,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int if (lp_map_to_guest() == MAP_TO_GUEST_ON_BAD_USER) { - if (smb_getpwnam(user,domain,True)) + if (smb_getpwnam(user,True)) { DEBUG(1,("Rejecting user '%s': bad password\n", user)); return bad_password_error(inbuf,outbuf); @@ -933,14 +944,14 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int */ } - if (*smb_apasswd || !smb_getpwnam(user,domain,True)) + if (*smb_apasswd || !smb_getpwnam(user,True)) pstrcpy(user,lp_guestaccount(-1)); DEBUG(3,("Registered username %s for guest access\n",user)); guest = True; } } - if (!smb_getpwnam(user,domain,True)) { + if (!smb_getpwnam(user,True)) { DEBUG(3,("No such user %s [%s] - using guest account\n",user, domain)); pstrcpy(user,lp_guestaccount(-1)); guest = True; @@ -975,7 +986,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int user we should become. */ { - const struct passwd *pw = smb_getpwnam(user,domain,False); + const struct passwd *pw = smb_getpwnam(user,False); if (!pw) { DEBUG(1,("Username %s is invalid on this system\n",user)); return bad_password_error(inbuf,outbuf); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 71d718154d1..f713b185623 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -295,7 +295,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int } /* find out some info about the user */ - pass = smb_getpwnam(user,validated_domain(vuid),True); + pass = smb_getpwnam(user,True); if (pass == NULL) { DEBUG(0,( "Couldn't find account %s\n",user)); |