svn commit: samba r20994 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_24/source/nsswitch

jpeach at samba.org jpeach at samba.org
Wed Jan 24 05:03:16 GMT 2007


Author: jpeach
Date: 2007-01-24 05:03:15 +0000 (Wed, 24 Jan 2007)
New Revision: 20994

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20994

Log:
Remove unused code.

Modified:
   branches/SAMBA_3_0/source/nsswitch/wb_client.c
   branches/SAMBA_3_0_24/source/nsswitch/wb_client.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/wb_client.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/wb_client.c	2007-01-24 04:46:35 UTC (rev 20993)
+++ branches/SAMBA_3_0/source/nsswitch/wb_client.c	2007-01-24 05:03:15 UTC (rev 20994)
@@ -539,128 +539,6 @@
 	return (result == NSS_STATUS_SUCCESS);
 }
 
-/* Fetch the list of groups a user is a member of from winbindd.  This is
-   used by winbind_getgroups. */
-
-static int wb_getgroups(const char *user, gid_t **groups)
-{
-	struct winbindd_request request;
-	struct winbindd_response response;
-	int result;
-
-	/* Call winbindd */
-
-	ZERO_STRUCT(request);
-	fstrcpy(request.data.username, user);
-
-	ZERO_STRUCT(response);
-
-	result = winbindd_request_response(WINBINDD_GETGROUPS, &request, &response);
-
-	if (result == NSS_STATUS_SUCCESS) {
-		
-		/* Return group list.  Don't forget to free the group list
-		   when finished. */
-
-		*groups = (gid_t *)response.extra_data.data;
-		return response.data.num_entries;
-	}
-
-	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 *groups = NULL;
-	int result;
-
-	/* Call normal initgroups if we are a local user */
-
-	if (!strchr(user, *lp_winbind_separator())) {
-		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) {
-			groups = SMB_REALLOC_ARRAY(groups, gid_t, ngroups + 1);
-			if (!groups) {
-				errno = ENOMEM;
-				result = -1;
-				goto done;
-			}
-
-			groups[ngroups] = gid;
-			ngroups++;
-		}
-
-		/* Set the groups */
-
-		if (sys_setgroups(ngroups, groups) == -1) {
-			errno = EPERM;
-			result = -1;
-			goto done;
-		}
-
-	} 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
-   number of groups for the user is returned. */
-
-int winbind_getgroups(const char *user, gid_t **list)
-{
-	/*
-	 * Don't do the lookup if the name has no separator _and_ we are not in
-	 * 'winbind use default domain' mode.
-	 */
-
-	if (!(strchr(user, *lp_winbind_separator()) || lp_winbind_use_default_domain()))
-		return -1;
-
-	/* Fetch list of groups */
-
-	return wb_getgroups(user, list);
-}
-
 /**********************************************************************
  simple wrapper function to see if winbindd is alive
 **********************************************************************/

Modified: branches/SAMBA_3_0_24/source/nsswitch/wb_client.c
===================================================================
--- branches/SAMBA_3_0_24/source/nsswitch/wb_client.c	2007-01-24 04:46:35 UTC (rev 20993)
+++ branches/SAMBA_3_0_24/source/nsswitch/wb_client.c	2007-01-24 05:03:15 UTC (rev 20994)
@@ -407,128 +407,6 @@
 	return True;
 }
 
-/* Fetch the list of groups a user is a member of from winbindd.  This is
-   used by winbind_getgroups. */
-
-static int wb_getgroups(const char *user, gid_t **groups)
-{
-	struct winbindd_request request;
-	struct winbindd_response response;
-	int result;
-
-	/* Call winbindd */
-
-	ZERO_STRUCT(request);
-	fstrcpy(request.data.username, user);
-
-	ZERO_STRUCT(response);
-
-	result = winbindd_request_response(WINBINDD_GETGROUPS, &request, &response);
-
-	if (result == NSS_STATUS_SUCCESS) {
-		
-		/* Return group list.  Don't forget to free the group list
-		   when finished. */
-
-		*groups = (gid_t *)response.extra_data.data;
-		return response.data.num_entries;
-	}
-
-	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 *groups = NULL;
-	int result;
-
-	/* Call normal initgroups if we are a local user */
-
-	if (!strchr(user, *lp_winbind_separator())) {
-		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) {
-			groups = SMB_REALLOC_ARRAY(groups, gid_t, ngroups + 1);
-			if (!groups) {
-				errno = ENOMEM;
-				result = -1;
-				goto done;
-			}
-
-			groups[ngroups] = gid;
-			ngroups++;
-		}
-
-		/* Set the groups */
-
-		if (sys_setgroups(ngroups, groups) == -1) {
-			errno = EPERM;
-			result = -1;
-			goto done;
-		}
-
-	} 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
-   number of groups for the user is returned. */
-
-int winbind_getgroups(const char *user, gid_t **list)
-{
-	/*
-	 * Don't do the lookup if the name has no separator _and_ we are not in
-	 * 'winbind use default domain' mode.
-	 */
-
-	if (!(strchr(user, *lp_winbind_separator()) || lp_winbind_use_default_domain()))
-		return -1;
-
-	/* Fetch list of groups */
-
-	return wb_getgroups(user, list);
-}
-
 /**********************************************************************
  simple wrapper function to see if winbindd is alive
 **********************************************************************/



More information about the samba-cvs mailing list