[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-604-gce7fe8a

Stefan Metzmacher metze at samba.org
Wed Dec 12 09:45:23 GMT 2007


The branch, v3-2-test has been updated
       via  ce7fe8acf41e90553431c7cda6823700701835c7 (commit)
       via  fd4499ee438e4947990200db529363d51bd2c956 (commit)
      from  d30b945e99390761e405492e40c90e84da4fe482 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit ce7fe8acf41e90553431c7cda6823700701835c7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 12 09:51:56 2007 +0100

    winbindd: remove unused WINBINDD_DUMP_MAPS support
    
    Also the design of this function was really bad,
    instead do the dump into a file, the client should get
    back the list of mappings.
    
    metze

commit fd4499ee438e4947990200db529363d51bd2c956
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 12 09:02:23 2007 +0100

    winbindd: remove unused WINBINDD_DUAL_NAME2*ID and WINBINDD_DUAL_*ID2NAME calls
    
    WINBINDD_DUAL_UID2NAME
    WINBINDD_DUAL_NAME2UID
    WINBINDD_DUAL_GID2NAME
    WINBINDD_DUAL_NAME2GID
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source/nsswitch/wb_client.c               |   18 --
 source/nsswitch/winbind_struct_protocol.h |    8 -
 source/winbindd/idmap.c                   |   67 -------
 source/winbindd/winbindd.c                |    2 -
 source/winbindd/winbindd_idmap.c          |  304 -----------------------------
 source/winbindd/winbindd_sid.c            |   39 ----
 6 files changed, 0 insertions(+), 438 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/nsswitch/wb_client.c b/source/nsswitch/wb_client.c
index 3e3c140..1fd1e02 100644
--- a/source/nsswitch/wb_client.c
+++ b/source/nsswitch/wb_client.c
@@ -405,24 +405,6 @@ bool winbind_sids_to_unixids(struct id_map *ids, int num_ids)
 	return (result == NSS_STATUS_SUCCESS);
 }
 
