1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

150 Commits

Author SHA1 Message Date
Stefan Metzmacher
934b375639 smbd: remove unused tevent_context argument from notify_init
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:18 +02:00
Stefan Metzmacher
cfaba68478 s3:smbd: return the correct error for cancelled SMB2 notifies on expired sessions
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13197

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-12-21 19:12:09 +01:00
Volker Lendecke
fa96452f9c smbd: Re-register notify requests
When notifyd is restarted, the parent will broadcast that fact to all workers.
They will then re-register their notify requests.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:07 +02:00
Volker Lendecke
cf7fea2312 smbd: Store notify filters in fsp->notify
When notifyd crashes, it will be restarted. We need to restore the filters with
notifyd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:07 +02:00
Volker Lendecke
99b9f5729a smbd: Protect notify_callback from stray pointers
This protection right now lives in notify_msg.c with the notify_list, but that
will go.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:07 +02:00
Volker Lendecke
3caa8a1bf1 smbd: Pass "sconn" via notify to notify_callback()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:07 +02:00
Volker Lendecke
d446e406db smbd: There's only one notify_callback
We do not have different callbacks per notify, put the callback function into
the notify context

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:07 +02:00
Volker Lendecke
2779cae823 smbd: Make notify_callback() public
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:07 +02:00
Volker Lendecke
ed26f4b22a smbd: Avoid a talloc_asprintf
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-20 05:21:06 +02:00
Michael Adam
476672b647 dlist: remove unneeded type argument from DLIST_ADD_END()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Jeremy Allison
7c483690ac smbd: Fix file name buflen and padding in notify repsonse
The array is uint16, doubling the file name length consumes twice the space
required.

As we're hand assembling this as a series of concatinated individual data_blobs,
we must take care to ensure the correct 4 byte alignment that was
being masked by the previous doubling of the filename length.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10634

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Oct 18 01:56:41 CEST 2015 on sn-devel-104
2015-10-18 01:56:41 +02:00
Volker Lendecke
ce26c64272 smbd: Kernel change notify is done by notifyd
smbd itself does not need to call VFS_NOTIFY_WATCH anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-07-07 23:51:24 +02:00
Stefan Metzmacher
5169e9b20c s3:smbd: use STATUS_NOTIFY_CLEANUP on smb2 logoff (explicit and implicit) and tdis
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-06 22:33:19 +02:00
Stefan Metzmacher
2c47fb1608 s3:smbd: add a smbd_notify_cancel_by_map() helper function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-06 22:33:19 +02:00
Richard Sharpe
6abd986704 Convert all uses of uint8/16/32 to _t in source3/smbd.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-06 04:14:14 +02:00
Volker Lendecke
50a1247927 smbd: Cancel pending notifies if the directory goes away
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-04-22 23:00:20 +02:00
Volker Lendecke
173a647698 notify: Move path construction to notify_trigger
notify_msg won't need to construct the path anymore, it will be able to
put the parts into iovecs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 16 21:22:26 CET 2014 on sn-devel-104
2014-12-16 21:22:26 +01:00
Jeremy Allison
29b00ca2bd s3: smbd: Ensure we don't call qsort() with a size of -1.
Based on a patch idea from Ken Harris <kharris@mathworks.com>

Fixes bug 10798 - crash in source3/smbd/notify.c

https://bugzilla.samba.org/show_bug.cgi?id=10798

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
2014-09-11 01:27:15 +02:00
Volker Lendecke
c6a2734010 smbd: Sort notify events by timestamp
This will fix the raw.notify test with the new messaging system. With the new
messaging system messages come in via yet another fd that has to line up in
poll next to the incoming client TCP socket. With the signal-based messaging
messages were always handled before client requests. The new scheme means that
notify messages might be deferred a bit (something which can happen in a
cluster already now), which then means that notify_marshall_changes() will
coalesce entries, which in turn makes raw.notify unhappy.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-23 22:33:08 +02:00
Volker Lendecke
da1778f445 smbd: Pass timespec_current through the notify_callback
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-23 22:33:08 +02:00
Volker Lendecke
892bec88a3 smbd: Pass timespec_current to notify_fsp
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-23 22:33:08 +02:00
Volker Lendecke
e616e3c937 smbd: Add a timestamp to queued notify events
In a cluster and with changed messaging it can happen that messages are
scheduled after new SMB requests. This re-ordering breaks a few notify tests.
This starts the infrastructure to add timestamps to notify events, so that they
can be sorted before they are sent out. The timestamp will be the current local
time of notify_fname, that's all we can do.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-23 22:33:08 +02:00
Stefan Metzmacher
952392af38 s3:smbd: use PATH_MAX for the buffer passed to full_path_tos()
We use this in other places too and it's better than a hardcoded value.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-12-14 16:24:34 +01:00
Volker Lendecke
5baa7402ba smbd: Implement and use full_path_tos
Yes, this looks like a hack, but talloc_asprintf does show up high in
profiles called from these routines

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-12-14 11:21:32 +01:00
Stefan Metzmacher
415e8e0513 s3:smbd: s/struct event_context/struct tevent_context
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-19 23:47:51 +01:00
Stefan Metzmacher
659f3e681e s3:smbd: make struct notify_change_buf private to notify.c
metze
2012-06-06 10:18:37 +02:00
Stefan Metzmacher
dc962c195e s3:smbd: add change_notify_fsp_has_changes()
metze
2012-06-06 10:18:37 +02:00
Volker Lendecke
843432d56f s3: New notify implementation
From notify_internal.c:

        /*
         * The notify database is split up into two databases: One
         * relatively static index db and the real notify db with the
         * volatile entries.
         */

