summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-09-18 21:19:41 +0000
committerJeremy Allison <jra@samba.org>2003-09-18 21:19:41 +0000
commitd4df20e96f87a55b80a66b3ff588122125cf0cec (patch)
treea25c753eae39df269c09c665304addfa9a0db604 /source3
parent9f50a90db174afe594cf6e3d1fb443ee8f9abe16 (diff)
downloadsamba-d4df20e96f87a55b80a66b3ff588122125cf0cec.tar.gz
samba-d4df20e96f87a55b80a66b3ff588122125cf0cec.tar.bz2
samba-d4df20e96f87a55b80a66b3ff588122125cf0cec.zip
Oops. Proper fix for #470.
Jeremy. (This used to be commit 82f98b066d345fdac40a584078a19453bda53d5b)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/passdb.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 743ea823bf..78f36eb9b6 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -1061,6 +1061,24 @@ BOOL local_password_change(const char *user_name, int local_flags,
}
/****************************************************************************
+ Convert a uid to SID - algorithmic.
+****************************************************************************/
+
+static DOM_SID *algorithmic_uid_to_sid(DOM_SID *psid, uid_t uid)
+{
+ if ( !lp_enable_rid_algorithm() )
+ return NULL;
+
+ DEBUG(8,("algorithmic_uid_to_sid: falling back to RID algorithm\n"));
+ sid_copy( psid, get_global_sam_sid() );
+ sid_append_rid( psid, fallback_pdb_uid_to_user_rid(uid) );
+ DEBUG(10,("algorithmic_uid_to_sid: uid (%d) -> SID %s.\n",
+ (unsigned int)uid, sid_string_static(psid) ));
+
+ return psid;
+}
+
+/****************************************************************************
Convert a uid to SID - locally.
****************************************************************************/
@@ -1074,15 +1092,7 @@ DOM_SID *local_uid_to_sid(DOM_SID *psid, uid_t uid)
if ( !unix_pw ) {
DEBUG(4,("local_uid_to_sid: host has no idea of uid %lu\n", (unsigned long)uid));
-
- if ( !lp_enable_rid_algorithm() )
- return NULL;
-
- DEBUG(8,("local_uid_to_sid: falling back to RID algorithm\n"));
-
- sid_copy( psid, get_global_sam_sid() );
- sid_append_rid( psid, fallback_pdb_uid_to_user_rid(uid) );
- goto out;
+ return algorithmic_uid_to_sid( psid, uid);
}
if ( !NT_STATUS_IS_OK(pdb_init_sam(&sampw)) ) {
@@ -1099,18 +1109,10 @@ DOM_SID *local_uid_to_sid(DOM_SID *psid, uid_t uid)
else {
DEBUG(4,("local_uid_to_sid: User %s [uid == %lu] has no samba account\n",
unix_pw->pw_name, (unsigned long)uid));
-
- if ( !lp_enable_rid_algorithm() )
- return NULL;
- DEBUG(8,("local_uid_to_sid: falling back to RID algorithm\n"));
-
- sid_copy( psid, get_global_sam_sid() );
- sid_append_rid( psid, fallback_pdb_uid_to_user_rid(uid) );
+ return algorithmic_uid_to_sid( psid, uid);
}
-out:
-
DEBUG(10,("local_uid_to_sid: uid (%d) -> SID %s (%s).\n",
(unsigned int)uid, sid_string_static(psid), unix_pw->pw_name));