The branch, master has been updated via d86f9ff7fdd smbd: Simplify callers of notify_filter_string via a37ea9d750e smbd: Simplify notify_filter_string via 6e7a1cc6467 smbd: Modernize a DEBUG via 6d0444a7bfb lib: Align an integer type via fc0c605aac6 smbd: Simplify smbd_do_qfilepathinfo() via 4af84350bd2 lib: Avoid an includes.h via 1b47fae676b lib: Move 286 bytes from R/W data to R/O text segment via 3f2e45aa163 tdb: Update times in tdb_transaction_commit per fd, not per name via 06aff34586d smbd: Fix DEBUG messages via 1cea29c3987 credentials: Protect the cred's nt hash with talloc_keep_secret via 3c84a84fff1 spnego: Fix typos via 2b06123a9b6 gensec: Fix whitespace via 9be7dbd9c47 gse: Simplify gse_errstr() with talloc_asprintf_addbuf() via 221ef3ca865 gse: Avoid explicit ZERO_STRUCT in gse_errstr() via 7fba822817a libsmb: "clang-format" for an if-condition via 7f935e27749 lib: Remove pointless \ line endings via 4f64e455f6f tdb: Fix a typo via f3934fb9d09 heimdal_build: Fix whitespace via 8a7aad7fe0f torture4: Fix some whitespace from cfb81b0c313 packaging: Add missing quotes in smbprint
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit d86f9ff7fdd042b76cf03cd84668c98391652f5e Author: Volker Lendecke <v...@samba.org> Date: Thu Jun 20 20:25:24 2024 +0200 smbd: Simplify callers of notify_filter_string This is exactly the application talloc_tos() was made for Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Mon Jun 24 17:27:04 UTC 2024 on atb-devel-224 commit a37ea9d750e1fcfc9e87ab747776bcc9cd70d568 Author: Volker Lendecke <v...@samba.org> Date: Thu Jun 20 20:19:52 2024 +0200 smbd: Simplify notify_filter_string Just a single NULL check through talloc_asprintf_addbuf Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6e7a1cc646786a51cedbdb971bf7b17b34eff652 Author: Volker Lendecke <v...@samba.org> Date: Thu Jun 20 20:06:44 2024 +0200 smbd: Modernize a DEBUG Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6d0444a7bfbf25241d7a7045b9ba9290fbc98c5f Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 17 12:45:32 2024 +0200 lib: Align an integer type Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit fc0c605aac64a4ec41b74ccfbb035075910268e3 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 17 15:24:57 2024 +0200 smbd: Simplify smbd_do_qfilepathinfo() Use fsctl_get_reparse_tag() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4af84350bd2ca3177f4153229565892383c8992c Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 10 14:32:27 2024 +0200 lib: Avoid an includes.h Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1b47fae676b59d99e601e208ad365c152bd1e970 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 10 16:08:04 2024 +0200 lib: Move 286 bytes from R/W data to R/O text segment Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3f2e45aa163bfb7c0b3c459f82d2677a9cd8a443 Author: Volker Lendecke <v...@samba.org> Date: Fri Jun 14 17:48:52 2024 +0200 tdb: Update times in tdb_transaction_commit per fd, not per name We might have a relative filename in tdb->name, so we might do the wrong thing here. And as we have the fd, why not use it... We call futimens in vfs_default without #ifdef and it's Posix 2018 or before. So I don't think we need to check for it. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 06aff34586d154cb183235c8775a59798b329b6c Author: Volker Lendecke <v...@samba.org> Date: Fri Jun 14 18:28:10 2024 +0200 smbd: Fix DEBUG messages Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1cea29c39874ec0c04b95966cb0889cee475f26c Author: Volker Lendecke <v...@samba.org> Date: Fri May 24 17:16:14 2024 +0200 credentials: Protect the cred's nt hash with talloc_keep_secret This avoids the need for an explict ZERO_STRUCT before TALLOC_FREE Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3c84a84fff15500b6bbbfbbf29d2114bc3c7fed4 Author: Volker Lendecke <v...@samba.org> Date: Thu May 30 14:06:39 2024 +0200 spnego: Fix typos Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2b06123a9b64f9a8b5015f107cb082ac12807fa0 Author: Volker Lendecke <v...@samba.org> Date: Thu May 30 14:04:51 2024 +0200 gensec: Fix whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9be7dbd9c470493dfceb3647ac57cb42d78749b5 Author: Volker Lendecke <v...@samba.org> Date: Wed May 29 17:27:11 2024 +0200 gse: Simplify gse_errstr() with talloc_asprintf_addbuf() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 221ef3ca865e50eb4e75933caea68aa221e70222 Author: Volker Lendecke <v...@samba.org> Date: Wed May 29 17:25:54 2024 +0200 gse: Avoid explicit ZERO_STRUCT in gse_errstr() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 7fba822817a1c0b30263058679a72ba13ffa1fb3 Author: Volker Lendecke <v...@samba.org> Date: Fri May 31 11:42:45 2024 +0200 libsmb: "clang-format" for an if-condition Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 7f935e27749b384e8bd324ba0051204f367d4ba9 Author: Volker Lendecke <v...@samba.org> Date: Fri May 31 11:41:28 2024 +0200 lib: Remove pointless \ line endings Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4f64e455f6f5b8dafac184761686af8697a3bd21 Author: Volker Lendecke <v...@samba.org> Date: Fri May 31 08:51:45 2024 +0200 tdb: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit f3934fb9d0930b152d59a5a080f8695d069b35ca Author: Volker Lendecke <v...@samba.org> Date: Mon Apr 29 13:11:36 2024 +0200 heimdal_build: Fix whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8a7aad7fe0f1bda0f79cdc891ea9b0dbfa5ccbc2 Author: Volker Lendecke <v...@samba.org> Date: Fri May 31 21:28:50 2024 +0200 torture4: Fix some whitespace Review with "git show -w" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: auth/credentials/credentials.c | 5 + auth/gensec/spnego.c | 24 ++--- auth/ntlmssp/ntlmssp_client.c | 1 - lib/tdb/common/freelist.c | 2 +- lib/tdb/common/transaction.c | 4 +- lib/util/tevent_debug.c | 4 +- source3/lib/adouble.c | 2 +- source3/lib/charcnv.c | 5 +- source3/lib/util.c | 2 +- source3/librpc/crypto/gse.c | 25 ++--- source3/smbd/dosmode.c | 9 +- source3/smbd/notify.c | 67 +++---------- source3/smbd/server.c | 4 +- source3/smbd/smb1_nttrans.c | 18 +--- source3/smbd/smb2_notify.c | 18 +--- source3/smbd/smb2_trans2.c | 10 +- source4/torture/raw/acls.c | 182 +++++++++++++++++----------------- source4/torture/raw/chkpath.c | 16 +-- source4/torture/raw/close.c | 26 ++--- source4/torture/raw/composite.c | 20 ++-- source4/torture/raw/context.c | 40 ++++---- source4/torture/raw/ioctl.c | 14 +-- source4/torture/raw/lock.c | 32 +++--- source4/torture/raw/lockbench.c | 44 ++++---- source4/torture/raw/mkdir.c | 20 ++-- source4/torture/raw/mux.c | 16 +-- source4/torture/raw/notify.c | 40 ++++---- source4/torture/raw/open.c | 48 ++++----- source4/torture/raw/openbench.c | 48 ++++----- source4/torture/raw/oplock.c | 110 ++++++++++---------- source4/torture/raw/pingpong.c | 19 ++-- source4/torture/raw/qfileinfo.c | 102 +++++++++---------- source4/torture/raw/qfsinfo.c | 60 +++++------ source4/torture/raw/raw.c | 8 +- source4/torture/raw/read.c | 30 +++--- source4/torture/raw/rename.c | 40 ++++---- source4/torture/raw/samba3hide.c | 26 ++--- source4/torture/raw/samba3misc.c | 16 +-- source4/torture/raw/search.c | 102 +++++++++---------- source4/torture/raw/seek.c | 22 ++-- source4/torture/raw/setfileinfo.c | 24 ++--- source4/torture/raw/streams.c | 20 ++-- source4/torture/raw/unlink.c | 26 ++--- third_party/heimdal_build/hdb-glue.c | 9 +- third_party/heimdal_build/kafs.h | 2 +- third_party/heimdal_build/krb5-glue.c | 8 +- third_party/heimdal_build/replace.c | 10 +- 47 files changed, 654 insertions(+), 726 deletions(-) Changeset truncated at 500 lines: diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c index d57096c5707..aade70cd2c1 100644 --- a/auth/credentials/credentials.c +++ b/auth/credentials/credentials.c @@ -604,6 +604,7 @@ _PUBLIC_ bool cli_credentials_set_password(struct cli_credentials *cred, if (nt_hash == NULL) { return false; } + talloc_keep_secret(nt_hash); converted = strhex_to_str((char *)nt_hash->hash, sizeof(nt_hash->hash), @@ -739,6 +740,7 @@ _PUBLIC_ struct samr_Password *cli_credentials_get_nt_hash(struct cli_credential if (nt_hash == NULL) { return NULL; } + talloc_keep_secret(nt_hash); if (password_is_nt_hash) { size_t password_len = strlen(password); @@ -763,6 +765,7 @@ return_hash: if (nt_hash == NULL) { return NULL; } + talloc_keep_secret(nt_hash); *nt_hash = *cred->nt_hash; @@ -788,6 +791,7 @@ _PUBLIC_ struct samr_Password *cli_credentials_get_old_nt_hash(struct cli_creden if (!nt_hash) { return NULL; } + talloc_keep_secret(nt_hash); *nt_hash = *cred->old_nt_hash; @@ -800,6 +804,7 @@ _PUBLIC_ struct samr_Password *cli_credentials_get_old_nt_hash(struct cli_creden if (!nt_hash) { return NULL; } + talloc_keep_secret(nt_hash); E_md4hash(old_password, nt_hash->hash); diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c index d63d292f168..28d2e69132b 100644 --- a/auth/gensec/spnego.c +++ b/auth/gensec/spnego.c @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. RFC2478 Compliant SPNEGO implementation @@ -66,11 +66,11 @@ struct spnego_neg_ops { const char *name; /* * The start hook does the initial processing on the incoming packet and - * may starts the first possible subcontext. It indicates that + * may start the first possible subcontext. It indicates that * gensec_update() is required on the subcontext by returning * NT_STATUS_MORE_PROCESSING_REQUIRED and return something useful in * 'in_next'. Note that 'in_mem_ctx' is just passed as a hint, the - * caller should treat 'in_next' as const and don't attempt to free the + * caller should treat 'in_next' as const and not attempt to free the * content. NT_STATUS_OK indicates the finish hook should be invoked * directly within the need of gensec_update() on the subcontext. * Every other error indicates an error that's returned to the caller. @@ -88,7 +88,7 @@ struct spnego_neg_ops { * gensec_update() is required on the subcontext by returning * NT_STATUS_MORE_PROCESSING_REQUIRED and return something useful in * 'in_next'. Note that 'in_mem_ctx' is just passed as a hint, the - * caller should treat 'in_next' as const and don't attempt to free the + * caller should treat 'in_next' as const and not attempt to free the * content. NT_STATUS_OK indicates the finish hook should be invoked * directly within the need of gensec_update() on the subcontext. * Every other error indicates an error that's returned to the caller. @@ -221,14 +221,14 @@ static NTSTATUS gensec_spnego_server_start(struct gensec_security *gensec_securi return NT_STATUS_OK; } -/** Fallback to another GENSEC mechanism, based on magic strings +/** Fallback to another GENSEC mechanism, based on magic strings * * This is the 'fallback' case, where we don't get SPNEGO, and have to * try all the other options (and hope they all have a magic string * they check) */ -static NTSTATUS gensec_spnego_server_try_fallback(struct gensec_security *gensec_security, +static NTSTATUS gensec_spnego_server_try_fallback(struct gensec_security *gensec_security, struct spnego_state *spnego_state, TALLOC_CTX *mem_ctx, const DATA_BLOB in) @@ -267,8 +267,8 @@ static NTSTATUS gensec_spnego_server_try_fallback(struct gensec_security *gensec spnego_state->state_position = SPNEGO_FALLBACK; - nt_status = gensec_subcontext_start(spnego_state, - gensec_security, + nt_status = gensec_subcontext_start(spnego_state, + gensec_security, &spnego_state->sub_sec_security); if (!NT_STATUS_IS_OK(nt_status)) { @@ -1098,7 +1098,7 @@ static const struct spnego_neg_ops gensec_spnego_client_negTokenTarg_ops = { .finish_fn = gensec_spnego_client_negTokenTarg_finish, }; -/** create a server negTokenTarg +/** create a server negTokenTarg * * This is the case, where the client is the first one who sends data */ @@ -1118,7 +1118,7 @@ static NTSTATUS gensec_spnego_server_response(struct spnego_state *spnego_state, spnego_out.negTokenTarg.mechListMIC = mech_list_mic; spnego_out.negTokenTarg.supportedMech = NULL; - if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { spnego_out.negTokenTarg.supportedMech = spnego_state->neg_oid; if (spnego_state->mic_requested) { spnego_out.negTokenTarg.negResult = SPNEGO_REQUEST_MIC; @@ -2185,9 +2185,9 @@ static NTSTATUS gensec_spnego_update_recv(struct tevent_req *req, return status; } -static const char *gensec_spnego_oids[] = { +static const char *gensec_spnego_oids[] = { GENSEC_OID_SPNEGO, - NULL + NULL }; static const struct gensec_security_ops gensec_spnego_security_ops = { diff --git a/auth/ntlmssp/ntlmssp_client.c b/auth/ntlmssp/ntlmssp_client.c index d8dc1d2940b..a50ff661f5f 100644 --- a/auth/ntlmssp/ntlmssp_client.c +++ b/auth/ntlmssp/ntlmssp_client.c @@ -416,7 +416,6 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, nt_hash = cli_credentials_get_nt_hash(gensec_security->credentials, mem_ctx); if (nt_hash != NULL) { - ZERO_STRUCTP(nt_hash); TALLOC_FREE(nt_hash); ntlmssp_state->use_ccache = false; } diff --git a/lib/tdb/common/freelist.c b/lib/tdb/common/freelist.c index 046c747cf9b..d6671378620 100644 --- a/lib/tdb/common/freelist.c +++ b/lib/tdb/common/freelist.c @@ -34,7 +34,7 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct tdb_record return -1; if (rec->magic == TDB_MAGIC) { - /* this happens when a app is showdown while deleting a record - we should + /* this happens when a app is shutdown while deleting a record - we should not completely fail when this happens */ TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read non-free magic 0x%x at offset=%u - fixing\n", rec->magic, off)); diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index 78bbd7ad23e..b4dec1024a0 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -1206,9 +1206,7 @@ _PUBLIC_ int tdb_transaction_commit(struct tdb_context *tdb) not be backed up (as tdb rounding to block sizes means that file size changes are quite rare too). The following forces mtime changes when a transaction completes */ -#ifdef HAVE_UTIME - utime(tdb->name, NULL); -#endif + futimens(tdb->fd, NULL); /* use a transaction cancel to free memory and remove the transaction locks */ diff --git a/lib/util/tevent_debug.c b/lib/util/tevent_debug.c index 4ec905759a1..996f49598ea 100644 --- a/lib/util/tevent_debug.c +++ b/lib/util/tevent_debug.c @@ -16,8 +16,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "includes.h" +#include "replace.h" #include <tevent.h> +#include "lib/util/debug.h" +#include "lib/util/samba_util.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_TEVENT diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c index 1e8dbc4aaf3..264e8f69013 100644 --- a/source3/lib/adouble.c +++ b/source3/lib/adouble.c @@ -210,7 +210,7 @@ static const uint32_t set_eid[] = { AD_DEV, AD_INO, AD_SYN, AD_ID }; -static char empty_resourcefork[] = { +static const char empty_resourcefork[] = { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x54, 0x68, 0x69, 0x73, 0x20, 0x72, 0x65, 0x73, diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index d00a3a3cfa0..6364329b791 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -485,9 +485,8 @@ size_t pull_string_talloc(TALLOC_CTX *ctx, "UNICODE defined"); } - if (!(flags & STR_ASCII) && \ - ((flags & STR_UNICODE || \ - (smb_flags2 & FLAGS2_UNICODE_STRINGS)))) { + if (!(flags & STR_ASCII) && + ((flags & STR_UNICODE || (smb_flags2 & FLAGS2_UNICODE_STRINGS)))) { return pull_ucs2_base_talloc(ctx, base_ptr, ppdest, diff --git a/source3/lib/util.c b/source3/lib/util.c index 29b5874d428..0deda2394f4 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1070,7 +1070,7 @@ const char *get_remote_arch_str(void) enum remote_arch_types get_remote_arch_from_str(const char *remote_arch_string) { - int i; + size_t i; for (i = 0; i < ARRAY_SIZE(remote_arch_strings); i++) { if (strcmp(remote_arch_string, remote_arch_strings[i]) == 0) { diff --git a/source3/librpc/crypto/gse.c b/source3/librpc/crypto/gse.c index f70f67957a3..a071025c6f6 100644 --- a/source3/librpc/crypto/gse.c +++ b/source3/librpc/crypto/gse.c @@ -820,15 +820,12 @@ done: static char *gse_errstr(TALLOC_CTX *mem_ctx, OM_uint32 maj, OM_uint32 min) { OM_uint32 gss_min, gss_maj; - gss_buffer_desc msg_min; - gss_buffer_desc msg_maj; + gss_buffer_desc msg_min = {}; + gss_buffer_desc msg_maj = {}; OM_uint32 msg_ctx = 0; char *errstr = NULL; - ZERO_STRUCT(msg_min); - ZERO_STRUCT(msg_maj); - gss_maj = gss_display_status(&gss_min, maj, GSS_C_GSS_CODE, GSS_C_NO_OID, &msg_ctx, &msg_maj); if (gss_maj) { @@ -837,9 +834,7 @@ static char *gse_errstr(TALLOC_CTX *mem_ctx, OM_uint32 maj, OM_uint32 min) errstr = talloc_strndup(mem_ctx, (char *)msg_maj.value, msg_maj.length); - if (!errstr) { - goto done; - } + gss_maj = gss_display_status(&gss_min, min, GSS_C_MECH_CODE, (gss_OID)discard_const(gss_mech_krb5), &msg_ctx, &msg_min); @@ -847,16 +842,10 @@ static char *gse_errstr(TALLOC_CTX *mem_ctx, OM_uint32 maj, OM_uint32 min) goto done; } - errstr = talloc_strdup_append_buffer(errstr, ": "); - if (!errstr) { - goto done; - } - errstr = talloc_strndup_append_buffer(errstr, - (char *)msg_min.value, - msg_min.length); - if (!errstr) { - goto done; - } + talloc_asprintf_addbuf(&errstr, + ": %.*s", + (int)msg_min.length, + (char *)msg_min.value); done: if (msg_min.value) { diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index fac226459ce..8b47a89dec4 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -457,10 +457,11 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn, dosattrib.info.info5.create_time = full_timespec_to_nt_time( &smb_fname->st.st_ex_btime); - DEBUG(10,("set_ea_dos_attributes: set attribute 0x%x, btime = %s on file %s\n", - (unsigned int)dosmode, - time_to_asc(convert_timespec_to_time_t(smb_fname->st.st_ex_btime)), - smb_fname_str_dbg(smb_fname) )); + DBG_DEBUG("set attribute 0x%" PRIx32 ", btime = %s on file %s\n", + dosmode, + time_to_asc(convert_timespec_to_time_t( + smb_fname->st.st_ex_btime)), + smb_fname_str_dbg(smb_fname)); ndr_err = ndr_push_struct_blob( &blob, talloc_tos(), &dosattrib, diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index d08df3c8380..c6710a84b93 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -859,81 +859,46 @@ char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32_t filter) char *result = NULL; result = talloc_strdup(mem_ctx, ""); - if (result == NULL) { - return NULL; - } if (filter & FILE_NOTIFY_CHANGE_FILE_NAME) { - result = talloc_asprintf_append(result, "FILE_NAME|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "FILE_NAME|"); } if (filter & FILE_NOTIFY_CHANGE_DIR_NAME) { - result = talloc_asprintf_append(result, "DIR_NAME|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "DIR_NAME|"); } if (filter & FILE_NOTIFY_CHANGE_ATTRIBUTES) { - result = talloc_asprintf_append(result, "ATTRIBUTES|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "ATTRIBUTES|"); } if (filter & FILE_NOTIFY_CHANGE_SIZE) { - result = talloc_asprintf_append(result, "SIZE|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "SIZE|"); } if (filter & FILE_NOTIFY_CHANGE_LAST_WRITE) { - result = talloc_asprintf_append(result, "LAST_WRITE|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "LAST_WRITE|"); } if (filter & FILE_NOTIFY_CHANGE_LAST_ACCESS) { - result = talloc_asprintf_append(result, "LAST_ACCESS|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "LAST_ACCESS|"); } if (filter & FILE_NOTIFY_CHANGE_CREATION) { - result = talloc_asprintf_append(result, "CREATION|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "CREATION|"); } if (filter & FILE_NOTIFY_CHANGE_EA) { - result = talloc_asprintf_append(result, "EA|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "EA|"); } if (filter & FILE_NOTIFY_CHANGE_SECURITY) { - result = talloc_asprintf_append(result, "SECURITY|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "SECURITY|"); } if (filter & FILE_NOTIFY_CHANGE_STREAM_NAME) { - result = talloc_asprintf_append(result, "STREAM_NAME|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "STREAM_NAME|"); } if (filter & FILE_NOTIFY_CHANGE_STREAM_SIZE) { - result = talloc_asprintf_append(result, "STREAM_SIZE|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "STREAM_SIZE|"); } if (filter & FILE_NOTIFY_CHANGE_STREAM_WRITE) { - result = talloc_asprintf_append(result, "STREAM_WRITE|"); - if (result == NULL) { - return NULL; - } + talloc_asprintf_addbuf(&result, "STREAM_WRITE|"); + } + + if (result == NULL) { + return NULL; } if (*result == '\0') return result; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index c7d5dae44f0..e9ba7be9166 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1512,7 +1512,7 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg, NULL, NULL); if (!NT_STATUS_IS_OK(status)) { - DBG_WARNING("g_lock_lock(G_LOCK_WRITE) failed: %s\n", + DBG_WARNING("g_lock_lock(G_LOCK_UPGRADE) failed: %s\n", nt_errstr(status)); DBG_ERR("smbd %s already running, refusing to start " "version %s\n", state.version, version); @@ -1536,7 +1536,7 @@ static NTSTATUS smbd_claim_version(struct messaging_context *msg, NULL, NULL); if (!NT_STATUS_IS_OK(status)) { - DBG_WARNING("g_lock_lock(G_LOCK_READ) failed: %s\n", + DBG_WARNING("g_lock_lock(G_LOCK_DOWNGRADE) failed: %s\n", nt_errstr(status)); TALLOC_FREE(ctx); return status; diff --git a/source3/smbd/smb1_nttrans.c b/source3/smbd/smb1_nttrans.c index 104d3c09656..f89cddb2501 100644 --- a/source3/smbd/smb1_nttrans.c +++ b/source3/smbd/smb1_nttrans.c @@ -1675,20 +1675,10 @@ static void call_nt_transact_notify_change(connection_struct *conn, return; } - { - char *filter_string; - - if (!(filter_string = notify_filter_string(NULL, filter))) { - reply_nterror(req,NT_STATUS_NO_MEMORY); - return; - } - - DEBUG(3,("call_nt_transact_notify_change: notify change " - "called on %s, filter = %s, recursive = %d\n", - fsp_str_dbg(fsp), filter_string, recursive)); - - TALLOC_FREE(filter_string); - } + DBG_NOTICE("notify change called on %s, filter = %s, recursive = %d\n", + fsp_str_dbg(fsp), + notify_filter_string(talloc_tos(), filter), + recursive); if((!fsp->fsp_flags.is_directory) || (conn != fsp->conn)) { reply_nterror(req, NT_STATUS_INVALID_PARAMETER); diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c index 8cccd90b3fb..2f4176f3fbb 100644 --- a/source3/smbd/smb2_notify.c +++ b/source3/smbd/smb2_notify.c @@ -240,20 +240,10 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, state->smbreq = smbreq; smbreq->async_priv = (void *)req; - if (DEBUGLEVEL >= 3) { - char *filter_string; - - filter_string = notify_filter_string(NULL, in_completion_filter); - if (tevent_req_nomem(filter_string, req)) { - return tevent_req_post(req, ev); - } - - DEBUG(3,("smbd_smb2_notify_send: notify change " - "called on %s, filter = %s, recursive = %d\n", - fsp_str_dbg(fsp), filter_string, recursive)); - - TALLOC_FREE(filter_string); - } + DBG_NOTICE("notify change called on %s, filter = %s, recursive = %d\n", + fsp_str_dbg(fsp), + notify_filter_string(talloc_tos(), in_completion_filter), + recursive); if ((!fsp->fsp_flags.is_directory) || (conn != fsp->conn)) { tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index 65940295248..32d368cedaa 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -3688,18 +3688,10 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, case SMB_FILE_ATTRIBUTE_TAG_INFORMATION: { uint32_t tag = 0; - uint8_t *data = NULL; - uint32_t datalen; -- Samba Shared Repository