summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-01-27 12:12:22 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-01-27 12:12:22 +0000
commit7b671e34f599b9d27c615c1be35db4ae10ce6481 (patch)
tree6695be8dfea1451944f0b5af2a8b0170aecbdf30 /source3/nsswitch
parent184cc84adab4ead8fde1b79c449ef47f23567165 (diff)
downloadsamba-7b671e34f599b9d27c615c1be35db4ae10ce6481.tar.gz
samba-7b671e34f599b9d27c615c1be35db4ae10ce6481.tar.bz2
samba-7b671e34f599b9d27c615c1be35db4ae10ce6481.zip
Some more 'winbind default domain' support patches from Alexander Bokovoy
<a.bokovoy@sam-solutions.net>. This patch is designed to remove the 'special cases' required for this support. In particular this now kills off winbind_initgroups, as it appears no longer to be required. Andrew Bartlett (This used to be commit f1d8d509766e9169d39332559162cfec249bfc70)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/wb_client.c82
1 files changed, 1 insertions, 81 deletions
diff --git a/source3/nsswitch/wb_client.c b/source3/nsswitch/wb_client.c
index df2a1c1f6e..87c16f959a 100644
--- a/source3/nsswitch/wb_client.c
+++ b/source3/nsswitch/wb_client.c
@@ -229,7 +229,7 @@ BOOL winbind_gid_to_sid(DOM_SID *sid, gid_t gid)
}
/* Fetch the list of groups a user is a member of from winbindd. This is
- used by winbind_initgroups and winbind_getgroups. */
+ used by winbind_getgroups. */
static int wb_getgroups(const char *user, gid_t **groups)
{
@@ -257,86 +257,6 @@ static int wb_getgroups(const char *user, gid_t **groups)
return -1;
}
-/* Call winbindd to initialise group membership. This is necessary for
- some systems (i.e RH5.2) that do not have an initgroups function as part
- of the nss extension. In RH5.2 this is implemented using getgrent()
- which can be amazingly inefficient as well as having problems with
- username case. */
-
-int winbind_initgroups(char *user, gid_t gid)
-{
- gid_t *tgr, *groups = NULL;
- int result;
-
- /* Call normal initgroups if we are a local user */
-
- if (!(strchr(user, *lp_winbind_separator()) || lp_winbind_use_default_domain())) {
- return initgroups(user, gid);
- }
-
- result = wb_getgroups(user, &groups);
-
- DEBUG(10,("winbind_getgroups: %s: result = %s\n", user,
- result == -1 ? "FAIL" : "SUCCESS"));
-
- if (result != -1) {
- int ngroups = result, i;
- BOOL is_member = False;
-
- /* Check to see if the passed gid is already in the list */
-
- for (i = 0; i < ngroups; i++) {
- if (groups[i] == gid) {
- is_member = True;
- }
- }
-
- /* Add group to list if necessary */
-
- if (!is_member) {
- tgr = (gid_t *)Realloc(groups, sizeof(gid_t) * ngroups + 1);
-
- if (!tgr) {
- errno = ENOMEM;
- result = -1;
- goto done;
- }
- else groups = tgr;
-
- groups[ngroups] = gid;
- ngroups++;
- }
-
- /* Set the groups */
-
- if (sys_setgroups(ngroups, groups) == -1) {
- errno = EPERM;
- result = -1;
- goto done;
- }
-
- } else {
- /* The call failed but if 'winbind use default domain' is 'true', we
- should call normal initgroups. */
-
- if (lp_winbind_use_default_domain()) {
- return initgroups(user, gid);
- } else {
- /* The call failed. Set errno to something so we don't get
- a bogus value from the last failed system call. */
-
- errno = EIO;
- }
- }
-
- /* Free response data if necessary */
-
- done:
- SAFE_FREE(groups);
-
- return result;
-}
-
/* Return a list of groups the user is a member of. This function is
useful for large systems where inverting the group database would be too
time consuming. If size is zero, list is not modified and the total