svn commit: samba r25571 - in branches/SAMBA_3_2/source/winbindd: .

metze at samba.org metze at samba.org
Mon Oct 8 12:26:00 GMT 2007


Author: metze
Date: 2007-10-08 12:25:57 +0000 (Mon, 08 Oct 2007)
New Revision: 25571

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

Log:
split up child_dispatch_table into domain, idmap and locator tables

metze
Modified:
   branches/SAMBA_3_2/source/winbindd/winbindd.h
   branches/SAMBA_3_2/source/winbindd/winbindd_dual.c
   branches/SAMBA_3_2/source/winbindd/winbindd_idmap.c
   branches/SAMBA_3_2/source/winbindd/winbindd_locator.c
   branches/SAMBA_3_2/source/winbindd/winbindd_util.c


Changeset:
Modified: branches/SAMBA_3_2/source/winbindd/winbindd.h
===================================================================
--- branches/SAMBA_3_2/source/winbindd/winbindd.h	2007-10-08 11:15:28 UTC (rev 25570)
+++ branches/SAMBA_3_2/source/winbindd/winbindd.h	2007-10-08 12:25:57 UTC (rev 25571)
@@ -134,6 +134,17 @@
 
 /* Async child */
 
+struct winbindd_domain;
+
+struct winbindd_child_dispatch_table {
+	enum winbindd_cmd cmd;
+	enum winbindd_result (*fn)(struct winbindd_domain *domain,
+				   struct winbindd_cli_state *state);
+	const char *winbindd_cmd_name;
+};
+
+extern const struct winbindd_child_dispatch_table domain_dispatch_table[];
+
 struct winbindd_child {
 	struct winbindd_child *next, *prev;
 
@@ -144,6 +155,8 @@
 	struct fd_event event;
 	struct timed_event *lockout_policy_event;
 	struct winbindd_async_request *requests;
+
+	const struct winbindd_child_dispatch_table *table;
 };
 
 /* Structures to hold per domain information */

Modified: branches/SAMBA_3_2/source/winbindd/winbindd_dual.c
===================================================================
--- branches/SAMBA_3_2/source/winbindd/winbindd_dual.c	2007-10-08 11:15:28 UTC (rev 25570)
+++ branches/SAMBA_3_2/source/winbindd/winbindd_dual.c	2007-10-08 12:25:57 UTC (rev 25571)
@@ -408,23 +408,14 @@
 			     recvfrom_child, state);
 }
 
