#include "system/filesys.h"
#include "lib/util/server_id.h"
#include "lib/util/close_low_fd.h"
-#include "popt_common.h"
+#include "lib/cmdline/cmdline.h"
#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
.descrip = "Set profiling level","PROFILE_LEVEL",
},
POPT_COMMON_SAMBA
+ POPT_COMMON_VERSION
POPT_TABLEEND
};
struct smbd_parent_context *parent = NULL;
.exit_server = smbd_exit_server,
.exit_server_cleanly = smbd_exit_server_cleanly,
};
+ bool ok;
/*
* Do this before any other talloc operation
talloc_enable_null_tracking();
frame = talloc_stackframe();
- setup_logging(argv[0], DEBUG_DEFAULT_STDOUT);
-
smb_init_locale();
set_smbd_shim(&smbd_shim_fns);
set_auth_parameters(argc,argv);
#endif
- pc = poptGetContext("smbd", argc, argv, long_options, 0);
+ ok = samba_cmdline_init(frame,
+ SAMBA_CMDLINE_CONFIG_SERVER,
+ true /* require_smbconf */);
+ if (!ok) {
+ DBG_ERR("Failed to setup cmdline parser!\n");
+ exit(ENOMEM);
+ }
+
+ pc = samba_popt_get_context(getprogname(),
+ argc,
+ argv,
+ long_options,
+ 0);
+ if (pc == NULL) {
+ DBG_ERR("Failed to get popt context!\n");
+ exit(ENOMEM);
+ }
+
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
case OPT_DAEMON:
gain_root_privilege();
gain_root_group_privilege();
- fault_setup();
dump_core_setup("smbd", lp_logfile(talloc_tos(), lp_sub));
/* we are never interested in SIGPIPE */
exit(1);
}
- if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {
- DEBUG(0, ("error opening config file '%s'\n", get_dyn_CONFIGFILE()));
- exit(1);
- }
-
/*
* This calls unshare(CLONE_FS); on linux
* in order to check if the running kernel/container
if (serving_printers) {
bool bgq = lp_parm_bool(-1, "smbd", "backgroundqueue", true);
- bool ok = printing_subsystem_init(ev_ctx,
- msg_ctx,
- dce_ctx,
- true,
- bgq);
+ ok = printing_subsystem_init(ev_ctx,
+ msg_ctx,
+ dce_ctx,
+ true,
+ bgq);
if (!ok) {
exit_daemon("Samba failed to init printing subsystem", EACCES);
}
}
#endif
} else if (serving_printers) {
- bool ok = printing_subsystem_init(ev_ctx,
- msg_ctx,
- dce_ctx,
- false,
- false);
+ ok = printing_subsystem_init(ev_ctx,
+ msg_ctx,
+ dce_ctx,
+ false,
+ false);
if (!ok) {
exit(1);
}