svn commit: samba r5648 - in trunk/source: auth groupdb lib
rpc_server
vlendec at samba.org
vlendec at samba.org
Thu Mar 3 16:53:21 GMT 2005
Author: vlendec
Date: 2005-03-03 16:53:19 +0000 (Thu, 03 Mar 2005)
New Revision: 5648
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5648
Log:
Caches are good for performance, but you get a consistency problem.
Fix bug # 2401.
Volker
Modified:
trunk/source/auth/auth_util.c
trunk/source/groupdb/mapping.c
trunk/source/lib/util_pw.c
trunk/source/rpc_server/srv_samr_nt.c
Changeset:
Modified: trunk/source/auth/auth_util.c
===================================================================
--- trunk/source/auth/auth_util.c 2005-03-03 16:52:44 UTC (rev 5647)
+++ trunk/source/auth/auth_util.c 2005-03-03 16:53:19 UTC (rev 5648)
@@ -50,6 +50,7 @@
if (homedir)
all_string_sub(add_script, "%H", homedir, sizeof(pstring));
ret = smbrun(add_script,NULL);
+ flush_pwnam_cache();
DEBUG(ret ? 0 : 3,("smb_create_user: Running the command `%s' gave %d\n",add_script,ret));
return ret;
}
Modified: trunk/source/groupdb/mapping.c
===================================================================
--- trunk/source/groupdb/mapping.c 2005-03-03 16:52:44 UTC (rev 5647)
+++ trunk/source/groupdb/mapping.c 2005-03-03 16:53:19 UTC (rev 5648)
@@ -1049,6 +1049,7 @@
all_string_sub(add_script, "%g", unix_group, sizeof(add_script));
all_string_sub(add_script, "%u", unix_user, sizeof(add_script));
ret = smbrun(add_script,NULL);
+ flush_pwnam_cache();
DEBUG(ret ? 0 : 3,("smb_set_primary_group: "
"Running the command `%s' gave %d\n",add_script,ret));
return ret;
@@ -1059,6 +1060,7 @@
if ( winbind_set_user_primary_group( unix_user, unix_group ) ) {
DEBUG(3,("smb_delete_group: winbindd set the group (%s) as the primary group for user (%s)\n",
unix_group, unix_user));
+ flush_pwnam_cache();
return 0;
}
Modified: trunk/source/lib/util_pw.c
===================================================================
--- trunk/source/lib/util_pw.c 2005-03-03 16:52:44 UTC (rev 5647)
+++ trunk/source/lib/util_pw.c 2005-03-03 16:53:19 UTC (rev 5648)
@@ -70,6 +70,20 @@
return;
}
+void flush_pwnam_cache(void)
+{
+ int i;
+
+ init_pwnam_cache();
+
+ for (i=0; i<PWNAMCACHE_SIZE; i++) {
+ if (pwnam_cache[i] == NULL)
+ continue;
+
+ passwd_free(&pwnam_cache[i]);
+ }
+}
+
struct passwd *getpwnam_alloc(const char *name)
{
int i;
Modified: trunk/source/rpc_server/srv_samr_nt.c
===================================================================
--- trunk/source/rpc_server/srv_samr_nt.c 2005-03-03 16:52:44 UTC (rev 5647)
+++ trunk/source/rpc_server/srv_samr_nt.c 2005-03-03 16:53:19 UTC (rev 5648)
@@ -2446,6 +2446,7 @@
/* implicit call to getpwnam() next. we have a valid SID coming out of this call */
+ flush_pwnam_cache();
nt_status = pdb_init_sam_new(&sam_pass, account, new_rid);
/* this code is order such that we have no unnecessary retuns
@@ -3862,6 +3863,7 @@
return -1;
all_string_sub(del_script, "%u", unix_user, sizeof(del_script));
ret = smbrun(del_script,NULL);
+ flush_pwnam_cache();
DEBUG(ret ? 0 : 3,("smb_delete_user: Running the command `%s' gave %d\n",del_script,ret));
return ret;
More information about the samba-cvs
mailing list