diff options
author | Gerald Carter <jerry@samba.org> | 2003-12-19 00:33:27 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-12-19 00:33:27 +0000 |
commit | 99b2bbfaa26139e6c27db8bebcd10719872bcbe2 (patch) | |
tree | 68792e89a30a5570d735f14fbaf65779b3f86a2b /source3/auth/auth_util.c | |
parent | 80222a3a92209394e35edaee5f5773c72d0e1fdf (diff) | |
download | samba-99b2bbfaa26139e6c27db8bebcd10719872bcbe2.tar.gz samba-99b2bbfaa26139e6c27db8bebcd10719872bcbe2.tar.bz2 samba-99b2bbfaa26139e6c27db8bebcd10719872bcbe2.zip |
* add a few useful debug lines
* fix bug involving Win9x clients. Make sure we
save the right case for the located username
in fill_sam_account()
(This used to be commit d22b4097d4c2bde7989af31ccb572871c6e63424)
Diffstat (limited to 'source3/auth/auth_util.c')
-rw-r--r-- | source3/auth/auth_util.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 3dc0fdbe46..c474049617 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -926,21 +926,38 @@ static NTSTATUS fill_sam_account(TALLOC_CTX *mem_ctx, fstring dom_user; struct passwd *passwd; - fstr_sprintf(dom_user, "%s%s%s", - domain, lp_winbind_separator(), username); + fstr_sprintf(dom_user, "%s%s%s", domain, lp_winbind_separator(), + username); passwd = Get_Pwnam(dom_user); + + if ( passwd ) { + char *p; + + /* make sure we get the case of the username correct */ + /* work around 'winbind use default domain = yes' */ + + p = strchr( passwd->pw_name, *lp_winbind_separator() ); + if ( !p ) + fstr_sprintf(dom_user, "%s%s%s", domain, + lp_winbind_separator(), passwd->pw_name); + else + fstrcpy( dom_user, passwd->pw_name ); + } + else { + /* if the lookup for DOMAIN\username failed, try again + with just 'username'. This is need for accessing the server + as a trust user that actually maps to a local account */ - /* if the lookup for DOMAIN\username failed, try again - with just 'username'. This is need for accessing the server - as a trust user that actually maps to a local account */ - - if ( !passwd ) { fstrcpy( dom_user, username ); passwd = Get_Pwnam( dom_user ); + + /* make sure we get the case of the username correct */ + if ( passwd ) + fstrcpy( dom_user, passwd->pw_name ); } - if (passwd == NULL) + if ( !passwd ) return NT_STATUS_NO_SUCH_USER; *uid = passwd->pw_uid; @@ -953,6 +970,9 @@ static NTSTATUS fill_sam_account(TALLOC_CTX *mem_ctx, --jerry */ *found_username = talloc_strdup(mem_ctx, dom_user); + + DEBUG(5,("fill_sam_account: located username was [%s]\n", + *found_username)); return pdb_init_sam_pw(sam_account, passwd); } |