s3:smbd: add smbd_notify_cancel_by_smbreq()
authorStefan Metzmacher <metze@samba.org>
Sat, 15 Aug 2009 08:07:00 +0000 (10:07 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 17 Aug 2009 07:25:45 +0000 (09:25 +0200)
This function will be used by the SMB2 notify code.

metze

source3/smbd/globals.h
source3/smbd/notify.c

index bfed901bf4adb208a9c030651d0e8d773a096b78..4fa85a9fdb32853f0d1aa2ef0e703356d4d5583e 100644 (file)
@@ -234,6 +234,9 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
                           uint32_t *_mode,
                           long *_prev_offset);
 
+void smbd_notify_cancel_by_smbreq(struct smbd_server_connection *sconn,
+                                 const struct smb_request *smbreq);
+
 void smbd_server_connection_terminate_ex(struct smbd_server_connection *sconn,
                                         const char *reason,
                                         const char *location);
index 8f37923865bedfaa444490203bfa7b171ae2e57c..e430fcfc04c4a039f6ac24e107a08200f025400e 100644 (file)
@@ -317,6 +317,26 @@ void remove_pending_change_notify_requests_by_mid(uint16 mid)
        change_notify_remove_request(map->req);
 }
 
+void smbd_notify_cancel_by_smbreq(struct smbd_server_connection *sconn,
+                                 const struct smb_request *smbreq)
+{
+       struct notify_mid_map *map;
+
+       for (map = sconn->smb1.notify_mid_maps; map; map = map->next) {
+               if (map->req->req == smbreq) {
+                       break;
+               }
+       }
+
+       if (map == NULL) {
+               return;
+       }
+
+       change_notify_reply(map->req->fsp->conn, map->req->req,
+                           NT_STATUS_CANCELLED, 0, NULL, map->req->reply_fn);
+       change_notify_remove_request(map->req);
+}
+
 /****************************************************************************
  Delete entries by fnum from the change notify pending queue.
 *****************************************************************************/