This change is necessary to make notify scale better in a cluster
2012-04-17 10:21:02 +02:00
Volker Lendecke
fa6f61e835 s3: Pass filters explicitly through vfs notify watch
This removes a dependency on "struct notify_entry" and makes the nature of the
API more explicit. We depend upon the VFS module to mask out elements from
e->filter and e->subdir_filter that it took over to handle.

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Mon Mar 26 17:45:44 CEST 2012 on sn-devel-104
2012-03-26 17:45:43 +02:00
Volker Lendecke
1cc7abf8aa s3: Remove the sys_notify dependency from notify_internal
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Mar 23 12:12:51 CET 2012 on sn-devel-104
2012-03-23 12:12:51 +01:00
Volker Lendecke
f3fe53668f s3: Move the notify_ctx to the smbd_server_connection
We only need one notify_ctx per smbd. The notify_array can become quite large.
It's based on absolute paths, so there's no point in having a copy of the
complete array in memory multiple times.

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Wed Mar 21 14:26:07 CET 2012 on sn-devel-104
2012-03-21 14:26:06 +01:00
Volker Lendecke
91f77253e7 s3: Remove "conn" param from sys_notify_context_create 2012-03-21 12:52:09 +01:00
Volker Lendecke
6a2bf12f6a s3: Remove "conn" from sys_notify_context 2012-03-21 12:52:09 +01:00
Volker Lendecke
8e256a2734 s3: Pass "conn" to sys_notify_watch() 2012-03-21 12:52:09 +01:00
Volker Lendecke
8044db0a4d s3: Pass "conn" to notify_add() 2012-03-21 12:52:09 +01:00
Volker Lendecke
4319076cca s3: Pass "path" through vfs_notify_watch 2012-03-21 12:52:09 +01:00
Volker Lendecke
8503eecabb s3-notify: Lift "/." handling up one level
This slightly simplifies the code

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Mar 16 14:28:44 CET 2012 on sn-devel-104
2012-03-16 14:28:42 +01:00
Volker Lendecke
177c61bd72 s3: asprintf->talloc_asprintf
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Mar  9 19:01:06 CET 2012 on sn-devel-104
2012-03-09 19:01:06 +01:00
Volker Lendecke
8a75d3d91e s3: Replace a SMB_ASSERT with an error return 2012-03-09 17:21:55 +01:00
Andrew Bartlett
ad0a07c531 s3-talloc Change TALLOC_ZERO_P() to talloc_zero()
Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
d5e6a47f06 s3-talloc Change TALLOC_P() to talloc()
Using the standard macro makes it easier to move code into common, as
TALLOC_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
73b377432c s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc()
Using the standard macro makes it easier to move code into common, as
TALLOC_REALLOC_ARRAY isn't standard talloc.

Andrew Bartlett
2011-06-09 12:40:08 +02:00
Günther Deschner
8c24ebf371 s3: include smbd/smbd.h where needed.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
ca460113ea s3-notify: use autogenerated FILE_NOTIFY_INFORMATION marshalling in smbd.
Guenther
2010-07-07 13:54:57 +02:00
Chere Zhou
00056e73c1 s3:smbd: Align change notify replies on 4-byte boundary
MS-CIFS section 2.2.7.4.2 states this is mandatory.  WinXP clients
don't seem to care, but a Win7 client will send an immediate Close()
to the directory handle when receiving an incorrectly aligned
change notify response.
2010-07-06 13:28:02 -07:00
Volker Lendecke
5d43180a55 s3: Explicitly pass sconn to the remove_pending_change_notify_request_by_mid 2010-06-12 15:42:55 +02:00
Volker Lendecke
f589909eb1 s3: change_notify_reply() does not need its "conn" argument 2010-06-12 15:42:55 +02:00
Volker Lendecke
4a9b3e557f s3: Explicitly pass sconn to the change_notify_remove_request 2010-06-12 15:42:55 +02:00
Volker Lendecke
9386e2d9d8 s3: Remove smbd_server_conn from change_notify_add_request 2010-06-12 15:42:55 +02:00
Volker Lendecke
3087986e76 s3: Remove sconn arg from smbd_notify_cancel_by_smbreq 2010-06-12 15:42:50 +02:00