[PATCH] Add support for fall-through handling if the compiler supports it

Andreas Schneider asn at samba.org
Tue Feb 20 17:12:54 UTC 2018


On Tuesday, 20 February 2018 17:00:06 CET jim via samba-technical wrote:
> On 2/20/2018 10:45 AM, Andreas Schneider via samba-technical wrote:
> > -static WERROR simpleclass_IClassFactory_CreateInstance (struct
> > IClassFactory *d, TALLOC_CTX *mem_ctx, struct IUnknown *iunk, struct GUID
> > *iid, struct IUnknown **ppv) +static WERROR
> > simpleclass_IClassFactory_CreateInstance(struct IClassFactory *d, +			
			
> >       TALLOC_CTX *mem_ctx,
> > +						       struct MInterfacePointer *pUnknown,
> > +						       struct GUID *iid,
> > +						       struct MInterfacePointer *ppv)
> > 
> >   {
> >   
> >   	struct IStream *ret;
> >   	/* FIXME: Check whether IID == ISTREAM_IID */
> > 
> > @@ -71,8 +84,8 @@ static WERROR simpleclass_IClassFactory_CreateInstance
> > (struct IClassFactory *d,> 
> >   	ret->vtable = &simple_IStream_vtable;
> >   	ret->object_data = NULL;
> > 
> > -	*ppv = (struct IUnknown *)ret;
> > -
> > +	ppv = (struct MInterfacePointer *)ret;
> > +
> > 
> >   	return WERR_OK;
> >   
> >   }
> 
> Andreas,
> 
> This change does not have the same effect.
> Before the struct IStream pointer was returned into the calling argument
> ppv pointer.
> Now this pointer is assigned with no effect to (local) argument ppv.
> The argument should be 'struct MInterfacePointer **ppv' and '*ppv =
> (struct MInterfacePointer *)ret'.

I've fixed the IDL. See attached.


Thanks,


	Andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org
-------------- next part --------------
>From 841afbbdca681170b2c7cc84ce0e394254194448 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 21 Dec 2017 17:24:01 +0100
Subject: [PATCH 01/59] s3:selftest: Run the smbtorture3 TLDAP test

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/selftest/tests.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 89c8d6035e3..5232aecb609 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -92,6 +92,9 @@ for t in tests:
         plantestsuite("samba3.smbtorture_s3.crypt_server(nt4_dc).%s" % t, "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmpenc', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
     plantestsuite("samba3.smbtorture_s3.plain(ad_dc_ntvfs).%s" % t, "ad_dc_ntvfs", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
 
+t = "TLDAP"
+plantestsuite("samba3.smbtorture_s3.plain.%s(ad_dc)" % t, "ad_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER/tmp', '$DC_USERNAME', '$DC_PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
+
 #
 # RENAME-ACCESS needs to run against a special share - acl_xattr_ign_sysacl_windows
 #
-- 
2.16.1


>From 7ea9e2845f7afe8c4a51f9b1b89ad2efceb093d1 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:16:43 +0200
Subject: [PATCH 02/59] s4:lib:com: Fix function declartions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 librpc/idl/dcom.idl              |  2 +-
 source4/lib/com/classes/simple.c | 25 +++++++++++++++++++------
 source4/lib/com/main.c           |  4 ++--
 3 files changed, 22 insertions(+), 9 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 7d0573372e3..54c74ce564b 100644
--- a/source4/lib/com/classes/simple.c
+++ b/source4/lib/com/classes/simple.c
@@ -43,13 +43,22 @@ static uint32_t simple_IUnknown_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx
 	return 1;
 }
 
-static WERROR simple_IStream_Read (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *pv, uint32_t num_requested, uint32_t *num_readx, uint32_t num_read)
+static WERROR simple_IStream_Read(struct IStream *d,
+				  TALLOC_CTX *mem_ctx,
+				  uint8_t *pv,
+				  uint32_t num_requested,
+				  uint32_t *num_readx,
+				  uint32_t *num_read)
 {
-	printf("%d bytes are being read\n", num_read);
+	printf("%d bytes are being read\n", *num_read);
 	return WERR_OK;
 }
 
-static WERROR simple_IStream_Write (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *data, uint32_t num_requested, uint32_t num_written)
+static WERROR simple_IStream_Write(struct IStream *d,
+				   TALLOC_CTX *mem_ctx,
+				   uint8_t *data,
+				   uint32_t num_requested,
+				   uint32_t *num_written)
 {
 	printf("%d bytes are being written\n", num_requested);
 	return WERR_OK;
@@ -62,7 +71,11 @@ static WERROR simpleclass_IUnknown_QueryInterface (struct IUnknown *d, TALLOC_CT
 	return WERR_OK;
 }
 
-static WERROR simpleclass_IClassFactory_CreateInstance (struct IClassFactory *d, TALLOC_CTX *mem_ctx, struct IUnknown *iunk, struct GUID *iid, struct IUnknown **ppv)
+static WERROR simpleclass_IClassFactory_CreateInstance(struct IClassFactory *d,
+						       TALLOC_CTX *mem_ctx,
+						       struct MInterfacePointer *pUnknown,
+						       struct GUID *iid,
+						       struct MInterfacePointer **ppv)
 {
 	struct IStream *ret;
 	/* FIXME: Check whether IID == ISTREAM_IID */
@@ -71,8 +84,8 @@ static WERROR simpleclass_IClassFactory_CreateInstance (struct IClassFactory *d,
 	ret->vtable = &simple_IStream_vtable;
 	ret->object_data = NULL;
 
-	*ppv = (struct IUnknown *)ret;
-	
+	*ppv = (struct MInterfacePointer *)ret;
+
 	return WERR_OK;
 }
 
diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c
index 68a3bc6d3d3..da1e6777e81 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;
 	
-- 
2.16.1


>From 6cdf985f257c7fc82c11d96c170544c9d0aa63f1 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:51:39 +0200
Subject: [PATCH 03/59] lib:texpect: Avoid some compiler warnings

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 <expect_instructions> <progname> [<args>] */
 			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;
 }
-- 
2.16.1


>From f1e4e0d5eaf7dd18f45d5ac5ca998aebd048fb8a Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:33:10 +0200
Subject: [PATCH 04/59] lib:replace: Add FALL_THROUGH support

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 .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 @@ flags = [
     '-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)
 
-- 
2.16.1


>From c0b98b8174e283eb4ac662809803173f57a0a272 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:25:46 +0200
Subject: [PATCH 05/59] lib:replace: Add FALL_THROUGH statements in strptime.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 2135eab3dd9c5023b3ffbc8e3b2a4293d4c092b9 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:17:21 +0200
Subject: [PATCH 06/59] lib:ldb: Add FALL_THROUGH statements in common/ldb_dn.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 '>':
-- 
2.16.1


>From d600e59309d86e42e6754dde90d39c3955e45f28 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:18:28 +0200
Subject: [PATCH 07/59] lib:ldb: Add FALL_THROUGH statements in
 ldb_map/ldb_map_inbound.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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);
-- 
2.16.1


>From b7d314f11f9618b09f69716a7f4b31ea991e7736 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:19:23 +0200
Subject: [PATCH 08/59] 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:
-- 
2.16.1


>From 44a971003ff81a55ce139d17df87c510f7ace28d Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:20:04 +0200
Subject: [PATCH 09/59] lib:ldb: Add FALL_THROUGH statements in
 ldb_map/ldb_map_outbound.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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:
-- 
2.16.1


>From 1d3cb55ec7792fafc75d1a4250947b2bc5b556ae Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:20:57 +0200
Subject: [PATCH 10/59] lib:param: Add FALL_THROUGH statements in loadparm.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From f05da28394a3378555347ff543577b8ce860aa25 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:49:50 +0200
Subject: [PATCH 11/59] lib:util: Add FALL_THROUGH statements in substitute.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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];
 			}
-- 
2.16.1


>From 7bdbfc2c6ff19239a28988a825fd56aa4514e7a8 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:40:14 +0200
Subject: [PATCH 12/59] lib:util: Add FALL_THROUGH statements in
 charset/charset_macosxfs.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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");
-- 
2.16.1


>From ce1ea39c24d838886013d1c07795e86de9a28911 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:41:25 +0200
Subject: [PATCH 13/59] lib:util: Add FALL_THROUGH statements in util_file.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 615c56f6df7b2b2e79bfbf299da18127da717545 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:22:44 +0200
Subject: [PATCH 14/59] s3:lib: Add FALL_THROUGH statements in
 substitute_generic.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 9c4e7d060ddd0cf93a2da4afdfef037780fbd5a7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 16:57:38 +0200
Subject: [PATCH 15/59] s3:lib: Add FALL_THROUGH statements in util_path.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 9b9835e808240b6e84be11aa04af56835673a4d8 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:25:20 +0200
Subject: [PATCH 16/59] s3:lib: Add FALL_THROUGH statements in util_str.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 32d0a0b8c80140c78049dad61c13377972cddb06 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:55:10 +0200
Subject: [PATCH 17/59] lib:tdb: Add FALL_THROUGH statements in hash.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 283583c0a8c7bc1e2ff73e9a41e230b00209b17e Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:58:00 +0200
Subject: [PATCH 18/59] lib:tdb: Add FALL_THROUGH statements in tdbtool.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 8d2b4419e08c5f9d03bb656161497c2c177e3ff5 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:28:12 +0200
Subject: [PATCH 19/59] lib:tdb: Add FALL_THROUGH statements in
 common/summary.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From fffdf72f36502bd601058e872cb347c8887540c9 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:43:53 +0200
Subject: [PATCH 20/59] libgpo: Add FALL_THROUGH statements in gpo_sec.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
 	}
-- 
2.16.1


>From 6afdd3b0076b3b0671ba8e3237723b4a677660dd Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:03:09 +0200
Subject: [PATCH 21/59] librpc:ndr: Add FALL_THROUGH statements in ndr_cab.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
 	}
