[SCM] Samba Shared Repository - branch v4-7-test updated
Karolin Seeger
kseeger at samba.org
Fri Apr 20 14:44:03 UTC 2018
The branch, v4-7-test has been updated
via 38af417 s3:passdb: Do not return OK if we don't have pinfo set up
via 7a58eb8 lib/util: remove unused '#include <sys/syscall.h>' from tests/tfork.c
via 5d00889 winbind: Use one queue for all domain children
via 470aa11 winbind: Maintain a binding handle per domain and always go via wb_domain_request_send()
via fe8982b winbind: make choose_domain_child() static
via 8a544c7 winbind: add locator_child_handle() and use it instead of child->binding_handle
via 136c16e winbind: add idmap_child_handle() and use it instead of child->binding_handle
via 128789f winbind: improve wb_domain_request_send() to use wb_dsgetdcname_send() for a foreign domain
via 5bbe243 winbind: use state->{ev,request} in wb_domain_request_send()
via ed83d30 winbind: avoid using fstrcpy(dcname,...) in _dual_init_connection
via bd14266 winbind: cleanup winbindd_cli_state->pwent_state if winbindd_getpwent_recv() returns an error
via e404058 winbind: cleanup winbindd_cli_state->grent_state if winbindd_getgrent_recv() returns an error
via 2594449 winbind: call lp_winbind_enum_{users,groups}() already in set{pw,gr}ent()
via 06c5e07 winbind: protect a pending wb_child_request against a talloc_free()
via dbb72ad winbind: use tevent_queue_wait_send/recv in wb_child_request_*()
via 28680d7 winbind: Improve child selection
via e19b0731 smbclient: Handle ENUM_DIR in "notify" command
via 0c5e24d libsmb: Handle IO_TIMEOUT in cli_smb2_notify properly
via b28593e libsmb: Handle long-running smb2cli_notify
via 3c3746f libsmb: Enable "cli_notify" for SMB2+
via 41666d5 libsmb: Add cli_smb2_notify
via 898297b libsmb: Add smb2cli_notify()
via 8b47aed rpc_server: Init local_server_* in make_internal_rpc_pipe_socketpair
via 80b822b tevent: version 0.9.36
via c2a3333 tevent: add tevent_queue_entry_untrigger()
via 55b8d61 tevent: improve documentation of tevent_queue_add_optimize_empty()
via a588c39 tevent: version 0.9.35
via 5457c2f lib/async_req/async_sock.c set socket close on exec
via b344866 lib/tevent/echo_server.c set socket close on exec
via 7206dfd tevent: Fix typos
via 772ca21 lib: tevent: Minor cleanup. wakeup_fd can always be gotten from the event context.
via bc24206 lib: tevent: Use system <tevent.h>, not internal header path (except in self-test).
via 383f130 libads: Fix the build --without-ads
from 2366b51 VERISON: Bump version up to 4.7.8...
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-test
- Log -----------------------------------------------------------------
commit 38af417f34bee9d60417affb8ece81bc2c172b92
Author: Andreas Schneider <asn at samba.org>
Date: Tue Apr 17 08:55:23 2018 +0200
s3:passdb: Do not return OK if we don't have pinfo set up
This prevents a crash in fill_mem_keytab_from_secrets()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13376
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 99859479fc6e12b2f74ce2dfa83da56d8b8f3d26)
Autobuild-User(v4-7-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-7-test): Fri Apr 20 16:43:11 CEST 2018 on sn-devel-144
commit 7a58eb8aac648f4fb34c9f09cad0b8633469d14c
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Mar 20 16:49:30 2018 +0100
lib/util: remove unused '#include <sys/syscall.h>' from tests/tfork.c
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13342
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit f2ff61ce9e8ab56d8a69fce29c9f214d5d98f89e)
commit 5d008894dca367f4683f3455edea1f3f778c4aed
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Feb 14 15:04:01 2018 +0100
winbind: Use one queue for all domain children
If we have multiple domain children, it's important
that the first idle child takes over the next waiting request.
Before we had the problem that a request could get stuck in the
queue of a busy child, while later requests could get served fine by
other children.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13292
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Fri Feb 23 09:04:23 CET 2018 on sn-devel-144
(similar to commit 7f2d45a6c2a88dd8833fc66d314ec21507dd52c3)
commit 470aa11c339a1e5283245750bac831075910f0c4
Author: Volker Lendecke <vl at samba.org>
Date: Tue Feb 13 16:04:44 2018 +0100
winbind: Maintain a binding handle per domain and always go via wb_domain_request_send()
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13292
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Volker Lendecke <vl at samba.org>
(similar to commit b518cb0597d269002105644302c58ca8f9f0f717)
commit fe8982b3850e878dd3b848bcb8fdb4e5671a4aba
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 20 14:43:38 2018 +0100
winbind: make choose_domain_child() static
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13292
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 5116aff286bdffe4abc9ddda09cf64ab999fd13e)
commit 8a544c7cab5fb913ed2078c1ac82dcdef36832a9
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Feb 14 13:24:54 2018 +0100
winbind: add locator_child_handle() and use it instead of child->binding_handle
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13292
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 44ebaaac8933f5fc16a043b8c15a9449746af47b)
commit 136c16eee0515fae174a10c7120e7a8caa857e1c
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Feb 14 13:24:54 2018 +0100
winbind: add idmap_child_handle() and use it instead of child->binding_handle
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13292
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit c2d78a0a0a3f9b9ade61cf707f23e59a1a16c61b)
commit 128789f0861fecd30667cecaaaea9ce35db29b4a
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Feb 14 15:11:50 2018 +0100
winbind: improve wb_domain_request_send() to use wb_dsgetdcname_send() for a foreign domain
Commit ed3bc614cccec6167c64ac58d78344b6426cd019 got the logic wrong while
trying to implement the logic we had in init_child_connection(),
which was removed by commit d61f3626b79e0523beadff355453145aa7b0195c.
Instead of doing a WINBINDD_GETDCNAME request (which would caused an error
because the implementation was removed in commit
958fdaf5c3ba17969a5110e6b2b08babb9096d7e), we sent the callers request
and interpreted the result as WINBINDD_GETDCNAME response, which
led to an empty dcname variable. As result the domain child
opened a connection to the primary domain in order to lookup
a dc.
If we want to connect the primary domain from the parent via
a domain child of the primary domain.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13295
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 1f41193e005df37401a28004f0a95d4d73b98ccd)
commit 5bbe243fe5421d8102f61ca7b1f7b8f8baf5ba90
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Feb 14 15:09:51 2018 +0100
winbind: use state->{ev,request} in wb_domain_request_send()
This will reduce the diff for the following changes.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13295
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 4d804f5f3e65df0e2f646d4f88793cab8e2f32d1)
commit ed83d30ead1edfd2ea4ab8ecddd51613150f6aa2
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Feb 15 16:00:33 2018 +0100
winbind: avoid using fstrcpy(dcname,...) in _dual_init_connection
domain->dcname was converted from fstring to char * by commit
14bae61ba36814ea5eca7c51cf1cc039e9e6803f.
Luckily this was only ever called with an empty string in
state->request->data.init_conn.dcname.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13294
Signed-off-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit d73e3d451976e692c6c346f98547d7123f7b9006)
commit bd14266978a29676b545164fb6fcd50252fe52cd
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Feb 16 16:13:16 2018 +0100
winbind: cleanup winbindd_cli_state->pwent_state if winbindd_getpwent_recv() returns an error
A client may skip the explicit endpwent() if getgrent() fails.
This allows client_is_idle() return true in more cases.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13293
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit b158d4e4c1c3fee0a8884bc5e8f0c5a5ce49687f)
commit e40405854191f8f5f733e9c58f2e8c9b1976624c
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Feb 16 16:13:16 2018 +0100
winbind: cleanup winbindd_cli_state->grent_state if winbindd_getgrent_recv() returns an error
A client may skip the explicit endgrent() if getgrent() fails.
This allows client_is_idle() return true in more cases.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13293
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit b7789da8468c3f070727011639d5f74aca76cb59)
commit 2594449b6da14a4b566b85f4c1a7230017e41bd9
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Feb 16 16:09:58 2018 +0100
winbind: call lp_winbind_enum_{users,groups}() already in set{pw,gr}ent()
This way we don't keep winbindd_cli_state->{pw,gr}ent_state arround forever,
if the client forgets an explicit end{pw,gr}ent().
This allows client_is_idle() return true in more cases.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13293
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 6548b82b5c1ed30ce14e17e4ba9d4bc24ab49c42)
commit 06c5e074e1c17c2f3c752753d6e9f8152cbbce70
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Feb 16 15:05:57 2018 +0100
winbind: protect a pending wb_child_request against a talloc_free()
If the (winbind) client gave up we call TALLOC_FREE(state->mem_ctx)
in remove_client(). This triggers a recursive talloc_free() for all
in flight requests.
In order to maintain the winbindd parent-child protocol, we need
to keep the orphaned wb_simple_trans request until the parent
got the response from the child.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13290
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 43af57d8728883c5ddbe169e1483181246fb68a8)
commit dbb72add2e76bd4d7ee14d84a59ec86b05e8706f
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Feb 16 15:02:42 2018 +0100
winbind: use tevent_queue_wait_send/recv in wb_child_request_*()
We need a way to keep the child->queue blocked without relying on
the current 'req' (wb_child_request_state).
The next commit will make use of this.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13290
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit d29dda141e08af42c535e8718226f95c45aadab8)
commit 28680d7bdd955b565b0cefb2efb2357373b23b21
Author: Volker Lendecke <vl at samba.org>
Date: Fri Feb 9 10:27:55 2018 +0100
winbind: Improve child selection
This improves the situation when a client request blocks a winbind
child. This might be a slow samlogon or lookupnames to a domain that's
far away. With random selection of the child for new request coming in
we could end up with a long queue when other, non-blocked children
could serve those new requests. Choose the shortest queue.
This is an immediate and simple fix. Step two will be to have a
per-domain and not a per-child queue. Right now we're pre-selecting
the check-out queue at Fry's randomly without looking at the queue
length. With this change we're picking the shortest queue. The better
change will be what Fry's really does: One central queue and red/green
lights on the busy/free checkout counters.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13290
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Mon Feb 12 19:51:35 CET 2018 on sn-devel-144
(cherry picked from commit b4384b7f0ecf3b47dd60acaf77636b679e3adc05)
commit e19b0731070af35c3ee492c27cdfccc7cbf966f0
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 30 16:15:03 2017 +0100
smbclient: Handle ENUM_DIR in "notify" command
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Apr 5 04:05:52 CEST 2018 on sn-devel-144
(cherry picked from commit 1452677ef0044815df0702de5424d4711e18144b)
commit 0c5e24d0f2085d836b0301272a1d54bb08f4a25d
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 30 14:36:46 2017 +0100
libsmb: Handle IO_TIMEOUT in cli_smb2_notify properly
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit abfe482828e8c1dc233d67657a4d11a91a731f70)
commit b28593e86c5ff78076e1e01a60d11f02cc961579
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 30 14:34:12 2017 +0100
libsmb: Handle long-running smb2cli_notify
This likely runs into a timeout. Properly cancel the smb2 request,
allowing the higher-level caller to re-issue this request on an existing
handle.
I did not see a proper way to achieve this with tevent_req_set_endtime or
something like that.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 91c0f497816bb88d8935a8a79c146c08379ecf53)
commit 3c3746fc05d80fab374ac9a2b819cc61a5990b0d
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 25 12:30:47 2017 +0200
libsmb: Enable "cli_notify" for SMB2+
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jul 26 01:33:25 CEST 2017 on sn-devel-144
(cherry picked from commit 5005a3a6961d40fe349f76db67c980be7dc9f3ea)
commit 41666d5992a2a8a15cd46069c88792310eb2af78
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 25 12:12:02 2017 +0200
libsmb: Add cli_smb2_notify
We have to do the parsing manually. Looking at librpc/gen_ndr/ndr_notify.c we
have the following code snippet:
size_FileName1_0 = strlen_m(r->FileName1);
NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->FileName1,
size_FileName1_0, sizeof(uint16_t),
CH_UTF16));
which means that we take strlen_m(r->FileName1) before we pull
it off the wire. Not sure how to fix this, but that is clearly
broken pidl output. Once that is fixed, we can convert this
to ndr_pull_struct.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 18011343d80a28fb46894d712b22c84dce067342)
commit 898297b7a1ef4397b018327b83e3f77c709f94f8
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 25 12:11:37 2017 +0200
libsmb: Add smb2cli_notify()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13382
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit ad33964f8c85b67a2d2b451bece208d8bfb8cad6)
commit 8b47aedf5e6def042495c2721cf774c3b3d03009
Author: Volker Lendecke <vl at samba.org>
Date: Wed Apr 11 10:42:21 2018 +0200
rpc_server: Init local_server_* in make_internal_rpc_pipe_socketpair
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13370
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Wed Apr 11 15:19:19 CEST 2018 on sn-devel-144
(cherry picked from commit 212815969f4a706bc8395e2f6dbf225318ff2ad7)
commit 80b822b60f988a2820e627e25ac00f205586fc15
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Feb 20 13:54:49 2018 +0100
tevent: version 0.9.36
* improve documentation of tevent_queue_add_optimize_empty()
* add tevent_queue_entry_untrigger()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13291
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit f00c7cf9f5f325de0b754b127fcc0f07bea2d825)
commit c2a333337da85afc921ae2dd0d8bbeeb7f435b89
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Feb 15 14:47:25 2018 +0100
tevent: add tevent_queue_entry_untrigger()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13291
Pair-Programmed-With: Volker Lendecke <vl at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 5c6f31697a8edb03d36eece5c79581b952743b5b)
commit 55b8d619cf3efd4d02dc9460c3b62e7b8a9ada83
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Feb 16 16:47:57 2018 +0100
tevent: improve documentation of tevent_queue_add_optimize_empty()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13291
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 88d6703b89f9a7f847b6ec47d97569432927dcff)
commit a588c39a7e661c721706608e579bd08e70393d19
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Jan 12 15:08:14 2018 +0100
tevent: version 0.9.35
* Minor cleanup. wakeup_fd can always be gotten from the event context.
* Use smb_set_close_on_exec() in example code.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 6dd0a8c1a67922d1f893d5ef500861ec5e7c5a36)
commit 5457c2fd4b5caf370973c9f79b8f7e2056230785
Author: Gary Lockyer <gary at catalyst.net.nz>
Date: Mon Dec 11 09:31:33 2017 +1300
lib/async_req/async_sock.c set socket close on exec
Set SOCKET_CLOEXEC on the sockets returned by accept. This ensures that
the socket is unavailable to any child process created by system().
Making it harder for malicious code to set up a command channel,
as seen in the exploit for CVE-2015-0240
Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 8b3c58251146d2e982a6c9fdb3828ca65e307a96)
commit b3448666ccebe142d7844271d150d48f430504ed
Author: Gary Lockyer <gary at catalyst.net.nz>
Date: Mon Dec 11 09:17:49 2017 +1300
lib/tevent/echo_server.c set socket close on exec
Set SOCKET_CLOEXEC on the sockets returned by accept. This ensures that
the socket is unavailable to any child process created by system().
Making it harder for malicious code to set up a command channel,
as seen in the exploit for CVE-2015-0240
Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 954eddd0b8c25424fd44bbd002ba36873fe2c8d4)
commit 7206dfd4fbf17b542f682556be831fdd2b764186
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 30 13:51:25 2017 +0100
tevent: Fix typos
While there, fix comment formatting
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit c19b49bad8071bc33089e5b3c053fcb890a8ea11)
commit 772ca21780decfa34d7608e12c93e5d3882cc8fb
Author: Jeremy Allison <jra at samba.org>
Date: Fri Nov 10 19:26:55 2017 -0800
lib: tevent: Minor cleanup. wakeup_fd can always be gotten from the event context.
We don't need to store it. I prefer this as it shows that we must always
get wakeup_fd from the event context at time of use, rather than possibly
storing an out-of-date variable.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Fri Nov 17 12:43:01 CET 2017 on sn-devel-144
(cherry picked from commit 993fa5793fd6a95173eda574562661ab8959c544)
commit bc24206dfbd2356b6059814d0bf7efdf480ca0ef
Author: Jeremy Allison <jra at samba.org>
Date: Mon Aug 14 15:54:39 2017 -0700
lib: tevent: Use system <tevent.h>, not internal header path (except in self-test).
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
(similar to commit bee22f187cfca26da13efb4cc980a705ec252a21)
commit 383f130f70ff5bb9c09927b6368c219ba9bdf64d
Author: Volker Lendecke <vl at samba.org>
Date: Sat Feb 3 07:07:24 2018 +0100
libads: Fix the build --without-ads
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: David Disseldorp <ddiss at samba.org>
Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Tue Feb 6 02:47:44 CET 2018 on sn-devel-144
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13273
(cherry picked from commit 859698d29b547217356851094ed8188236e717b6)
-----------------------------------------------------------------------
Summary of changes:
lib/async_req/async_connect_send_test.c | 2 +-
lib/async_req/async_sock.c | 1 +
.../ABI/{tevent-0.9.34.sigs => tevent-0.9.35.sigs} | 0
.../ABI/{tevent-0.9.34.sigs => tevent-0.9.36.sigs} | 1 +
lib/tevent/echo_server.c | 1 +
lib/tevent/testsuite.c | 2 +-
lib/tevent/tevent.h | 29 ++-
lib/tevent/tevent_internal.h | 1 -
lib/tevent/tevent_queue.c | 13 +
lib/tevent/tevent_threads.c | 4 +-
lib/tevent/wscript | 2 +-
lib/util/tests/tfork.c | 1 -
libcli/smb/smb2cli_notify.c | 214 ++++++++++++++++
libcli/smb/smbXcli_base.h | 26 ++
libcli/smb/wscript | 1 +
source3/client/client.c | 9 +-
source3/libads/kerberos_keytab.c | 4 +
source3/libsmb/cli_smb2_fnum.c | 101 ++++++++
source3/libsmb/cli_smb2_fnum.h | 5 +
source3/libsmb/clifile.c | 10 +-
source3/passdb/machine_account_secrets.c | 2 +-
source3/rpc_server/rpc_ncacn_np.c | 31 ++-
source3/rpc_server/rpc_ncacn_np.h | 18 +-
source3/rpc_server/srv_pipe_hnd.c | 18 +-
source3/winbindd/wb_dsgetdcname.c | 8 +-
source3/winbindd/wb_sids2xids.c | 6 +-
source3/winbindd/winbindd.h | 3 +
source3/winbindd/winbindd_allocate_gid.c | 6 +-
source3/winbindd/winbindd_allocate_uid.c | 6 +-
source3/winbindd/winbindd_dsgetdcname.c | 6 +-
source3/winbindd/winbindd_dual.c | 285 ++++++++++++++++-----
source3/winbindd/winbindd_dual_ndr.c | 61 ++++-
source3/winbindd/winbindd_getgrent.c | 9 +-
source3/winbindd/winbindd_getpwent.c | 6 +-
source3/winbindd/winbindd_idmap.c | 5 +
source3/winbindd/winbindd_locator.c | 5 +
source3/winbindd/winbindd_proto.h | 3 +-
source3/winbindd/winbindd_setgrent.c | 5 +
source3/winbindd/winbindd_setpwent.c | 5 +
source3/winbindd/winbindd_util.c | 19 +-
source4/librpc/rpc/dcerpc_roh_channel_in.c | 2 +-
source4/librpc/rpc/dcerpc_roh_channel_out.c | 2 +-
source4/torture/smb2/rename.c | 2 +-
43 files changed, 798 insertions(+), 142 deletions(-)
copy lib/tevent/ABI/{tevent-0.9.34.sigs => tevent-0.9.35.sigs} (100%)
copy lib/tevent/ABI/{tevent-0.9.34.sigs => tevent-0.9.36.sigs} (99%)
create mode 100644 libcli/smb/smb2cli_notify.c
Changeset truncated at 500 lines:
diff --git a/lib/async_req/async_connect_send_test.c b/lib/async_req/async_connect_send_test.c
index 34ea6b7..d570c60 100644
--- a/lib/async_req/async_connect_send_test.c
+++ b/lib/async_req/async_connect_send_test.c
@@ -17,7 +17,7 @@
*/
#include "replace.h"
-#include "lib/tevent/tevent.h"
+#include <tevent.h>
#include "lib/async_req/async_sock.h"
#include <stdio.h>
#include <string.h>
diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c
index db3916e..0a8a333 100644
--- a/lib/async_req/async_sock.c
+++ b/lib/async_req/async_sock.c
@@ -738,6 +738,7 @@ static void accept_handler(struct tevent_context *ev, struct tevent_fd *fde,
tevent_req_error(req, errno);
return;
}
+ smb_set_close_on_exec(ret);
state->sock = ret;
tevent_req_done(req);
}
diff --git a/lib/tevent/ABI/tevent-0.9.34.sigs b/lib/tevent/ABI/tevent-0.9.35.sigs
similarity index 100%
copy from lib/tevent/ABI/tevent-0.9.34.sigs
copy to lib/tevent/ABI/tevent-0.9.35.sigs
diff --git a/lib/tevent/ABI/tevent-0.9.34.sigs b/lib/tevent/ABI/tevent-0.9.36.sigs
similarity index 99%
copy from lib/tevent/ABI/tevent-0.9.34.sigs
copy to lib/tevent/ABI/tevent-0.9.36.sigs
index 7a6a236..8a579c8 100644
--- a/lib/tevent/ABI/tevent-0.9.34.sigs
+++ b/lib/tevent/ABI/tevent-0.9.36.sigs
@@ -53,6 +53,7 @@ tevent_num_signals: size_t (void)
tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *)
tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *)
tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *)
+tevent_queue_entry_untrigger: void (struct tevent_queue_entry *)
tevent_queue_length: size_t (struct tevent_queue *)
tevent_queue_running: bool (struct tevent_queue *)
tevent_queue_start: void (struct tevent_queue *)
diff --git a/lib/tevent/echo_server.c b/lib/tevent/echo_server.c
index 6e7f181..f93d8bc 100644
--- a/lib/tevent/echo_server.c
+++ b/lib/tevent/echo_server.c
@@ -118,6 +118,7 @@ static void accept_handler(struct tevent_context *ev, struct tevent_fd *fde,
tevent_req_error(req, errno);
return;
}
+ smb_set_close_on_exec(ret);
state->sock = ret;
tevent_req_done(req);
}
diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c
index ee29e5b..e508452 100644
--- a/lib/tevent/testsuite.c
+++ b/lib/tevent/testsuite.c
@@ -25,7 +25,7 @@
*/
#include "includes.h"
-#include "lib/tevent/tevent.h"
+#include "tevent.h"
#include "system/filesys.h"
#include "system/select.h"
#include "system/network.h"
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 728cf62..7bb9c61 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -936,8 +936,8 @@ void tevent_req_set_cancel_fn(struct tevent_req *req, tevent_req_cancel_fn fn);
*
* @param[in] req The request to use.
*
- * @return This function returns true is the request is cancelable,
- * othererwise false is returned.
+ * @return This function returns true if the request is
+ * cancelable, otherwise false is returned.
*
* @note Even if the function returns true, the caller need to wait
* for the function to complete normally.
@@ -1611,6 +1611,9 @@ struct tevent_queue_entry *tevent_queue_add_entry(
* already called tevent_req_notify_callback(), tevent_req_error(),
* tevent_req_done() or a similar function.
*
+ * The trigger function has no chance to see the returned
+ * queue_entry in the optimized case.
+ *
* The request can be removed from the queue by calling talloc_free()
* (or a similar function) on the returned queue entry.
*
@@ -1641,6 +1644,28 @@ struct tevent_queue_entry *tevent_queue_add_optimize_empty(
void *private_data);
/**
+ * @brief Untrigger an already triggered queue entry.
+ *
+ * If a trigger function detects that it needs to remain
+ * in the queue, it needs to call tevent_queue_stop()
+ * followed by tevent_queue_entry_untrigger().
+ *
+ * @note In order to call tevent_queue_entry_untrigger()
+ * the queue must be already stopped and the given queue_entry
+ * must be the first one in the queue! Otherwise it calls abort().
+ *
+ * @note You can't use this together with tevent_queue_add_optimize_empty()
+ * because the trigger function don't have access to the quene entry
+ * in the case of an empty queue.
+ *
+ * @param[in] queue_entry The queue entry to rearm.
+ *
+ * @see tevent_queue_add_entry()
+ * @see tevent_queue_stop()
+ */
+void tevent_queue_entry_untrigger(struct tevent_queue_entry *entry);
+
+/**
* @brief Start a tevent queue.
*
* The queue is started by default.
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index 47ea39b..ec3955e 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -235,7 +235,6 @@ struct tevent_threaded_context {
pthread_mutex_t event_ctx_mutex;
#endif
struct tevent_context *event_ctx;
- int wakeup_fd;
};
struct tevent_debug_ops {
diff --git a/lib/tevent/tevent_queue.c b/lib/tevent/tevent_queue.c
index 5516c6c..9c3973b 100644
--- a/lib/tevent/tevent_queue.c
+++ b/lib/tevent/tevent_queue.c
@@ -266,6 +266,19 @@ struct tevent_queue_entry *tevent_queue_add_optimize_empty(
trigger, private_data, true);
}
+void tevent_queue_entry_untrigger(struct tevent_queue_entry *entry)
+{
+ if (entry->queue->running) {
+ abort();
+ }
+
+ if (entry->queue->list != entry) {
+ abort();
+ }
+
+ entry->triggered = false;
+}
+
void tevent_queue_start(struct tevent_queue *queue)
{
if (queue->running) {
diff --git a/lib/tevent/tevent_threads.c b/lib/tevent/tevent_threads.c
index 2e83f1b..2c6e66b 100644
--- a/lib/tevent/tevent_threads.c
+++ b/lib/tevent/tevent_threads.c
@@ -424,7 +424,6 @@ struct tevent_threaded_context *tevent_threaded_context_create(
return NULL;
}
tctx->event_ctx = ev;
- tctx->wakeup_fd = ev->wakeup_fd;
ret = pthread_mutex_init(&tctx->event_ctx_mutex, NULL);
if (ret != 0) {
@@ -489,14 +488,13 @@ void _tevent_threaded_schedule_immediate(struct tevent_threaded_context *tctx,
}
DLIST_ADD_END(ev->scheduled_immediates, im);
+ wakeup_fd = ev->wakeup_fd;
ret = pthread_mutex_unlock(&ev->scheduled_mutex);
if (ret != 0) {
abort();
}
- wakeup_fd = tctx->wakeup_fd;
-
ret = pthread_mutex_unlock(&tctx->event_ctx_mutex);
if (ret != 0) {
abort();
diff --git a/lib/tevent/wscript b/lib/tevent/wscript
index 31f7ee7..94d190f 100644
--- a/lib/tevent/wscript
+++ b/lib/tevent/wscript
@@ -1,7 +1,7 @@
#!/usr/bin/env python
APPNAME = 'tevent'
-VERSION = '0.9.34'
+VERSION = '0.9.36'
blddir = 'bin'
diff --git a/lib/util/tests/tfork.c b/lib/util/tests/tfork.c
index bf642fe..9bcdc2f 100644
--- a/lib/util/tests/tfork.c
+++ b/lib/util/tests/tfork.c
@@ -32,7 +32,6 @@
#include "lib/util/sys_rw.h"
#ifdef HAVE_PTHREAD
#include <pthread.h>
-#include <sys/syscall.h>
#endif
static bool test_tfork_simple(struct torture_context *tctx)
diff --git a/libcli/smb/smb2cli_notify.c b/libcli/smb/smb2cli_notify.c
new file mode 100644
index 0000000..34329ba
--- /dev/null
+++ b/libcli/smb/smb2cli_notify.c
@@ -0,0 +1,214 @@
+/*
+ Unix SMB/CIFS implementation.
+ smb2 lib
+ Copyright (C) Volker Lendecke 2017
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "system/network.h"
+#include "lib/util/tevent_ntstatus.h"
+#include "smb_common.h"
+#include "smbXcli_base.h"
+#include "librpc/gen_ndr/ndr_notify.h"
+
+struct smb2cli_notify_state {
+ uint8_t fixed[32];
+
+ struct iovec *recv_iov;
+ uint8_t *data;
+ uint32_t data_length;
+
+ struct tevent_req *subreq;
+};
+
+static void smb2cli_notify_done(struct tevent_req *subreq);
+static void smb2cli_notify_timedout(struct tevent_req *subreq);
+
+struct tevent_req *smb2cli_notify_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ struct smbXcli_tcon *tcon,
+ uint32_t output_buffer_length,
+ uint64_t fid_persistent,
+ uint64_t fid_volatile,
+ uint32_t completion_filter,
+ bool recursive)
+{
+ struct tevent_req *req, *subreq;
+ struct smb2cli_notify_state *state;
+ uint8_t *fixed;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct smb2cli_notify_state);
+ if (req == NULL) {
+ return NULL;
+ }
+ fixed = state->fixed;
+ SSVAL(fixed, 0, 32);
+ SSVAL(fixed, 2, recursive ? SMB2_WATCH_TREE : 0);
+ SIVAL(fixed, 4, output_buffer_length);
+ SBVAL(fixed, 8, fid_persistent);
+ SBVAL(fixed, 16, fid_volatile);
+ SIVAL(fixed, 24, completion_filter);
+ SIVAL(fixed, 28, 0); /* reserved */
+
+ state->subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_NOTIFY,
+ 0, 0, /* flags */
+ 0, /* timeout_msec */
+ tcon,
+ session,
+ state->fixed, sizeof(state->fixed),
+ NULL, 0, /* dyn* */
+ 0); /* max_dyn_len */
+ if (tevent_req_nomem(state->subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(state->subreq, smb2cli_notify_done, req);
+
+ subreq = tevent_wakeup_send(state, ev,
+ timeval_current_ofs_msec(timeout_msec));
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, smb2cli_notify_timedout, req);
+
+ return req;
+}
+
+static void smb2cli_notify_timedout(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct smb2cli_notify_state *state = tevent_req_data(
+ req, struct smb2cli_notify_state);
+ bool ok;
+
+ ok = tevent_wakeup_recv(subreq);
+ if (!ok) {
+ tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+ return;
+ }
+
+ ok = tevent_req_cancel(state->subreq);
+ if (!ok) {
+ tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+ return;
+ }
+}
+
+static void smb2cli_notify_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct smb2cli_notify_state *state = tevent_req_data(
+ req, struct smb2cli_notify_state);
+ NTSTATUS status;
+ struct iovec *iov;
+ uint16_t data_offset;
+ static const struct smb2cli_req_expected_response expected[] = {
+ {
+ .status = NT_STATUS_OK,
+ .body_size = 0x09
+ }
+ };
+
+ status = smb2cli_req_recv(subreq, state, &iov,
+ expected, ARRAY_SIZE(expected));
+ TALLOC_FREE(subreq);
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_CANCELLED)) {
+ status = NT_STATUS_IO_TIMEOUT;
+ }
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+
+ data_offset = SVAL(iov[1].iov_base, 2);
+ state->data_length = IVAL(iov[1].iov_base, 4);
+
+ if ((data_offset != SMB2_HDR_BODY + 8) ||
+ (state->data_length > iov[2].iov_len)) {
+ tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
+ return;
+ }
+
+ state->recv_iov = iov;
+ state->data = (uint8_t *)iov[2].iov_base;
+ tevent_req_done(req);
+}
+
+NTSTATUS smb2cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+ uint8_t **data, uint32_t *data_length)
+{
+ struct smb2cli_notify_state *state = tevent_req_data(
+ req, struct smb2cli_notify_state);
+ NTSTATUS status;
+
+ if (tevent_req_is_nterror(req, &status)) {
+ return status;
+ }
+ talloc_steal(mem_ctx, state->recv_iov);
+ *data_length = state->data_length;
+ *data = state->data;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS smb2cli_notify(struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ struct smbXcli_tcon *tcon,
+ uint32_t output_buffer_length,
+ uint64_t fid_persistent,
+ uint64_t fid_volatile,
+ uint32_t completion_filter,
+ bool recursive,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **data,
+ uint32_t *data_length)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct tevent_context *ev;
+ struct tevent_req *req;
+ NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+ if (smbXcli_conn_has_async_calls(conn)) {
+ /*
+ * Can't use sync call while an async call is in flight
+ */
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto fail;
+ }
+ ev = samba_tevent_context_init(frame);
+ if (ev == NULL) {
+ goto fail;
+ }
+ req = smb2cli_notify_send(frame, ev, conn, timeout_msec,
+ session, tcon, output_buffer_length,
+ fid_persistent, fid_volatile,
+ completion_filter, recursive);
+ if (req == NULL) {
+ goto fail;
+ }
+ if (!tevent_req_poll_ntstatus(req, ev, &status)) {
+ goto fail;
+ }
+ status = smb2cli_notify_recv(req, mem_ctx, data, data_length);
+ fail:
+ TALLOC_FREE(frame);
+ return status;
+}
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 2532084..20ef26e 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -811,6 +811,32 @@ NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
uint8_t **data,
uint32_t *data_length);
+struct tevent_req *smb2cli_notify_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ struct smbXcli_tcon *tcon,
+ uint32_t output_buffer_length,
+ uint64_t fid_persistent,
+ uint64_t fid_volatile,
+ uint32_t completion_filter,
+ bool recursive);
+NTSTATUS smb2cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+ uint8_t **data, uint32_t *data_length);
+NTSTATUS smb2cli_notify(struct smbXcli_conn *conn,
+ uint32_t timeout_msec,
+ struct smbXcli_session *session,
+ struct smbXcli_tcon *tcon,
+ uint32_t output_buffer_length,
+ uint64_t fid_persistent,
+ uint64_t fid_volatile,
+ uint32_t completion_filter,
+ bool recursive,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **data,
+ uint32_t *data_length);
+
struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbXcli_conn *conn,
diff --git a/libcli/smb/wscript b/libcli/smb/wscript
index e662826..53a5c21 100644
--- a/libcli/smb/wscript
+++ b/libcli/smb/wscript
@@ -39,6 +39,7 @@ def build(bld):
smb2cli_flush.c
smb2cli_set_info.c
smb2cli_query_info.c
+ smb2cli_notify.c
smb2cli_query_directory.c
smb2cli_ioctl.c
smb2cli_echo.c
diff --git a/source3/client/client.c b/source3/client/client.c
index 0ee084a..639d9fa 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4561,12 +4561,17 @@ static int cmd_notify(void)
}
while (1) {
- uint32_t i, num_changes;
- struct notify_change *changes;
+ uint32_t i;
+ uint32_t num_changes = 0;
+ struct notify_change *changes = NULL;
status = cli_notify(cli, fnum, 1000, FILE_NOTIFY_CHANGE_ALL,
true,
talloc_tos(), &num_changes, &changes);
+ if (NT_STATUS_EQUAL(status, STATUS_NOTIFY_ENUM_DIR)) {
+ printf("NOTIFY_ENUM_DIR\n");
--
Samba Shared Repository
More information about the samba-cvs
mailing list