#include "lib/conn_tdb.h"
#include "serverid.h"
#include "status_profile.h"
+#include "smbd/notifyd/notifyd.h"
#define SMB_MAXPIDS 2048
static uid_t Ucrit_uid = 0; /* added by OH */
static int print_share_mode(const struct share_mode_entry *e,
const char *sharepath,
const char *fname,
+ const char *sname,
void *dummy)
{
static int count;
d_printf("NONE ");
}
- d_printf(" %s %s %s",sharepath, fname, time_to_asc((time_t)e->time.tv_sec));
+ d_printf(" %s %s%s %s",
+ sharepath, fname,
+ sname ? sname : "",
+ time_to_asc((time_t)e->time.tv_sec));
}
return 0;
}
-static void print_notify_recs(const char *path,
- struct notify_db_entry *entries,
- size_t num_entries,
- time_t deleted_time, void *private_data)
+static bool print_notify_rec(const char *path, struct server_id server,
+ const struct notify_instance *instance,
+ void *private_data)
{
- size_t i;
- d_printf("%s\n", path);
+ struct server_id_buf idbuf;
- 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;
+ d_printf("%s\\%s\\%x\\%x\n", path, server_id_str_buf(server, &idbuf),
+ (unsigned)instance->filter,
+ (unsigned)instance->subdir_filter);
- 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");
+ return true;
}
int main(int argc, const char *argv[])
};
TALLOC_CTX *frame = talloc_stackframe();
int ret = 0;
- struct messaging_context *msg_ctx;
+ struct messaging_context *msg_ctx = NULL;
char *db_path;
bool ok;
smb_init_locale();
setup_logging(argv[0], DEBUG_STDERR);
+ lp_set_cmdline("log level", "0");
if (getuid() != geteuid()) {
d_printf("smbstatus should not be run setuid\n");
}
- if (lp_clustering()) {
- /*
- * This implicitly initializes the global ctdbd
- * connection, usable by the db_open() calls further
- * down.
- */
- msg_ctx = messaging_init(NULL, samba_tevent_context_init(NULL));
- if (msg_ctx == NULL) {
- fprintf(stderr, "messaging_init failed\n");
- ret = -1;
- goto done;
- }
+ /*
+ * This implicitly initializes the global ctdbd connection,
+ * usable by the db_open() calls further down.
+ */
+ msg_ctx = messaging_init(NULL, samba_tevent_context_init(NULL));
+ if (msg_ctx == NULL) {
+ fprintf(stderr, "messaging_init failed\n");
+ ret = -1;
+ goto done;
}
if (!lp_load_global(get_dyn_CONFIGFILE())) {
if (show_notify) {
struct notify_context *n;
- n = notify_init(talloc_tos(), NULL, NULL);
+ n = notify_init(talloc_tos(), msg_ctx,
+ messaging_tevent_context(msg_ctx));
if (n == NULL) {
goto done;
}
- notify_walk(n, print_notify_recs, NULL);
+ notify_walk(n, print_notify_rec, NULL);
TALLOC_FREE(n);
}