-- 
2.16.1


>From 0dd4a816a644bd28f28e9b5590d9d8935d4e429c Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:35:28 +0200
Subject: [PATCH 22/59] s3:auth: Add FALL_THROUGH statements in auth_sam.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
 	}
-- 
2.16.1


>From 3dcd016bc76d73fc4ea9393fcfe1203725b07612 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 16:55:23 +0200
Subject: [PATCH 23/59] s3:auth: Add FALL_THROUGH statements in pampass.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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... */
-- 
2.16.1


>From 6fa8b3e5ca07119201d0679affd7e727e65af816 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:25:30 +0200
Subject: [PATCH 24/59] 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++;
-- 
2.16.1


>From 773e3f6fd537d835696d7fb03a6824f5e05c4ed2 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:51:08 +0200
Subject: [PATCH 25/59] s3:lib: Add FALL_THROUGH statements in sysacls.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From d695ac29a8b464908478b2ea9a169a637b50ddd9 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:54:48 +0200
Subject: [PATCH 26/59] s3:lib: Add FALL_THROUGH statements in util_sd.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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:
-- 
2.16.1


>From 119daddfda6c75b5d604a81d10a0a7c34b47244c Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:36:50 +0200
Subject: [PATCH 27/59] s3:libsmb: Add FALL_THROUGH statements in dsgetdcname.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 &&
-- 
2.16.1


