From 35608af51d4f01c5fe4ed1d91c9261dcaa49f4af Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 7 Dec 2007 16:00:45 +0100 Subject: winbindd: rename child table struct elements Add struct_ prefix to struct based protocol specific elemetens struct winbindd_child_dispatch_table. metze (This used to be commit 4ab9a8aab72a8406659a72e87b2d2a1ec2a2eabf) --- source3/winbindd/winbindd.h | 8 +-- source3/winbindd/winbindd_dual.c | 112 +++++++++++++++++++++++++----------- source3/winbindd/winbindd_idmap.c | 77 +++++++++++++++++++------ source3/winbindd/winbindd_locator.c | 10 +++- 4 files changed, 150 insertions(+), 57 deletions(-) (limited to 'source3') diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h index 248bcff92b..d76e9b5921 100644 --- a/source3/winbindd/winbindd.h +++ b/source3/winbindd/winbindd.h @@ -137,10 +137,10 @@ struct winbindd_async_request; 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; + const char *name; + enum winbindd_cmd struct_cmd; + enum winbindd_result (*struct_fn)(struct winbindd_domain *domain, + struct winbindd_cli_state *state); }; extern const struct winbindd_child_dispatch_table domain_dispatch_table[]; diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 1e76c12d4b..08ce7f4f55 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -409,27 +409,77 @@ void sendto_domain(struct winbindd_cli_state *state, } const struct winbindd_child_dispatch_table domain_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_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" }, - { WINBINDD_PAM_LOGOFF, winbindd_dual_pam_logoff, "PAM_LOGOFF" }, - { 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_USERINFO, winbindd_dual_userinfo, "DUAL_USERINFO" }, - { WINBINDD_GETUSERDOMGROUPS, winbindd_dual_getuserdomgroups, "GETUSERDOMGROUPS" }, - { WINBINDD_DUAL_GETSIDALIASES, winbindd_dual_getsidaliases, "GETSIDALIASES" }, - { WINBINDD_CCACHE_NTLMAUTH, winbindd_dual_ccache_ntlm_auth, "CCACHE_NTLM_AUTH" }, - /* End of list */ - - { WINBINDD_NUM_CMDS, NULL, "NONE" } + { + .name = "LOOKUPSID", + .struct_cmd = WINBINDD_LOOKUPSID, + .struct_fn = winbindd_dual_lookupsid, + },{ + .name = "LOOKUPNAME", + .struct_cmd = WINBINDD_LOOKUPNAME, + .struct_fn = winbindd_dual_lookupname, + },{ + .name = "LOOKUPRIDS", + .struct_cmd = WINBINDD_LOOKUPRIDS, + .struct_fn = winbindd_dual_lookuprids, + },{ + .name = "LIST_TRUSTDOM", + .struct_cmd = WINBINDD_LIST_TRUSTDOM, + .struct_fn = winbindd_dual_list_trusted_domains, + },{ + .name = "INIT_CONNECTION", + .struct_cmd = WINBINDD_INIT_CONNECTION, + .struct_fn = winbindd_dual_init_connection, + },{ + .name = "GETDCNAME", + .struct_cmd = WINBINDD_GETDCNAME, + .struct_fn = winbindd_dual_getdcname, + },{ + .name = "SHOW_SEQUENCE", + .struct_cmd = WINBINDD_SHOW_SEQUENCE, + .struct_fn = winbindd_dual_show_sequence, + },{ + .name = "PAM_AUTH", + .struct_cmd = WINBINDD_PAM_AUTH, + .struct_fn = winbindd_dual_pam_auth, + },{ + .name = "AUTH_CRAP", + .struct_cmd = WINBINDD_PAM_AUTH_CRAP, + .struct_fn = winbindd_dual_pam_auth_crap, + },{ + .name = "PAM_LOGOFF", + .struct_cmd = WINBINDD_PAM_LOGOFF, + .struct_fn = winbindd_dual_pam_logoff, + },{ + .name = "CHNG_PSWD_AUTH_CRAP", + .struct_cmd = WINBINDD_PAM_CHNG_PSWD_AUTH_CRAP, + .struct_fn = winbindd_dual_pam_chng_pswd_auth_crap, + },{ + .name = "PAM_CHAUTHTOK", + .struct_cmd = WINBINDD_PAM_CHAUTHTOK, + .struct_fn = winbindd_dual_pam_chauthtok, + },{ + .name = "CHECK_MACHACC", + .struct_cmd = WINBINDD_CHECK_MACHACC, + .struct_fn = winbindd_dual_check_machine_acct, + },{ + .name = "DUAL_USERINFO", + .struct_cmd = WINBINDD_DUAL_USERINFO, + .struct_fn = winbindd_dual_userinfo, + },{ + .name = "GETUSERDOMGROUPS", + .struct_cmd = WINBINDD_GETUSERDOMGROUPS, + .struct_fn = winbindd_dual_getuserdomgroups, + },{ + .name = "GETSIDALIASES", + .struct_cmd = WINBINDD_DUAL_GETSIDALIASES, + .struct_fn = winbindd_dual_getsidaliases, + },{ + .name = "CCACHE_NTLM_AUTH", + .struct_cmd = WINBINDD_CCACHE_NTLMAUTH, + .struct_fn = winbindd_dual_ccache_ntlm_auth, + },{ + .name = NULL, + } }; static void child_process_request(struct winbindd_child *child, @@ -449,20 +499,18 @@ static void child_process_request(struct winbindd_child *child, /* Process command */ - for (; table->fn; table++) { - if (state->request.cmd == table->cmd) { - DEBUG(10,("process_request: request fn %s\n", - table->winbindd_cmd_name )); - state->response.result = table->fn(domain, state); - break; + for (; table->name; table++) { + if (state->request.cmd == table->struct_cmd) { + DEBUG(10,("child_process_request: request fn %s\n", + table->name)); + state->response.result = table->struct_fn(domain, state); + return; } } - if (!table->fn) { - DEBUG(1 ,("child_process_request: unknown request fn number %d\n", - (int)state->request.cmd )); - state->response.result = WINBINDD_ERROR; - } + DEBUG(1 ,("child_process_request: unknown request fn number %d\n", + (int)state->request.cmd)); + state->response.result = WINBINDD_ERROR; } void setup_domain_child(struct winbindd_domain *domain, diff --git a/source3/winbindd/winbindd_idmap.c b/source3/winbindd/winbindd_idmap.c index 250b2d2e85..379e7b51ea 100644 --- a/source3/winbindd/winbindd_idmap.c +++ b/source3/winbindd/winbindd_idmap.c @@ -796,24 +796,65 @@ enum winbindd_result winbindd_dual_dump_maps(struct winbindd_domain *domain, } 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" }, + { + .name = "DUAL_SID2UID", + .struct_cmd = WINBINDD_DUAL_SID2UID, + .struct_fn = winbindd_dual_sid2uid, + },{ + .name = "DUAL_SID2GID", + .struct_cmd = WINBINDD_DUAL_SID2GID, + .struct_fn = winbindd_dual_sid2gid, #if 0 /* DISABLED until we fix the interface in Samba 3.0.26 --jerry */ - { WINBINDD_DUAL_SIDS2XIDS, winbindd_dual_sids2xids, "DUAL_SIDS2XIDS" }, + },{ + .name = "DUAL_SIDS2XIDS", + .struct_cmd = WINBINDD_DUAL_SIDS2XIDS, + .struct_fn = winbindd_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" } + },{ + .name = "DUAL_UID2SID", + .struct_cmd = WINBINDD_DUAL_UID2SID, + .struct_fn = winbindd_dual_uid2sid, + },{ + .name = "DUAL_GID2SID", + .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, + },{ + .name = "DUAL_SET_HWMS", + .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, + },{ + .name = "ALLOCATE_GID", + .struct_cmd = WINBINDD_ALLOCATE_GID, + .struct_fn = winbindd_dual_allocate_gid, + },{ + .name = NULL, + } }; diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 7db2e2ada0..67bafc7c07 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -96,7 +96,11 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, } static const struct winbindd_child_dispatch_table locator_dispatch_table[] = { - { WINBINDD_DSGETDCNAME, dual_dsgetdcname, "DSGETDCNAME" }, - - { WINBINDD_NUM_CMDS, NULL, "NONE" } + { + .name = "DSGETDCNAME", + .struct_cmd = WINBINDD_DSGETDCNAME, + .struct_fn = dual_dsgetdcname, + },{ + .name = NULL, + } }; -- cgit