The branch, master has been updated via 0a93f5367bc s3:smbd: Fix invalid memory access in posix_sys_acl_blob_get_fd() via 9d82f90b264 selftest: Disable detection of ODR violations via 878b4a71aa9 s3:libsmb: Use C99 initializer for py_cli_notify_state_methods via 53012b105ed lib:krb5_wrap: Check the format string of krb5_warnx() via 5d1eef269a1 lib:texpect: Check the format string of err() via a47fdd9ebb1 libndr: Use better and more clear check for empty flags via 0d985d5f8e3 s3:printing: Correctly mark fall through switch statements via 546dbf6c92d s4:registry: Mark fall through switch statement via 3c4dd384a13 s4:registry: Add missing break in switch statement via a8782009343 s4:ntvfs: Add missing break in switch statement via a531f834942 s3:smbd: Add missing break in switch statement via b549fdb6daf s3:rpcclient: Add missing break in switch statement via 4b398bb4760 s4:rpc_server: Add missing break in switch statement via e8fb2378bdd s3:printing: Add missing break in switch statement via 16088d6cab2 s3:lib: Add missing break in switch statement via 1ffacac547a lib:ldb: Add missing break in switch statement via 02fe2d050d9 s4:gensec: Fix overflow issues in switch statement from 1e79ff444e1 s3: smbd: Add missing lock free and file close in error path.
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 0a93f5367bc55ee14f13da5bdb812333c9d9e9f3 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 12:03:17 2021 +0100 s3:smbd: Fix invalid memory access in posix_sys_acl_blob_get_fd() We are handing down an out of scope buffer. Found by AddressSanitizer. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14627 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Mon Feb 1 22:55:10 UTC 2021 on sn-devel-184 commit 9d82f90b264e5918fe9f9a483cd472fc9f95aae1 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 12:06:16 2021 +0100 selftest: Disable detection of ODR violations Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 878b4a71aa9c97ef247feccf9c4ea818d33d62d6 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 19:49:18 2021 +0100 s3:libsmb: Use C99 initializer for py_cli_notify_state_methods error: missing field 'ml_meth' initializer [-Werror,-Wmissing-field-initializers] { NULL } ^ Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 53012b105edf96721500a9d29635eed9ae2a82de Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:32:25 2021 +0100 lib:krb5_wrap: Check the format string of krb5_warnx() error: format string is not a string literal [-Werror,-Wformat-nonliteral] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5d1eef269a1f56d08aa4456e3bf66622515f5c5e Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:30:15 2021 +0100 lib:texpect: Check the format string of err() error: format string is not a string literal [-Werror,-Wformat-nonliteral] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a47fdd9ebb19f2d4b874808b5fbda19dce950021 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:20:18 2021 +0100 libndr: Use better and more clear check for empty flags warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 0d985d5f8e338c975ba020ad06bb244ac8a85e76 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:16:25 2021 +0100 s3:printing: Correctly mark fall through switch statements Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 546dbf6c92d19bd8712e47ca990abce2e110f96d Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 14:35:34 2021 +0100 s4:registry: Mark fall through switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3c4dd384a138ff5bd2bef7829b1dd269e5f1bffd Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 14:36:57 2021 +0100 s4:registry: Add missing break in switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a87820093431ac1b5940c7b010553af9cbfced22 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:18:39 2021 +0100 s4:ntvfs: Add missing break in switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a531f8349422e0d85cc9ee3d0a43b3e94803db2f Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:15:08 2021 +0100 s3:smbd: Add missing break in switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit b549fdb6daf630b5fc23cabcd20d3402e35e2c6d Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 19:50:27 2021 +0100 s3:rpcclient: Add missing break in switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4b398bb47606fe5797ca840b92ca55d6930126b1 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:19:51 2021 +0100 s4:rpc_server: Add missing break in switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e8fb2378bdd7a7acf6edd7415a1fcfde2d6b5604 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:17:29 2021 +0100 s3:printing: Add missing break in switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 16088d6cab2e10252c1904b259eb6b4f69d74692 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 18:13:10 2021 +0100 s3:lib: Add missing break in switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1ffacac547a8ce29c6696dda73991a8db7e34dfd Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 14:21:21 2021 +0100 lib:ldb: Add missing break in switch statement error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 02fe2d050d91a9571345eb4c03f170a98292d971 Author: Andreas Schneider <a...@samba.org> Date: Mon Feb 1 14:33:55 2021 +0100 s4:gensec: Fix overflow issues in switch statement error: overflow converting case value to switch condition type (-1765328344 to 2529638952) [-Werror,-Wswitch] Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/krb5_wrap/krb5_samba.h | 3 ++- lib/ldb/ldb_map/ldb_map_inbound.c | 1 + lib/texpect/texpect.c | 3 +++ librpc/ndr/libndr.h | 2 +- selftest/wscript | 4 ++-- source3/lib/id_cache.c | 1 + source3/libsmb/pylibsmb.c | 26 +++++++++++++++----------- source3/printing/lpq_parse.c | 4 ++-- source3/printing/nt_printing_tdb.c | 1 + source3/registry/reg_parse.c | 1 + source3/registry/reg_parse_internal.c | 1 + source3/rpcclient/cmd_netlogon.c | 1 + source3/smbd/posix_acls.c | 2 +- source3/smbd/trans2.c | 1 + source4/auth/gensec/gensec_gssapi.c | 10 +++++----- source4/ntvfs/posix/pvfs_fsinfo.c | 1 + source4/rpc_server/netlogon/dcerpc_netlogon.c | 1 + 17 files changed, 40 insertions(+), 23 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h index ca9a893e4f7..9550447b2c5 100644 --- a/lib/krb5_wrap/krb5_samba.h +++ b/lib/krb5_wrap/krb5_samba.h @@ -389,7 +389,8 @@ int smb_krb5_principal_get_type(krb5_context context, krb5_const_principal principal); #if !defined(HAVE_KRB5_WARNX) -krb5_error_code krb5_warnx(krb5_context context, const char *fmt, ...); +krb5_error_code krb5_warnx(krb5_context context, const char *fmt, ...) + PRINTF_ATTRIBUTE(2, 0); #endif krb5_error_code smb_krb5_cc_copy_creds(krb5_context context, diff --git a/lib/ldb/ldb_map/ldb_map_inbound.c b/lib/ldb/ldb_map/ldb_map_inbound.c index 861c4c1622d..324295737da 100644 --- a/lib/ldb/ldb_map/ldb_map_inbound.c +++ b/lib/ldb/ldb_map/ldb_map_inbound.c @@ -262,6 +262,7 @@ static int map_search_self_callback(struct ldb_request *req, struct ldb_reply *a LDB_ERR_OPERATIONS_ERROR); } + break; default: /* ignore referrals */ break; diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c index 8c9431e366e..5657efa44d1 100644 --- a/lib/texpect/texpect.c +++ b/lib/texpect/texpect.c @@ -59,6 +59,9 @@ #else const char progname[] = "unknown program"; +static void err(int eval, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 0); +static void errx(int eval, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 0); + static void err(int eval, const char *fmt, ...) { int err_errno = errno; diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index fd772b9b510..25b68db3466 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -415,7 +415,7 @@ enum ndr_compression_alg { #define NDR_PULL_GET_MEM_CTX(ndr) (ndr->current_mem_ctx) #define NDR_PULL_SET_MEM_CTX(ndr, mem_ctx, flgs) do {\ - if ( !(flgs) || (ndr->flags & flgs) ) {\ + if ( (flgs == 0) || (ndr->flags & flgs) ) {\ if (!(mem_ctx)) {\ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "NDR_PULL_SET_MEM_CTX(NULL): %s\n", __location__); \ }\ diff --git a/selftest/wscript b/selftest/wscript index 60297045078..afb1fa936cd 100644 --- a/selftest/wscript +++ b/selftest/wscript @@ -296,8 +296,8 @@ def cmd_testonly(opt): env.CORE_COMMAND = 'unshare --net --user --map-root-user ' + env.CORE_COMMAND if env.ADDRESS_SANITIZER: - # For now we cannot run with leak detection - no_leak_check = "ASAN_OPTIONS=detect_leaks=0 " + # For now we cannot run with leak and odr detection + no_leak_check = "ASAN_OPTIONS=detect_leaks=0:detect_odr_violation=0 " # And we need to disable RTLD_DEEPBIND in ldb and socket wrapper no_leak_check += "LDB_MODULES_DISABLE_DEEPBIND=1 " no_leak_check += "SOCKET_WRAPPER_DISABLE_DEEP_BIND=1" diff --git a/source3/lib/id_cache.c b/source3/lib/id_cache.c index 3a703ae4af3..adf6ccd6bb7 100644 --- a/source3/lib/id_cache.c +++ b/source3/lib/id_cache.c @@ -87,6 +87,7 @@ void id_cache_delete_from_cache(const struct id_cache_ref* id) break; case USERNAME: delete_getpwnam_cache(id->id.name); + break; default: break; } diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index 510dd3185d8..45abbec14d2 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -1344,18 +1344,22 @@ static PyObject *py_cli_notify_get_changes(struct py_cli_notify_state *self, } static PyMethodDef py_cli_notify_state_methods[] = { - { "get_changes", - (PyCFunction)py_cli_notify_get_changes, - METH_VARARGS|METH_KEYWORDS, - "Wait for change notifications: \n" - "N.get_changes(wait=BOOLEAN) -> " - "change notifications as a dictionary\n" - "\t\tList contents of a directory. The keys are, \n" - "\t\t\tname: name of changed object\n" - "\t\t\taction: type of the change\n" - "None is returned if there's no response jet and wait=False is passed" + { + .ml_name = "get_changes", + .ml_meth = (PyCFunction)py_cli_notify_get_changes, + .ml_flags = METH_VARARGS|METH_KEYWORDS, + .ml_doc = "Wait for change notifications: \n" + "N.get_changes(wait=BOOLEAN) -> " + "change notifications as a dictionary\n" + "\t\tList contents of a directory. The keys are, \n" + "\t\t\tname: name of changed object\n" + "\t\t\taction: type of the change\n" + "None is returned if there's no response jet and " + "wait=False is passed" }, - { NULL } + { + .ml_name = NULL + } }; static PyTypeObject py_cli_notify_state_type = { diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index d7a63a59f27..f016707c088 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -1131,7 +1131,7 @@ bool parse_lpq_entry(enum printing_types printing_type,char *line, return ret; } } - /* fallthrough */ + FALL_THROUGH; case LPSTAT_STOPPED: for (i=0; stat1_strings[i]; i++) { if (strstr_m(line,stat1_strings[i])) { @@ -1140,7 +1140,7 @@ bool parse_lpq_entry(enum printing_types printing_type,char *line, return ret; } } - /* fallthrough */ + FALL_THROUGH; case LPSTAT_ERROR: for (i=0; stat2_strings[i]; i++) { if (strstr_m(line,stat2_strings[i])) { diff --git a/source3/printing/nt_printing_tdb.c b/source3/printing/nt_printing_tdb.c index 7db3c073a2b..eddefe59e72 100644 --- a/source3/printing/nt_printing_tdb.c +++ b/source3/printing/nt_printing_tdb.c @@ -210,6 +210,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key, case READ_CONTROL_ACCESS: sec->dacl->aces[i].access_mask = PRINTER_ACE_MANAGE_DOCUMENTS; + break; default: /* no change */ break; } diff --git a/source3/registry/reg_parse.c b/source3/registry/reg_parse.c index 24e9b62a516..6230b000c3b 100644 --- a/source3/registry/reg_parse.c +++ b/source3/registry/reg_parse.c @@ -121,6 +121,7 @@ static bool act_val_hex(struct reg_parse* p, cbuf* value, bool cont) } talloc_free(dst); } + break; default: break; } diff --git a/source3/registry/reg_parse_internal.c b/source3/registry/reg_parse_internal.c index aa5bc92c5df..8f0ab92b315 100644 --- a/source3/registry/reg_parse_internal.c +++ b/source3/registry/reg_parse_internal.c @@ -381,6 +381,7 @@ int cbuf_puts_case(cbuf* s, const char* str, size_t len, enum fmt_case fmt) case FMT_CASE_TITLE: *ptr = toupper(*ptr); ptr++; + FALL_THROUGH; case FMT_CASE_LOWER: while(*ptr != '\0') { *ptr = tolower(*ptr); diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index d5c1b91f2be..18e1862ebaa 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -102,6 +102,7 @@ static WERROR cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, break; case NETLOGON_CONTROL_SET_DBFLAG: data.debug_level = atoi(domain); + break; default: break; } diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 041305d4aec..c1d5b7cd047 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -4651,12 +4651,12 @@ int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle, TALLOC_CTX *frame; struct smb_acl_wrapper acl_wrapper = { 0 }; int fd = fsp_get_pathref_fd(fsp); + char buf[PATH_MAX] = {0}; struct smb_filename fname; int ret; if (fsp->fsp_flags.have_proc_fds) { const char *proc_fd_path = NULL; - char buf[PATH_MAX]; proc_fd_path = sys_proc_fd_path(fd, buf, sizeof(buf)); if (proc_fd_path == NULL) { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index ba19fd2897b..6dbbe9cd7f1 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -6378,6 +6378,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd return; } lock_data_count = total_data; + break; } default: break; diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c index 2a261a1664f..16520004415 100644 --- a/source4/auth/gensec/gensec_gssapi.c +++ b/source4/auth/gensec/gensec_gssapi.c @@ -764,27 +764,27 @@ init_sec_context_done: } else if (smb_gss_oid_equal(gensec_gssapi_state->gss_oid, gss_mech_krb5)) { switch (min_stat) { - case KRB5KRB_AP_ERR_TKT_NYV: + case (OM_uint32)KRB5KRB_AP_ERR_TKT_NYV: DEBUG(1, ("Error with ticket to contact %s: possible clock skew between us and the KDC or target server: %s\n", gensec_gssapi_state->target_principal, gssapi_error_string(out_mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid))); return NT_STATUS_TIME_DIFFERENCE_AT_DC; /* Make SPNEGO ignore us, we can't go any further here */ - case KRB5KRB_AP_ERR_TKT_EXPIRED: + case (OM_uint32)KRB5KRB_AP_ERR_TKT_EXPIRED: DEBUG(1, ("Error with ticket to contact %s: ticket is expired, possible clock skew between us and the KDC or target server: %s\n", gensec_gssapi_state->target_principal, gssapi_error_string(out_mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid))); return NT_STATUS_INVALID_PARAMETER; /* Make SPNEGO ignore us, we can't go any further here */ - case KRB5_KDC_UNREACH: + case (OM_uint32)KRB5_KDC_UNREACH: DEBUG(3, ("Cannot reach a KDC we require in order to obtain a ticket to %s: %s\n", gensec_gssapi_state->target_principal, gssapi_error_string(out_mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid))); return NT_STATUS_NO_LOGON_SERVERS; /* Make SPNEGO ignore us, we can't go any further here */ - case KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN: + case (OM_uint32)KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN: DEBUG(3, ("Server %s is not registered with our KDC: %s\n", gensec_gssapi_state->target_principal, gssapi_error_string(out_mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid))); return NT_STATUS_INVALID_PARAMETER; /* Make SPNEGO ignore us, we can't go any further here */ - case KRB5KRB_AP_ERR_MSG_TYPE: + case (OM_uint32)KRB5KRB_AP_ERR_MSG_TYPE: /* garbage input, possibly from the auto-mech detection */ return NT_STATUS_INVALID_PARAMETER; default: diff --git a/source4/ntvfs/posix/pvfs_fsinfo.c b/source4/ntvfs/posix/pvfs_fsinfo.c index 35256fe69d1..c355c19b300 100644 --- a/source4/ntvfs/posix/pvfs_fsinfo.c +++ b/source4/ntvfs/posix/pvfs_fsinfo.c @@ -102,6 +102,7 @@ NTSTATUS pvfs_fsinfo(struct ntvfs_module_context *ntvfs, if (sys_fsusage(pvfs->base_directory, &blocks_free, &blocks_total) == -1) { return pvfs_map_errno(pvfs, errno); } + break; default: break; } diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index ac8f2eab657..c87375c16a5 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -1171,6 +1171,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogon_base_call(struct dcesrv_netr_LogonSamL user_info->netlogon_trust_account.sid = creds->sid; + break; default: /* We do not need to set up the user_info in this case */ break; -- Samba Shared Repository