>From 0d353a93a568a51e9a570af99ab008aabd6ac128 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:53:45 +0200
Subject: [PATCH 28/59] s3:modules: Add FALL_THROUGH statements in
 vfs_acl_common.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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
-- 
2.16.1


>From c1f5742e5c5c07275545f0b5e64e8e318a96b786 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:50:18 +0200
Subject: [PATCH 29/59] s3:smbd: Add FALL_THROUGH statements in nttrans.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 &&
-- 
2.16.1


>From 8f3c73f9b6787af0fb68bbbd1e037755f99c96e9 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:52:06 +0200
Subject: [PATCH 30/59] s3:smbd: Add FALL_THROUGH statements in trans2.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
 	}
-- 
2.16.1


>From c072628d6804e3159ecee1296b9036bf8bec2590 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:55:35 +0200
Subject: [PATCH 31/59] s3:utils: Add FALL_THROUGH statements in regedit.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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);
-- 
2.16.1


>From 5734fc2a5dc5748f9d79c00a7e0e79f0d66c97a5 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:57:10 +0200
Subject: [PATCH 32/59] s3:utils: Add FALL_THROUGH statements in net_conf.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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]);
-- 
2.16.1


>From 0813a5862ec18aa259f0c343c2f8dd9b7f3672f0 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:58:40 +0200
Subject: [PATCH 33/59] s3:utils: Add FALL_THROUGH statements in net_rpc_conf.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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]);
-- 
2.16.1


>From 53890b4b459f8d52008d9fe725134810d020c888 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:42:46 +0200
Subject: [PATCH 34/59] s3:rpc_server: Add FALL_THROUGH statements in
 rpc_server.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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);
-- 
2.16.1


>From e3fef9f2ff66154d65d9e83992de760963eff50a Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:21:02 +0200
Subject: [PATCH 35/59] s4:samdb: Add FALL_THROUGH statements in cracknames.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 96c7cfd30cdf5b5a23f985c9ff0a815427223010 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:28:11 +0200
Subject: [PATCH 36/59] s4:samdb: Add FALL_THROUGH statements in
 linked_attributes.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 */
-- 
2.16.1


>From 5d40fc21aea8b2710a216c2cb21c81f9dd120337 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:29:55 +0200
Subject: [PATCH 37/59] s4:auth: Add FALL_THROUGH statements in auth_util.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 6b8c640d5b0079764cdda06a15b27b509b1724d0 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:30:53 +0200
Subject: [PATCH 38/59] s4:auth: Add FALL_THROUGH statements in auth_sam.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 5e2a5843fc4..3d8266c4420 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);
-- 
2.16.1


>From 88bf7f685c8994efd385d54e5e82590a7ad657fe Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:33:12 +0200
Subject: [PATCH 39/59] s4:auth: Add FALL_THROUGH statements in gensec_krb5.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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:
-- 
2.16.1


