#include "smbd/process_model.h"
#include "smbd/service.h"
#include "passdb/secrets.h"
-#include "lib/util/pidfile.h"
+#include "smbd/pidfile.h"
/*
recursively delete a directory tree
char *fname;
struct stat st;
- if (strcmp(de->d_name, ".") == 0 ||
- strcmp(de->d_name, "..") == 0) {
+ if (ISDOT(de->d_name) || ISDOTDOT(de->d_name)) {
continue;
}
debug_schedule_reopen_logs();
}
+static void sig_term(int sig)
+{
+#if HAVE_GETPGRP
+ static int done_sigterm;
+ if (done_sigterm == 0 && getpgrp() == getpid()) {
+ DEBUG(0,("SIGTERM: killing children\n"));
+ done_sigterm = 1;
+ kill(-getpgrp(), SIGTERM);
+ }
+#endif
+ exit(0);
+}
+
/*
setup signal masks
*/
BlockSignals(False, SIGTERM);
CatchSignal(SIGHUP, sig_hup);
+ CatchSignal(SIGTERM, sig_term);
}
/*
uint8_t c;
if (read(0, &c, 1) == 0) {
DEBUG(0,("%s: EOF on stdin - terminating\n", binary_name));
+#if HAVE_GETPGRP
+ if (getpgrp() == getpid()) {
+ kill(-getpgrp(), SIGTERM);
+ }
+#endif
exit(0);
}
}
NTSTATUS status;
const char *model = "standard";
int max_runtime = 0;
+ enum {
+ OPT_INTERACTIVE = 1000,
+ OPT_PROCESS_MODEL
+ };
struct poptOption long_options[] = {
POPT_AUTOHELP
- {"interactive", 'i', POPT_ARG_VAL, &interactive, True,
+ {"interactive", 'i', POPT_ARG_NONE, NULL, OPT_INTERACTIVE,
"Run interactive (not a daemon)", NULL},
- {"model", 'M', POPT_ARG_STRING, &model, True,
+ {"model", 'M', POPT_ARG_STRING, NULL, OPT_PROCESS_MODEL,
"Select process model", "MODEL"},
- {"maximum-runtime", 0, POPT_ARG_INT, &max_runtime, True,
+ {"maximum-runtime",0, POPT_ARG_INT, &max_runtime, 0,
"set maximum runtime of the server process, till autotermination", "seconds"},
POPT_COMMON_SAMBA
POPT_COMMON_VERSION
- POPT_TABLEEND
+ { NULL }
};
pc = poptGetContext(binary_name, argc, argv, long_options, 0);
- while((opt = poptGetNextOpt(pc)) != -1) /* noop */ ;
-
+ while((opt = poptGetNextOpt(pc)) != -1) {
+ switch(opt) {
+ case OPT_INTERACTIVE:
+ interactive = True;
+ break;
+ case OPT_PROCESS_MODEL:
+ model = poptGetOptArg(pc);
+ break;
+ }
+ }
poptFreeContext(pc);
setup_logging(binary_name, interactive?DEBUG_STDOUT:DEBUG_FILE);
ldb_global_init(); /* FIXME: */
+ share_init();
+
gensec_init(); /* FIXME: */
registry_init(); /* FIXME: maybe run this in the initialization function