The branch, master has been updated via 3d9b1dd3552 winbindd: Simplify parse_domain_user() via 683e25787c5 libsmb: Avoid an "else" via f4be9bfc11c vfs: Add some const to make in/out params more obvious via 8547f6f7f31 libsmb: Slightly simplify cli_tcon_andx_done() via 30dc783c721 libsmb: Remove sync smb1cli_trans and _echo wrappers via 431e2a10505 lib: Fix Coverity ID 1509061 Use of 32-bit time_t via ea8ff86162d lib: Use talloc_realloc_zero() in a few obvious places via 51d05da70e8 lib: Add talloc_realloc_zero() via 5b28822d9be libsmb: Slightly clarify format in set/get_secdesc via 911b683819c libsmb: Make map_fnum_to_smb2_handle type-safe via db715cd2726 libsmb: Make dsgetdcname print flags in one DEBUG via d873b244c34 libsmb: Remove an unnecessary cast via 00e7307046e tls: Reorder macro for easier readability via 608c7390d1d lib: Remove unused interpret_string_addr_prefer_ipv4() via ed66c5623d4 lib: Fix whitespace via 34f7e432534 libsmb: Use tevent_req_nterror() properly via 213f0a42454 libsmb: Save a few lines with direct var initialization via a2804f4ca43 dnsserver: Align an integer type via 982f0145114 vfs: Simplify fruit_unlink_rsrc_stream() via 26fab22383e vfs_streams_xattr: Add some overflow protection to pread and pwrite via c70f4f4d839 vfs: Slightly streamline streams_xattr_renameat() via 2c3dae6af57 tls: Make tstream_tls_params_quic_enabled a bit easier to read via f1f0c7090fc tls: Fix a printf sign mismatch via a70d64db5b2 tls: Fix whitespace via d46fceb43f4 smbd: Align integer types via a1e040f902d smbd: Align an integer type via ada25fd8eff lib: tevent_req_set_endtime() can fail from ad753da08d2 lib: Re-add dlclose(handle) when module initialization failed
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 3d9b1dd3552e33d555fe689d2a513f57014a15a3 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 25 12:59:32 2025 +0200 winbindd: Simplify parse_domain_user() We have talloc_strndup() for this. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Tue Sep 2 09:08:59 UTC 2025 on atb-devel-224 commit 683e25787c54b72efdea77e6cb9d92e897ca68b7 Author: Volker Lendecke <v...@samba.org> Date: Wed Aug 20 18:23:50 2025 +0200 libsmb: Avoid an "else" We return in the if-branch Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit f4be9bfc11c90a0d79e54e228662d944b375a066 Author: Volker Lendecke <v...@samba.org> Date: Fri Aug 1 18:07:25 2025 +0200 vfs: Add some const to make in/out params more obvious Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 8547f6f7f313df1bb7b06914ccbc08f5ff387ccc Author: Volker Lendecke <v...@samba.org> Date: Fri Jun 20 16:45:30 2025 +0200 libsmb: Slightly simplify cli_tcon_andx_done() We have tevent_req_nomem() for this Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 30dc783c721bcfab9af4d75edb9160bbd7f0520a Author: Volker Lendecke <v...@samba.org> Date: Fri Jun 20 17:20:11 2025 +0200 libsmb: Remove sync smb1cli_trans and _echo wrappers Unused. If someone wants them back, they're easy to recreate Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 431e2a105051ebca0749fca25480f6972c578146 Author: Volker Lendecke <v...@samba.org> Date: Fri Jun 20 09:48:11 2025 +0200 lib: Fix Coverity ID 1509061 Use of 32-bit time_t "man gnutls_x509_crt_set_serial" says that the serial number should be a big-endian positive integer of up to 20 bytes.... Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit ea8ff86162dd8106aa5572cb4e88c89ecd2d4227 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 29 15:26:21 2025 +0200 lib: Use talloc_realloc_zero() in a few obvious places Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 51d05da70e8461834396d361eead807127751b76 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 29 14:50:40 2025 +0200 lib: Add talloc_realloc_zero() Like talloc_realloc, zeroing out expanded memory Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 5b28822d9be81dae7a8341cc359c6e79498df241 Author: Volker Lendecke <v...@samba.org> Date: Tue May 13 11:31:12 2025 +0200 libsmb: Slightly clarify format in set/get_secdesc We have reserved fields after those 16-bit ones. With little endian those are set to 0 with PUSH_LE32. That is unnecessary here, the fields are already set to 0. This patch is not for efficiency, I just got a bit confused by the subtlety. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 911b683819c17d4cc1ee3d17be2c8adefb8127fb Author: Volker Lendecke <v...@samba.org> Date: Tue May 13 11:12:25 2025 +0200 libsmb: Make map_fnum_to_smb2_handle type-safe "struct smb2_hnd" is talloced here, use talloc_get_type_abort() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit db715cd27269a9a6860f8d9e20ac1c6605b1136b Author: Volker Lendecke <v...@samba.org> Date: Mon May 12 18:21:40 2025 +0200 libsmb: Make dsgetdcname print flags in one DEBUG Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit d873b244c34dd346cf218b810ec064cfe05ded59 Author: Volker Lendecke <v...@samba.org> Date: Tue May 13 11:13:08 2025 +0200 libsmb: Remove an unnecessary cast Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 00e7307046e64364b25e33a74c387daca2144897 Author: Volker Lendecke <v...@samba.org> Date: Fri Aug 1 16:06:23 2025 +0200 tls: Reorder macro for easier readability Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 608c7390d1dec0d5dbb0b9692f5ec58c60091a33 Author: Volker Lendecke <v...@samba.org> Date: Wed Jun 25 10:10:53 2025 +0200 lib: Remove unused interpret_string_addr_prefer_ipv4() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit ed66c5623d47993b1d2a8737bf83f548c40d4b3d Author: Volker Lendecke <v...@samba.org> Date: Wed Jun 25 09:42:21 2025 +0200 lib: Fix whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 34f7e4325341080702e2993375b849d40dc5a7e0 Author: Volker Lendecke <v...@samba.org> Date: Fri Jun 20 17:21:49 2025 +0200 libsmb: Use tevent_req_nterror() properly Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 213f0a42454a59796565887ffc37e11befbdda56 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 23 16:12:26 2025 +0200 libsmb: Save a few lines with direct var initialization Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit a2804f4ca434e958b136758f7b1b97b30f4fcc93 Author: Volker Lendecke <v...@samba.org> Date: Thu Jul 3 10:38:03 2025 +0200 dnsserver: Align an integer type Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 982f0145114f0e21a8dd9451663e2d55c8adb21c Author: Volker Lendecke <v...@samba.org> Date: Sun Feb 2 16:44:53 2025 +0100 vfs: Simplify fruit_unlink_rsrc_stream() We have the dirfsp around, no need to do a full stat() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 26fab22383e5d01fc51ab04f80bcea4c9bcf2cc4 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 29 14:49:33 2025 +0200 vfs_streams_xattr: Add some overflow protection to pread and pwrite Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit c70f4f4d839f98eed986d1d731addd98d0283fbe Author: Volker Lendecke <v...@samba.org> Date: Mon Jul 28 10:44:24 2025 +0200 vfs: Slightly streamline streams_xattr_renameat() We have strequal() for this Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit 2c3dae6af574b9784f2f9bec499c5c857d6f586d Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 4 13:44:01 2025 +0200 tls: Make tstream_tls_params_quic_enabled a bit easier to read YMMV Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit f1f0c7090fc20dfe06802f190ca10928b3dd79b2 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 4 13:43:31 2025 +0200 tls: Fix a printf sign mismatch Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit a70d64db5b23cba864980d5c7b77a517551a7188 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 4 13:40:17 2025 +0200 tls: Fix whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit d46fceb43f4ff79052777b5e4981eb918d94fd85 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 4 13:54:10 2025 +0200 smbd: Align integer types Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit a1e040f902d8e98ef7e8c58cc50491ada8be5542 Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 7 14:11:33 2025 +0200 smbd: Align an integer type Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> commit ada25fd8eff6e792709429ea3610cb29e1da33fd Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 18 10:50:33 2025 +0200 lib: tevent_req_set_endtime() can fail Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Anoop C S <anoo...@samba.org> ----------------------------------------------------------------------- Summary of changes: ...oc-util-2.3.0.sigs => pytalloc-util-2.4.4.sigs} | 0 .../ABI/{talloc-2.3.5.sigs => talloc-2.4.4.sigs} | 1 + lib/talloc/talloc.c | 33 +++++++++ lib/talloc/talloc.h | 33 +++++++++ lib/talloc/wscript | 2 +- lib/util/util_net.c | 19 +---- lib/util/util_net.h | 9 --- lib/util/util_runcmd.c | 5 +- libcli/smb/smb1cli_echo.c | 35 +-------- libcli/smb/smb1cli_trans.c | 62 ---------------- libcli/smb/smbXcli_base.h | 19 ----- source3/lib/adouble.c | 11 +-- source3/libads/ldap.c | 6 +- source3/libsmb/cli_smb2_fnum.c | 8 +- source3/libsmb/cliconnect.c | 7 +- source3/libsmb/clisecdesc.c | 8 +- source3/libsmb/dsgetdcname.c | 85 ++++++++++++---------- source3/libsmb/libsmb_xattr.c | 12 ++- source3/modules/nfs4acl_xattr_nfs.c | 2 +- source3/modules/vfs_fruit.c | 29 ++------ source3/modules/vfs_streams_xattr.c | 13 +++- source3/profile/profile.c | 10 +-- source3/smbd/server.c | 3 +- source3/smbd/smb2_negprot.c | 2 +- source3/winbindd/winbindd_util.c | 4 +- source4/lib/tls/tls.h | 18 ++--- source4/lib/tls/tls_tstream.c | 12 ++- source4/lib/tls/tlscert.c | 5 +- source4/rpc_server/dnsserver/dnsutils.c | 2 +- source4/torture/winbind/struct_based.c | 14 ++-- 30 files changed, 206 insertions(+), 263 deletions(-) copy lib/talloc/ABI/{pytalloc-util-2.3.0.sigs => pytalloc-util-2.4.4.sigs} (100%) copy lib/talloc/ABI/{talloc-2.3.5.sigs => talloc-2.4.4.sigs} (97%) Changeset truncated at 500 lines: diff --git a/lib/talloc/ABI/pytalloc-util-2.3.0.sigs b/lib/talloc/ABI/pytalloc-util-2.4.4.sigs similarity index 100% copy from lib/talloc/ABI/pytalloc-util-2.3.0.sigs copy to lib/talloc/ABI/pytalloc-util-2.4.4.sigs diff --git a/lib/talloc/ABI/talloc-2.3.5.sigs b/lib/talloc/ABI/talloc-2.4.4.sigs similarity index 97% copy from lib/talloc/ABI/talloc-2.3.5.sigs copy to lib/talloc/ABI/talloc-2.4.4.sigs index ec3cee44d8f..7499ecbc312 100644 --- a/lib/talloc/ABI/talloc-2.3.5.sigs +++ b/lib/talloc/ABI/talloc-2.4.4.sigs @@ -7,6 +7,7 @@ _talloc_move: void *(const void *, const void *) _talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) _talloc_realloc: void *(const void *, void *, size_t, const char *) _talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_realloc_array_zero: void *(const void *, void *, size_t, unsigned int, const char *) _talloc_reference_loc: void *(const void *, const void *, const char *) _talloc_set_destructor: void (const void *, int (*)(void *)) _talloc_steal_loc: void *(const void *, const void *, const char *) diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 727abe77a24..ac3d26fcb52 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -2810,6 +2810,39 @@ _PUBLIC_ void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, return _talloc_realloc(ctx, ptr, el_size * count, name); } +/* + * realloc an array, checking for integer overflow in the array size + * and zero out potential additional memory + */ +_PUBLIC_ void *_talloc_realloc_array_zero(const void *ctx, + void *ptr, + size_t el_size, + unsigned count, + const char *name) +{ + size_t existing, newsize; + void *newptr = NULL; + + if (count >= MAX_TALLOC_SIZE / el_size) { + return NULL; + } + + existing = talloc_get_size(ptr); + newsize = el_size * count; + + newptr = _talloc_realloc(ctx, ptr, newsize, name); + if (newptr == NULL) { + return NULL; + } + + if (newsize > existing) { + size_t to_zero = newsize - existing; + memset_s(((char *)newptr) + existing, to_zero, 0, to_zero); + } + + return newptr; +} + /* a function version of talloc_realloc(), so it can be passed as a function pointer to libraries that want a realloc function (a realloc function encapsulates diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h index eef1a701b1f..62142d188f1 100644 --- a/lib/talloc/talloc.h +++ b/lib/talloc/talloc.h @@ -1296,6 +1296,39 @@ _PUBLIC_ void *talloc_realloc(const void *ctx, void *ptr, #type, size_t count); _PUBLIC_ void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name); #endif +#ifdef DOXYGEN +/** + * @brief Change the size of a talloc array, zero out additional space. + * + * Same as talloc_realloc() with the additional behavior to zero out + * code in case the array is expanded. + * + * @param[in] ctx The parent context used if ptr is NULL. + * + * @param[in] ptr The chunk to be resized. + * + * @param[in] type The type of the array element inside ptr. + * + * @param[in] count The intended number of array elements. + * + * @return The new array, NULL on error. The call will fail either + * due to a lack of memory, or because the pointer has more + * than one parent (see talloc_reference()). + */ +_PUBLIC_ void *talloc_realloc_zero(const void *ctx, + void *ptr, + #type, + size_t count); +#else +#define talloc_realloc_zero(ctx, p, type, count) \ + (type *)_talloc_realloc_array_zero(ctx, p, sizeof(type), count, #type) +_PUBLIC_ void *_talloc_realloc_array_zero(const void *ctx, + void *ptr, + size_t el_size, + unsigned count, + const char *name); +#endif + #ifdef DOXYGEN /** * @brief Untyped realloc to change the size of a talloc array. diff --git a/lib/talloc/wscript b/lib/talloc/wscript index b4b89ec1993..d36d3587480 100644 --- a/lib/talloc/wscript +++ b/lib/talloc/wscript @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.4.3' +VERSION = '2.4.4' import os import sys diff --git a/lib/util/util_net.c b/lib/util/util_net.c index 5c19cc90003..e410cdf915a 100644 --- a/lib/util/util_net.c +++ b/lib/util/util_net.c @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. Samba utility functions Copyright (C) Jelmer Vernooij <jel...@samba.org> 2008 @@ -326,21 +326,6 @@ bool interpret_string_addr(struct sockaddr_storage *pss, false); } -/******************************************************************* - Map a text hostname or IP address (IPv4 or IPv6) into a - struct sockaddr_storage. Version that prefers IPv4. -******************************************************************/ - -bool interpret_string_addr_prefer_ipv4(struct sockaddr_storage *pss, - const char *str, - int flags) -{ - return interpret_string_addr_pref(pss, - str, - flags, - true); -} - /** * Interpret an internet address or name into an IP address in 4 byte form. * RETURNS IN NETWORK BYTE ORDER (big endian). @@ -440,7 +425,7 @@ _PUBLIC_ bool same_net_v4(struct in_addr ip1, struct in_addr ip2, struct in_addr nmask = ntohl(mask.s_addr); net1 = ntohl(ip1.s_addr); net2 = ntohl(ip2.s_addr); - + return((net1 & nmask) == (net2 & nmask)); } diff --git a/lib/util/util_net.h b/lib/util/util_net.h index adfe749d4b7..d8eac33f629 100644 --- a/lib/util/util_net.h +++ b/lib/util/util_net.h @@ -47,15 +47,6 @@ bool interpret_string_addr(struct sockaddr_storage *pss, const char *str, int flags); -/******************************************************************* - Map a text hostname or IP address (IPv4 or IPv6) into a - struct sockaddr_storage. Version that prefers IPv4. -******************************************************************/ - -bool interpret_string_addr_prefer_ipv4(struct sockaddr_storage *pss, - const char *str, - int flags); - void set_sockaddr_port(struct sockaddr *psa, uint16_t port); /** diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c index ea2e8eead0e..2a36e9ea3ee 100644 --- a/lib/util/util_runcmd.c +++ b/lib/util/util_runcmd.c @@ -213,7 +213,10 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx, tevent_fd_set_auto_close(state->fde_status); if (!timeval_is_zero(&endtime)) { - tevent_req_set_endtime(req, ev, endtime); + bool ok = tevent_req_set_endtime(req, ev, endtime); + if (!ok) { + return tevent_req_post(req, ev); + } } return req; diff --git a/libcli/smb/smb1cli_echo.c b/libcli/smb/smb1cli_echo.c index 10dff2d8c9b..de633e7721a 100644 --- a/libcli/smb/smb1cli_echo.c +++ b/libcli/smb/smb1cli_echo.c @@ -96,8 +96,7 @@ static void smb1cli_echo_done(struct tevent_req *subreq) NULL, /* pbytes_offset */ NULL, /* pinbuf */ expected, ARRAY_SIZE(expected)); - if (!NT_STATUS_IS_OK(status)) { - tevent_req_nterror(req, status); + if (tevent_req_nterror(req, status)) { return; } @@ -135,35 +134,3 @@ NTSTATUS smb1cli_echo_recv(struct tevent_req *req) { return tevent_req_simple_recv_ntstatus(req); } - -NTSTATUS smb1cli_echo(struct smbXcli_conn *conn, uint32_t timeout_msec, - uint16_t num_echos, DATA_BLOB data) -{ - 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 = smb1cli_echo_send(frame, ev, conn, timeout_msec, num_echos, data); - if (req == NULL) { - goto fail; - } - if (!tevent_req_poll_ntstatus(req, ev, &status)) { - goto fail; - } - status = smb1cli_echo_recv(req); - fail: - TALLOC_FREE(frame); - return status; -} diff --git a/libcli/smb/smb1cli_trans.c b/libcli/smb/smb1cli_trans.c index 02b2b2efb08..cb355c80ef2 100644 --- a/libcli/smb/smb1cli_trans.c +++ b/libcli/smb/smb1cli_trans.c @@ -838,65 +838,3 @@ NTSTATUS smb1cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, tevent_req_received(req); return status; } - -NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn, - uint8_t trans_cmd, - uint8_t additional_flags, uint8_t clear_flags, - uint16_t additional_flags2, uint16_t clear_flags2, - uint32_t timeout_msec, - uint32_t pid, - struct smbXcli_tcon *tcon, - struct smbXcli_session *session, - const char *pipe_name, uint16_t fid, uint16_t function, - int flags, - uint16_t *setup, uint8_t num_setup, uint8_t max_setup, - uint8_t *param, uint32_t num_param, uint32_t max_param, - uint8_t *data, uint32_t num_data, uint32_t max_data, - uint16_t *recv_flags2, - uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup, - uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam, - uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata) -{ - 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_MIX; - goto fail; - } - - ev = samba_tevent_context_init(frame); - if (ev == NULL) { - goto fail; - } - - req = smb1cli_trans_send(frame, ev, conn, trans_cmd, - additional_flags, clear_flags, - additional_flags2, clear_flags2, - timeout_msec, - pid, tcon, session, - pipe_name, fid, function, flags, - setup, num_setup, max_setup, - param, num_param, max_param, - data, num_data, max_data); - if (req == NULL) { - goto fail; - } - - if (!tevent_req_poll_ntstatus(req, ev, &status)) { - goto fail; - } - - status = smb1cli_trans_recv(req, mem_ctx, recv_flags2, - rsetup, min_rsetup, num_rsetup, - rparam, min_rparam, num_rparam, - rdata, min_rdata, num_rdata); - fail: - TALLOC_FREE(frame); - return status; -} diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index e4e7ab180eb..e88a866c6ac 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -229,23 +229,6 @@ NTSTATUS smb1cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, uint32_t *num_param, uint8_t **data, uint32_t min_data, uint32_t *num_data); -NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn, - uint8_t trans_cmd, - uint8_t additional_flags, uint8_t clear_flags, - uint16_t additional_flags2, uint16_t clear_flags2, - uint32_t timeout_msec, - uint32_t pid, - struct smbXcli_tcon *tcon, - struct smbXcli_session *session, - const char *pipe_name, uint16_t fid, uint16_t function, - int flags, - uint16_t *setup, uint8_t num_setup, uint8_t max_setup, - uint8_t *param, uint32_t num_param, uint32_t max_param, - uint8_t *data, uint32_t num_data, uint32_t max_data, - uint16_t *recv_flags2, - uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup, - uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam, - uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata); struct tevent_req *smb1cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -254,8 +237,6 @@ struct tevent_req *smb1cli_echo_send(TALLOC_CTX *mem_ctx, uint16_t num_echos, DATA_BLOB data); NTSTATUS smb1cli_echo_recv(struct tevent_req *req); -NTSTATUS smb1cli_echo(struct smbXcli_conn *conn, uint32_t timeout_msec, - uint16_t num_echos, DATA_BLOB data); struct tevent_req *smb1cli_session_setup_lm21_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c index 9d22dafeb63..bc48c9d8e2e 100644 --- a/source3/lib/adouble.c +++ b/source3/lib/adouble.c @@ -553,16 +553,13 @@ static bool ad_pack_xattrs(struct vfs_handle_struct *handle, oldsize = talloc_get_size(ad->ad_data); if (oldsize < AD_XATTR_MAX_HDR_SIZE) { - ad->ad_data = talloc_realloc(ad, - ad->ad_data, - char, - AD_XATTR_MAX_HDR_SIZE); + ad->ad_data = talloc_realloc_zero(ad, + ad->ad_data, + char, + AD_XATTR_MAX_HDR_SIZE); if (ad->ad_data == NULL) { return false; } - memset(ad->ad_data + oldsize, - 0, - AD_XATTR_MAX_HDR_SIZE - oldsize); } /* diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 49fa1d47298..862ac6e18e4 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2871,12 +2871,14 @@ ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, } /* Make sure to NULL terminate the array */ - spn_array = talloc_realloc(ctx, spn_array, const char *, num_spns + 1); + spn_array = talloc_realloc_zero(ctx, + spn_array, + const char *, + num_spns + 1); if (spn_array == NULL) { ret = ADS_ERROR(LDAP_NO_MEMORY); goto done; } - spn_array[num_spns] = NULL; controlstr = talloc_asprintf(ctx, "%u", acct_control); if (controlstr == NULL) { diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index cbbd1208e04..ce2b1552f47 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -98,7 +98,7 @@ static NTSTATUS map_smb2_handle_to_fnum(struct cli_state *cli, return NT_STATUS_NO_MEMORY; } - *pfnum = (uint16_t)ret; + *pfnum = ret; return NT_STATUS_OK; } @@ -111,14 +111,16 @@ static NTSTATUS map_fnum_to_smb2_handle(struct cli_state *cli, struct smb2_hnd **pph) /* Out */ { struct idr_context *idp = cli->smb2.open_handles; + void *ph = NULL; if (idp == NULL) { return NT_STATUS_INVALID_PARAMETER; } - *pph = (struct smb2_hnd *)idr_find(idp, fnum); - if (*pph == NULL) { + ph = idr_find(idp, fnum); + if (ph == NULL) { return NT_STATUS_INVALID_HANDLE; } + *pph = talloc_get_type_abort(ph, struct smb2_hnd); return NT_STATUS_OK; } diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 116f746d37e..c7c22c18810 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -2028,8 +2028,7 @@ static void cli_tcon_andx_done(struct tevent_req *subreq) } } else { cli->dev = talloc_strdup(cli, ""); - if (cli->dev == NULL) { - tevent_req_nterror(req, NT_STATUS_NO_MEMORY); + if (tevent_req_nomem(cli->dev, req)) { return; } } @@ -3446,7 +3445,9 @@ static void cli_full_connection_creds_enc_start(struct tevent_req *req) "SMB3 encryption - failing connect\n"); tevent_req_nterror(req, status); return; - } else if (!NT_STATUS_IS_OK(status)) { + } + + if (!NT_STATUS_IS_OK(status)) { d_printf("Encryption required and " "setup failed with error %s.\n", nt_errstr(status)); diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c index 32558c148c9..e6c31cfb49f 100644 --- a/source3/libsmb/clisecdesc.c +++ b/source3/libsmb/clisecdesc.c @@ -69,7 +69,8 @@ struct tevent_req *cli_query_security_descriptor_send( return req; } - PUSH_LE_U32(state->param, 0, fnum); + PUSH_LE_U16(state->param, 0, fnum); + /* 2 bytes reserved, set to 0 by tevent_req_create */ PUSH_LE_U32(state->param, 4, sec_info); subreq = cli_trans_send( @@ -268,8 +269,9 @@ struct tevent_req *cli_set_security_descriptor_send( return req; } - SIVAL(state->param, 0, fnum); - SIVAL(state->param, 4, sec_info); + PUSH_LE_U16(state->param, 0, fnum); + /* 2 bytes reserved, set to 0 by tevent_req_create */ + PUSH_LE_U32(state->param, 4, sec_info); subreq = cli_trans_send( state, /* mem_ctx */ diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index 97633317903..d3394d03be6 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -51,76 +51,81 @@ static NTSTATUS make_dc_info_from_cldap_reply( /**************************************************************** ****************************************************************/ -static void debug_dsdcinfo_flags(int lvl, uint32_t flags) +static char *dsdcinfo_flags_str(TALLOC_CTX *mem_ctx, uint32_t flags) { - DEBUG(lvl,("debug_dsdcinfo_flags: 0x%08x\n\t", flags)); + char *s = NULL; + + s = talloc_asprintf(mem_ctx, "0x%08x\n\t", flags); if (flags & DS_FORCE_REDISCOVERY) -- Samba Shared Repository