]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbind: send "debug traceid" from winbindd parent to child
authorPavel Filipenský <pfilipen@redhat.com>
Sun, 5 Sep 2021 18:37:55 +0000 (20:37 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 10 May 2022 18:25:01 +0000 (18:25 +0000)
Bumping WINBIND_INTERFACE_VERSION to 32

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue May 10 18:25:01 UTC 2022 on sn-devel-184

nsswitch/winbind_struct_protocol.h
source3/winbindd/winbindd_dual.c

index 87d10ae6e3e430eccacb9b56f21574f278b380c1..ac0558c87c5c8585cbece572a1006f66d8ed0550 100644 (file)
@@ -61,8 +61,9 @@ typedef char fstring[FSTRING_LEN];
  * 29: added "authoritative" to response.data.auth
  * 30: added "validation_level" and "info6" to response.data.auth
  * 31: added "client_name" to the request
+ * 32: added "traceid" to the request
  */
-#define WINBIND_INTERFACE_VERSION 31
+#define WINBIND_INTERFACE_VERSION 32
 
 /* Have to deal with time_t being 4 or 8 bytes due to structure alignment.
    On a 64bit Linux box, we have to support a constant structure size
@@ -253,6 +254,7 @@ struct winbindd_request {
        uint32_t flags;          /* flags relevant *only* to a given request */
        fstring domain_name;    /* name of domain for which the request applies */
        char client_name[32];   /* The client process sending the request */
+       uint64_t traceid;       /* debug traceid is sent from parent to child */
 
        union {
                fstring winsreq;     /* WINS request */
index d517b83a3e2dd0f7494bf4d572ab3ced1512ed02..b880feaac1339ca17781d5fa22152c09a654b8ba 100644 (file)
@@ -33,6 +33,7 @@
 #include "nsswitch/wb_reqtrans.h"
 #include "secrets.h"
 #include "../lib/util/select.h"
+#include "winbindd_traceid.h"
 #include "../libcli/security/security.h"
 #include "system/select.h"
 #include "messages.h"
@@ -222,6 +223,8 @@ struct tevent_req *wb_child_request_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       state->request->traceid = debug_traceid_get();
+
        if (request->extra_data.data != NULL) {
                state->request->extra_data.data = talloc_memdup(
                        state->request,
@@ -1625,6 +1628,7 @@ static void child_handler(struct tevent_context *ev, struct tevent_fd *fde,
        struct child_handler_state *state =
                (struct child_handler_state *)private_data;
        NTSTATUS status;
+       uint64_t parent_traceid;
 
        /* fetch a request from the main daemon */
        status = child_read_request(state->cli.sock, state->cli.request);
@@ -1634,6 +1638,10 @@ static void child_handler(struct tevent_context *ev, struct tevent_fd *fde,
                _exit(0);
        }
 
+       /* read traceid from request */
+       parent_traceid = state->cli.request->traceid;
+       debug_traceid_set(parent_traceid);
+
        DEBUG(4,("child daemon request %d\n",
                 (int)state->cli.request->cmd));
 
@@ -1747,6 +1755,11 @@ static bool fork_domain_child(struct winbindd_child *child)
 
        status = winbindd_reinit_after_fork(child, child->logfilename);
 
+       /* setup callbacks again, one of them is removed in reinit_after_fork */
+       if (lp_winbind_debug_traceid()) {
+               winbind_debug_traceid_setup(global_event_context());
+       }
+
        nwritten = sys_write(state.cli.sock, &status, sizeof(status));
        if (nwritten != sizeof(status)) {
                DEBUG(1, ("fork_domain_child: Could not write status: "