]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r2086: fix bug with winbindd_getpwnam() caused by Microsoft DC's not filling in the...
authorGerald Carter <jerry@samba.org>
Fri, 27 Aug 2004 13:39:09 +0000 (13:39 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:52:31 +0000 (10:52 -0500)
source/auth/auth_domain.c
source/libsmb/samlogon_cache.c
source/nsswitch/winbindd_pam.c

index fdff0b52f963aecb22a93a813957c69705bda438..6483dc143a0564d0f2af20c293d02157c44d4a88 100644 (file)
@@ -205,7 +205,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
        } else {
                nt_status = make_server_info_info3(mem_ctx, user_info->internal_username.str, 
                                                   user_info->smb_name.str, domain, server_info, &info3);
-               netsamlogon_cache_store( mem_ctx, &info3 );
+               netsamlogon_cache_store( mem_ctx, user_info->smb_name.str, &info3 );
        }
 
 #if 0
index 4cd642c4e35a64a120c3f07ada88dd7176dd62e9..0105bc08c3a112b23836d4427df9a520046e5b8e 100644 (file)
@@ -106,9 +106,10 @@ void netsamlogon_clear_cached_user(TDB_CONTEXT *tdb, NET_USER_INFO_3 *user)
 
 /***********************************************************************
  Store a NET_USER_INFO_3 structure in a tdb for later user 
+ username should be in UTF-8 format
 ***********************************************************************/
 
-BOOL netsamlogon_cache_store(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *user)
+BOOL netsamlogon_cache_store(TALLOC_CTX *mem_ctx, const char * username, NET_USER_INFO_3 *user)
 {
        TDB_DATA        data;
         fstring        keystr;
@@ -130,6 +131,14 @@ BOOL netsamlogon_cache_store(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *user)
        slprintf(keystr, sizeof(keystr), "%s", sid_string_static(&user_sid));
 
        DEBUG(10,("netsamlogon_cache_store: SID [%s]\n", keystr));
+       
+       /* only Samba fills in the username, not sure why NT doesn't */
+       /* so we fill it in since winbindd_getpwnam() makes use of it */
+       
+       if ( !user->uni_user_name.buffer ) {
+               init_unistr2( &user->uni_user_name, username, STR_TERMINATE );
+               init_uni_hdr( &user->hdr_user_name, &user->uni_user_name );
+       }
                
        /* Prepare data */
        
index 03947de8750e6da93193e6ed5574edb6ac58801d..08913a35a48f5a9d07c76b1a5ec5e4c33b1122a6 100644 (file)
@@ -283,7 +283,7 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state)
        }
        
        if (NT_STATUS_IS_OK(result)) {
-               netsamlogon_cache_store( cli->mem_ctx, &info3 );
+               netsamlogon_cache_store( cli->mem_ctx, name_user, &info3 );
                wcache_invalidate_samlogon(find_domain_from_name(name_domain), &info3);
 
                /* Check if the user is in the right group */
@@ -538,7 +538,7 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state)
        }
 
        if (NT_STATUS_IS_OK(result)) {
-               netsamlogon_cache_store( cli->mem_ctx, &info3 );
+               netsamlogon_cache_store( cli->mem_ctx, name_user, &info3 );
                wcache_invalidate_samlogon(find_domain_from_name(name_domain), &info3);
                
                if (!NT_STATUS_IS_OK(result = check_info3_in_group(mem_ctx, &info3, state->request.data.auth_crap.required_membership_sid))) {