smbd: Pass "sconn" via notify to notify_callback()
authorVolker Lendecke <vl@samba.org>
Tue, 14 Jun 2016 12:54:32 +0000 (14:54 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 20 Jul 2016 03:21:07 +0000 (05:21 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/notify.c
source3/smbd/notify_msg.c
source3/smbd/proto.h
source3/smbd/service.c
source3/utils/status.c

index f493f11aa69a558389689b2fe3fc271b297adf32..7a436a9f56e270780f9837da503636277f7158f1 100644 (file)
@@ -240,7 +240,8 @@ void change_notify_reply(struct smb_request *req,
        notify_buf->num_changes = 0;
 }
 
-void notify_callback(void *private_data, struct timespec when,
+void notify_callback(struct smbd_server_connection *sconn,
+                    void *private_data, struct timespec when,
                     const struct notify_event *e)
 {
        files_struct *fsp = (files_struct *)private_data;
index e9f91995a1179519b036f8110ebe4c1ebd4a9dd2..cd9a0fb1e9251bba5481b082b4f9a1ec492ab1fb 100644 (file)
@@ -39,7 +39,10 @@ struct notify_context {
        struct server_id notifyd;
        struct messaging_context *msg_ctx;
        struct notify_list *list;
-       void (*callback)(void *private_data, struct timespec when,
+
+       struct smbd_server_connection *sconn;
+       void (*callback)(struct smbd_server_connection *sconn,
+                        void *private_data, struct timespec when,
                         const struct notify_event *ctx);
 };
 
@@ -50,7 +53,9 @@ static void notify_handler(struct messaging_context *msg, void *private_data,
 struct notify_context *notify_init(
        TALLOC_CTX *mem_ctx, struct messaging_context *msg,
        struct tevent_context *ev,
-       void (*callback)(void *, struct timespec,
+       struct smbd_server_connection *sconn,
+       void (*callback)(struct smbd_server_connection *sconn,
+                        void *, struct timespec,
                         const struct notify_event *))
 {
        struct server_id_db *names_db;
@@ -63,6 +68,8 @@ struct notify_context *notify_init(
        }
        ctx->msg_ctx = msg;
        ctx->list = NULL;
+
+       ctx->sconn = sconn;
        ctx->callback = callback;
 
        names_db = messaging_names_db(msg);
@@ -118,8 +125,8 @@ static void notify_handler(struct messaging_context *msg, void *private_data,
 
        for (listel = ctx->list; listel != NULL; listel = listel->next) {
                if (listel->private_data == event.private_data) {
-                       ctx->callback(listel->private_data, event_msg->when,
-                                     &event);
+                       ctx->callback(ctx->sconn, listel->private_data,
+                                     event_msg->when, &event);
                        break;
                }
        }
index b677748c2e6d8f0445691715af907a4993ec761a..97d738c40e6df26375c96b79f1e62f8284e497d7 100644 (file)
@@ -530,7 +530,8 @@ void change_notify_reply(struct smb_request *req,
                         void (*reply_fn)(struct smb_request *req,
                                          NTSTATUS error_code,
                                          uint8_t *buf, size_t len));
-void notify_callback(void *private_data, struct timespec when,
+void notify_callback(struct smbd_server_connection *sconn,
+                    void *private_data, struct timespec when,
                     const struct notify_event *e);
 NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter,
                              bool recursive);
@@ -586,7 +587,9 @@ int fam_watch(TALLOC_CTX *mem_ctx,
 struct notify_context *notify_init(
        TALLOC_CTX *mem_ctx, struct messaging_context *msg,
        struct tevent_context *ev,
-       void (*callback)(void *, struct timespec,
+       struct smbd_server_connection *sconn,
+       void (*callback)(struct smbd_server_connection *sconn,
+                        void *, struct timespec,
                         const struct notify_event *));
 NTSTATUS notify_add(struct notify_context *ctx,
                    const char *path, uint32_t filter, uint32_t subdir_filter,
index 4b16dbad5e92510067f15f6e35744b849c9004a1..ef434f9f3684e5338e58640a8fc77f5fe410abc1 100644 (file)
@@ -529,7 +529,7 @@ static NTSTATUS notify_init_sconn(struct smbd_server_connection *sconn)
        }
 
        sconn->notify_ctx = notify_init(sconn, sconn->msg_ctx, sconn->ev_ctx,
-                                       notify_callback);
+                                       sconn, notify_callback);
        if (sconn->notify_ctx == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
index 7bff1023853a85723fefa701a7a871dc1f4e048d..f185663ec1719da76bbaa7bb87a6c3e127ad8501 100644 (file)
@@ -708,7 +708,8 @@ int main(int argc, const char *argv[])
                struct notify_context *n;
 
                n = notify_init(talloc_tos(), msg_ctx,
-                               messaging_tevent_context(msg_ctx), NULL);
+                               messaging_tevent_context(msg_ctx),
+                               NULL, NULL);
                if (n == NULL) {
                        goto done;
                }