1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s3:winbind: Improve logging in winbindd_wins_byip.c

Test scenario:
$ bin/wbinfo --WINS-by-ip=10.53.57.30

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Pavel Filipenský 2022-06-24 13:07:42 +02:00 committed by Andreas Schneider
parent 0f031024b1
commit 7a9bec6a67

View File

@ -45,14 +45,16 @@ struct tevent_req *winbindd_wins_byip_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
/* Ensure null termination */
request->data.winsreq[sizeof(request->data.winsreq)-1]='\0';
fstr_sprintf(state->response, "%s\t", request->data.winsreq);
DEBUG(3, ("[%5lu]: wins_byip %s\n", (unsigned long)cli->pid,
request->data.winsreq));
D_NOTICE("[%s (%u)] Winbind external command WINS_BYIP start.\n"
"Resolving wins byip for %s.\n",
cli->client_name,
(unsigned int)cli->pid,
request->data.winsreq);
make_nmb_name(&state->star, "*", 0);
@ -104,11 +106,11 @@ static void winbindd_wins_byip_done(struct tevent_req *subreq)
continue;
}
DEBUG(10, ("got name %s\n", names[i].name));
D_DEBUG("Got name '%s'.\n", names[i].name);
size = strlen(names[i].name + strlen(state->response));
if (size > sizeof(state->response) - 1) {
DEBUG(10, ("To much data\n"));
D_WARNING("Too much data!\n");
tevent_req_nterror(req, STATUS_BUFFER_OVERFLOW);
return;
}
@ -117,7 +119,6 @@ static void winbindd_wins_byip_done(struct tevent_req *subreq)
}
state->response[strlen(state->response)-1] = '\n';
DEBUG(10, ("response: %s", state->response));
TALLOC_FREE(names);
tevent_req_done(req);
@ -133,6 +134,9 @@ NTSTATUS winbindd_wins_byip_recv(struct tevent_req *req,
if (tevent_req_is_nterror(req, &status)) {
return status;
}
D_NOTICE("Winbind external command WINS_BYIP end.\n"
"Response: %s",
state->response);
fstrcpy(presp->data.winsresp, state->response);
return NT_STATUS_OK;
}