summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-08-05 23:24:14 +0000
committerGerald Carter <jerry@samba.org>2003-08-05 23:24:14 +0000
commit055b7df499b157669899893366d85f1b6cf1bb06 (patch)
tree789ded6b8ed80e988ff2638b637fbb9ca1a2c568 /source3/passdb
parenta4954bd3d28bc9ffcd33d4ceef71ba1a31723eb6 (diff)
downloadsamba-055b7df499b157669899893366d85f1b6cf1bb06.tar.gz
samba-055b7df499b157669899893366d85f1b6cf1bb06.tar.bz2
samba-055b7df499b157669899893366d85f1b6cf1bb06.zip
fix bug #245; local_lookupsid() needed to make a getpwuid() call to get the username instead of making up unix_user.##
(This used to be commit b947fc3eed464d7a64914f3965964d29be031614)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/passdb.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index e440e064ef..9f7b44f4e1 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -758,13 +758,25 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use
if (fallback_pdb_rid_is_user(rid)) {
uid_t uid;
+ struct passwd *pw = NULL;
DEBUG(5, ("assuming RID %u is a user\n", (unsigned)rid));
uid = fallback_pdb_user_rid_to_uid(rid);
- slprintf(name, sizeof(fstring)-1, "unix_user.%u", (unsigned int)uid);
-
- return False; /* Indicates that this user was 'not mapped' */
+ pw = sys_getpwuid( uid );
+
+ DEBUG(5,("local_lookup_sid: looking up uid %u %s\n", (unsigned int)uid,
+ pw ? "succeeded" : "failed" ));
+
+ if ( !pw )
+ slprintf(name, "unix_user.%u", (unsigned int)uid);
+ else
+ fstrcpy( name, pw->pw_name );
+
+ DEBUG(5,("local_lookup_sid: found user %s for rid %u\n", name,
+ (unsigned int)rid ));
+
+ return ( pw != NULL );
} else {
gid_t gid;
struct group *gr;
@@ -779,16 +791,15 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use
DEBUG(5,("local_lookup_sid: looking up gid %u %s\n", (unsigned int)gid,
gr ? "succeeded" : "failed" ));
- if(!gr) {
+ if( !gr )
slprintf(name, sizeof(fstring)-1, "unix_group.%u", (unsigned int)gid);
- return False; /* Indicates that this group was 'not mapped' */
- }
-
- fstrcpy( name, gr->gr_name);
+ else
+ fstrcpy( name, gr->gr_name);
DEBUG(5,("local_lookup_sid: found group %s for rid %u\n", name,
(unsigned int)rid ));
- return True;
+
+ return ( gr != NULL );
}
}