+const struct winbindd_child_dispatch_table domain_dispatch_table[] = {
 
-struct winbindd_child_dispatch_table {
-	enum winbindd_cmd cmd;
-	enum winbindd_result (*fn)(struct winbindd_domain *domain,
-				   struct winbindd_cli_state *state);
-	const char *winbindd_cmd_name;
-};
-
-static struct winbindd_child_dispatch_table child_dispatch_table[] = {
-	
 	{ WINBINDD_LOOKUPSID,            winbindd_dual_lookupsid,             "LOOKUPSID" },
 	{ WINBINDD_LOOKUPNAME,           winbindd_dual_lookupname,            "LOOKUPNAME" },
 	{ WINBINDD_LOOKUPRIDS,           winbindd_dual_lookuprids,            "LOOKUPRIDS" },
 	{ WINBINDD_LIST_TRUSTDOM,        winbindd_dual_list_trusted_domains,  "LIST_TRUSTDOM" },
 	{ WINBINDD_INIT_CONNECTION,      winbindd_dual_init_connection,       "INIT_CONNECTION" },
 	{ WINBINDD_GETDCNAME,            winbindd_dual_getdcname,             "GETDCNAME" },
-	{ WINBINDD_DSGETDCNAME,          winbindd_dual_dsgetdcname,           "DSGETDCNAME" },
 	{ WINBINDD_SHOW_SEQUENCE,        winbindd_dual_show_sequence,         "SHOW_SEQUENCE" },
 	{ WINBINDD_PAM_AUTH,             winbindd_dual_pam_auth,              "PAM_AUTH" },
 	{ WINBINDD_PAM_AUTH_CRAP,        winbindd_dual_pam_auth_crap,         "AUTH_CRAP" },
@@ -432,23 +423,7 @@
 	{ WINBINDD_PAM_CHNG_PSWD_AUTH_CRAP,winbindd_dual_pam_chng_pswd_auth_crap,"CHNG_PSWD_AUTH_CRAP" },
 	{ WINBINDD_PAM_CHAUTHTOK,        winbindd_dual_pam_chauthtok,         "PAM_CHAUTHTOK" },
 	{ WINBINDD_CHECK_MACHACC,        winbindd_dual_check_machine_acct,    "CHECK_MACHACC" },
-	{ WINBINDD_DUAL_SID2UID,         winbindd_dual_sid2uid,               "DUAL_SID2UID" },
-	{ WINBINDD_DUAL_SID2GID,         winbindd_dual_sid2gid,               "DUAL_SID2GID" },
-#if 0   /* DISABLED until we fix the interface in Samba 3.0.26 --jerry */
-	{ WINBINDD_DUAL_SIDS2XIDS,       winbindd_dual_sids2xids,             "DUAL_SIDS2XIDS" },
-#endif  /* end DISABLED */
-	{ WINBINDD_DUAL_UID2SID,         winbindd_dual_uid2sid,               "DUAL_UID2SID" },
-	{ WINBINDD_DUAL_GID2SID,         winbindd_dual_gid2sid,               "DUAL_GID2SID" },
-	{ WINBINDD_DUAL_UID2NAME,        winbindd_dual_uid2name,              "DUAL_UID2NAME" },
-	{ WINBINDD_DUAL_NAME2UID,        winbindd_dual_name2uid,              "DUAL_NAME2UID" },
-	{ WINBINDD_DUAL_GID2NAME,        winbindd_dual_gid2name,              "DUAL_GID2NAME" },
-	{ WINBINDD_DUAL_NAME2GID,        winbindd_dual_name2gid,              "DUAL_NAME2GID" },
-	{ WINBINDD_DUAL_SET_MAPPING,     winbindd_dual_set_mapping,           "DUAL_SET_MAPPING" },
-	{ WINBINDD_DUAL_SET_HWM,         winbindd_dual_set_hwm,               "DUAL_SET_HWMS" },
-	{ WINBINDD_DUAL_DUMP_MAPS,       winbindd_dual_dump_maps,             "DUAL_DUMP_MAPS" },
 	{ WINBINDD_DUAL_USERINFO,        winbindd_dual_userinfo,              "DUAL_USERINFO" },
-	{ WINBINDD_ALLOCATE_UID,         winbindd_dual_allocate_uid,          "ALLOCATE_UID" },
-	{ WINBINDD_ALLOCATE_GID,         winbindd_dual_allocate_gid,          "ALLOCATE_GID" },
 	{ WINBINDD_GETUSERDOMGROUPS,     winbindd_dual_getuserdomgroups,      "GETUSERDOMGROUPS" },
 	{ WINBINDD_DUAL_GETSIDALIASES,   winbindd_dual_getsidaliases,         "GETSIDALIASES" },
 	{ WINBINDD_CCACHE_NTLMAUTH,      winbindd_dual_ccache_ntlm_auth,      "CCACHE_NTLM_AUTH" },
@@ -457,10 +432,11 @@
 	{ WINBINDD_NUM_CMDS, NULL, "NONE" }
 };
 
-static void child_process_request(struct winbindd_domain *domain,
+static void child_process_request(struct winbindd_child *child,
 				  struct winbindd_cli_state *state)
 {
-	struct winbindd_child_dispatch_table *table;
+	struct winbindd_domain *domain = child->domain;
+	const struct winbindd_child_dispatch_table *table = child->table;
 
 	/* Free response data - we may be interrupted and receive another
 	   command before being able to send this data off. */
@@ -473,7 +449,7 @@
 
 	/* Process command */
 
-	for (table = child_dispatch_table; table->fn; table++) {
+	for (; table->fn; table++) {
 		if (state->request.cmd == table->cmd) {
 			DEBUG(10,("process_request: request fn %s\n",
 				  table->winbindd_cmd_name ));
@@ -483,7 +459,7 @@
 	}
 
 	if (!table->fn) {
-		DEBUG(10,("process_request: unknown request fn number %d\n",
+		DEBUG(1 ,("child_process_request: unknown request fn number %d\n",
 			  (int)state->request.cmd ));
 		state->response.result = WINBINDD_ERROR;
 	}
@@ -491,6 +467,7 @@
 
 void setup_domain_child(struct winbindd_domain *domain,
 			struct winbindd_child *child,
+			const struct winbindd_child_dispatch_table *table,
 			const char *explicit_logfile)
 {
 	if (explicit_logfile != NULL) {
@@ -505,6 +482,7 @@
 	}
 
 	child->domain = domain;
+	child->table = table;
 }
 
 struct winbindd_child *children = NULL;
@@ -1106,7 +1084,7 @@
 
 		ZERO_STRUCT(state.response);
 		state.request.null_term = '\0';
-		child_process_request(child->domain, &state);
+		child_process_request(child, &state);
 
 		SAFE_FREE(state.request.extra_data.data);
 

Modified: branches/SAMBA_3_2/source/winbindd/winbindd_idmap.c
===================================================================
--- branches/SAMBA_3_2/source/winbindd/winbindd_idmap.c	2007-10-08 11:15:28 UTC (rev 25570)
+++ branches/SAMBA_3_2/source/winbindd/winbindd_idmap.c	2007-10-08 12:25:57 UTC (rev 25571)
@@ -37,11 +37,16 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
+static const struct winbindd_child_dispatch_table idmap_dispatch_table[];
+
 static struct winbindd_child static_idmap_child;
 
 void init_idmap_child(void)
 {
-	setup_domain_child(NULL, &static_idmap_child, "idmap");
+	setup_domain_child(NULL,
+			   &static_idmap_child,
+			   idmap_dispatch_table,
+			   "idmap");
 }
 
 struct winbindd_child *idmap_child(void)
@@ -788,3 +793,26 @@
 
 	return WINBINDD_OK;
 }
+
+static const struct winbindd_child_dispatch_table idmap_dispatch_table[] = {
+
+	{ WINBINDD_DUAL_SID2UID,         winbindd_dual_sid2uid,               "DUAL_SID2UID" },
+	{ WINBINDD_DUAL_SID2GID,         winbindd_dual_sid2gid,               "DUAL_SID2GID" },
+#if 0   /* DISABLED until we fix the interface in Samba 3.0.26 --jerry */
+	{ WINBINDD_DUAL_SIDS2XIDS,       winbindd_dual_sids2xids,             "DUAL_SIDS2XIDS" },
+#endif  /* end DISABLED */
+	{ WINBINDD_DUAL_UID2SID,         winbindd_dual_uid2sid,               "DUAL_UID2SID" },
+	{ WINBINDD_DUAL_GID2SID,         winbindd_dual_gid2sid,               "DUAL_GID2SID" },
+	{ WINBINDD_DUAL_UID2NAME,        winbindd_dual_uid2name,              "DUAL_UID2NAME" },
+	{ WINBINDD_DUAL_NAME2UID,        winbindd_dual_name2uid,              "DUAL_NAME2UID" },
+	{ WINBINDD_DUAL_GID2NAME,        winbindd_dual_gid2name,              "DUAL_GID2NAME" },
+	{ WINBINDD_DUAL_NAME2GID,        winbindd_dual_name2gid,              "DUAL_NAME2GID" },
+	{ WINBINDD_DUAL_SET_MAPPING,     winbindd_dual_set_mapping,           "DUAL_SET_MAPPING" },
+	{ WINBINDD_DUAL_SET_HWM,         winbindd_dual_set_hwm,               "DUAL_SET_HWMS" },
+	{ WINBINDD_DUAL_DUMP_MAPS,       winbindd_dual_dump_maps,             "DUAL_DUMP_MAPS" },
+	{ WINBINDD_ALLOCATE_UID,         winbindd_dual_allocate_uid,          "ALLOCATE_UID" },
+	{ WINBINDD_ALLOCATE_GID,         winbindd_dual_allocate_gid,          "ALLOCATE_GID" },
+	/* End of list */
+
+	{ WINBINDD_NUM_CMDS, NULL, "NONE" }
+};

Modified: branches/SAMBA_3_2/source/winbindd/winbindd_locator.c
===================================================================
--- branches/SAMBA_3_2/source/winbindd/winbindd_locator.c	2007-10-08 11:15:28 UTC (rev 25570)
+++ branches/SAMBA_3_2/source/winbindd/winbindd_locator.c	2007-10-08 12:25:57 UTC (rev 25571)
@@ -26,11 +26,17 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
+
+static const struct winbindd_child_dispatch_table locator_dispatch_table[];
+
 static struct winbindd_child static_locator_child;
 
 void init_locator_child(void)
 {
-	setup_domain_child(NULL, &static_locator_child, "locator");
+	setup_domain_child(NULL,
+			   &static_locator_child,
+			   locator_dispatch_table,
+			   "locator");
 }
 
 struct winbindd_child *locator_child(void)
@@ -49,8 +55,8 @@
 	sendto_child(state, locator_child());
 }
 
-enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain,
-					       struct winbindd_cli_state *state)
+static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain,
+					     struct winbindd_cli_state *state)
 {
 	NTSTATUS result;
 	struct DS_DOMAIN_CONTROLLER_INFO *info = NULL;
@@ -88,3 +94,9 @@
 
 	return WINBINDD_OK;
 }
+
+static const struct winbindd_child_dispatch_table locator_dispatch_table[] = {
+	{ WINBINDD_DSGETDCNAME, dual_dsgetdcname, "DSGETDCNAME" },
+
+	{ WINBINDD_NUM_CMDS, NULL, "NONE" }
+};

Modified: branches/SAMBA_3_2/source/winbindd/winbindd_util.c
===================================================================
--- branches/SAMBA_3_2/source/winbindd/winbindd_util.c	2007-10-08 11:15:28 UTC (rev 25570)
+++ branches/SAMBA_3_2/source/winbindd/winbindd_util.c	2007-10-08 12:25:57 UTC (rev 25571)
@@ -324,7 +324,10 @@
 						    &cache_methods,
 						    &sid);
 			if (domain) {
-				setup_domain_child(domain, &domain->child, NULL);
+				setup_domain_child(domain,
+						   &domain->child,
+						   domain_dispatch_table,
+						   NULL);
 			}
 		}
 		p=q;
@@ -693,7 +696,10 @@
 	domain = add_trusted_domain("BUILTIN", NULL, &passdb_methods,
 				    &global_sid_Builtin);
 	if (domain) {
-		setup_domain_child(domain, &domain->child, NULL);
+		setup_domain_child(domain,
+				   &domain->child,
+				   domain_dispatch_table,
+				   NULL);
 	}
 
 	/* Local SAM */
@@ -704,7 +710,10 @@
 		if ( role != ROLE_DOMAIN_MEMBER ) {
 			domain->primary = True;
 		}
-		setup_domain_child(domain, &domain->child, NULL);
+		setup_domain_child(domain,
+				   &domain->child,
+				   domain_dispatch_table,
+				   NULL);
 	}
 
 	/* Add ourselves as the first entry. */
@@ -721,8 +730,11 @@
 					     &cache_methods, &our_sid);
 		if (domain) {
 			domain->primary = True;
-			setup_domain_child(domain, &domain->child, NULL);
-		
+			setup_domain_child(domain,
+					   &domain->child,
+					   domain_dispatch_table,
+					   NULL);
+
 			/* Even in the parent winbindd we'll need to
 			   talk to the DC, so try and see if we can
 			   contact it. Theoretically this isn't neccessary
@@ -767,7 +779,10 @@
 	domain->internal = False;
 	domain->online = True;	
 
-	setup_domain_child(domain, &domain->child, NULL);
+	setup_domain_child(domain,
+			   &domain->child,
+			   domain_dispatch_table,
+			   NULL);
 
 	wcache_tdc_add_domain( domain );
 



More information about the samba-cvs mailing list