The branch, master has been updated via f5c8b1aa834 Bug 9931: change pytalloc source to LGPL via fb229276e49 fuzz:afl main: run the initialisation function via e0dd4d0ac02 fuzz: add a LLVMFuzzerInitialize() to all fuzzers via 17602fefded fuzz:afl main: add a diagnostic message via c9f51f16720 fuzz/afl main: don't treat fuzzer as fuzzee via d26b7002588 autobuild: fuzz: correctly spell AFL build option via 9e3f0fa34b4 rpc_server: Fix a -Werror=format-truncation error via d50bf88d20c rpcclient: Fix a DBG msg: This is not dcerpc_winreg_int_openkey() via 174b9115245 winbindd: Improve a DEBUG message in sam_name_to_sid() via 18f3197808c rpcclient: Factor out cmd_set_auth() via 698c6de66e2 rpcclient: Convert binding-related commands to RPC_RTYPE_BINDING via e85640279b4 rpcclient: Add RPC_RTYPE_BINDING via cf2a943b8de rpcclient: Simplify do_cmd via b546b87b78b rpcclient: Avoid a few implicit NULL assignments via 386f62fb572 rpc_server: Initialize variables in get_md4pw() via 35ecbb3221f rpc_server: Save roundtrips into samr for machine pwd changes via c6ccf1b91ba auth3: Make it a bit easier to #include "source3/include/auth.h" via e6c64076235 auth3: Align integer types via bb5bf508197 lib: Remove init_names() via 57d548b5020 nmbd: Move my_netbios_names() to nmbd via 5831e8f2301 lib: Unfold calls to my_netbios_names() in util_names.c via 088386bbeda lib: Decouple is_myname() from init_names() via cf43f331be8 lib: Make pidfile_path_create() return the existing PID on conflict via 9614273aa3d librpc: Make "dcesrv_context->callbacks" a pointer via c8f47dfc03d torture: Make srv_cb static via 8d37c632b9a rpc_server4: Make "srv_callbacks" static via 403eabe4fc3 librpc: Add "private_data" to struct dcesrv_context_callbacks via e338d4fab47 printing: Move rap2jobid functions to their own file via 46cc9b51220 printing: Introduce printer_list_printername_exists() via e09f29eedd7 printing: Remove simple wrapper function pcap_printer_read_fn() via b6b0c0cb7e0 lib: Use FIONREAD in wait_for_read_send/recv via c58e9aa482c tests: Fix a typo via 6e41d1f3855 printing: Fix a typo via 6fb317227dc winbind: Simplify winbindd_samr.c via bdba1cd09b5 s3: VFS: Remove vfs_tru64acl.[c|h] from fd1b09bb3b2 VFS: glusterfs: Ensure vfs_gluster_fsetxattr() only uses an io fd for a handle based call.
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit f5c8b1aa834b53326efe243908b86ad969668c98 Author: David Disseldorp <dd...@samba.org> Date: Wed Jun 5 15:48:24 2013 +0200 Bug 9931: change pytalloc source to LGPL pytalloc is currently GPL, while the rest of talloc is LGPL. This situation arose because pytalloc was originally developed under source4/scripting/python/, and moved into talloc proper with commit 0f043c197c473c801fc32c727194b5a2d6ae232f ("Move pytalloc to talloc directory.", October 2008). BUG: https://bugzilla.samba.org/show_bug.cgi?id=9931 Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Jelmer Vernooij <jel...@samba.org> Reviewed-by: Björn Jacke <bja...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Mar 16 18:17:43 UTC 2021 on sn-devel-184 commit fb229276e49af93fd49381190be54650cfd6ac5b Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Jan 28 17:31:28 2021 +1300 fuzz:afl main: run the initialisation function Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jeremy Allison <j...@samba.org> commit e0dd4d0ac02c7040e8f6d346d4a8b7d087adfc04 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Fri Jan 29 14:11:46 2021 +1300 fuzz: add a LLVMFuzzerInitialize() to all fuzzers To compile the AFL binaries, we need every fuzzer to have a consistent set of functions. Some fuzzers require the initialize function, so all the rest must have an empty one. AFL binaires are handy for testing the fuzz results in a less magical environment than libfuzzer/honggfuzz give you. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jeremy Allison <j...@samba.org> commit 17602fefdeddaf7c26d451f7e3350c43ccb9a0e9 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Jan 28 17:33:22 2021 +1300 fuzz:afl main: add a diagnostic message LLVMFuzzerTestOneInput() NEVER returns non-zero, but if it does, we might as well know what made it do so Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jeremy Allison <j...@samba.org> commit c9f51f167201716b212cf0e7ad45ca2d5d50cade Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Jan 28 17:24:47 2021 +1300 fuzz/afl main: don't treat fuzzer as fuzzee Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jeremy Allison <j...@samba.org> commit d26b70025885ad4cdf0347e637de701cf379b8eb Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Jan 28 17:06:28 2021 +1300 autobuild: fuzz: correctly spell AFL build option Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9e3f0fa34b47a2dbf910c0942276b3ec06fdab6c Author: Volker Lendecke <v...@samba.org> Date: Tue Feb 9 12:26:20 2021 +0100 rpc_server: Fix a -Werror=format-truncation error gcc gets this wrong, it believes %u can write up to "2147483647" (2^31-1). Silence this with an easy patch. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d50bf88d20cd65827e853300ce658e850e7603a3 Author: Volker Lendecke <v...@samba.org> Date: Tue Feb 2 15:12:55 2021 +0100 rpcclient: Fix a DBG msg: This is not dcerpc_winreg_int_openkey() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 174b911524556127671a828ed9604f97984ecf37 Author: Volker Lendecke <v...@samba.org> Date: Tue Feb 23 08:16:04 2021 +0100 winbindd: Improve a DEBUG message in sam_name_to_sid() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 18f3197808c894fa76cc3a1b04550b3ce1be79f3 Author: Volker Lendecke <v...@samba.org> Date: Sun Feb 7 14:38:34 2021 +0100 rpcclient: Factor out cmd_set_auth() sign, seal and packet did exactly the same wrt authentication Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 698c6de66e24ba5a726956ba47aeee3331426258 Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 6 22:21:01 2021 +0100 rpcclient: Convert binding-related commands to RPC_RTYPE_BINDING Purely cosmetic at this point, will become useful soon Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e85640279b4a78555b4bfd612d326df2c73ced29 Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 6 21:33:41 2021 +0100 rpcclient: Add RPC_RTYPE_BINDING Purely transport-related commands don't need the cli_state. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit cf2a943b8de5428d1fd43f57f1eee397020ef122 Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 6 22:18:27 2021 +0100 rpcclient: Simplify do_cmd Reduce indentation by an early "continue;", simplify if-expression Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit b546b87b78bddae0fd8b3132e678fcece0b2f71d Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 6 21:35:56 2021 +0100 rpcclient: Avoid a few implicit NULL assignments Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 386f62fb572dfca97631cf970f2847c920cc1351 Author: Volker Lendecke <v...@samba.org> Date: Sun Mar 14 10:18:12 2021 +0100 rpc_server: Initialize variables in get_md4pw() My gcc complained at one point about uninitialized vars Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 35ecbb3221f156923703a591d90be1e3518c2d98 Author: Volker Lendecke <v...@samba.org> Date: Sun Mar 14 10:05:33 2021 +0100 rpc_server: Save roundtrips into samr for machine pwd changes We already have the machine SID, no need to look it up again. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c6ccf1b91ba54d64b088a27002a12578f95ad63f Author: Volker Lendecke <v...@samba.org> Date: Fri Feb 5 15:00:00 2021 +0100 auth3: Make it a bit easier to #include "source3/include/auth.h" Avoid using "uchar" in source3/auth/proto.h, this is #defined in includes.h Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e6c6407623543ba3dff330dc459cbf0620f0954f Author: Volker Lendecke <v...@samba.org> Date: Thu Mar 4 11:42:25 2021 +0100 auth3: Align integer types Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit bb5bf508197205f6a9d17b3418a9291b934bd9fa Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 13 22:07:53 2021 +0100 lib: Remove init_names() is_myname() looks at lp_* directly, nmbd maintains its own list: We don't need the baroque loadparm handler anymore. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 57d548b5020b5071e80d6b07c168c8207b52df25 Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 13 21:56:53 2021 +0100 nmbd: Move my_netbios_names() to nmbd nmbd is the heaviest user of this. The only other user was is_myname(), which is used in quite a few places in source3. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5831e8f2301a062f1e8a0113c1bda997701f38cf Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 13 21:41:57 2021 +0100 lib: Unfold calls to my_netbios_names() in util_names.c This will all go away in a few patches, this is an intermediate step. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 088386bbedabc11c1f406a3867e1b06b2fdb560f Author: Volker Lendecke <v...@samba.org> Date: Wed Feb 3 10:15:00 2021 +0100 lib: Decouple is_myname() from init_names() In a new binary I forgot "init_names()" in main and it crashed in auth3. We should not have to call init_names() everywhere I guess. The my_netbios_names() array is free of duplicates, but as we don't expect more than a handful of netbios aliases this does not matter for just checking existence of a name. And moreover, a properly configured smb.conf doesn't have tons of dups in "netbios aliases" anyway. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit cf43f331be818c6253bb45fcfa89327a3c858188 Author: Volker Lendecke <v...@samba.org> Date: Mon Feb 15 11:38:18 2021 +0100 lib: Make pidfile_path_create() return the existing PID on conflict Use F_GETLK to get the lock holder PID, this is more accurate than reading the file contents: A conflicting process might not have written its PID yet. Also, F_GETLK easily allows to do a retry if the lock holder just died. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9614273aa3d0d7c7113d25b2204ebb292405c7a8 Author: Volker Lendecke <v...@samba.org> Date: Tue Feb 2 15:07:35 2021 +0100 librpc: Make "dcesrv_context->callbacks" a pointer This structure just grew from 3 to 6 pointers, avoid making a copy of this. All callers of dcesrv_init_context() have this as a static struct in the C object, so a pointer to that won't change. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c8f47dfc03de58525a49824725a3c367d393433b Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 13 16:34:23 2021 +0100 torture: Make srv_cb static Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8d37c632b9a4d33e24ff02e6b72590d33cb9907d Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 13 16:33:21 2021 +0100 rpc_server4: Make "srv_callbacks" static Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 403eabe4fc3d43d80f3b33f104a8e35296b60fef Author: Volker Lendecke <v...@samba.org> Date: Fri Jan 29 18:16:08 2021 +0100 librpc: Add "private_data" to struct dcesrv_context_callbacks Not used right now, but we should never have callbacks without a "private_data" pointer. Some of the callbacks could even today benefit from this. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e338d4fab47d78e28139979480902c8f95986a08 Author: Volker Lendecke <v...@samba.org> Date: Thu Mar 11 18:02:44 2021 +0100 printing: Move rap2jobid functions to their own file This will make it easier to split out the spoolss functions later Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 46cc9b512200fcd435be313e915c1b1fc0deb428 Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 13 14:34:35 2021 +0100 printing: Introduce printer_list_printername_exists() Replace pcap_printername_ok(). Slightly different semantics: If the printer list db has a corrupted record, this is not detected. Why this patch? pcap_printername_ok() is a simple wrapper around the tdb accessing function, and this reduces a dependency on pcap.c Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e09f29eedd718f4e02fd0de55e69af877713b46d Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 13 14:19:23 2021 +0100 printing: Remove simple wrapper function pcap_printer_read_fn() There's only one caller that was trivial to convert Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit b6b0c0cb7e034effd2370e9043140e2ac090c514 Author: Volker Lendecke <v...@samba.org> Date: Tue Mar 9 12:54:49 2021 +0100 lib: Use FIONREAD in wait_for_read_send/recv ENOTSOCK looks ugly in straces... Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c58e9aa482cc650f99d040808ccfc780e1232210 Author: Volker Lendecke <v...@samba.org> Date: Tue Mar 9 17:34:26 2021 +0100 tests: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6e41d1f3855ad89feacd02775a24ee9412804792 Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 13 14:10:33 2021 +0100 printing: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6fb317227dcdea29b2e5aef604050deda8d59240 Author: Volker Lendecke <v...@samba.org> Date: Tue Feb 23 22:09:24 2021 +0100 winbind: Simplify winbindd_samr.c talloc_stackframe() panics on failure Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit bdba1cd09b55b51b7d2a0d1456d330e420b6da1e Author: Jeremy Allison <j...@samba.org> Date: Fri Mar 12 12:10:49 2021 -0800 s3: VFS: Remove vfs_tru64acl.[c|h] Support was discontinued for the entire Tru64 OS on 31 December 2012. Signed-off-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: ctdb/common/pidfile.c | 2 +- docs-xml/smbdotconf/base/netbiosaliases.xml | 1 - lib/async_req/async_sock.c | 21 +- lib/fuzzing/afl-fuzz-main.c | 16 +- lib/fuzzing/fuzz_cli_credentials_parse_string.c | 6 + lib/fuzzing/fuzz_dcerpc_parse_binding.c | 6 + lib/fuzzing/fuzz_ldb_dn_explode.c | 6 + lib/fuzzing/fuzz_ldb_ldif_read.c | 6 + lib/fuzzing/fuzz_ldb_parse_binary_decode.c | 6 + lib/fuzzing/fuzz_ldb_parse_control.c | 6 + lib/fuzzing/fuzz_ndr_X.c | 6 + lib/fuzzing/fuzz_nmblib_parse_packet.c | 6 + lib/param/loadparm.c | 13 - lib/param/s3_param.h | 1 - lib/talloc/pytalloc.c | 22 +- lib/talloc/pytalloc.h | 26 +- lib/talloc/pytalloc_util.c | 26 +- lib/util/pidfile.c | 80 ++-- lib/util/pidfile.h | 8 +- librpc/rpc/dcesrv_auth.c | 19 +- librpc/rpc/dcesrv_core.c | 11 +- librpc/rpc/dcesrv_core.h | 19 +- script/autobuild.py | 2 +- source3/auth/proto.h | 10 +- source3/auth/token_util.c | 4 +- source3/client/client.c | 5 - source3/include/nt_printing.h | 2 +- source3/include/printing.h | 3 - source3/include/proto.h | 4 - source3/lib/netapi/netapi.c | 2 - source3/lib/util.c | 36 +- source3/lib/util_names.c | 131 ------ source3/modules/vfs_tru64acl.c | 505 --------------------- source3/modules/vfs_tru64acl.h | 45 -- source3/modules/wscript_build | 7 - source3/nmbd/nmbd.c | 4 +- source3/nmbd/nmbd_mynames.c | 69 +++ source3/nmbd/nmbd_proto.h | 2 + source3/param/loadparm_ctx.c | 1 - source3/param/service.c | 3 +- source3/printing/load.c | 21 +- source3/printing/pcap.c | 20 - source3/printing/pcap.h | 1 - source3/printing/printer_list.c | 21 + source3/printing/printer_list.h | 2 + source3/printing/printing.c | 147 +----- source3/printing/printspoolss.c | 1 + source3/printing/queue_process.c | 4 +- source3/printing/rap_jobid.c | 164 +++++++ .../{lib/version_test.c => printing/rap_jobid.h} | 19 +- source3/rpc_client/cli_winreg_int.c | 4 +- source3/rpc_server/netlogon/srv_netlog_nt.c | 108 ++++- source3/rpc_server/rpc_ncacn_np.c | 4 +- source3/rpc_server/rpc_server.c | 16 +- source3/rpc_server/rpc_server.h | 16 +- source3/rpc_server/rpc_sock_helper.c | 2 +- source3/rpcclient/rpcclient.c | 249 ++++------ source3/rpcclient/rpcclient.h | 5 + source3/script/tests/test_smb1_system_security.sh | 2 +- source3/smbd/lanman.c | 1 + source3/smbd/reply.c | 1 + source3/smbd/server.c | 3 - source3/smbd/server_reload.c | 4 +- source3/torture/pdbtest.c | 1 - source3/utils/net.c | 3 - source3/utils/pdbedit.c | 3 - source3/utils/smbpasswd.c | 8 - source3/winbindd/winbindd.c | 5 - source3/winbindd/winbindd_dual_ndr.c | 7 +- source3/winbindd/winbindd_samr.c | 102 +---- source3/wscript_build | 1 + source4/client/client.c | 2 - source4/rpc_server/dcerpc_server.c | 16 +- source4/rpc_server/service_rpc.c | 2 +- source4/torture/libnetapi/libnetapi.c | 1 - source4/torture/rpc/spoolss_notify.c | 2 +- testsuite/unittests/test_sambafs_srv_pipe.c | 6 +- 77 files changed, 788 insertions(+), 1334 deletions(-) delete mode 100644 source3/modules/vfs_tru64acl.c delete mode 100644 source3/modules/vfs_tru64acl.h create mode 100644 source3/printing/rap_jobid.c copy source3/{lib/version_test.c => printing/rap_jobid.h} (68%) Changeset truncated at 500 lines: diff --git a/ctdb/common/pidfile.c b/ctdb/common/pidfile.c index e78542d5f2f..47589f4b083 100644 --- a/ctdb/common/pidfile.c +++ b/ctdb/common/pidfile.c @@ -54,7 +54,7 @@ int pidfile_context_create(TALLOC_CTX *mem_ctx, const char *pidfile, pid_ctx->pid = getpid(); - ret = pidfile_path_create(pid_ctx->pidfile, &fd); + ret = pidfile_path_create(pid_ctx->pidfile, &fd, NULL); if (ret != 0) { return ret; } diff --git a/docs-xml/smbdotconf/base/netbiosaliases.xml b/docs-xml/smbdotconf/base/netbiosaliases.xml index 0304ab02d92..b9b66b16ef1 100644 --- a/docs-xml/smbdotconf/base/netbiosaliases.xml +++ b/docs-xml/smbdotconf/base/netbiosaliases.xml @@ -1,7 +1,6 @@ <samba:parameter name="netbios aliases" context="G" type="cmdlist" - handler="handle_netbios_aliases" xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> <description> <para>This is a list of NetBIOS names that nmbd will diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c index 3035aaaf623..ae1d3257f65 100644 --- a/lib/async_req/async_sock.c +++ b/lib/async_req/async_sock.c @@ -652,8 +652,7 @@ static void wait_for_read_done(struct tevent_context *ev, private_data, struct tevent_req); struct wait_for_read_state *state = tevent_req_data(req, struct wait_for_read_state); - ssize_t nread; - char c; + int ret, available; if ((flags & TEVENT_FD_READ) == 0) { return; @@ -664,26 +663,20 @@ static void wait_for_read_done(struct tevent_context *ev, return; } - nread = recv(state->fd, &c, 1, MSG_PEEK); + ret = ioctl(state->fd, FIONREAD, &available); - if (nread == 0) { - tevent_req_error(req, EPIPE); - return; - } - - if ((nread == -1) && (errno == EINTR)) { + if ((ret == -1) && (errno == EINTR)) { /* come back later */ return; } - if ((nread == -1) && (errno == ENOTSOCK)) { - /* Ignore this specific error on pipes */ - tevent_req_done(req); + if (ret == -1) { + tevent_req_error(req, errno); return; } - if (nread == -1) { - tevent_req_error(req, errno); + if (available == 0) { + tevent_req_error(req, EPIPE); return; } diff --git a/lib/fuzzing/afl-fuzz-main.c b/lib/fuzzing/afl-fuzz-main.c index 9f677557867..e0a1d264fc4 100644 --- a/lib/fuzzing/afl-fuzz-main.c +++ b/lib/fuzzing/afl-fuzz-main.c @@ -26,11 +26,19 @@ int main(int argc, char *argv[]) { int ret; size_t size = 0; + int i; + + ret = LLVMFuzzerInitialize(&argc, &argv); + if (ret != 0) { + printf("LLVMFuzzerInitialize returned %d\n", ret); + return ret; + } + + #ifdef __AFL_LOOP while (__AFL_LOOP(1000)) #else - int i; - for (i = 0; i < argc; i++) { + for (i = 1; i < argc; i++) { uint8_t *buf = (uint8_t *)file_load(argv[i], &size, 0, @@ -38,10 +46,12 @@ int main(int argc, char *argv[]) { ret = LLVMFuzzerTestOneInput(buf, size); TALLOC_FREE(buf); if (ret != 0) { + printf("LLVMFuzzerTestOneInput returned %d on argument %d\n", + ret, i); return ret; } } - if (i == 0) + if (i == 1) #endif { uint8_t *buf = (uint8_t *)fd_load(0, &size, 0, NULL); diff --git a/lib/fuzzing/fuzz_cli_credentials_parse_string.c b/lib/fuzzing/fuzz_cli_credentials_parse_string.c index 3b88109298d..bac6ef27674 100644 --- a/lib/fuzzing/fuzz_cli_credentials_parse_string.c +++ b/lib/fuzzing/fuzz_cli_credentials_parse_string.c @@ -55,3 +55,9 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len) talloc_free(mem_ctx); return 0; } + + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} diff --git a/lib/fuzzing/fuzz_dcerpc_parse_binding.c b/lib/fuzzing/fuzz_dcerpc_parse_binding.c index 61df0c0670e..b353066764b 100644 --- a/lib/fuzzing/fuzz_dcerpc_parse_binding.c +++ b/lib/fuzzing/fuzz_dcerpc_parse_binding.c @@ -68,3 +68,9 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len) talloc_free(mem_ctx); return 0; } + + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} diff --git a/lib/fuzzing/fuzz_ldb_dn_explode.c b/lib/fuzzing/fuzz_ldb_dn_explode.c index 29747178e3e..f2b200b46a8 100644 --- a/lib/fuzzing/fuzz_ldb_dn_explode.c +++ b/lib/fuzzing/fuzz_ldb_dn_explode.c @@ -45,3 +45,9 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len) TALLOC_FREE(ldb); return 0; } + + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} diff --git a/lib/fuzzing/fuzz_ldb_ldif_read.c b/lib/fuzzing/fuzz_ldb_ldif_read.c index 4eee1701836..0700a851fb5 100644 --- a/lib/fuzzing/fuzz_ldb_ldif_read.c +++ b/lib/fuzzing/fuzz_ldb_ldif_read.c @@ -48,3 +48,9 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len) TALLOC_FREE(ldb); return 0; } + + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} diff --git a/lib/fuzzing/fuzz_ldb_parse_binary_decode.c b/lib/fuzzing/fuzz_ldb_parse_binary_decode.c index 6b79a34a027..734196e036d 100644 --- a/lib/fuzzing/fuzz_ldb_parse_binary_decode.c +++ b/lib/fuzzing/fuzz_ldb_parse_binary_decode.c @@ -47,3 +47,9 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len) TALLOC_FREE(mem_ctx); return 0; } + + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} diff --git a/lib/fuzzing/fuzz_ldb_parse_control.c b/lib/fuzzing/fuzz_ldb_parse_control.c index 98af24a8000..c78222c3c85 100644 --- a/lib/fuzzing/fuzz_ldb_parse_control.c +++ b/lib/fuzzing/fuzz_ldb_parse_control.c @@ -47,3 +47,9 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len) TALLOC_FREE(ldb); return 0; } + + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} diff --git a/lib/fuzzing/fuzz_ndr_X.c b/lib/fuzzing/fuzz_ndr_X.c index fc940f3011b..bedefba8553 100644 --- a/lib/fuzzing/fuzz_ndr_X.c +++ b/lib/fuzzing/fuzz_ndr_X.c @@ -329,3 +329,9 @@ int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { return 0; } + + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} diff --git a/lib/fuzzing/fuzz_nmblib_parse_packet.c b/lib/fuzzing/fuzz_nmblib_parse_packet.c index 7b35abe9f97..85dd823e51c 100644 --- a/lib/fuzzing/fuzz_nmblib_parse_packet.c +++ b/lib/fuzzing/fuzz_nmblib_parse_packet.c @@ -54,3 +54,9 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len) } return 0; } + + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + return 0; +} diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 0c4c3d0f555..6f0eeb7edf6 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -1290,19 +1290,6 @@ bool handle_ldap_debug_level(struct loadparm_context *lp_ctx, struct loadparm_se return true; } -bool handle_netbios_aliases(struct loadparm_context *lp_ctx, struct loadparm_service *service, - const char *pszParmValue, char **ptr) -{ - TALLOC_FREE(lp_ctx->globals->netbios_aliases); - lp_ctx->globals->netbios_aliases = str_list_make_v3_const(lp_ctx->globals->ctx, - pszParmValue, NULL); - - if (lp_ctx->s3_fns) { - return lp_ctx->s3_fns->set_netbios_aliases(lp_ctx->globals->netbios_aliases); - } - return true; -} - /* * idmap related parameters */ diff --git a/lib/param/s3_param.h b/lib/param/s3_param.h index 7bbadfd196a..f9ed7c3e2d7 100644 --- a/lib/param/s3_param.h +++ b/lib/param/s3_param.h @@ -14,7 +14,6 @@ struct loadparm_s3_helpers bool (*lp_include)(struct loadparm_context*, struct loadparm_service *, const char *, char **); void (*init_ldap_debugging)(void); - bool (*set_netbios_aliases)(const char **); bool (*do_section)(const char *pszSectionName, void *userdata); struct loadparm_global *globals; unsigned int *flags; diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c index cc5a6a812ea..15e4232f0c8 100644 --- a/lib/talloc/pytalloc.c +++ b/lib/talloc/pytalloc.c @@ -3,18 +3,22 @@ Python Talloc Module Copyright (C) Jelmer Vernooij <jel...@samba.org> 2010-2011 - 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. + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL - This program is distributed in the hope that it will be useful, + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser 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/>. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include <Python.h> diff --git a/lib/talloc/pytalloc.h b/lib/talloc/pytalloc.h index 9aeb121eb29..c1f9b446e16 100644 --- a/lib/talloc/pytalloc.h +++ b/lib/talloc/pytalloc.h @@ -3,18 +3,22 @@ Samba utility functions Copyright (C) Jelmer Vernooij <jel...@samba.org> 2008 - 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, + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library 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/>. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _PYTALLOC_H_ diff --git a/lib/talloc/pytalloc_util.c b/lib/talloc/pytalloc_util.c index c580d46f858..1b7cfdda6e7 100644 --- a/lib/talloc/pytalloc_util.c +++ b/lib/talloc/pytalloc_util.c @@ -3,18 +3,22 @@ Python/Talloc glue Copyright (C) Jelmer Vernooij <jel...@samba.org> 2008 - 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, + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library 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/>. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include <Python.h> diff --git a/lib/util/pidfile.c b/lib/util/pidfile.c index b7daa089223..4f4e5e9782c 100644 --- a/lib/util/pidfile.c +++ b/lib/util/pidfile.c @@ -27,16 +27,14 @@ #include "lib/util/pidfile.h" -int pidfile_path_create(const char *path, int *outfd) +int pidfile_path_create(const char *path, int *pfd, pid_t *existing_pid) { struct flock lck; char tmp[64] = { 0 }; - pid_t pid; int fd, ret = 0; int len; ssize_t nwritten; - - pid = getpid(); + bool retried = false; fd = open(path, O_CREAT|O_WRONLY|O_NONBLOCK, 0644); if (fd == -1) { @@ -44,10 +42,11 @@ int pidfile_path_create(const char *path, int *outfd) } if (! set_close_on_exec(fd)) { - close(fd); - return EIO; + ret = errno; + goto fail; } +retry: lck = (struct flock) { .l_type = F_WRLCK, .l_whence = SEEK_SET, @@ -59,25 +58,41 @@ int pidfile_path_create(const char *path, int *outfd) if (ret != 0) { ret = errno; - close(fd); - return ret; + + if ((ret == EACCES) || (ret == EAGAIN)) { + do { + ret = fcntl(fd, F_GETLK, &lck); + } while ((ret == -1) && (errno == EINTR)); + + if (ret == -1) { + ret = errno; + goto fail; + } + + if (lck.l_type == F_UNLCK) { + if (!retried) { + /* Lock holder died, retry once */ + retried = true; + goto retry; + } + /* Something badly wrong */ + ret = EIO; + goto fail; + } + + if (existing_pid != NULL) { + *existing_pid = lck.l_pid; + } + return EAGAIN; + } + goto fail; } /* * PID file is locked by us so from here on we should unlink * on failure */ - - do { - ret = ftruncate(fd, 0); - } while ((ret == -1) && (errno == EINTR)); - - if (ret == -1) { - ret = EIO; - goto fail_unlink; - } - - len = snprintf(tmp, sizeof(tmp), "%u\n", pid); + len = snprintf(tmp, sizeof(tmp), "%u\n", getpid()); if (len < 0) { ret = errno; goto fail_unlink; @@ -92,17 +107,25 @@ int pidfile_path_create(const char *path, int *outfd) } while ((nwritten == -1) && (errno == EINTR)); if ((nwritten == -1) || (nwritten != len)) { - ret = EIO; + ret = errno; goto fail_unlink; } - if (outfd != NULL) { - *outfd = fd; + do { + ret = ftruncate(fd, len); + } while ((ret == -1) && (errno == EINTR)); + + if (ret == -1) { + ret = errno; + goto fail_unlink; } + + *pfd = fd; return 0; fail_unlink: unlink(path); +fail: close(fd); return ret; } @@ -185,24 +208,17 @@ void pidfile_create(const char *piddir, const char *name) size_t len = strlen(piddir) + strlen(name) + 6; char pidFile[len]; pid_t pid; - int ret; + int ret, fd; -- Samba Shared Repository