--- smbd/server.c.orig 2009-05-23 17:31:53.000000000 +0000 +++ smbd/server.c 2009-05-24 02:33:18.000000000 +0000 @@ -1125,6 +1125,9 @@ static bool Fork = True; static bool no_process_group = False; static bool log_stdout = False; +#ifdef WITH_SYSLOG + static bool syslog_only = False; +#endif static char *ports = NULL; static char *profile_level = NULL; int opt; @@ -1135,6 +1138,9 @@ OPT_INTERACTIVE, OPT_FORK, OPT_NO_PROCESS_GROUP, +#ifdef WITH_SYSLOG + OPT_SYSLOG_ONLY, +#endif OPT_LOG_STDOUT }; struct poptOption long_options[] = { @@ -1144,6 +1150,9 @@ {"foreground", 'F', POPT_ARG_NONE, NULL, OPT_FORK, "Run daemon in foreground (for daemontools, etc.)" }, {"no-process-group", '\0', POPT_ARG_NONE, NULL, OPT_NO_PROCESS_GROUP, "Don't create a new process group" }, {"log-stdout", 'S', POPT_ARG_NONE, NULL, OPT_LOG_STDOUT, "Log to stdout" }, +#ifdef WITH_SYSLOG + {"syslog-only", 'L', POPT_ARG_NONE, NULL, OPT_SYSLOG_ONLY, "Log to syslog" }, +#endif {"build-options", 'b', POPT_ARG_NONE, NULL, 'b', "Print build options" }, {"port", 'p', POPT_ARG_STRING, &ports, 0, "Listen on the specified ports"}, {"profiling-level", 'P', POPT_ARG_STRING, &profile_level, 0, "Set profiling level","PROFILE_LEVEL"}, @@ -1177,6 +1186,11 @@ case OPT_LOG_STDOUT: log_stdout = true; break; +#ifdef WITH_SYSLOG + case OPT_SYSLOG_ONLY: + syslog_only = true; + break; +#endif case 'b': print_build_options = True; break; @@ -1194,6 +1208,12 @@ log_stdout = True; } +#ifdef WITH_SYSLOG + if( syslog_only ) { + debug_set_syslog_only(); + } +#endif + setup_logging(argv[0],log_stdout); if (print_build_options) { @@ -1221,6 +1241,13 @@ exit(1); } +#ifdef WITH_SYSLOG + if (log_stdout && syslog_only) { + DEBUG(0,("ERROR: Can't log to stdout (-S) and syslog only (-L) at the same time\n")); + exit(1); + } +#endif + /* we want to re-seed early to prevent time delays causing client problems at a later date. (tridge) */ generate_random_buffer(NULL, 0);