diff options
author | Volker Lendecke <vl@samba.org> | 2012-04-04 14:51:09 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2012-04-17 11:54:35 +0200 |
commit | 8ed7ff483cc55091138f1e61cfc7573f2f8a0015 (patch) | |
tree | 62382ace2d91513bcf01a0e193b3a0a97e79a8c7 /source3 | |
parent | ee4f2abbda32c4712d0cbc0be171c31d1559a263 (diff) | |
download | samba-8ed7ff483cc55091138f1e61cfc7573f2f8a0015.tar.gz samba-8ed7ff483cc55091138f1e61cfc7573f2f8a0015.tar.bz2 samba-8ed7ff483cc55091138f1e61cfc7573f2f8a0015.zip |
s3: Add smbstatus -N to output the notify db
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Tue Apr 17 11:54:35 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 1 | ||||
-rw-r--r-- | source3/utils/status.c | 40 | ||||
-rwxr-xr-x | source3/wscript_build | 2 |
3 files changed, 42 insertions, 1 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index aef9750cbd..d48ce37064 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1038,6 +1038,7 @@ SWAT_OBJ = $(SWAT_OBJ1) $(PARAM_OBJ) $(PRINTING_OBJ) $(PRINTBASE_OBJ) $(LIBSMB_O STATUS_OBJ = utils/status.o utils/status_profile.o \ $(LOCKING_OBJ) $(PARAM_OBJ) \ + smbd/notify_internal.o librpc/gen_ndr/ndr_notify.o \ $(PROFILE_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \ $(LIBSMB_ERR_OBJ) $(FNAME_UTIL_OBJ) diff --git a/source3/utils/status.c b/source3/utils/status.c index 0755f9fdf2..95b279ea3b 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -40,6 +40,8 @@ #include "locking/proto.h" #include "messages.h" #include "librpc/gen_ndr/open_files.h" +#include "smbd/proto.h" +#include "librpc/gen_ndr/notify.h" #define SMB_MAXPIDS 2048 static uid_t Ucrit_uid = 0; /* added by OH */ @@ -287,13 +289,36 @@ static int traverse_sessionid(const char *key, struct sessionid *session, } +static void print_notify_recs(const char *path, + struct notify_db_entry *entries, + size_t num_entries, + time_t deleted_time, void *private_data) +{ + size_t i; + d_printf("%s\n", path); + + if (num_entries == 0) { + d_printf("deleted %s\n", time_to_asc(deleted_time)); + } + for (i=0; i<num_entries; i++) { + struct notify_db_entry *e = &entries[i]; + char *str; + + str = server_id_str(talloc_tos(), &e->server); + printf("%s %x %x\n", str, (unsigned)e->filter, + (unsigned)e->subdir_filter); + TALLOC_FREE(str); + } + printf("\n"); +} int main(int argc, char *argv[]) { int c; int profile_only = 0; bool show_processes, show_locks, show_shares; + bool show_notify = false; poptContext pc; struct poptOption long_options[] = { POPT_AUTOHELP @@ -301,6 +326,7 @@ static int traverse_sessionid(const char *key, struct sessionid *session, {"verbose", 'v', POPT_ARG_NONE, NULL, 'v', "Be verbose" }, {"locks", 'L', POPT_ARG_NONE, NULL, 'L', "Show locks only" }, {"shares", 'S', POPT_ARG_NONE, NULL, 'S', "Show shares only" }, + {"notify", 'N', POPT_ARG_NONE, NULL, 'N', "Show notifies" }, {"user", 'u', POPT_ARG_STRING, &username, 'u', "Switch to user" }, {"brief", 'b', POPT_ARG_NONE, NULL, 'b', "Be brief" }, {"profile", 'P', POPT_ARG_NONE, NULL, 'P', "Do profiling" }, @@ -342,6 +368,9 @@ static int traverse_sessionid(const char *key, struct sessionid *session, case 'S': shares_only = true; break; + case 'N': + show_notify = true; + break; case 'b': brief = true; break; @@ -487,6 +516,17 @@ static int traverse_sessionid(const char *key, struct sessionid *session, locking_end(); } + if (show_notify) { + struct notify_context *n; + + n = notify_init(talloc_tos(), NULL, NULL); + if (n == NULL) { + goto done; + } + notify_walk(n, print_notify_recs, NULL); + TALLOC_FREE(n); + } + done: TALLOC_FREE(frame); return ret; diff --git a/source3/wscript_build b/source3/wscript_build index 652743c86f..d68dd5cdb2 100755 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -427,7 +427,7 @@ SWAT_SRC1 = '''web/cgi.c web/diagnose.c web/startstop.c web/statuspage.c SWAT_SRC = '''${SWAT_SRC1}''' -STATUS_SRC = '''utils/status.c utils/status_profile.c''' +STATUS_SRC = '''utils/status.c utils/status_profile.c smbd/notify_internal.c''' SMBCONTROL_SRC = '''utils/smbcontrol.c''' |