summaryrefslogtreecommitdiff
path: root/source3/libsmb/samlogon_cache.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-08-27 13:39:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:31 -0500
commited5fd7117e931b2fce2c2a94adc53eeb3d8a8256 (patch)
tree1f20daf020f6c65b4e54e914714e431b4a51ee74 /source3/libsmb/samlogon_cache.c
parent69e87ef8c3005c1cdf23e0ac46beb718986d7daa (diff)
downloadsamba-ed5fd7117e931b2fce2c2a94adc53eeb3d8a8256.tar.gz
samba-ed5fd7117e931b2fce2c2a94adc53eeb3d8a8256.tar.bz2
samba-ed5fd7117e931b2fce2c2a94adc53eeb3d8a8256.zip
r2086: fix bug with winbindd_getpwnam() caused by Microsoft DC's not filling in the username in the user_info3
(This used to be commit 4703a71fa88dff8bdc932f6c9af3a9d25a88938f)
Diffstat (limited to 'source3/libsmb/samlogon_cache.c')
-rw-r--r--source3/libsmb/samlogon_cache.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c
index 4cd642c4e3..0105bc08c3 100644
--- a/source3/libsmb/samlogon_cache.c
+++ b/source3/libsmb/samlogon_cache.c
@@ -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 */