summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/winbindd/winbindd.h13
-rw-r--r--source3/winbindd/winbindd_dual.c40
-rw-r--r--source3/winbindd/winbindd_idmap.c30
-rw-r--r--source3/winbindd/winbindd_locator.c18
-rw-r--r--source3/winbindd/winbindd_util.c27
5 files changed, 87 insertions, 41 deletions
diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h
index e7119c332f..d61254af4a 100644
--- a/source3/winbindd/winbindd.h
+++ b/source3/winbindd/winbindd.h
@@ -134,6 +134,17 @@ struct winbindd_async_request;
/* 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 winbindd_child {
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 */
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index d9a42c31dc..7e53fbbbee 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -408,23 +408,14 @@ void sendto_domain(struct winbindd_cli_state *state,
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 @@ static struct winbindd_child_dispatch_table child_dispatch_table[] = {
{ 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 @@ static struct winbindd_child_dispatch_table child_dispatch_table[] = {
{ 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 @@ static void child_process_request(struct winbindd_domain *domain,
/* 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 @@ static void child_process_request(struct winbindd_domain *domain,
}
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 @@ static void child_process_request(struct winbindd_domain *domain,
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 @@ void setup_domain_child(struct winbindd_domain *domain,
}
child->domain = domain;
+ child->table = table;
}
struct winbindd_child *children = NULL;
@@ -1106,7 +1084,7 @@ static BOOL fork_domain_child(struct winbindd_child *child)
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);
diff --git a/source3/winbindd/winbindd_idmap.c b/source3/winbindd/winbindd_idmap.c
index 608948787e..f590813de3 100644
--- a/source3/winbindd/winbindd_idmap.c
+++ b/source3/winbindd/winbindd_idmap.c
@@ -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 @@ enum winbindd_result winbindd_dual_dump_maps(struct winbindd_domain *domain,
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" }
+};
diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c
index 52b6dc06f1..ade2c1539b 100644
--- a/source3/winbindd/winbindd_locator.c
+++ b/source3/winbindd/winbindd_locator.c
@@ -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 @@ void winbindd_dsgetdcname(struct winbindd_cli_state *state)
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 @@ enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain,
return WINBINDD_OK;
}
+
+static const struct winbindd_child_dispatch_table locator_dispatch_table[] = {
+ { WINBINDD_DSGETDCNAME, dual_dsgetdcname, "DSGETDCNAME" },
+
+ { WINBINDD_NUM_CMDS, NULL, "NONE" }
+};
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 0e6ba1c043..49d20c527e 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -324,7 +324,10 @@ static void trustdom_recv(void *private_data, BOOL success)
&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 @@ BOOL init_domain_list(void)
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 @@ BOOL init_domain_list(void)
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 @@ BOOL init_domain_list(void)
&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 @@ void check_domain_trusted( const char *name, const DOM_SID *user_sid )
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 );