s3:winbind: Convert Ping parent/child call to NDR
authorSamuel Cabrero <scabrero@samba.org>
Wed, 16 Feb 2022 12:41:05 +0000 (13:41 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 25 Mar 2022 17:03:29 +0000 (17:03 +0000)
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/winbindd/winbindd_async.c [deleted file]
source3/winbindd/winbindd_domain.c
source3/winbindd/winbindd_domain_info.c
source3/winbindd/winbindd_idmap.c
source3/winbindd/winbindd_locator.c
source3/winbindd/winbindd_proto.h
source3/winbindd/wscript_build

diff --git a/source3/winbindd/winbindd_async.c b/source3/winbindd/winbindd_async.c
deleted file mode 100644 (file)
index 75dfa0e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-
-   Async helpers for blocking functions
-
-   Copyright (C) Volker Lendecke 2005
-   Copyright (C) Gerald Carter 2006
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "winbindd.h"
-#include "../libcli/security/security.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_WINBIND
-
-enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
-                                       struct winbindd_cli_state *state)
-{
-       return WINBINDD_OK;
-}
index fdf5768c5263f1035be11d583bdb71299411b939..0f3950068839e2218801bdcef2b29c7f574bebdf 100644 (file)
 
 static const struct winbindd_child_dispatch_table domain_dispatch_table[] = {
        {
-               .name           = "PING",
-               .struct_cmd     = WINBINDD_PING,
-               .struct_fn      = winbindd_dual_ping,
-       },{
                .name           = "INIT_CONNECTION",
                .struct_cmd     = WINBINDD_INIT_CONNECTION,
                .struct_fn      = winbindd_dual_init_connection,
index a9319849729e35a08a7756b8084f1e25c336c146..c4364d99ad3b9275c31079f0a382e26648f6e690 100644 (file)
 #include "winbindd.h"
 #include "lib/util/string_wrappers.h"
 #include "lib/global_contexts.h"
+#include "librpc/gen_ndr/ndr_winbind_c.h"
 
 struct winbindd_domain_info_state {
        struct winbindd_domain *domain;
-       struct winbindd_request ping_request;
+       uint32_t in;
+       uint32_t out;
 };
 
 static void winbindd_domain_info_done(struct tevent_req *subreq);
@@ -62,14 +64,17 @@ struct tevent_req *winbindd_domain_info_send(
                return tevent_req_post(req, ev);
        }
 
-       state->ping_request.cmd = WINBINDD_PING;
-
        /*
         * Send a ping down. This implicitly initializes the domain.
         */
 
-       subreq = wb_domain_request_send(state, global_event_context(),
-                                       state->domain, &state->ping_request);
+       state->in = cli->pid;
+       state->out = 0;
+       subreq = dcerpc_wbint_Ping_send(state,
+                                       global_event_context(),
+                                       dom_child_handle(state->domain),
+                                       state->in,
+                                       &state->out);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -84,19 +89,24 @@ static void winbindd_domain_info_done(struct tevent_req *subreq)
                subreq, struct tevent_req);
        struct winbindd_domain_info_state *state = tevent_req_data(
                req, struct winbindd_domain_info_state);
-       struct winbindd_response *response;
-       int ret, err;
+       NTSTATUS status, result;
 
-       ret = wb_domain_request_recv(subreq, state, &response, &err);
+       status = dcerpc_wbint_Ping_recv(subreq, state, &result);
        TALLOC_FREE(subreq);
-       if (ret == -1) {
-               DBG_DEBUG("wb_domain_request failed: %s\n", strerror(err));
-               tevent_req_nterror(req, map_nt_error_from_unix(err));
+       if (tevent_req_nterror(req, status)) {
+               DBG_NOTICE("dcerpc_wbint_Ping call failed: %s\n",
+                          nt_errstr(status));
+               return;
+       }
+
+       if (tevent_req_nterror(req, result)) {
+               DBG_NOTICE("dcerpc_wbint_Ping failed: %s\n",
+                          nt_errstr(result));
                return;
        }
 
        if (!state->domain->initialized) {
-               DBG_INFO("wb_domain_request did not initialize domain %s\n",
+               DBG_INFO("dcerpc_wbint_Ping did not initialize domain %s\n",
                         state->domain->name);
                tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
                return;
@@ -114,8 +124,8 @@ NTSTATUS winbindd_domain_info_recv(struct tevent_req *req,
        NTSTATUS status;
 
        if (tevent_req_is_nterror(req, &status)) {
-               DBG_DEBUG("winbindd_domain_info failed: %s\n",
-                         nt_errstr(status));
+               DBG_NOTICE("winbindd_domain_info failed: %s\n",
+                          nt_errstr(status));
                return status;
        }
 
index 41be6f144796ef20d73b3fd74ff9cfd496eae709..79775a03c8b7d5c52f64bd994821df410bf1b6db 100644 (file)
@@ -70,10 +70,6 @@ struct dcerpc_binding_handle *idmap_child_handle(void)
 
 static const struct winbindd_child_dispatch_table idmap_dispatch_table[] = {
        {
-               .name           = "PING",
-               .struct_cmd     = WINBINDD_PING,
-               .struct_fn      = winbindd_dual_ping,
-       },{
                .name           = "NDRCMD",
                .struct_cmd     = WINBINDD_DUAL_NDRCMD,
                .struct_fn      = winbindd_dual_ndrcmd,
index 55b64555376cebfe74d78d332f4bb1fb96f95393..e31d1031bb99e9437701ae90780b78d2dfbdfb5c 100644 (file)
@@ -41,10 +41,6 @@ struct dcerpc_binding_handle *locator_child_handle(void)
 
 static const struct winbindd_child_dispatch_table locator_dispatch_table[] = {
        {
-               .name           = "PING",
-               .struct_cmd     = WINBINDD_PING,
-               .struct_fn      = winbindd_dual_ping,
-       },{
                .name           = "NDRCMD",
                .struct_cmd     = WINBINDD_DUAL_NDRCMD,
                .struct_fn      = winbindd_dual_ndrcmd,
index b9b7be40245e3abb20306c397baf438dcd3a9049..d61915241d32425655fe8091a9a16f085fb88dd9 100644 (file)
@@ -552,9 +552,6 @@ bool parse_xidlist(TALLOC_CTX *mem_ctx, const char *xidstr,
 
 void winbindd_wins_byname(struct winbindd_cli_state *state);
 
-enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
-                                       struct winbindd_cli_state *state);
-
 struct dcerpc_binding_handle *wbint_binding_handle(TALLOC_CTX *mem_ctx,
                                                struct winbindd_domain *domain,
                                                struct winbindd_child *child);
index 2ee46903abc7f5a3e5f640a40072fa72dfa1658a..c1439572cad75e9c620dd75caebc1f357dff6197 100644 (file)
@@ -190,7 +190,6 @@ bld.SAMBA3_SUBSYSTEM('winbindd-lib',
                     winbindd_dual.c
                     winbindd_dual_ndr.c
                     winbindd_dual_srv.c
-                    winbindd_async.c
                     winbindd_creds.c
                     winbindd_cred_cache.c
                     winbindd_ccache_access.c