summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-08-31 15:24:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:27 -0500
commitac3f2e784f818fb06b20b053cf4127d331e8f63c (patch)
tree7759de16715cbe6c394c7704f7fefbbf29d2e2e9 /source3/utils
parent51e5001cba2ae438674517371d29ae7f78c0a52a (diff)
downloadsamba-ac3f2e784f818fb06b20b053cf4127d331e8f63c.tar.gz
samba-ac3f2e784f818fb06b20b053cf4127d331e8f63c.tar.bz2
samba-ac3f2e784f818fb06b20b053cf4127d331e8f63c.zip
r24843: Add a "validate-cache" control message to winbindd.
So there is a new subcommand "smbcontrol winbindd validate-cache" now. This change provides the infrastructure: The function currently returns "true" unconditionally. The call of a real cache validation function will be incorporated in subsequent changes. Michael (This used to be commit ef92d505c04397614cb0dd5ede967e9017a5e302)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/smbcontrol.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 2a435945e6..8255a41c96 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -1012,6 +1012,48 @@ static BOOL do_dump_event_list(struct messaging_context *msg_ctx,
return send_message(msg_ctx, pid, MSG_DUMP_EVENT_LIST, NULL, 0);
}
+static void winbind_validate_cache_cb(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id pid,
+ DATA_BLOB *data)
+{
+ char *src_string = procid_str(NULL, &pid);
+ printf("Winbindd cache is %svalid. (answer from pid %s)\n",
+ (*(data->data) == 0 ? "" : "NOT "), src_string);
+ TALLOC_FREE(src_string);
+ num_replies++;
+}
+
+static BOOL do_winbind_validate_cache(struct messaging_context *msg_ctx,
+ const struct server_id pid,
+ const int argc, const char **argv)
+{
+ struct server_id myid = pid_to_procid(sys_getpid());
+
+ if (argc != 1) {
+ fprintf(stderr, "Usage: smbcontrol winbindd validate-cache\n");
+ return False;
+ }
+
+ messaging_register(msg_ctx, NULL, MSG_WINBIND_VALIDATE_CACHE,
+ winbind_validate_cache_cb);
+
+ if (!send_message(msg_ctx, pid, MSG_WINBIND_VALIDATE_CACHE, &myid,
+ sizeof(myid))) {
+ return False;
+ }
+
+ wait_replies(msg_ctx, procid_to_pid(&pid) == 0);
+
+ if (num_replies == 0) {
+ printf("No replies received\n");
+ }
+
+ messaging_deregister(msg_ctx, MSG_WINBIND_VALIDATE_CACHE, NULL);
+
+ return num_replies;
+}
static BOOL do_reload_config(struct messaging_context *msg_ctx,
const struct server_id pid,
@@ -1110,6 +1152,8 @@ static const struct {
{ "offline", do_winbind_offline, "Ask winbind to go into offline state"},
{ "onlinestatus", do_winbind_onlinestatus, "Request winbind online status"},
{ "dump-event-list", do_dump_event_list, "Dump event list"},
+ { "validate-cache" , do_winbind_validate_cache,
+ "Validate winbind's credential cache" },
{ "noop", do_noop, "Do nothing" },
{ NULL }
};