-bool winbind_idmap_dump_maps(TALLOC_CTX *memctx, const char *file)
-{
-	struct winbindd_request request;
-	struct winbindd_response response;
-	int result;
-
-	ZERO_STRUCT(request);
-	ZERO_STRUCT(response);
-
-	request.extra_data.data = SMB_STRDUP(file);
-	request.extra_len = strlen(request.extra_data.data) + 1;
-
-	result = winbindd_request_response(WINBINDD_DUMP_MAPS, &request, &response);
-
-	SAFE_FREE(request.extra_data.data);
-	return (result == NSS_STATUS_SUCCESS);
-}
-
 bool winbind_allocate_uid(uid_t *uid)
 {
 	struct winbindd_request request;
diff --git a/source/nsswitch/winbind_struct_protocol.h b/source/nsswitch/winbind_struct_protocol.h
index e780cad..5b663c6 100644
--- a/source/nsswitch/winbind_struct_protocol.h
+++ b/source/nsswitch/winbind_struct_protocol.h
@@ -108,8 +108,6 @@ enum winbindd_cmd {
 
 	/* Miscellaneous other stuff */
 
-	WINBINDD_DUMP_MAPS,
-
 	WINBINDD_CHECK_MACHACC,     /* Check machine account pw works */
 	WINBINDD_PING,              /* Just tell me winbind is running */
 	WINBINDD_INFO,              /* Various bit of info.  Currently just tidbits */
@@ -153,14 +151,8 @@ enum winbindd_cmd {
 	WINBINDD_DUAL_GID2SID,
 	WINBINDD_DUAL_SET_MAPPING,
 	WINBINDD_DUAL_SET_HWM,
-	WINBINDD_DUAL_DUMP_MAPS,
 
 	/* Wrapper around possibly blocking unix nss calls */
-	WINBINDD_DUAL_UID2NAME,
-	WINBINDD_DUAL_NAME2UID,
-	WINBINDD_DUAL_GID2NAME,
-	WINBINDD_DUAL_NAME2GID,
-
 	WINBINDD_DUAL_USERINFO,
 	WINBINDD_DUAL_GETSIDALIASES,
 
diff --git a/source/winbindd/idmap.c b/source/winbindd/idmap.c
index e825ed9..6b4af10 100644
--- a/source/winbindd/idmap.c
+++ b/source/winbindd/idmap.c
@@ -1486,73 +1486,6 @@ done:
 	return ret;
 }
 
-/**************************************************************************
- Dump backend status.
-**************************************************************************/
-
-void idmap_dump_maps(const char *logfile)
-{
-	NTSTATUS ret;
-	struct unixid allid;
-	struct id_map *maps;
-	int num_maps;
-	FILE *dump;
-	int i;
-
-	if (! NT_STATUS_IS_OK(ret = idmap_init())) {
-		return;
-	}
-
-	dump = fopen(logfile, "w");
-	if ( ! dump) {
-		DEBUG(0, ("Unable to open open stream for file [%s], "
-			  "errno: %d\n", logfile, errno));
-		return;
-	}
-
-	if (NT_STATUS_IS_OK(ret = idmap_alloc_init())) {
-		allid.type = ID_TYPE_UID;
-		allid.id = 0;
-		idmap_alloc_ctx->methods->get_id_hwm(&allid);
-		fprintf(dump, "USER HWM %lu\n", (unsigned long)allid.id);
-
-		allid.type = ID_TYPE_GID;
-		allid.id = 0;
-		idmap_alloc_ctx->methods->get_id_hwm(&allid);
-		fprintf(dump, "GROUP HWM %lu\n", (unsigned long)allid.id);
-	}
-
-	maps = talloc(idmap_ctx, struct id_map);
-	num_maps = 0;
-
-	for (i = 0; i < num_domains; i++) {
-		if (idmap_domains[i]->methods->dump_data) {
-			idmap_domains[i]->methods->dump_data(idmap_domains[i],
-							     &maps, &num_maps);
-		}
-	}
-
-	for (i = 0; i < num_maps; i++) {
-		switch (maps[i].xid.type) {
-		case ID_TYPE_UID:
-			fprintf(dump, "UID %lu %s\n",
-				(unsigned long)maps[i].xid.id,
-				sid_string_static(maps[i].sid));
-			break;
-		case ID_TYPE_GID:
-			fprintf(dump, "GID %lu %s\n",
-				(unsigned long)maps[i].xid.id,
-				sid_string_static(maps[i].sid));
-			break;
-		case ID_TYPE_NOT_SPECIFIED:
-			break;
-		}
-	}
-
-	fflush(dump);
-	fclose(dump);
-}
-
 char *idmap_fetch_secret(const char *backend, bool alloc,
 			       const char *domain, const char *identity)
 {
diff --git a/source/winbindd/winbindd.c b/source/winbindd/winbindd.c
index 598ec8e..b695c2e 100644
--- a/source/winbindd/winbindd.c
+++ b/source/winbindd/winbindd.c
@@ -331,8 +331,6 @@ static struct winbindd_dispatch_table {
 
 	/* Miscellaneous */
 
-	{ WINBINDD_DUMP_MAPS, winbindd_dump_maps, "DUMP_MAPS" },
-
 	{ WINBINDD_CHECK_MACHACC, winbindd_check_machine_acct, "CHECK_MACHACC" },
 	{ WINBINDD_PING, winbindd_ping, "PING" },
 	{ WINBINDD_INFO, winbindd_info, "INFO" },
diff --git a/source/winbindd/winbindd_idmap.c b/source/winbindd/winbindd_idmap.c
index be090af..cc5cf1e 100644
--- a/source/winbindd/winbindd_idmap.c
+++ b/source/winbindd/winbindd_idmap.c
@@ -329,130 +329,6 @@ enum winbindd_result winbindd_dual_sid2uid(struct winbindd_domain *domain,
 	return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
 }
 
-#if 0	/* not used */
-static void uid2name_recv(TALLOC_CTX *mem_ctx, bool success,
-			  struct winbindd_response *response,
-			  void *c, void *private_data);
-
-void winbindd_uid2name_async(TALLOC_CTX *mem_ctx, uid_t uid,
-			     void (*cont)(void *private_data, bool success,
-					  const char *name),
-			     void *private_data)
-{
-	struct winbindd_request request;
-	ZERO_STRUCT(request);
-	request.cmd = WINBINDD_DUAL_UID2NAME;
-	request.data.uid = uid;
-	do_async(mem_ctx, idmap_child(), &request, uid2name_recv,
-		 (void *)cont, private_data);
-}
-#endif	/* not used */
-
-enum winbindd_result winbindd_dual_uid2name(struct winbindd_domain *domain,
-					    struct winbindd_cli_state *state)
-{
-	struct passwd *pw;
-
-	DEBUG(3, ("[%5lu]: uid2name %lu\n", (unsigned long)state->pid,
-		  (unsigned long)state->request.data.uid));
-
-	pw = getpwuid(state->request.data.uid);
-	if (pw == NULL) {
-		DEBUG(5, ("User %lu not found\n",
-			  (unsigned long)state->request.data.uid));
-		return WINBINDD_ERROR;
-	}
-
-	fstrcpy(state->response.data.name.name, pw->pw_name);
-	return WINBINDD_OK;
-}
-
-#if 0	/* not used */
-static void uid2name_recv(TALLOC_CTX *mem_ctx, bool success,
-			  struct winbindd_response *response,
-			  void *c, void *private_data)
-{
-	void (*cont)(void *priv, bool succ, const char *name) =
-		(void (*)(void *, bool, const char *))c;
-
-	if (!success) {
-		DEBUG(5, ("Could not trigger uid2name\n"));
-		cont(private_data, False, NULL);
-		return;
-	}
-
-	if (response->result != WINBINDD_OK) {
-		DEBUG(5, ("uid2name returned an error\n"));
-		cont(private_data, False, NULL);
-		return;
-	}
-
-	cont(private_data, True, response->data.name.name);
-}
-
-static void name2uid_recv(TALLOC_CTX *mem_ctx, bool success,
-			  struct winbindd_response *response,
-			  void *c, void *private_data);
-
-static void winbindd_name2uid_async(TALLOC_CTX *mem_ctx, const char *name,
-				    void (*cont)(void *private_data, bool success,
-						 uid_t uid),
-				    void *private_data)
-{
-	struct winbindd_request request;
-	ZERO_STRUCT(request);
-	request.cmd = WINBINDD_DUAL_NAME2UID;
-	fstrcpy(request.data.username, name);
-	do_async(mem_ctx, idmap_child(), &request, name2uid_recv,
-		 (void *)cont, private_data);
-}
-#endif	/* not used */
-
-enum winbindd_result winbindd_dual_name2uid(struct winbindd_domain *domain,
-					    struct winbindd_cli_state *state)
-{
-	struct passwd *pw;
-
-	/* Ensure null termination */
-	state->request.data.username
-		[sizeof(state->request.data.username)-1] = '\0';
-
-	DEBUG(3, ("[%5lu]: name2uid %s\n", (unsigned long)state->pid,
-		  state->request.data.username));
-
-	pw = getpwnam(state->request.data.username);
-	if (pw == NULL) {
-		return WINBINDD_ERROR;
-	}
-
-	state->response.data.uid = pw->pw_uid;
-	return WINBINDD_OK;
-}
-
-#if 0	/* not used */
-static void name2uid_recv(TALLOC_CTX *mem_ctx, bool success,
-			  struct winbindd_response *response,
-			  void *c, void *private_data)
-{
-	void (*cont)(void *priv, bool succ, uid_t uid) =
-		(void (*)(void *, bool, uid_t))c;
-
-	if (!success) {
-		DEBUG(5, ("Could not trigger name2uid\n"));
-		cont(private_data, False, 0);
-		return;
-	}
-
-	if (response->result != WINBINDD_OK) {
-		DEBUG(5, ("name2uid returned an error\n"));
-		cont(private_data, False, 0);
-		return;
-	}
-
-	cont(private_data, True, response->data.uid);
-}
-#endif	/* not used */
-
 static void winbindd_sid2gid_recv(TALLOC_CTX *mem_ctx, bool success,
 			       struct winbindd_response *response,
 			       void *c, void *private_data)
@@ -515,121 +391,6 @@ enum winbindd_result winbindd_dual_sid2gid(struct winbindd_domain *domain,
 	return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
 }
 
-static void gid2name_recv(TALLOC_CTX *mem_ctx, bool success,
-			  struct winbindd_response *response,
-			  void *c, void *private_data)
-{
-	void (*cont)(void *priv, bool succ, const char *name) =
-		(void (*)(void *, bool, const char *))c;
-
-	if (!success) {
-		DEBUG(5, ("Could not trigger gid2name\n"));
-		cont(private_data, False, NULL);
-		return;
-	}
-
-	if (response->result != WINBINDD_OK) {
-		DEBUG(5, ("gid2name returned an error\n"));
-		cont(private_data, False, NULL);
-		return;
-	}
-
-	cont(private_data, True, response->data.name.name);
-}
-
-void winbindd_gid2name_async(TALLOC_CTX *mem_ctx, gid_t gid,
-			     void (*cont)(void *private_data, bool success,
-					  const char *name),
-			     void *private_data)
-{
-	struct winbindd_request request;
-	ZERO_STRUCT(request);
-	request.cmd = WINBINDD_DUAL_GID2NAME;
-	request.data.gid = gid;
-	do_async(mem_ctx, idmap_child(), &request, gid2name_recv,
-		 (void *)cont, private_data);
-}
-
-enum winbindd_result winbindd_dual_gid2name(struct winbindd_domain *domain,
-					    struct winbindd_cli_state *state)
-{
-	struct group *gr;
-
-	DEBUG(3, ("[%5lu]: gid2name %lu\n", (unsigned long)state->pid,
-		  (unsigned long)state->request.data.gid));
-
-	gr = getgrgid(state->request.data.gid);
-	if (gr == NULL)
-		return WINBINDD_ERROR;
-
-	fstrcpy(state->response.data.name.name, gr->gr_name);
-	return WINBINDD_OK;
-}
-
-#if 0	/* not used */
-static void name2gid_recv(TALLOC_CTX *mem_ctx, bool success,
-			  struct winbindd_response *response,
-			  void *c, void *private_data);
-
-static void winbindd_name2gid_async(TALLOC_CTX *mem_ctx, const char *name,
-				    void (*cont)(void *private_data, bool success,
-						 gid_t gid),
-				    void *private_data)
-{
-	struct winbindd_request request;
-	ZERO_STRUCT(request);
-	request.cmd = WINBINDD_DUAL_NAME2GID;
-	fstrcpy(request.data.groupname, name);
-	do_async(mem_ctx, idmap_child(), &request, name2gid_recv,
-		 (void *)cont, private_data);
-}
-#endif	/* not used */
-
-enum winbindd_result winbindd_dual_name2gid(struct winbindd_domain *domain,
-					    struct winbindd_cli_state *state)
-{
-	struct group *gr;
-
-	/* Ensure null termination */
-	state->request.data.groupname
-		[sizeof(state->request.data.groupname)-1] = '\0';
-
-	DEBUG(3, ("[%5lu]: name2gid %s\n", (unsigned long)state->pid,
-		  state->request.data.groupname));
-
-	gr = getgrnam(state->request.data.groupname);
-	if (gr == NULL) {
-		return WINBINDD_ERROR;
-	}
-
-	state->response.data.gid = gr->gr_gid;
-	return WINBINDD_OK;
-}
-
-#if 0	/* not used */
-static void name2gid_recv(TALLOC_CTX *mem_ctx, bool success,
-			  struct winbindd_response *response,
-			  void *c, void *private_data)
-{
-	void (*cont)(void *priv, bool succ, gid_t gid) =
-		(void (*)(void *, bool, gid_t))c;
-
-	if (!success) {
-		DEBUG(5, ("Could not trigger name2gid\n"));
-		cont(private_data, False, 0);
-		return;
-	}
-
-	if (response->result != WINBINDD_OK) {
-		DEBUG(5, ("name2gid returned an error\n"));
-		cont(private_data, False, 0);
-		return;
-	}
-
-	cont(private_data, True, response->data.gid);
-}
-#endif	/* not used */
-
 /* The following uid2sid/gid2sid functions has been contributed by
  * Keith Reynolds <Keith.Reynolds at centrify.com> */
 
@@ -750,51 +511,6 @@ enum winbindd_result winbindd_dual_gid2sid(struct winbindd_domain *domain,
 	return WINBINDD_ERROR;
 }
 
-static void winbindd_dump_id_maps_recv(TALLOC_CTX *mem_ctx, bool success,
-			       struct winbindd_response *response,
-			       void *c, void *private_data)
-{
-	void (*cont)(void *priv, bool succ) =
-		(void (*)(void *, bool))c;
-
-	if (!success) {
-		DEBUG(5, ("Could not trigger a map dump\n"));
-		cont(private_data, False);
-		return;
-	}
-
-	if (response->result != WINBINDD_OK) {
-		DEBUG(5, ("idmap dump maps returned an error\n"));
-		cont(private_data, False);
-		return;
-	}
-
-	cont(private_data, True);
-}
-
-void winbindd_dump_maps_async(TALLOC_CTX *mem_ctx, const char *logfile,
-			 void (*cont)(void *private_data, bool success),
-			 void *private_data)
-{
-	struct winbindd_request request;
-	ZERO_STRUCT(request);
-	request.cmd = WINBINDD_DUAL_DUMP_MAPS;
-	request.extra_data.data = discard_const(logfile);
-	request.extra_len = strlen(logfile)+1;
-	do_async(mem_ctx, idmap_child(), &request, winbindd_dump_id_maps_recv,
-		 (void *)cont, private_data);
-}
-
-enum winbindd_result winbindd_dual_dump_maps(struct winbindd_domain *domain,
-					   struct winbindd_cli_state *state)
-{
-	DEBUG(3, ("[%5lu]: dual dump maps\n", (unsigned long)state->pid));
-
-	idmap_dump_maps((char *)state->request.extra_data.data);
-
-	return WINBINDD_OK;
-}
-
 static const struct winbindd_child_dispatch_table idmap_dispatch_table[] = {
 	{
 		.name		= "DUAL_SID2UID",
@@ -819,22 +535,6 @@ static const struct winbindd_child_dispatch_table idmap_dispatch_table[] = {
 		.struct_cmd	= WINBINDD_DUAL_GID2SID,
 		.struct_fn	= winbindd_dual_gid2sid,
 	},{
-		.name		= "DUAL_UID2NAME",
-		.struct_cmd	= WINBINDD_DUAL_UID2NAME,
-		.struct_fn	= winbindd_dual_uid2name,
-	},{
-		.name		= "DUAL_NAME2UID",
-		.struct_cmd	= WINBINDD_DUAL_NAME2UID,
-		.struct_fn	= winbindd_dual_name2uid,
-	},{
-		.name		= "DUAL_GID2NAME",
-		.struct_cmd	= WINBINDD_DUAL_GID2NAME,
-		.struct_fn	= winbindd_dual_gid2name,
-	},{
-		.name		= "DUAL_NAME2GID",
-		.struct_cmd	= WINBINDD_DUAL_NAME2GID,
-		.struct_fn	= winbindd_dual_name2gid,
-	},{
 		.name		= "DUAL_SET_MAPPING",
 		.struct_cmd	= WINBINDD_DUAL_SET_MAPPING,
 		.struct_fn	= winbindd_dual_set_mapping,
@@ -843,10 +543,6 @@ static const struct winbindd_child_dispatch_table idmap_dispatch_table[] = {
 		.struct_cmd	= WINBINDD_DUAL_SET_HWM,
 		.struct_fn	= winbindd_dual_set_hwm,
 	},{
-		.name		= "DUAL_DUMP_MAPS",
-		.struct_cmd	= WINBINDD_DUAL_DUMP_MAPS,
-		.struct_fn	= winbindd_dual_dump_maps,
-	},{
 		.name		= "ALLOCATE_UID",
 		.struct_cmd	= WINBINDD_ALLOCATE_UID,
 		.struct_fn	= winbindd_dual_allocate_uid,
diff --git a/source/winbindd/winbindd_sid.c b/source/winbindd/winbindd_sid.c
index c01c6f0..302460c 100644
--- a/source/winbindd/winbindd_sid.c
+++ b/source/winbindd/winbindd_sid.c
@@ -515,42 +515,3 @@ enum winbindd_result winbindd_dual_allocate_gid(struct winbindd_domain *domain,
 	state->response.data.gid = xid.id;
 	return WINBINDD_OK;
 }
-


-- 
Samba Shared Repository


More information about the samba-cvs mailing list