From ca7cb8e8a3c8c0bd000ca278140711bfa24a812d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 18:16:43 +0200 Subject: [PATCH 01/58] s4:lib:com: Fix function declartions Signed-off-by: Andreas Schneider --- librpc/idl/dcom.idl | 2 +- source4/lib/com/classes/simple.c | 4 ++-- source4/lib/com/main.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/librpc/idl/dcom.idl b/librpc/idl/dcom.idl index e53d7b8f811..5559811be38 100644 --- a/librpc/idl/dcom.idl +++ b/librpc/idl/dcom.idl @@ -52,7 +52,7 @@ interface IUnknown [local] WERROR CreateInstance( [in,unique] MInterfacePointer *pUnknown, [in,unique] GUID *iid, - [out, iid_is(riid),unique] MInterfacePointer *ppv + [out, iid_is(riid),unique] MInterfacePointer **ppv ); [call_as(CreateInstance)] WERROR RemoteCreateInstance(); diff --git a/source4/lib/com/classes/simple.c b/source4/lib/com/classes/simple.c index 4d28a158102..54c74ce564b 100644 --- a/source4/lib/com/classes/simple.c +++ b/source4/lib/com/classes/simple.c @@ -75,7 +75,7 @@ static WERROR simpleclass_IClassFactory_CreateInstance(struct IClassFactory *d, TALLOC_CTX *mem_ctx, struct MInterfacePointer *pUnknown, struct GUID *iid, - struct MInterfacePointer *ppv) + struct MInterfacePointer **ppv) { struct IStream *ret; /* FIXME: Check whether IID == ISTREAM_IID */ @@ -84,7 +84,7 @@ static WERROR simpleclass_IClassFactory_CreateInstance(struct IClassFactory *d, ret->vtable = &simple_IStream_vtable; ret->object_data = NULL; - ppv = (struct MInterfacePointer *)ret; + *ppv = (struct MInterfacePointer *)ret; return WERR_OK; } diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c index 68a3bc6d3d3..647f32346d9 100644 --- a/source4/lib/com/main.c +++ b/source4/lib/com/main.c @@ -52,7 +52,7 @@ WERROR com_create_object(struct com_context *ctx, struct GUID *clsid, int num_if } /* Run IClassFactory::CreateInstance() */ - error = IClassFactory_CreateInstance(factory, ctx, NULL, &classfact_iid, (struct MInterfacePointer *) &iunk); + error = IClassFactory_CreateInstance(factory, ctx, NULL, &classfact_iid, (struct MInterfacePointer **)&iunk); if (!W_ERROR_IS_OK(error)) { DEBUG(3, ("Error while calling IClassFactory::CreateInstance : %s\n", win_errstr(error))); return error; @@ -64,7 +64,7 @@ WERROR com_create_object(struct com_context *ctx, struct GUID *clsid, int num_if } /* Release class object */ - IUnknown_Release(factory, ctx); + IUnknown_Release((struct IUnknown *)factory, ctx); error = WERR_OK; From 98530e32d697bbd17fe25ca21cd027df6902a854 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 16:51:39 +0200 Subject: [PATCH 02/58] lib:texpect: Avoid some compiler warnings Signed-off-by: Andreas Schneider --- lib/texpect/texpect.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c index b553de8ca5c..dd786705e8e 100644 --- a/lib/texpect/texpect.c +++ b/lib/texpect/texpect.c @@ -434,6 +434,9 @@ int main(int argc, const char **argv) switch (pid) { case -1: err(1, "Failed to fork"); + + /* Never reached */ + return 1; case 0: if(setsid()<0) @@ -448,6 +451,9 @@ int main(int argc, const char **argv) /* texpect [] */ execvp(program, program_args); err(1, "Failed to exec: %s", program); + + /* Never reached */ + return 1; default: close(slave); { @@ -462,4 +468,7 @@ int main(int argc, const char **argv) return eval_parent(pid); } + + /* Never reached */ + return 1; } From 2a3d3263deccad98fabd7e24024ddcde040c7e92 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 16:33:10 +0200 Subject: [PATCH 03/58] lib:replace: Add FALL_THROUGH support Signed-off-by: Andreas Schneider --- .ycm_extra_conf.py | 1 + lib/replace/replace.h | 9 +++++++++ lib/replace/wscript | 31 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index c96b59e373b..97122a9169e 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -47,6 +47,7 @@ '-D_XOPEN_SOURCE_EXTENDED=1', '-DAD_DC_BUILD_IS_ENABLED=1', '-DHAVE_IPV6=1', + '-DFALL_THROUGH', '-I/usr/local/include', '-I.', '-Iauth', diff --git a/lib/replace/replace.h b/lib/replace/replace.h index 128978c561e..e2a55415e04 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -922,6 +922,15 @@ void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2); #define setproctitle_init rep_setproctitle_init void rep_setproctitle_init(int argc, char *argv[], char *envp[]); #endif + +#ifndef FALL_THROUGH +# ifdef HAVE_FALLTHROUGH_ATTRIBUTE +# define FALL_THROUGH __attribute__ ((fallthrough)) +# else /* HAVE_FALLTHROUGH_ATTRIBUTE */ +# define FALL_THROUGH ((void)0) +# endif /* HAVE_FALLTHROUGH_ATTRIBUTE */ +#endif /* FALL_THROUGH */ + bool nss_wrapper_enabled(void); bool nss_wrapper_hosts_enabled(void); bool socket_wrapper_enabled(void); diff --git a/lib/replace/wscript b/lib/replace/wscript index 2c638b77212..af636358c4c 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -250,6 +250,37 @@ def configure(conf): headers='stdint.h sys/atomic.h', msg='Checking for atomic_add_32 compiler builtin') + conf.CHECK_CODE(''' + #define FALL_THROUGH __attribute__((fallthrough)) + + enum direction_e { + UP = 0, + DOWN, + }; + + int main(void) { + enum direction_e key = UP; + int i = 10; + int j = 0; + + switch (key) { + case UP: + i = 5; + FALL_THROUGH; + case DOWN: + j = i * 2; + break; + default: + break; + } + + return 0; + } + ''', + 'HAVE_FALLTHROUGH_ATTRIBUTE', + addmain=False, + msg='Checking for fallthrough attribute') + # these may be builtins, so we need the link=False strategy conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy strncpy bzero', link=False) From 9660e7a3438f75653fa44cbb784ad8aafdb7ebe4 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 18:25:46 +0200 Subject: [PATCH 04/58] lib:replace: Add FALL_THROUGH statements in strptime.c Signed-off-by: Andreas Schneider --- lib/replace/strptime.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/replace/strptime.c b/lib/replace/strptime.c index 20e5d8c39b6..bbc742277de 100644 --- a/lib/replace/strptime.c +++ b/lib/replace/strptime.c @@ -462,7 +462,8 @@ strptime_internal (rp, fmt, tm, decided, era_cnt) *decided = raw; } #endif - /* Fall through. */ + + FALL_THROUGH; case 'D': /* Match standard day format. */ if (!recursive (HERE_D_FMT)) @@ -611,7 +612,8 @@ strptime_internal (rp, fmt, tm, decided, era_cnt) *decided = raw; } #endif - /* Fall through. */ + + FALL_THROUGH; case 'T': if (!recursive (HERE_T_FMT)) return NULL; From d1ba35c08c23900a2efc4785b1d8a7db810d4691 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 15:17:21 +0200 Subject: [PATCH 05/58] lib:ldb: Add FALL_THROUGH statements in common/ldb_dn.c Signed-off-by: Andreas Schneider --- lib/ldb/common/ldb_dn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c index b23ee1734cd..dfeb600f56f 100644 --- a/lib/ldb/common/ldb_dn.c +++ b/lib/ldb/common/ldb_dn.c @@ -629,7 +629,8 @@ static bool ldb_dn_explode(struct ldb_dn *dn) l++; break; } - /* fall through */ + + FALL_THROUGH; case '\"': case '<': case '>': From d18c565c3199518d9d8a33de7ceb2951f39b9dd8 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 15:18:28 +0200 Subject: [PATCH 06/58] lib:ldb: Add FALL_THROUGH statements in ldb_map/ldb_map_inbound.c Signed-off-by: Andreas Schneider --- lib/ldb/ldb_map/ldb_map_inbound.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ldb/ldb_map/ldb_map_inbound.c b/lib/ldb/ldb_map/ldb_map_inbound.c index 461e68113ab..861c4c1622d 100644 --- a/lib/ldb/ldb_map/ldb_map_inbound.c +++ b/lib/ldb/ldb_map/ldb_map_inbound.c @@ -87,7 +87,8 @@ static int ldb_msg_el_partition(struct ldb_module *module, enum ldb_request_type el = ldb_msg_el_map_local(module, remote, map, old); break; } - /* fall through */ + + FALL_THROUGH; case LDB_MAP_IGNORE: goto local; @@ -99,7 +100,8 @@ static int ldb_msg_el_partition(struct ldb_module *module, enum ldb_request_type map->local_name); goto local; } - /* fall through */ + + FALL_THROUGH; case LDB_MAP_KEEP: case LDB_MAP_RENAME: el = ldb_msg_el_map_local(module, remote, map, old); From a9b3009d93fea4241ecc1d01f742cabbea0edc83 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 15:19:23 +0200 Subject: [PATCH 07/58] lib:ldb: Add FALL_THROUGH statements in ldb_map/ldb_map.c --- lib/ldb/ldb_map/ldb_map.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ldb/ldb_map/ldb_map.c b/lib/ldb/ldb_map/ldb_map.c index f2a86fedd45..b453dff80d2 100644 --- a/lib/ldb/ldb_map/ldb_map.c +++ b/lib/ldb/ldb_map/ldb_map.c @@ -523,7 +523,8 @@ struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, struct "used in DN!", ldb_dn_get_component_name(dn, i)); goto failed; } - /* fall through */ + + FALL_THROUGH; case LDB_MAP_KEEP: case LDB_MAP_RENAME: case LDB_MAP_RENDROP: @@ -599,7 +600,8 @@ struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, struc "used in DN!", ldb_dn_get_component_name(dn, i)); goto failed; } - /* fall through */ + + FALL_THROUGH; case LDB_MAP_KEEP: case LDB_MAP_RENAME: case LDB_MAP_RENDROP: From 5b94f817fe6c92522ea83a8c5075b12de6dfa851 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 15:20:04 +0200 Subject: [PATCH 08/58] lib:ldb: Add FALL_THROUGH statements in ldb_map/ldb_map_outbound.c Signed-off-by: Andreas Schneider --- lib/ldb/ldb_map/ldb_map_outbound.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ldb/ldb_map/ldb_map_outbound.c b/lib/ldb/ldb_map/ldb_map_outbound.c index fd25c3658da..1f1a7e80142 100644 --- a/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/lib/ldb/ldb_map/ldb_map_outbound.c @@ -330,7 +330,8 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local attr_name); return LDB_SUCCESS; } - /* fall through */ + + FALL_THROUGH; case LDB_MAP_KEEP: case LDB_MAP_RENAME: case LDB_MAP_RENDROP: From 74e4ea7b4edd44879425de3b57fa1702b5a638b2 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 15:20:57 +0200 Subject: [PATCH 09/58] lib:param: Add FALL_THROUGH statements in loadparm.c Signed-off-by: Andreas Schneider --- lib/param/loadparm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index efad4a10f03..b46700dfb54 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -2058,7 +2058,8 @@ void lpcfg_print_parameter(struct parm_struct *p, void *ptr, FILE * f) case P_CMDLIST: list_sep = " "; - /* fall through */ + + FALL_THROUGH; case P_LIST: if ((char ***)ptr && *(char ***)ptr) { char **list = *(char ***)ptr; From cebc3b23a72025adb8e683f657fb5f23f037b5d3 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 16:49:50 +0200 Subject: [PATCH 10/58] lib:util: Add FALL_THROUGH statements in substitute.c Signed-off-by: Andreas Schneider --- lib/util/substitute.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/util/substitute.c b/lib/util/substitute.c index 49adeaf178a..2c18257da25 100644 --- a/lib/util/substitute.c +++ b/lib/util/substitute.c @@ -84,6 +84,7 @@ static void string_sub2(char *s,const char *pattern, const char *insert, size_t p[i] = insert[i]; break; } + FALL_THROUGH; case '`': case '"': case '\'': @@ -98,6 +99,7 @@ static void string_sub2(char *s,const char *pattern, const char *insert, size_t * not replacing unsafe chars */ break; } + FALL_THROUGH; default: p[i] = insert[i]; } From f03b9fdad035cb337957bf659e8fe19178b0eb90 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 18:40:14 +0200 Subject: [PATCH 11/58] lib:util: Add FALL_THROUGH statements in charset/charset_macosxfs.c Signed-off-by: Andreas Schneider --- lib/util/charset/charset_macosxfs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/util/charset/charset_macosxfs.c b/lib/util/charset/charset_macosxfs.c index 895277d001a..24e21fd6d2c 100644 --- a/lib/util/charset/charset_macosxfs.c +++ b/lib/util/charset/charset_macosxfs.c @@ -457,10 +457,11 @@ static size_t macosxfs_encoding_pull( switch(result) { case kCFStringEncodingConversionSuccess: - if (*inbytesleft == srcCharsUsed) + if (*inbytesleft == srcCharsUsed) { break; - else - ; /*fall through*/ + } + + FALL_THROUGH; case kCFStringEncodingInsufficientOutputBufferLength: debug_out("String conversion: " "Output buffer too small\n"); @@ -546,10 +547,11 @@ static size_t macosxfs_encoding_push( switch(result) { case kCFStringEncodingConversionSuccess: - if (*inbytesleft/2 == srcCharsUsed) + if (*inbytesleft/2 == srcCharsUsed) { break; - else - ; /*fall through*/ + } + + FALL_THROUGH; case kCFStringEncodingInsufficientOutputBufferLength: debug_out("String conversion: " "Output buffer too small\n"); From 5f75fc10e83cf827f95ebc2281f2c2eeac042173 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 18:41:25 +0200 Subject: [PATCH 12/58] lib:util: Add FALL_THROUGH statements in util_file.c Signed-off-by: Andreas Schneider --- lib/util/util_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/util/util_file.c b/lib/util/util_file.c index ac8206008a3..499e8c46693 100644 --- a/lib/util/util_file.c +++ b/lib/util/util_file.c @@ -130,7 +130,8 @@ char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, int maxlen, FILE *f) if (start_of_line) { break; } - /* fall through */ + + FALL_THROUGH; default: start_of_line = false; s[len++] = c; From 3c228ccc7ea5e8f7db242d0a40dfe99e0b918f8a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:22:44 +0200 Subject: [PATCH 13/58] s3:lib: Add FALL_THROUGH statements in substitute_generic.c Signed-off-by: Andreas Schneider --- source3/lib/substitute_generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/lib/substitute_generic.c b/source3/lib/substitute_generic.c index f24608eb96c..0498cd03833 100644 --- a/source3/lib/substitute_generic.c +++ b/source3/lib/substitute_generic.c @@ -68,6 +68,7 @@ char *realloc_string_sub2(char *string, if (allow_trailing_dollar && (i == li - 1 )) { break; } + FALL_THROUGH; case '`': case '"': case '\'': @@ -79,6 +80,7 @@ char *realloc_string_sub2(char *string, in[i] = '_'; break; } + FALL_THROUGH; default: /* ok */ break; From 4fdad3ccad03668aac990728c3668d0b3be9fa1e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 16:57:38 +0200 Subject: [PATCH 14/58] s3:lib: Add FALL_THROUGH statements in util_path.c Signed-off-by: Andreas Schneider --- source3/lib/util_path.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source3/lib/util_path.c b/source3/lib/util_path.c index 6f58a03ae58..5b133dfdc78 100644 --- a/source3/lib/util_path.c +++ b/source3/lib/util_path.c @@ -204,16 +204,20 @@ char *canonicalize_absolute_path(TALLOC_CTX *ctx, const char *abs_path) switch(siz) { case 5: *d++ = *s++; - /*fall through*/ + + FALL_THROUGH; case 4: *d++ = *s++; - /*fall through*/ + + FALL_THROUGH; case 3: *d++ = *s++; - /*fall through*/ + + FALL_THROUGH; case 2: *d++ = *s++; - /*fall through*/ + + FALL_THROUGH; case 1: *d++ = *s++; break; From 5efaa64be81242c7d37f491e876fe4334a741d27 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:25:20 +0200 Subject: [PATCH 15/58] s3:lib: Add FALL_THROUGH statements in util_str.c Signed-off-by: Andreas Schneider --- source3/lib/util_str.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 48e434f777e..eb36478d8a2 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -276,6 +276,8 @@ char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src, if (allow_trailing_dollar && (i == li - 1 )) { break; } + + FALL_THROUGH; case '`': case '"': case '\'': @@ -287,6 +289,8 @@ char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src, in[i] = '_'; break; } + + FALL_THROUGH; default: /* ok */ break; From 98c8f62c318b6af782b1685ea56083e445a36eb4 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 16:55:10 +0200 Subject: [PATCH 16/58] lib:tdb: Add FALL_THROUGH statements in hash.c Signed-off-by: Andreas Schneider --- lib/tdb/common/hash.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/tdb/common/hash.c b/lib/tdb/common/hash.c index 1eed7221d2a..4de7ba94d2c 100644 --- a/lib/tdb/common/hash.c +++ b/lib/tdb/common/hash.c @@ -232,16 +232,16 @@ static uint32_t hashlittle( const void *key, size_t length ) switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ + case 11: c+=((uint32_t)k8[10])<<16; FALL_THROUGH; + case 10: c+=((uint32_t)k8[9])<<8; FALL_THROUGH; + case 9 : c+=k8[8]; FALL_THROUGH; case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ + case 7 : b+=((uint32_t)k8[6])<<16; FALL_THROUGH; + case 6 : b+=((uint32_t)k8[5])<<8; FALL_THROUGH; + case 5 : b+=k8[4]; FALL_THROUGH; case 4 : a+=k[0]; break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ + case 3 : a+=((uint32_t)k8[2])<<16; FALL_THROUGH; + case 2 : a+=((uint32_t)k8[1])<<8; FALL_THROUGH; case 1 : a+=k8[0]; break; case 0 : return c; } @@ -268,23 +268,23 @@ static uint32_t hashlittle( const void *key, size_t length ) b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ + case 11: c+=((uint32_t)k8[10])<<16; FALL_THROUGH; case 10: c+=k[4]; b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; - case 9 : c+=k8[8]; /* fall through */ + case 9 : c+=k8[8]; FALL_THROUGH; case 8 : b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ + case 7 : b+=((uint32_t)k8[6])<<16; FALL_THROUGH; case 6 : b+=k[2]; a+=k[0]+(((uint32_t)k[1])<<16); break; - case 5 : b+=k8[4]; /* fall through */ + case 5 : b+=k8[4]; FALL_THROUGH; case 4 : a+=k[0]+(((uint32_t)k[1])<<16); break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ + case 3 : a+=((uint32_t)k8[2])<<16; FALL_THROUGH; case 2 : a+=k[0]; break; case 1 : a+=k8[0]; @@ -316,19 +316,19 @@ static uint32_t hashlittle( const void *key, size_t length ) } /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ + switch(length) { - case 12: c+=((uint32_t)k[11])<<24; - case 11: c+=((uint32_t)k[10])<<16; - case 10: c+=((uint32_t)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32_t)k[7])<<24; - case 7 : b+=((uint32_t)k[6])<<16; - case 6 : b+=((uint32_t)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32_t)k[3])<<24; - case 3 : a+=((uint32_t)k[2])<<16; - case 2 : a+=((uint32_t)k[1])<<8; + case 12: c+=((uint32_t)k[11])<<24; FALL_THROUGH; + case 11: c+=((uint32_t)k[10])<<16; FALL_THROUGH; + case 10: c+=((uint32_t)k[9])<<8; FALL_THROUGH; + case 9 : c+=k[8]; FALL_THROUGH; + case 8 : b+=((uint32_t)k[7])<<24; FALL_THROUGH; + case 7 : b+=((uint32_t)k[6])<<16; FALL_THROUGH; + case 6 : b+=((uint32_t)k[5])<<8; FALL_THROUGH; + case 5 : b+=k[4]; FALL_THROUGH; + case 4 : a+=((uint32_t)k[3])<<24; FALL_THROUGH; + case 3 : a+=((uint32_t)k[2])<<16; FALL_THROUGH; + case 2 : a+=((uint32_t)k[1])<<8; FALL_THROUGH; case 1 : a+=k[0]; break; case 0 : return c; From ba2003968367eb9d51bf26fb88fb4ea0a11d1f7d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 16:58:00 +0200 Subject: [PATCH 17/58] lib:tdb: Add FALL_THROUGH statements in tdbtool.c Signed-off-by: Andreas Schneider --- lib/tdb/tools/tdbtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c index e3535b93c7c..d8bacdb61b8 100644 --- a/lib/tdb/tools/tdbtool.c +++ b/lib/tdb/tools/tdbtool.c @@ -930,10 +930,13 @@ int main(int argc, char *argv[]) break; case 5: arg2 = tdb_convert_string(argv[4],&arg2len); + FALL_THROUGH; case 4: arg1 = tdb_convert_string(argv[3],&arg1len); + FALL_THROUGH; case 3: cmdname = argv[2]; + FALL_THROUGH; default: do_command(); break; From b5cbab65fb1c3b504f946b88094eac948064eca3 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 18:28:12 +0200 Subject: [PATCH 18/58] lib:tdb: Add FALL_THROUGH statements in common/summary.c Signed-off-by: Andreas Schneider --- lib/tdb/common/summary.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tdb/common/summary.c b/lib/tdb/common/summary.c index d786132d4a1..c9b5bc4c1d0 100644 --- a/lib/tdb/common/summary.c +++ b/lib/tdb/common/summary.c @@ -151,7 +151,8 @@ _PUBLIC_ char *tdb_summary(struct tdb_context *tdb) rec.rec_len = tdb_dead_space(tdb, off) - sizeof(rec); } - /* Fall through */ + + FALL_THROUGH; case TDB_DEAD_MAGIC: tally_add(&dead, rec.rec_len); break; From 7b94eeb92c95c315cc9d13403bdb9b7725659fa1 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:43:53 +0200 Subject: [PATCH 19/58] libgpo: Add FALL_THROUGH statements in gpo_sec.c Signed-off-by: Andreas Schneider --- libgpo/gpo_sec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libgpo/gpo_sec.c b/libgpo/gpo_sec.c index af73697e56e..98ee8eb3cc9 100644 --- a/libgpo/gpo_sec.c +++ b/libgpo/gpo_sec.c @@ -47,13 +47,15 @@ static bool gpo_sd_check_agp_object_guid(const struct security_ace_object *objec &ext_right_apg_guid)) { return true; } - /* FALL TROUGH */ + + FALL_THROUGH; case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: if (GUID_equal(&object->inherited_type.inherited_type, &ext_right_apg_guid)) { return true; } - /* FALL TROUGH */ + + FALL_THROUGH; default: break; } From f0bf24f3b287b7806e044805ca600a678a57ab58 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:03:09 +0200 Subject: [PATCH 20/58] librpc:ndr: Add FALL_THROUGH statements in ndr_cab.c Signed-off-by: Andreas Schneider --- librpc/ndr/ndr_cab.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/librpc/ndr/ndr_cab.c b/librpc/ndr/ndr_cab.c index 837ed253065..c415bfab34c 100644 --- a/librpc/ndr/ndr_cab.c +++ b/librpc/ndr/ndr_cab.c @@ -95,10 +95,13 @@ static uint32_t ndr_cab_compute_checksum(uint8_t *data, uint32_t length, uint32_ switch (length % 4) { case 3: ul |= (((uint32_t)(*pb++)) << 16); + FALL_THROUGH; case 2: ul |= (((uint32_t)(*pb++)) << 8); + FALL_THROUGH; case 1: ul |= (uint32_t)(*pb++); + FALL_THROUGH; default: break; } From ac788a56e8b51d80a5aca4898f7d08247c051a39 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:35:28 +0200 Subject: [PATCH 21/58] s3:auth: Add FALL_THROUGH statements in auth_sam.c Signed-off-by: Andreas Schneider --- source3/auth/auth_sam.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c index 4bcb7926c6e..46958c54d3a 100644 --- a/source3/auth/auth_sam.c +++ b/source3/auth/auth_sam.c @@ -88,6 +88,8 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context, ? "ROLE_DOMAIN_MEMBER" : "ROLE_STANDALONE") )); return NT_STATUS_NOT_IMPLEMENTED; } + + FALL_THROUGH; case ROLE_DOMAIN_PDC: case ROLE_DOMAIN_BDC: if ( !is_local_name && !is_my_domain ) { @@ -95,6 +97,8 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context, user_info->mapped.domain_name)); return NT_STATUS_NOT_IMPLEMENTED; } + + FALL_THROUGH; default: /* name is ok */ break; } From 5ed936f53478f388d8cdb6884457973087951610 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 16:55:23 +0200 Subject: [PATCH 22/58] s3:auth: Add FALL_THROUGH statements in pampass.c Signed-off-by: Andreas Schneider --- source3/auth/pampass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c index 1a82fe7f203..8cb894482ae 100644 --- a/source3/auth/pampass.c +++ b/source3/auth/pampass.c @@ -168,7 +168,7 @@ static int smb_pam_conv(int num_msg, break; case PAM_TEXT_INFO: - /* fall through */ + FALL_THROUGH; case PAM_ERROR_MSG: /* ignore it... */ @@ -390,7 +390,7 @@ static int smb_pam_passchange_conv(int num_msg, break; case PAM_TEXT_INFO: - /* fall through */ + FALL_THROUGH; case PAM_ERROR_MSG: /* ignore it... */ From 114f1006572a2b2ead795043d72aaf04760d3538 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:25:30 +0200 Subject: [PATCH 23/58] s3:lib: Add FALL_THROUGH statements in cbuf.c --- source3/lib/cbuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/lib/cbuf.c b/source3/lib/cbuf.c index 611aa80609f..426ecdb5a3b 100644 --- a/source3/lib/cbuf.c +++ b/source3/lib/cbuf.c @@ -278,7 +278,8 @@ int cbuf_print_quoted_string(cbuf* ost, const char* s) case '\\': cbuf_putc(ost, '\\'); n++; - /* no break */ + + FALL_THROUGH; default: cbuf_putc(ost, *s); n++; From 7eafbb35017be508096ea68da13de9690b2e60c0 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:51:08 +0200 Subject: [PATCH 24/58] s3:lib: Add FALL_THROUGH statements in sysacls.c Signed-off-by: Andreas Schneider --- source3/lib/sysacls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c index 0bf3c37edfa..c80f8f30c90 100644 --- a/source3/lib/sysacls.c +++ b/source3/lib/sysacls.c @@ -186,7 +186,8 @@ char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p) case SMB_ACL_USER: id = uidtoname(ap->info.user.uid); - /* FALL TROUGH */ + + FALL_THROUGH; case SMB_ACL_USER_OBJ: tag = "user"; break; @@ -199,7 +200,8 @@ char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p) } else { id = gr->gr_name; } - /* FALL TROUGH */ + + FALL_THROUGH; case SMB_ACL_GROUP_OBJ: tag = "group"; break; From f8b23f4155ab0e35537f1ee7613fddbba0e22ad0 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:54:48 +0200 Subject: [PATCH 25/58] s3:lib: Add FALL_THROUGH statements in util_sd.c Signed-off-by: Andreas Schneider --- source3/lib/util_sd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/lib/util_sd.c b/source3/lib/util_sd.c index aa6d4809fc8..39083b15438 100644 --- a/source3/lib/util_sd.c +++ b/source3/lib/util_sd.c @@ -394,6 +394,8 @@ static bool parse_ace_flags(const char *str, unsigned int *pflags) switch (*p) { case '|': p++; + + FALL_THROUGH; case '\0': continue; default: From c40c8b5535969ee985626353cfc3c690dee3c025 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:36:50 +0200 Subject: [PATCH 26/58] s3:libsmb: Add FALL_THROUGH statements in dsgetdcname.c Signed-off-by: Andreas Schneider --- source3/libsmb/dsgetdcname.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index 2fb9842a893..a7fe5a1e748 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -715,6 +715,8 @@ static void map_dc_and_domain_names(uint32_t flags, *domain_p = domain_name; break; } + + FALL_THROUGH; case DS_RETURN_DNS_NAME: default: if (dns_dc_name && dns_domain_name && From ca373d6dd57f4124443341f7087b8b904dca833e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:53:45 +0200 Subject: [PATCH 27/58] s3:modules: Add FALL_THROUGH statements in vfs_acl_common.c Signed-off-by: Andreas Schneider --- source3/modules/vfs_acl_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index 546e97b9b5d..b323079d08a 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -519,6 +519,7 @@ static NTSTATUS validate_nt_acl_blob(TALLOC_CTX *mem_ctx, } /* Otherwise, fall though and see if the NT ACL hash matches */ + FALL_THROUGH; } case 3: /* Get the full underlying sd for the hash From a9a42ec3c16080fe881c98f9d0504a0aa7c594be Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:50:18 +0200 Subject: [PATCH 28/58] s3:smbd: Add FALL_THROUGH statements in nttrans.c Signed-off-by: Andreas Schneider --- source3/smbd/nttrans.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 7b7f2056099..ca02dbcc3d9 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2387,6 +2387,7 @@ static void call_nt_transact_get_user_quota(connection_struct *conn, start_enum = False; + FALL_THROUGH; case TRANSACT_GET_USER_QUOTA_LIST_START: if (qt_handle->quota_list==NULL && From f5adbe3f6bdd26f1340ffc9fe86092202736dbb7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:52:06 +0200 Subject: [PATCH 29/58] s3:smbd: Add FALL_THROUGH statements in trans2.c Signed-off-by: Andreas Schneider --- source3/smbd/trans2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 512918efc89..b49c3ca7836 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -4032,7 +4032,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned SIVAL(pdata,84,0x100); /* Don't support mac... */ break; } - /* drop through */ + + FALL_THROUGH; default: return NT_STATUS_INVALID_LEVEL; } From 1ec935e4382f680b618c4f8ffeeb0ae74f165efb Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:55:35 +0200 Subject: [PATCH 30/58] s3:utils: Add FALL_THROUGH statements in regedit.c Signed-off-by: Andreas Schneider --- source3/utils/regedit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/utils/regedit.c b/source3/utils/regedit.c index 14e75c25bfa..27bd6f8f2c2 100644 --- a/source3/utils/regedit.c +++ b/source3/utils/regedit.c @@ -507,7 +507,8 @@ static void handle_value_input(struct regedit *regedit, int c) case 'b': case 'B': binmode = true; - /* Falthrough... */ + + FALL_THROUGH; case '\n': case KEY_ENTER: vitem = value_list_get_current_item(regedit->vl); From a809263fa9e80e65dcf1d1713ba00a0fd2f0589f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:57:10 +0200 Subject: [PATCH 31/58] s3:utils: Add FALL_THROUGH statements in net_conf.c Signed-off-by: Andreas Schneider --- source3/utils/net_conf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 8d9f1e6b99b..097baa1b82e 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -294,6 +294,8 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, d_printf(_("error: out of memory!\n")); goto done; } + + FALL_THROUGH; case 1: filename = argv[0]; break; @@ -563,6 +565,8 @@ static int net_conf_addshare(struct net_context *c, goto done; case 5: comment = argv[4]; + + FALL_THROUGH; case 4: if (!strnequal(argv[3], "guest_ok=", 9)) { net_conf_addshare_usage(c, argc, argv); @@ -581,6 +585,8 @@ static int net_conf_addshare(struct net_context *c, net_conf_addshare_usage(c, argc, argv); goto done; } + + FALL_THROUGH; case 3: if (!strnequal(argv[2], "writeable=", 10)) { net_conf_addshare_usage(c, argc, argv); @@ -599,6 +605,8 @@ static int net_conf_addshare(struct net_context *c, net_conf_addshare_usage(c, argc, argv); goto done; } + + FALL_THROUGH; case 2: path = argv[1]; sharename = talloc_strdup(mem_ctx, argv[0]); From b47c974fbcdb2a9f44c153937ad141976710b26e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:58:40 +0200 Subject: [PATCH 32/58] s3:utils: Add FALL_THROUGH statements in net_rpc_conf.c Signed-off-by: Andreas Schneider --- source3/utils/net_rpc_conf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/utils/net_rpc_conf.c b/source3/utils/net_rpc_conf.c index 0b1b59e3b45..4747da98325 100644 --- a/source3/utils/net_rpc_conf.c +++ b/source3/utils/net_rpc_conf.c @@ -1155,6 +1155,8 @@ static NTSTATUS rpc_conf_import_internal(struct net_context *c, d_printf(_("error: out of memory!\n")); goto error; } + + FALL_THROUGH; case 1: filename = argv[0]; break; @@ -1426,6 +1428,8 @@ static NTSTATUS rpc_conf_addshare_internal(struct net_context *c, goto error; case 5: comment = argv[4]; + + FALL_THROUGH; case 4: if (!strnequal(argv[3], "guest_ok=", 9)) { rpc_conf_addshare_usage(c, argc, argv); @@ -1446,6 +1450,8 @@ static NTSTATUS rpc_conf_addshare_internal(struct net_context *c, status = NT_STATUS_INVALID_PARAMETER; goto error; } + + FALL_THROUGH; case 3: if (!strnequal(argv[2], "writeable=", 10)) { rpc_conf_addshare_usage(c, argc, argv); @@ -1466,6 +1472,8 @@ static NTSTATUS rpc_conf_addshare_internal(struct net_context *c, status = NT_STATUS_INVALID_PARAMETER; goto error; } + + FALL_THROUGH; case 2: path = argv[1]; sharename = talloc_strdup(frame, argv[0]); From e87b1df747f5e24c6514abc0504121fdef3c1d57 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:42:46 +0200 Subject: [PATCH 33/58] s3:rpc_server: Add FALL_THROUGH statements in rpc_server.c Signed-off-by: Andreas Schneider --- source3/rpc_server/rpc_server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index 94335b3ea53..2327e433d8a 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -1068,7 +1068,8 @@ void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, } } } - /* FALL TROUGH */ + + FALL_THROUGH; case NCACN_NP: pipe_name = talloc_strdup(ncacn_conn, name); From 6072b5dff11dabeb8ff22a60369724dc7606e9ed Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:21:02 +0200 Subject: [PATCH 34/58] s4:samdb: Add FALL_THROUGH statements in cracknames.c Signed-off-by: Andreas Schneider --- source4/dsdb/samdb/cracknames.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index d43f510b949..d8fe0975d15 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -1083,7 +1083,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ return WERR_OK; } } - /* FALL TROUGH */ + FALL_THROUGH; default: info1->status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE; return WERR_OK; From 209915b85102f9bcc4a7d97d1643d143fa449f57 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:28:11 +0200 Subject: [PATCH 35/58] s4:samdb: Add FALL_THROUGH statements in linked_attributes.c Signed-off-by: Andreas Schneider --- source4/dsdb/samdb/ldb_modules/linked_attributes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c index c6beb25e58b..57d25076a75 100644 --- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c +++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c @@ -573,8 +573,7 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques /* treat as just a normal add the delete part is handled by the callback */ store_el = true; - /* break intentionally missing */ - + FALL_THROUGH; case LDB_FLAG_MOD_ADD: /* For each value being added, we need to setup the adds */ From 3027628e70f1c94ba77d4ca73d13c0f59e0574ab Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:29:55 +0200 Subject: [PATCH 36/58] s4:auth: Add FALL_THROUGH statements in auth_util.c Signed-off-by: Andreas Schneider --- source4/auth/ntlm/auth_util.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source4/auth/ntlm/auth_util.c b/source4/auth/ntlm/auth_util.c index 7feb20b8f62..5084cc4a929 100644 --- a/source4/auth/ntlm/auth_util.c +++ b/source4/auth/ntlm/auth_util.c @@ -62,7 +62,8 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth4_context *auth_conte return nt_status; } user_info_in = user_info_temp2; - /* fall through */ + + FALL_THROUGH; } case AUTH_PASSWORD_HASH: { @@ -122,7 +123,8 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth4_context *auth_conte } user_info_in = user_info_temp; - /* fall through */ + + FALL_THROUGH; } case AUTH_PASSWORD_RESPONSE: *user_info_encrypted = user_info_in; @@ -160,7 +162,8 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth4_context *auth_conte *user_info_temp->password.hash.nt = nt; user_info_in = user_info_temp; - /* fall through */ + + FALL_THROUGH; } case AUTH_PASSWORD_HASH: *user_info_encrypted = user_info_in; From b1ebf041fa7462777006fa2b0cbd8ad59c05e25b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:30:53 +0200 Subject: [PATCH 37/58] s4:auth: Add FALL_THROUGH statements in auth_sam.c Signed-off-by: Andreas Schneider --- source4/auth/ntlm/auth_sam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/auth/ntlm/auth_sam.c b/source4/auth/ntlm/auth_sam.c index 8c5ebd747e7..d63a7d131a6 100644 --- a/source4/auth/ntlm/auth_sam.c +++ b/source4/auth/ntlm/auth_sam.c @@ -70,7 +70,7 @@ static NTSTATUS authsam_password_ok(struct auth4_context *auth_context, } user_info = user_info_temp; - /*fall through*/ + FALL_THROUGH; } case AUTH_PASSWORD_HASH: *lm_sess_key = data_blob(NULL, 0); From 0d26b0c7b5388e8c60fa148de41beaf8a8f11365 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:33:12 +0200 Subject: [PATCH 38/58] s4:auth: Add FALL_THROUGH statements in gensec_krb5.c Signed-off-by: Andreas Schneider --- source4/auth/gensec/gensec_krb5.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c index 86ec23fe433..0323da87d29 100644 --- a/source4/auth/gensec/gensec_krb5.c +++ b/source4/auth/gensec/gensec_krb5.c @@ -407,12 +407,9 @@ static NTSTATUS gensec_krb5_common_client_creds(struct gensec_security *gensec_s /* Too much clock skew - we will need to kinit to re-skew the clock */ case KRB5KRB_AP_ERR_SKEW: case KRB5_KDCREP_SKEW: - { DEBUG(3, ("kerberos (mk_req) failed: %s\n", smb_get_krb5_error_message(gensec_krb5_state->smb_krb5_context->krb5_context, ret, gensec_krb5_state))); - /*fall through*/ - } - + FALL_THROUGH; /* just don't print a message for these really ordinary messages */ case KRB5_FCC_NOFILE: case KRB5_CC_NOTFOUND: From 680325d86975bb1ea002693fb453a31e908278e9 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:39:04 +0200 Subject: [PATCH 39/58] s4:rpc_server: Add FALL_THROUGH statements in dcesrv_srvsvc.c Signed-off-by: Andreas Schneider --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 4dd3e977b68..a6bee0d8ca0 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1127,6 +1127,7 @@ static WERROR dcesrv_srvsvc_fill_share_info(struct share_info *info, int *count, *((int *)info[i].value) = max_users; i++; + FALL_THROUGH; case 501: case 1: info[i].name = SHARE_TYPE; @@ -1147,6 +1148,7 @@ static WERROR dcesrv_srvsvc_fill_share_info(struct share_info *info, int *count, W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; + FALL_THROUGH; case 1004: if (comment) { info[i].name = SHARE_COMMENT; @@ -1156,6 +1158,8 @@ static WERROR dcesrv_srvsvc_fill_share_info(struct share_info *info, int *count, i++; } + + FALL_THROUGH; case 0: if (name && strcasecmp(share_name, name) != 0) { From 57babc6e71fb80e23bff4f26bc18c4903c61a173 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:39:52 +0200 Subject: [PATCH 40/58] s4:torture: Add FALL_THROUGH statements in basic/misc.c Signed-off-by: Andreas Schneider --- source4/torture/basic/misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c index 68b7cbec812..25ae4560de8 100644 --- a/source4/torture/basic/misc.c +++ b/source4/torture/basic/misc.c @@ -985,6 +985,8 @@ bool run_benchrw(struct torture_context *tctx) break; } state[i]->mode=FINISHED; + + FALL_THROUGH; case FINISHED: finished++; break; From f65f364bd0a2c2738d718eadbf70bf214cbde6d1 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 17:41:26 +0200 Subject: [PATCH 41/58] s4:torture: Add FALL_THROUGH statements in rpc/spoolss.c Signed-off-by: Andreas Schneider --- source4/torture/rpc/spoolss.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 31b9525ee62..91f32692042 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -1402,6 +1402,8 @@ static bool test_SetPrinter_errors(struct torture_context *tctx, /* ignored then */ break; } + + FALL_THROUGH; case SPOOLSS_PRINTER_CONTROL_PAUSE: /* 1 */ case SPOOLSS_PRINTER_CONTROL_RESUME: /* 2 */ case SPOOLSS_PRINTER_CONTROL_PURGE: /* 3 */ From 0e2337964021410cd28f763240651ca33424a971 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 18:20:53 +0200 Subject: [PATCH 42/58] auth:credentials: Add FALL_THROUGH statements in credentials.c Signed-off-by: Andreas Schneider --- auth/credentials/credentials.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c index 4f3042e3152..4663185c979 100644 --- a/auth/credentials/credentials.c +++ b/auth/credentials/credentials.c @@ -1277,17 +1277,21 @@ _PUBLIC_ bool cli_credentials_parse_password_fd(struct cli_credentials *credenti *++p = '\0'; /* advance p, and null-terminate pass */ break; } - /* fall through */ + + FALL_THROUGH; case 0: if (p - pass) { *p = '\0'; /* null-terminate it, just in case... */ p = NULL; /* then force the loop condition to become false */ break; - } else { - fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, "empty password\n"); - return false; } + fprintf(stderr, + "Error reading password from file descriptor " + "%d: empty password\n", + fd); + return false; + default: fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, strerror(errno)); From 6cef23ef8e70301f4b5171ec44ae534bedc06f03 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 18:23:31 +0200 Subject: [PATCH 43/58] auth:credentials: Add FALL_THROUGH statements in credentials_secrets.c Signed-off-by: Andreas Schneider --- auth/credentials/credentials_secrets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auth/credentials/credentials_secrets.c b/auth/credentials/credentials_secrets.c index beb292848ad..ae1d23b51c1 100644 --- a/auth/credentials/credentials_secrets.c +++ b/auth/credentials/credentials_secrets.c @@ -372,7 +372,8 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account_db_ctx(struct cli_credenti if (security != SEC_ADS) { break; } - /* fall through */ + + FALL_THROUGH; case ROLE_ACTIVE_DIRECTORY_DC: use_kerberos = CRED_AUTO_USE_KERBEROS; break; From 3fa3645a519f1220cf214fc59c826cba8cdb54ec Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 18:24:26 +0200 Subject: [PATCH 44/58] auth:gensec: Add FALL_THROUGH statements in spnego.c Signed-off-by: Andreas Schneider --- auth/gensec/spnego.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c index 56f9be412ab..0b3fbdce7ac 100644 --- a/auth/gensec/spnego.c +++ b/auth/gensec/spnego.c @@ -1649,7 +1649,7 @@ static struct tevent_req *gensec_spnego_update_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - /* fall through */ + FALL_THROUGH; case SPNEGO_CLIENT_START: case SPNEGO_SERVER_START: From c75ee155d0a484e307dd0bd83136b4fae697c916 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 16:56:27 +0200 Subject: [PATCH 45/58] nsswitch: Add FALL_THROUGH statements in pam_winbind.c Signed-off-by: Andreas Schneider --- nsswitch/pam_winbind.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c index e14fcfeb263..63fede87c78 100644 --- a/nsswitch/pam_winbind.c +++ b/nsswitch/pam_winbind.c @@ -2886,7 +2886,8 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, ret = atoi(tmp); switch (ret) { case PAM_AUTHTOK_EXPIRED: - /* fall through, since new token is required in this case */ + /* Since new token is required in this case */ + FALL_THROUGH; case PAM_NEW_AUTHTOK_REQD: _pam_log(ctx, LOG_WARNING, "pam_sm_acct_mgmt success but %s is set", From aa07931dcc961dc9f60a7a5855e68eca7a3fef24 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 27 Jul 2017 16:59:40 +0200 Subject: [PATCH 46/58] s3:libnet: Add FALL_THROUGH statements in libnet_join.c Signed-off-by: Andreas Schneider --- source3/libnet/libnet_join.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 0595cfe64ab..9b1bf342c19 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -2418,7 +2418,8 @@ static WERROR libnet_join_check_config(TALLOC_CTX *mem_ctx, valid_realm = true; ignored_realm = true; } - /* FALL THROUGH */ + + FALL_THROUGH; case SEC_ADS: valid_security = true; } From 557f3c6d021b91332034bad3f02dfd9ed7c70253 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:08:36 +0200 Subject: [PATCH 47/58] s3:modules: Add FALL_THROUGH statements in getdate.c Signed-off-by: Andreas Schneider --- source3/modules/getdate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source3/modules/getdate.c b/source3/modules/getdate.c index 6ed994649c4..2879bc87f4b 100644 --- a/source3/modules/getdate.c +++ b/source3/modules/getdate.c @@ -1098,9 +1098,10 @@ yytnamerr (char *yyres, const char *yystr) goto do_not_strip_quotes; case '\\': - if (*++yyp != '\\') + if (*++yyp != '\\') { goto do_not_strip_quotes; - /* Fall through. */ + } + FALL_THROUGH; default: if (yyres) yyres[yyn] = *yyp; From 2432bb33933e8d878d7a21c2c1d37c5f639d5023 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:12:43 +0200 Subject: [PATCH 48/58] s3:lsa: Add FALL_THROUGH statements in srv_lsa_nt.c Signed-off-by: Andreas Schneider --- source3/rpc_server/lsa/srv_lsa_nt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index 3cc87ad9081..a3254a61667 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -4288,11 +4288,13 @@ static NTSTATUS check_ft_info(TALLOC_CTX *mem_ctx, exclusion = true; break; } - /* fall through */ + + FALL_THROUGH; case DNS_CMP_FIRST_IS_CHILD: case DNS_CMP_SECOND_IS_CHILD: tln_conflict = true; - /* fall through */ + + FALL_THROUGH; default: break; } From b9ac658992a48d9bb6ce03e296ca8538b0bcdbbd Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:13:42 +0200 Subject: [PATCH 49/58] s3:rpcclient: Add FALL_THROUGH statements in rpcclient.c Signed-off-by: Andreas Schneider --- source3/rpcclient/rpcclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index c1039ed84c5..4eb1e145715 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -744,7 +744,7 @@ static NTSTATUS do_cmd(struct cli_state *cli, use_kerberos = CRED_AUTO_USE_KERBEROS; break; } - /* Fall through */ + FALL_THROUGH; case DCERPC_AUTH_TYPE_NTLMSSP: case DCERPC_AUTH_TYPE_KRB5: ntresult = cli_rpc_pipe_open_generic_auth( From 8911041ce7a14b4826cbd516c21cfcff9f1fe4fa Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:15:31 +0200 Subject: [PATCH 50/58] s3:smbd: Add FALL_THROUGH statements in reply.c Signed-off-by: Andreas Schneider --- source3/smbd/reply.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 623f83b1250..881667a6b44 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -190,16 +190,16 @@ static NTSTATUS check_path_syntax_internal(char *path, switch(siz) { case 5: *d++ = *s++; - /*fall through*/ + FALL_THROUGH; case 4: *d++ = *s++; - /*fall through*/ + FALL_THROUGH; case 3: *d++ = *s++; - /*fall through*/ + FALL_THROUGH; case 2: *d++ = *s++; - /*fall through*/ + FALL_THROUGH; case 1: *d++ = *s++; break; From e9beaf09a8f25373caca0808b092feae0698121d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:18:09 +0200 Subject: [PATCH 51/58] s3:utils: Add FALL_THROUGH statements in net_registry_check.c Signed-off-by: Andreas Schneider --- source3/utils/net_registry_check.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c index de79f3e6af3..2274b739b0d 100644 --- a/source3/utils/net_registry_check.c +++ b/source3/utils/net_registry_check.c @@ -810,7 +810,8 @@ static int check_tdb_action(struct db_record *rec, void *check_ctx) talloc_free(key); key = p; } - } /* fall through */ + FALL_THROUGH; + } case 'r': /* retry */ once_more = true; break; From d6eebd589166b34d0b0d8ba423982e2b3e75bb46 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:24:23 +0200 Subject: [PATCH 52/58] s3:utils: Add FALL_THROUGH statements in ntlm_auth.c Signed-off-by: Andreas Schneider --- source3/utils/ntlm_auth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 78bafe12efa..2c8d9910790 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -1390,7 +1390,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, * NTLMSSP_CLIENT_1 for now. */ use_cached_creds = false; - /* fall through */ + FALL_THROUGH; case NTLMSSP_CLIENT_1: /* setup the client side */ @@ -1486,7 +1486,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, if (!in.length) { first = true; } - /* fall through */ + FALL_THROUGH; case SQUID_2_5_NTLMSSP: nt_status = gensec_start_mech_by_oid(state->gensec_state, GENSEC_OID_NTLMSSP); break; From 9ab5fe732c8a8cc0634e0e3f4fcf2dd7be687913 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:25:27 +0200 Subject: [PATCH 53/58] s3:winbindd: Add FALL_THROUGH statements in idmap_autorid.c Signed-off-by: Andreas Schneider --- source3/winbindd/idmap_autorid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 39027d1511b..65b3d5af222 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -260,7 +260,7 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg, } /* If we end up here, something weird is in the record. */ - /* FALL THROUGH */ + FALL_THROUGH; default: DBG_DEBUG("SID/domain range: %s\n", (const char *)data.dptr); From be236af76e574e901658fb65cd60c4ee9648a3d0 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:26:38 +0200 Subject: [PATCH 54/58] s4:dsdb: Add FALL_THROUGH statements in password_hash.c Signed-off-by: Andreas Schneider --- source4/dsdb/samdb/ldb_modules/password_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index c428ff7f359..2e6464f0dd1 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -2241,7 +2241,7 @@ static int setup_last_set_field(struct setup_password_fields_io *io) if (!io->ac->update_password) { break; } - /* fall through */ + FALL_THROUGH; case UINT64_MAX: if (!io->ac->update_password && io->u.pwdLastSet != 0 && From 5ddda31ffae9a0a443fdd1a756b7ad6ff0117138 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:27:38 +0200 Subject: [PATCH 55/58] s4:lib: Add FALL_THROUGH statements in http.c Signed-off-by: Andreas Schneider --- source4/lib/http/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/lib/http/http.c b/source4/lib/http/http.c index 659cba0ff14..10b49cd14fe 100644 --- a/source4/lib/http/http.c +++ b/source4/lib/http/http.c @@ -117,7 +117,7 @@ static enum http_read_status http_parse_headers(struct http_read_response_state state->parser_state = HTTP_READING_BODY; break; } - /* fall through */ + FALL_THROUGH; case 0: DEBUG(11, ("%s: Skipping body for code %d\n", __func__, state->response->response_code)); From 1919a3fa1826e3d2bffdeed3df13ab2ab59f58c6 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:11:24 +0200 Subject: [PATCH 56/58] s3:spoolss: Remove incorrect fall through comment in srv_spoolss_nt.c Signed-off-by: Andreas Schneider --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index f0226ba9441..e5463683598 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1804,7 +1804,6 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p, DEBUG(4,("Setting print server access = %s\n", (r->in.access_mask == SERVER_ACCESS_ADMINISTER) ? "SERVER_ACCESS_ADMINISTER" : "SERVER_ACCESS_ENUMERATE" )); - /* We fall through to return WERR_OK */ break; case SPLHND_PRINTER: From 7e5dd3f42b47c85ae1ad560e0d2a15edad78a772 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 Oct 2017 11:06:48 +0200 Subject: [PATCH 57/58] libsmb: Remove incorrect fall through comment in trusts_util.c Signed-off-by: Andreas Schneider --- source3/libsmb/trusts_util.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c index fd1b3372b36..3ebf67f231e 100644 --- a/source3/libsmb/trusts_util.c +++ b/source3/libsmb/trusts_util.c @@ -84,7 +84,6 @@ char *trust_pw_new_value(TALLOC_CTX *mem_ctx, min = 120; max = 120; break; - /* fall through */ case SEC_CHAN_DOMAIN: /* * The maximum length of a trust account password. From e401484bec6509370a62954fbc456f301530c5f8 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 26 Jul 2017 16:29:06 +0200 Subject: [PATCH 58/58] wafsamba: Add -Wimplicit-fallthrough if available Signed-off-by: Andreas Schneider --- buildtools/wafsamba/samba_autoconf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index cc08e0d5c3d..35f4f36f61c 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -711,6 +711,8 @@ def SAMBA_CONFIG_H(conf, path=None): testflags=True) conf.ADD_CFLAGS('-Werror=uninitialized -Wuninitialized', testflags=True) + conf.ADD_CFLAGS('-Wimplicit-fallthrough', + testflags=True) conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True) conf.ADD_CFLAGS('-Wno-format-zero-length', testflags=True)