Index: auth/auth_util.c =================================================================== --- auth/auth_util.c (revision 5646) +++ auth/auth_util.c (revision 5647) @@ -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; } Index: groupdb/mapping.c =================================================================== --- groupdb/mapping.c (revision 5646) +++ groupdb/mapping.c (revision 5647) @@ -1050,6 +1050,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; @@ -1060,6 +1061,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; } Index: lib/util_pw.c =================================================================== --- lib/util_pw.c (revision 5646) +++ lib/util_pw.c (revision 5647) @@ -70,6 +70,20 @@ return; } +void flush_pwnam_cache(void) +{ + int i; + + init_pwnam_cache(); + + for (i=0; i