s3:winbind: Remove struct winbindd_child_dispatch_table
authorSamuel Cabrero <scabrero@samba.org>
Tue, 22 Jun 2021 08:44:53 +0000 (10:44 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 19 May 2022 18:50:24 +0000 (18:50 +0000)
All parent-child communication is based in NDR and dispatched as a local
RPC call.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May 19 18:50:24 UTC 2022 on sn-devel-184

source3/winbindd/winbindd.h
source3/winbindd/winbindd_domain.c
source3/winbindd/winbindd_dual.c
source3/winbindd/winbindd_idmap.c
source3/winbindd/winbindd_locator.c
source3/winbindd/winbindd_ndr.c
source3/winbindd/winbindd_proto.h

index fe286a9a686a065027c586a2612ae1d6d3a4955d..ea5c1c0d834bc1cf338fe54aef9e40a724c301a8 100644 (file)
@@ -103,13 +103,6 @@ struct winbindd_cm_conn {
 
 struct winbindd_domain;
 
-struct winbindd_child_dispatch_table {
-       const char *name;
-       enum winbindd_cmd struct_cmd;
-       enum winbindd_result (*struct_fn)(struct winbindd_domain *domain,
-                                         struct winbindd_cli_state *state);
-};
-
 struct winbindd_child {
        pid_t pid;
        struct winbindd_domain *domain;
@@ -122,8 +115,6 @@ struct winbindd_child {
 
        struct tevent_timer *lockout_policy_event;
        struct tevent_timer *machine_password_change_event;
-
-       const struct winbindd_child_dispatch_table *table;
 };
 
 /* Structures to hold per domain information */
index e5d461261b09b94833ac4d5491a088ed07c28c28..b1027735c8a8fd4d8e329cfd349ec6ae027c5c53 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
-static const struct winbindd_child_dispatch_table domain_dispatch_table[] = {
-       {
-               .name           = "NDRCMD",
-               .struct_cmd     = WINBINDD_DUAL_NDRCMD,
-               .struct_fn      = winbindd_dual_ndrcmd,
-       },{
-               .name           = NULL,
-       }
-};
-
 void setup_domain_child(struct winbindd_domain *domain)
 {
        int i;
 
         for (i=0; i<lp_winbind_max_domain_connections(); i++) {
                 setup_child(domain, &domain->children[i],
-                           domain_dispatch_table,
                             "log.wb", domain->name);
                domain->children[i].domain = domain;
        }
index bf90515509bbae375dc0b08e867cede29b423bc7..75ecdf53968e99707af35ea71d183439d735e6a8 100644 (file)
@@ -761,7 +761,6 @@ static void child_process_request(struct winbindd_child *child,
                                  struct winbindd_cli_state *state)
 {
        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. */
@@ -773,15 +772,7 @@ static void child_process_request(struct winbindd_child *child,
        state->mem_ctx = talloc_tos();
 
        /* Process command */
-
-       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;
-               }
-       }
+       state->response->result = winbindd_dual_ndrcmd(domain, state);
 
        DEBUG(1, ("child_process_request: unknown request fn number %d\n",
                  (int)state->request->cmd));
@@ -789,7 +780,6 @@ static void child_process_request(struct winbindd_child *child,
 }
 
 void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
-                const struct winbindd_child_dispatch_table *table,
                 const char *logprefix,
                 const char *logname)
 {
@@ -830,7 +820,6 @@ void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
        child->pid = 0;
        child->sock = -1;
        child->domain = domain;
-       child->table = table;
        child->queue = tevent_queue_create(NULL, "winbind_child");
        SMB_ASSERT(child->queue != NULL);
 
index 79775a03c8b7d5c52f64bd994821df410bf1b6db..e6d2c284cf201129c4be764a386a7389ff1a65a9 100644 (file)
@@ -68,16 +68,6 @@ struct dcerpc_binding_handle *idmap_child_handle(void)
        return static_idmap_child.binding_handle;
 }
 
-static const struct winbindd_child_dispatch_table idmap_dispatch_table[] = {
-       {
-               .name           = "NDRCMD",
-               .struct_cmd     = WINBINDD_DUAL_NDRCMD,
-               .struct_fn      = winbindd_dual_ndrcmd,
-       },{
-               .name           = NULL,
-       }
-};
-
 static void init_idmap_child_done(struct tevent_req *subreq);
 
 void init_idmap_child(void)
@@ -339,9 +329,7 @@ static void wb_parent_idmap_setup_lookupname_next(struct tevent_req *req)
                /*
                 * We're done, so start the idmap child
                 */
-               setup_child(NULL, &static_idmap_child,
-                           idmap_dispatch_table,
-                           "log.winbindd", "idmap");
+               setup_child(NULL, &static_idmap_child, "log.winbindd", "idmap");
                tevent_req_done(req);
                return;
        }
index e31d1031bb99e9437701ae90780b78d2dfbdfb5c..653ee93d12291b2c0c23590839b41d9b9b446116 100644 (file)
@@ -39,19 +39,7 @@ struct dcerpc_binding_handle *locator_child_handle(void)
        return static_locator_child.binding_handle;
 }
 
-static const struct winbindd_child_dispatch_table locator_dispatch_table[] = {
-       {
-               .name           = "NDRCMD",
-               .struct_cmd     = WINBINDD_DUAL_NDRCMD,
-               .struct_fn      = winbindd_dual_ndrcmd,
-       },{
-               .name           = NULL,
-       }
-};
-
 void init_locator_child(void)
 {
-       setup_child(NULL, &static_locator_child,
-                   locator_dispatch_table,
-                   "log.winbindd", "locator");
+       setup_child(NULL, &static_locator_child, "log.winbindd", "locator");
 }
index b393586a6920d8fd961cb8248d699f7f645f88be..7b48ddb2b9004cea1e9fa6057cfb763ceec50ccb 100644 (file)
@@ -45,7 +45,6 @@ void ndr_print_winbindd_child(struct ndr_print *ndr,
        ndr_print_string(ndr, "logfilename", r->logfilename);
        /* struct fd_event event; */
        ndr_print_ptr(ndr, "lockout_policy_event", r->lockout_policy_event);
-       ndr_print_ptr(ndr, "table", r->table);
        ndr->depth--;
 }
 
index 7774f2837aa422c4da2c132b9c8ce3b508f48ae0..7c5f7ad91bbe33243b561881c30e00699b24a4c3 100644 (file)
@@ -292,7 +292,6 @@ int wb_domain_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                           struct winbindd_response **presponse, int *err);
 
 void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
-                const struct winbindd_child_dispatch_table *table,
                 const char *logprefix,
                 const char *logname);
 void winbind_child_died(pid_t pid);