This is for better debugging messages.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
#include <pthread.h>
#endif
+static char client_name[32];
+
/* Global context */
struct winbindd_context {
SAFE_FREE(response->extra_data.data);
}
+static const char *winbind_get_client_name(void)
+{
+ if (client_name[0] == '\0') {
+ int len;
+
+ len = snprintf(client_name,
+ sizeof(client_name),
+ "%s",
+ getprogname());
+ if (len <= 0) {
+ return "<unkonwn>";
+ }
+ }
+
+ return client_name;
+}
+
/* Initialise a request structure */
static void winbindd_init_request(struct winbindd_request *request,
request->cmd = (enum winbindd_cmd)request_type;
request->pid = getpid();
+ (void)snprintf(request->client_name,
+ sizeof(request->client_name),
+ "%s",
+ winbind_get_client_name());
}
/* Initialise a response structure */
* removed WINBINDD_UID_TO_SID
* 29: added "authoritative" to response.data.auth
* 30: added "validation_level" and "info6" to response.data.auth
+ * 31: added "client_name" to the request
*/
-#define WINBIND_INTERFACE_VERSION 30
+#define WINBIND_INTERFACE_VERSION 31
/* 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
uint32_t wb_flags; /* generic flags */
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 */
union {
fstring winsreq; /* WINS request */
ZERO_STRUCT(state->wb_req);
state->wb_req.cmd = WINBINDD_INTERFACE_VERSION;
state->wb_req.pid = getpid();
+ (void)snprintf(state->wb_req.client_name,
+ sizeof(state->wb_req.client_name),
+ "%s",
+ "TORTURE");
subreq = wb_simple_trans_send(state, state->ev, NULL,
state->wb_ctx->fd, &state->wb_req);