summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-12-04 03:59:18 +0000
committerJeremy Allison <jra@samba.org>2001-12-04 03:59:18 +0000
commit36673778515e17f89eeaf2d31f85969a646b7785 (patch)
treee4f5d889c0d82f6e542dbeeb743eb57038e737ed /source3/smbd
parent8e99888e7b29817e2e242b8fe59a10465500807c (diff)
downloadsamba-36673778515e17f89eeaf2d31f85969a646b7785.tar.gz
samba-36673778515e17f89eeaf2d31f85969a646b7785.tar.bz2
samba-36673778515e17f89eeaf2d31f85969a646b7785.zip
Stop using getgrgid() - a very expensive call with winbindd, to look up
a group name. Jeremy. (This used to be commit b926660e73d4c94c30ec5a365027770acdafe25e)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/posix_acls.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index b00d1810a2..324169a092 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -103,13 +103,13 @@ static void print_canon_ace(canon_ace *pace, int num)
fstring str;
dbgtext( "canon_ace index %d. Type = %s ", num, pace->attr == ALLOW_ACE ? "allow" : "deny" );
- dbgtext( "SID = %s ", sid_to_string( str, &pace->trustee));
+ dbgtext( "SID = %s ", sid_to_string( str, &pace->trustee));
if (pace->owner_type == UID_ACE) {
- struct passwd *pass = sys_getpwuid(pace->unix_ug.uid);
- dbgtext( "uid %u (%s) ", (unsigned int)pace->unix_ug.uid, pass ? pass->pw_name : "UNKNOWN");
+ char *u_name = uidtoname(pace->unix_ug.uid);
+ dbgtext( "uid %u (%s) ", (unsigned int)pace->unix_ug.uid, u_name);
} else if (pace->owner_type == GID_ACE) {
- struct group *grp = getgrgid(pace->unix_ug.gid);
- dbgtext( "gid %u (%s) ", (unsigned int)pace->unix_ug.gid, grp ? grp->gr_name : "UNKNOWN");
+ char *g_name = gidtoname(pace->unix_ug.gid);
+ dbgtext( "gid %u (%s) ", (unsigned int)pace->unix_ug.gid, g_name);
} else
dbgtext( "other ");
switch (pace->type) {
@@ -925,26 +925,23 @@ Deny entry after Allow entry. Failing to set on file %s.\n", fsp->fsp_name ));
static BOOL uid_entry_in_group( canon_ace *uid_ace, canon_ace *group_ace )
{
extern DOM_SID global_sid_World;
- struct passwd *pass = NULL;
- struct group *gptr = NULL;
+ fstring u_name;
+ fstring g_name;
/* "Everyone" always matches every uid. */
if (sid_equal(&group_ace->trustee, &global_sid_World))
return True;
- if (!(pass = sys_getpwuid(uid_ace->unix_ug.uid)))
- return False;
-
- if (!(gptr = getgrgid(group_ace->unix_ug.gid)))
- return False;
+ fstrcpy(u_name, uidtoname(uid_ace->unix_ug.uid));
+ fstrcpy(g_name, gidtoname(group_ace->unix_ug.gid));
/*
* Due to the winbind interfaces we need to do this via names,
* not uids/gids.
*/
- return user_in_group_list(pass->pw_name, gptr->gr_name );
+ return user_in_group_list(u_name, g_name );
}
/****************************************************************************