>From a4459c52b8e4c56d7bd7404acb4e556bd5e48af3 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:39:04 +0200
Subject: [PATCH 40/59] s4:rpc_server: Add FALL_THROUGH statements in
 dcesrv_srvsvc.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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) {
-- 
2.16.1


>From 0a2f403ec205e36b36bfc000180b429622c2a585 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:39:52 +0200
Subject: [PATCH 41/59] s4:torture: Add FALL_THROUGH statements in basic/misc.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 204d3fe345d8d855181ff1d34b9da4b8ac5a4821 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:41:26 +0200
Subject: [PATCH 42/59] s4:torture: Add FALL_THROUGH statements in
 rpc/spoolss.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 */
-- 
2.16.1


>From ee3df3b16f97772b0b2ba1dbe2de71b53ddf5240 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:20:53 +0200
Subject: [PATCH 43/59] auth:credentials: Add FALL_THROUGH statements in
 credentials.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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));
-- 
2.16.1


>From f4e803d478d0e4cfe36eb613285205fa4ecfc753 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:23:31 +0200
Subject: [PATCH 44/59] auth:credentials: Add FALL_THROUGH statements in
 credentials_secrets.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From f667bc52840a5e3dd0423b9e84963ef7c8ccb484 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:24:26 +0200
Subject: [PATCH 45/59] auth:gensec: Add FALL_THROUGH statements in spnego.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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:
 
-- 
2.16.1


>From 559b0d487a1255384e4a3e6c8538d8116a568bc6 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 16:56:27 +0200
Subject: [PATCH 46/59] nsswitch: Add FALL_THROUGH statements in pam_winbind.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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",
-- 
2.16.1


>From abccca7cf85c934f4120fd2091f0397f0bcfc22c Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 16:59:40 +0200
Subject: [PATCH 47/59] s3:libnet: Add FALL_THROUGH statements in libnet_join.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
 			}
-- 
2.16.1


>From ed8caca57fb9cd140ffa5c1c578337f587c68817 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:08:36 +0200
Subject: [PATCH 48/59] s3:modules: Add FALL_THROUGH statements in getdate.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From fcd050359425363eec0061e0da63f9fe38a0503c Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:12:43 +0200
Subject: [PATCH 49/59] s3:lsa: Add FALL_THROUGH statements in srv_lsa_nt.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
 			}
-- 
2.16.1


>From 8ac5c8b1d47ed042e60efeee7cec00ac5d9266a5 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:13:42 +0200
Subject: [PATCH 50/59] s3:rpcclient: Add FALL_THROUGH statements in
 rpcclient.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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(
-- 
2.16.1


>From 1417c71718ae4b412b32571947b31830b79dcf46 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:15:31 +0200
Subject: [PATCH 51/59] s3:smbd: Add FALL_THROUGH statements in reply.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From c659086eadee38eb7111597e403ed05e59bbdd16 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:18:09 +0200
Subject: [PATCH 52/59] s3:utils: Add FALL_THROUGH statements in
 net_registry_check.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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;
-- 
2.16.1


>From 68327248855096cfa861f7d0a02d0b73a1ff7c98 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:24:23 +0200
Subject: [PATCH 53/59] s3:utils: Add FALL_THROUGH statements in ntlm_auth.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 3f544902a24..3979d0bf27b 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -1378,7 +1378,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 */
 
@@ -1474,7 +1474,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;
-- 
2.16.1


>From 01b8ce5160bb0ea836a0880dc26acc485346ea03 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:25:27 +0200
Subject: [PATCH 54/59] s3:winbindd: Add FALL_THROUGH statements in
 idmap_autorid.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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);
-- 
2.16.1


>From 7824f82c7c8862420e1d145dc29e4ee115c55122 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:26:38 +0200
Subject: [PATCH 55/59] s4:dsdb: Add FALL_THROUGH statements in password_hash.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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 &&
-- 
2.16.1


>From a972773f4ea31b855623a91a22f36d6035f0e421 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:27:38 +0200
Subject: [PATCH 56/59] s4:lib: Add FALL_THROUGH statements in http.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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));
-- 
2.16.1


>From d01459fc75eb35ac6191f576da64c27f57166f1a Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:11:24 +0200
Subject: [PATCH 57/59] s3:spoolss: Remove incorrect fall through comment in
 srv_spoolss_nt.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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:
-- 
2.16.1


>From d30f942c9b6bad78e43a57a95c7cb7564886dfea Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:06:48 +0200
Subject: [PATCH 58/59] libsmb: Remove incorrect fall through comment in
 trusts_util.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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.
-- 
2.16.1


>From 4e501c1f0b9802a3cc9299dc62d4f7ba4382bc47 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:29:06 +0200
Subject: [PATCH 59/59] wafsamba: Add -Wimplicit-fallthrough if available

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 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)
-- 
2.16.1



More information about the samba-technical mailing list