[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Tue Apr 27 14:15:01 UTC 2021
The branch, master has been updated
via c9508b971ca auth3: talloc_strackframe() panics on failure
via 117f00158af auth: Fix a typo
via a01f680e43a passdb: Add error checks in samu_set_unix_internal()
via 4e034e8f8fc auth3: if (ret==False) just looks weird
via ee431a29872 auth3: Fix a typo
via b150982d90b auth3: Use auth3_context_set_challenge() in auth3_set_challenge()
via cdd9d423716 auth3: Apply some const to auth3_context_set_challenge()
via ad7628b2cb2 gensec: Slightly simplify gensec_generate_session_info_pac()
via 349bd015d22 lib: Remove close_low_fds()
via 00b57391dd2 lib: Directly call close_low_fd() in become_daemon()
via 8728bf91471 smbd: Replace call to close_low_fds() with direct calls
via 8d2eb62a107 printing: Avoid zombies in the background daemon
via ce97c671862 printing: Reduce indentation in start_background_queue()
via 7997a090c68 printing: Remove dead code
via 3ba5ed73fcf printing: Remove the pause_pipe[] from queue_process.c
from 2e2426e5157 samba-tool group listmembers: always list objects which can not expire
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c9508b971ca54d5293d8976190635c406bd209c6
Author: Volker Lendecke <vl at samba.org>
Date: Thu Apr 22 10:29:24 2021 +0200
auth3: talloc_strackframe() panics on failure
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Apr 27 14:14:22 UTC 2021 on sn-devel-184
commit 117f00158afe74e8e1abf1a0a637cebc2738c36d
Author: Volker Lendecke <vl at samba.org>
Date: Thu Apr 22 10:29:14 2021 +0200
auth: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit a01f680e43a4aade9fde9bf83842647a3f9f708c
Author: Volker Lendecke <vl at samba.org>
Date: Wed Apr 21 21:51:44 2021 +0200
passdb: Add error checks in samu_set_unix_internal()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit 4e034e8f8fcd5e63dc4afe5a210ccea347bfa523
Author: Volker Lendecke <vl at samba.org>
Date: Wed Apr 21 21:30:30 2021 +0200
auth3: if (ret==False) just looks weird
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit ee431a298726b61fd0244c42e613fde87e2bdd82
Author: Volker Lendecke <vl at samba.org>
Date: Wed Apr 21 12:56:04 2021 +0200
auth3: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit b150982d90bf2c1d4dcf08384b1d35614d162e65
Author: Volker Lendecke <vl at samba.org>
Date: Wed Apr 21 12:29:16 2021 +0200
auth3: Use auth3_context_set_challenge() in auth3_set_challenge()
Don't duplicate what's already there.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit cdd9d423716f4f917a9f4589ac90ee1b21d11c02
Author: Volker Lendecke <vl at samba.org>
Date: Wed Apr 21 12:28:12 2021 +0200
auth3: Apply some const to auth3_context_set_challenge()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit ad7628b2cb254d9b25ee70f86edfeb725e809b01
Author: Volker Lendecke <vl at samba.org>
Date: Wed Apr 21 11:30:20 2021 +0200
gensec: Slightly simplify gensec_generate_session_info_pac()
Reduce indentation by an early error return and by introducing a
helper variable.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit 349bd015d227a625990af7122e39319431f7af8d
Author: Volker Lendecke <vl at samba.org>
Date: Fri Apr 23 16:37:31 2021 +0200
lib: Remove close_low_fds()
There were only two callers, it did not do proper error handling, and
it was confusing to call.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit 00b57391dd27d15fa25d5577b7c0192802468bab
Author: Volker Lendecke <vl at samba.org>
Date: Fri Apr 23 16:35:02 2021 +0200
lib: Directly call close_low_fd() in become_daemon()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit 8728bf91471fe044c989b2c8eaf9f5945f347b9b
Author: Volker Lendecke <vl at samba.org>
Date: Fri Apr 23 16:31:08 2021 +0200
smbd: Replace call to close_low_fds() with direct calls
Check the errors from close_low_fd(). Also, close_low_fds() does not
really add a lot of value, for example there's no caller that closes
stderr.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit 8d2eb62a1070dc2ee5be99338d4fa66981002c12
Author: Volker Lendecke <vl at samba.org>
Date: Fri Apr 23 11:17:33 2021 +0200
printing: Avoid zombies in the background daemon
Whatever you read about waitpid() tells you should should run it in a
loop.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit ce97c67186266213ef78ccc56917a6bb45bd200d
Author: Volker Lendecke <vl at samba.org>
Date: Fri Apr 23 16:09:43 2021 +0200
printing: Reduce indentation in start_background_queue()
We don't need the "if(pid==0)" here, we've covered "if(pid!=0)" a few
lines above.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit 7997a090c687df56c29607d4860b306aeb1dd237
Author: Volker Lendecke <vl at samba.org>
Date: Fri Apr 23 16:07:38 2021 +0200
printing: Remove dead code
This was already covered a few lines above.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
commit 3ba5ed73fcf40b4e18ae84c272188849449586fe
Author: Volker Lendecke <vl at samba.org>
Date: Fri Apr 23 16:03:57 2021 +0200
printing: Remove the pause_pipe[] from queue_process.c
Since c80f70390c37 we don't need this explicit pipe anymore.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
-----------------------------------------------------------------------
Summary of changes:
auth/gensec/gensec_util.c | 30 +++++---
lib/util/become_daemon.c | 40 +++-------
lib/util/become_daemon.h | 9 ---
librpc/idl/auth.idl | 2 +-
source3/auth/auth.c | 6 +-
source3/auth/auth_ntlmssp.c | 16 ++--
source3/auth/check_samsec.c | 2 +-
source3/auth/proto.h | 6 +-
source3/auth/server_info_sam.c | 7 +-
source3/passdb/passdb.c | 78 ++++++++++++++++----
source3/printing/queue_process.c | 153 +++++++++++++++------------------------
source3/smbd/server.c | 17 ++++-
12 files changed, 188 insertions(+), 178 deletions(-)
Changeset truncated at 500 lines:
diff --git a/auth/gensec/gensec_util.c b/auth/gensec/gensec_util.c
index e185acc0c20..e411751c3af 100644
--- a/auth/gensec/gensec_util.c
+++ b/auth/gensec/gensec_util.c
@@ -38,6 +38,8 @@ NTSTATUS gensec_generate_session_info_pac(TALLOC_CTX *mem_ctx,
struct auth_session_info **session_info)
{
uint32_t session_info_flags = 0;
+ struct auth4_context *auth_context = NULL;
+ NTSTATUS status;
if (gensec_security->want_features & GENSEC_FEATURE_UNIX_TOKEN) {
session_info_flags |= AUTH_SESSION_INFO_UNIX_TOKEN;
@@ -55,19 +57,25 @@ NTSTATUS gensec_generate_session_info_pac(TALLOC_CTX *mem_ctx,
"user lookup\n", principal_string);
}
- if (gensec_security->auth_context && gensec_security->auth_context->generate_session_info_pac) {
- return gensec_security->auth_context->generate_session_info_pac(gensec_security->auth_context,
- mem_ctx,
- smb_krb5_context,
- pac_blob,
- principal_string,
- remote_address,
- session_info_flags,
- session_info);
- } else {
- DEBUG(0, ("Cannot generate a session_info without the auth_context\n"));
+ auth_context = gensec_security->auth_context;
+
+ if ((auth_context == NULL) ||
+ (auth_context->generate_session_info_pac == NULL)) {
+ DBG_ERR("Cannot generate a session_info without "
+ "the auth_context\n");
return NT_STATUS_INTERNAL_ERROR;
}
+
+ status = auth_context->generate_session_info_pac(
+ auth_context,
+ mem_ctx,
+ smb_krb5_context,
+ pac_blob,
+ principal_string,
+ remote_address,
+ session_info_flags,
+ session_info);
+ return status;
}
/*
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 800a57437cc..984d4a82bcc 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -45,33 +45,6 @@ void daemon_sd_notifications(bool enable)
sd_notifications ? "enabled" : "disabled");
}
-/*******************************************************************
- Close the low 3 fd's and open dev/null in their place.
-********************************************************************/
-
-void close_low_fds(bool stdin_too, bool stdout_too, bool stderr_too)
-{
-
- if (stdin_too) {
- int ret = close_low_fd(0);
- if (ret != 0) {
- DBG_ERR("close_low_fd(0) failed: %s\n", strerror(ret));
- }
- }
- if (stdout_too) {
- int ret = close_low_fd(1);
- if (ret != 0) {
- DBG_ERR("close_low_fd(1) failed: %s\n", strerror(ret));
- }
- }
- if (stderr_too) {
- int ret = close_low_fd(2);
- if (ret != 0) {
- DBG_ERR("close_low_fd(2) failed: %s\n", strerror(ret));
- }
- }
-}
-
/****************************************************************************
Become a daemon, discarding the controlling terminal.
****************************************************************************/
@@ -115,7 +88,18 @@ void become_daemon(bool do_fork, bool no_session, bool log_stdout)
/* stdin must be open if we do not fork, for monitoring for
* close. stdout must be open if we are logging there, and we
* never close stderr (but debug might dup it onto a log file) */
- close_low_fds(do_fork, !log_stdout, false);
+ if (do_fork) {
+ int ret = close_low_fd(0);
+ if (ret != 0) {
+ exit_daemon("close_low_fd(0) failed: %s\n", errno);
+ }
+ }
+ if (!log_stdout) {
+ int ret = close_low_fd(1);
+ if (ret != 0) {
+ exit_daemon("close_low_fd(1) failed: %s\n", errno);
+ }
+ }
}
void exit_daemon(const char *msg, int error)
diff --git a/lib/util/become_daemon.h b/lib/util/become_daemon.h
index 149d4c0175e..e12be27246b 100644
--- a/lib/util/become_daemon.h
+++ b/lib/util/become_daemon.h
@@ -32,15 +32,6 @@
* @brief Utilities for demonising
*/
-/**
- * @brief Close the low 3 file descriptors and open /dev/null in their place
- *
- * @param[in] stdin_too Should stdin be closed?
- * @param[in] stdout_too Should stdout be closed?
- * @param[in] stderr_too Should stderr be closed?
-**/
-void close_low_fds(bool stdin_too, bool stdout_too, bool stderr_too);
-
/**
* @brief Enable or disable daemon status systemd notifications
*
diff --git a/librpc/idl/auth.idl b/librpc/idl/auth.idl
index 1092935b971..7de3d4c6bfb 100644
--- a/librpc/idl/auth.idl
+++ b/librpc/idl/auth.idl
@@ -25,7 +25,7 @@ interface auth
} auth_method;
/* This is the parts of the session_info that don't change
- * during local privilage and group manipulations */
+ * during local privilege and group manipulations */
typedef [public] struct {
[unique,charset(UTF8),string] char *account_name;
[unique,charset(UTF8),string] char *user_principal_name;
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index e67f4961ddb..ce6bf6c5621 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -609,8 +609,10 @@ NTSTATUS make_auth3_context_for_winbind(TALLOC_CTX *mem_ctx,
return make_auth_context_specific(mem_ctx, auth_context, methods);
}
-bool auth3_context_set_challenge(struct auth_context *ctx, uint8_t chal[8],
- const char *challenge_set_by)
+bool auth3_context_set_challenge(
+ struct auth_context *ctx,
+ const uint8_t chal[8],
+ const char *challenge_set_by)
{
ctx->challenge = data_blob_talloc(ctx, chal, 8);
if (ctx->challenge.data == NULL) {
diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c
index 8d213f194cf..676aa9d892c 100644
--- a/source3/auth/auth_ntlmssp.c
+++ b/source3/auth/auth_ntlmssp.c
@@ -43,7 +43,7 @@ NTSTATUS auth3_generate_session_info(struct auth4_context *auth_context,
* Some callers pass auth_user_info_dc, the SCHANNEL and
* NCALRPC_AS_SYSTEM gensec modules.
*
- * While the reset passes auth3_check_password() returned.
+ * While the rest passes auth3_check_password() returned.
*/
user_info = talloc_get_type(server_returned_info,
struct auth_user_info_dc);
@@ -111,13 +111,15 @@ NTSTATUS auth3_set_challenge(struct auth4_context *auth4_context, const uint8_t
{
struct auth_context *auth_context = talloc_get_type_abort(auth4_context->private_data,
struct auth_context);
+ bool ok;
- auth_context->challenge = data_blob_talloc(auth_context,
- chal, 8);
- NT_STATUS_HAVE_NO_MEMORY(auth_context->challenge.data);
-
- auth_context->challenge_set_by = talloc_strdup(auth_context, challenge_set_by);
- NT_STATUS_HAVE_NO_MEMORY(auth_context->challenge_set_by);
+ ok = auth3_context_set_challenge(auth_context, chal, challenge_set_by);
+ if (!ok) {
+ /*
+ * This can only fail for ENOMEM
+ */
+ return NT_STATUS_NO_MEMORY;
+ }
DEBUG(5, ("auth_context challenge set by %s\n", auth_context->challenge_set_by));
DEBUG(5, ("challenge is: \n"));
diff --git a/source3/auth/check_samsec.c b/source3/auth/check_samsec.c
index cfd32c5f5ba..b9563c958a9 100644
--- a/source3/auth/check_samsec.c
+++ b/source3/auth/check_samsec.c
@@ -394,7 +394,7 @@ NTSTATUS check_sam_security(const DATA_BLOB *challenge,
ret = pdb_getsampwnam(sampass, user_info->mapped.account_name);
unbecome_root();
- if (ret == False) {
+ if (!ret) {
DEBUG(3,("check_sam_security: Couldn't find user '%s' in "
"passdb.\n", user_info->mapped.account_name));
TALLOC_FREE(sampass);
diff --git a/source3/auth/proto.h b/source3/auth/proto.h
index bb247b9187c..036d4004c38 100644
--- a/source3/auth/proto.h
+++ b/source3/auth/proto.h
@@ -42,8 +42,10 @@ NTSTATUS make_auth3_context_for_netlogon(TALLOC_CTX *mem_ctx,
struct auth_context **auth_context);
NTSTATUS make_auth3_context_for_winbind(TALLOC_CTX *mem_ctx,
struct auth_context **auth_context);
-bool auth3_context_set_challenge(struct auth_context *ctx, uint8_t chal[8],
- const char *challenge_set_by);
+bool auth3_context_set_challenge(
+ struct auth_context *ctx,
+ const uint8_t chal[8],
+ const char *challenge_set_by);
/****************************************************************************
Try to get a challenge out of the various authentication modules.
diff --git a/source3/auth/server_info_sam.c b/source3/auth/server_info_sam.c
index 755791c1be4..79a7af7281e 100644
--- a/source3/auth/server_info_sam.c
+++ b/source3/auth/server_info_sam.c
@@ -65,14 +65,9 @@ NTSTATUS make_server_info_sam(TALLOC_CTX *mem_ctx,
struct passwd *pwd;
struct auth_serversupplied_info *server_info;
const char *username = pdb_get_username(sampass);
- TALLOC_CTX *tmp_ctx;
+ TALLOC_CTX *tmp_ctx = talloc_stackframe();
NTSTATUS status;
- tmp_ctx = talloc_stackframe();
- if (tmp_ctx == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
server_info = make_server_info(tmp_ctx);
if (server_info == NULL) {
status = NT_STATUS_NO_MEMORY;
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 4ce643a1833..f4cbbe6c06e 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -137,6 +137,7 @@ static NTSTATUS samu_set_unix_internal(struct pdb_methods *methods,
const char *domain = lp_netbios_name();
char *fullname;
uint32_t urid;
+ bool ok;
if ( !pwd ) {
return NT_STATUS_NO_SUCH_USER;
@@ -144,7 +145,10 @@ static NTSTATUS samu_set_unix_internal(struct pdb_methods *methods,
/* Basic properties based upon the Unix account information */
- pdb_set_username(user, pwd->pw_name, PDB_SET);
+ ok = pdb_set_username(user, pwd->pw_name, PDB_SET);
+ if (!ok) {
+ return NT_STATUS_NO_MEMORY;
+ }
fullname = NULL;
@@ -157,16 +161,26 @@ static NTSTATUS samu_set_unix_internal(struct pdb_methods *methods,
fullname = talloc_strndup(
talloc_tos(), pwd->pw_gecos,
strchr(pwd->pw_gecos, ',') - pwd->pw_gecos);
+ if (fullname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
}
if (fullname != NULL) {
- pdb_set_fullname(user, fullname, PDB_SET);
+ ok = pdb_set_fullname(user, fullname, PDB_SET);
} else {
- pdb_set_fullname(user, pwd->pw_gecos, PDB_SET);
+ ok = pdb_set_fullname(user, pwd->pw_gecos, PDB_SET);
}
TALLOC_FREE(fullname);
- pdb_set_domain (user, get_global_sam_name(), PDB_DEFAULT);
+ if (!ok) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ok = pdb_set_domain(user, get_global_sam_name(), PDB_DEFAULT);
+ if (!ok) {
+ return NT_STATUS_NO_MEMORY;
+ }
#if 0
/* This can lead to a primary group of S-1-22-2-XX which
will be rejected by other parts of the Samba code.
@@ -180,6 +194,9 @@ static NTSTATUS samu_set_unix_internal(struct pdb_methods *methods,
/* save the password structure for later use */
user->unix_pw = tcopy_passwd( user, pwd );
+ if (user->unix_pw == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
/* Special case for the guest account which must have a RID of 501 */
@@ -212,18 +229,53 @@ static NTSTATUS samu_set_unix_internal(struct pdb_methods *methods,
/* set some basic attributes */
- pdb_set_profile_path(user, talloc_sub_specified(user,
- lp_logon_path(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid),
- PDB_DEFAULT);
- pdb_set_homedir(user, talloc_sub_specified(user,
- lp_logon_home(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid),
+ ok = pdb_set_profile_path(
+ user,
+ talloc_sub_specified(
+ user,
+ lp_logon_path(),
+ pwd->pw_name,
+ NULL,
+ domain,
+ pwd->pw_uid,
+ pwd->pw_gid),
PDB_DEFAULT);
- pdb_set_dir_drive(user, talloc_sub_specified(user,
- lp_logon_drive(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid),
+ ok &= pdb_set_homedir(
+ user,
+ talloc_sub_specified(
+ user,
+ lp_logon_home(),
+ pwd->pw_name,
+ NULL,
+ domain,
+ pwd->pw_uid,
+ pwd->pw_gid),
PDB_DEFAULT);
- pdb_set_logon_script(user, talloc_sub_specified(user,
- lp_logon_script(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid),
+ ok &= pdb_set_dir_drive(
+ user,
+ talloc_sub_specified(
+ user,
+ lp_logon_drive(),
+ pwd->pw_name,
+ NULL,
+ domain,
+ pwd->pw_uid,
+ pwd->pw_gid),
PDB_DEFAULT);
+ ok &= pdb_set_logon_script(
+ user,
+ talloc_sub_specified(
+ user,
+ lp_logon_script(),
+ pwd->pw_name,
+ NULL,
+ domain,
+ pwd->pw_uid,
+ pwd->pw_gid),
+ PDB_DEFAULT);
+ if (!ok) {
+ return NT_STATUS_NO_MEMORY;
+ }
}
/* Now deal with the user SID. If we have a backend that can generate
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c
index 3cd53d8f39d..152b5b645ce 100644
--- a/source3/printing/queue_process.c
+++ b/source3/printing/queue_process.c
@@ -264,14 +264,20 @@ static void bq_sig_chld_handler(struct tevent_context *ev_ctx,
int status;
pid_t pid;
- pid = waitpid(-1, &status, WNOHANG);
- if (WIFEXITED(status)) {
- DEBUG(6, ("Bq child process %d terminated with %d\n",
- (int)pid, WEXITSTATUS(status)));
- } else {
- DEBUG(3, ("Bq child process %d terminated abnormally\n",
- (int)pid));
- }
+ do {
+ do {
+ pid = waitpid(-1, &status, WNOHANG);
+ } while ((pid == -1) && (errno == EINTR));
+
+ if (WIFEXITED(status)) {
+ DBG_INFO("Bq child process %d terminated with %d\n",
+ (int)pid,
+ WEXITSTATUS(status));
+ } else {
+ DBG_NOTICE("Bq child process %d terminated abnormally\n",
+ (int)pid);
+ }
+ } while (pid > 0);
}
static void bq_setup_sig_chld_handler(struct tevent_context *ev_ctx)
@@ -302,18 +308,6 @@ static void bq_smb_conf_updated(struct messaging_context *msg_ctx,
printing_subsystem_queue_tasks(state);
}
-static void printing_pause_fd_handler(struct tevent_context *ev,
- struct tevent_fd *fde,
- uint16_t flags,
- void *private_data)
-{
- /*
- * If pause_pipe[1] is closed it means the parent smbd
- * and children exited or aborted.
- */
- exit_server_cleanly(NULL);
-}
-
/****************************************************************************
main thread of the background lpq updater
****************************************************************************/
@@ -323,20 +317,11 @@ pid_t start_background_queue(struct tevent_context *ev,
{
pid_t pid;
struct bq_state *state;
-
- /* Use local variables for this as we don't
- * need to save the parent side of this, just
- * ensure it closes when the process exits.
- */
- int pause_pipe[2];
+ int ret;
+ NTSTATUS status;
DEBUG(3,("start_background_queue: Starting background LPQ thread\n"));
- if (pipe(pause_pipe) == -1) {
- DEBUG(5,("start_background_queue: cannot create pipe. %s\n", strerror(errno) ));
- exit(1);
- }
-
/*
* Block signals before forking child as it will have to
* set its own handlers. Child will re-enable SIGHUP as
@@ -355,80 +340,56 @@ pid_t start_background_queue(struct tevent_context *ev,
return pid;
}
- if (pid == -1) {
- DEBUG(5,("start_background_queue: background LPQ thread failed to start. %s\n", strerror(errno) ));
- exit(1);
- }
-
- if (pid == 0) {
- struct tevent_fd *fde;
- int ret;
- NTSTATUS status;
-
- /* Child. */
- DEBUG(5,("start_background_queue: background LPQ thread started\n"));
+ /* Child. */
+ DEBUG(5,("start_background_queue: background LPQ thread started\n"));
- close(pause_pipe[0]);
- pause_pipe[0] = -1;
+ status = smbd_reinit_after_fork(msg_ctx, ev, true, "lpqd");
- status = smbd_reinit_after_fork(msg_ctx, ev, true, "lpqd");
-
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("reinit_after_fork() failed\n"));
- smb_panic("reinit_after_fork() failed");
- }
-
- state = talloc_zero(NULL, struct bq_state);
- if (state == NULL) {
- exit(1);
- }
- state->ev = ev;
- state->msg = msg_ctx;
-
- bq_reopen_logs(logfile);
- bq_setup_sig_term_handler();
- bq_setup_sig_hup_handler(state);
- bq_setup_sig_chld_handler(ev);
-
- BlockSignals(false, SIGTERM);
- BlockSignals(false, SIGHUP);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("reinit_after_fork() failed\n"));
+ smb_panic("reinit_after_fork() failed");
+ }
- if (!printing_subsystem_queue_tasks(state)) {
- exit(1);
- }
+ state = talloc_zero(NULL, struct bq_state);
+ if (state == NULL) {
+ exit(1);
--
Samba Shared Repository
More information about the samba-cvs
mailing list