summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-06-23 12:53:47 +0200
committerJeremy Allison <jra@samba.org>2016-07-20 05:21:06 +0200
commit2c7bfdc6445a82823f3876eafe22cd7ec8ae95a2 (patch)
tree51ceabfe2e1c78cc110982462c6ea2fd15b0eb89 /source3
parent8e27c19d13a7d2c2cfc5881c95850a2d65d0aee3 (diff)
downloadsamba-2c7bfdc6445a82823f3876eafe22cd7ec8ae95a2.tar.gz
smbd: Factor out notify_init
Before this patch, failure of notify_init was ignored. Also, no proper error handling of a messaging_register failure was done. Fix those, also adding some debug messages. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/service.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 46bb226ecdf..37440e01d5d 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -520,6 +520,32 @@ NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum)
return NT_STATUS_OK;
}
+static NTSTATUS notify_init_sconn(struct smbd_server_connection *sconn)
+{
+ NTSTATUS status;
+
+ if (sconn->notify_ctx != NULL) {
+ return NT_STATUS_OK;
+ }
+
+ sconn->notify_ctx = notify_init(sconn, sconn->msg_ctx, sconn->ev_ctx);
+ if (sconn->notify_ctx == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = messaging_register(sconn->msg_ctx, sconn,
+ MSG_SMB_NOTIFY_CANCEL_DELETED,
+ smbd_notify_cancel_deleted);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_DEBUG("messaging_register failed: %s\n",
+ nt_errstr(status));
+ TALLOC_FREE(sconn->notify_ctx);
+ return status;
+ }
+
+ return NT_STATUS_OK;
+}
+
/****************************************************************************
Make a connection, given the snum to connect to, and the vuser of the
connecting user if appropriate.
@@ -689,13 +715,10 @@ static NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
if ((!conn->printer) && (!conn->ipc) &&
lp_change_notify()) {
- if (sconn->notify_ctx == NULL) {
- sconn->notify_ctx = notify_init(
- sconn, sconn->msg_ctx, sconn->ev_ctx);
- status = messaging_register(
- sconn->msg_ctx, sconn,
- MSG_SMB_NOTIFY_CANCEL_DELETED,
- smbd_notify_cancel_deleted);
+
+ status = notify_init_sconn(sconn);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto err_root_exit;
}
}