diff --git a/SOURCES/samba-4.4.6-fix_nss_wins.patch b/SOURCES/samba-4.4.6-fix_nss_wins.patch
new file mode 100644
index 0000000..ac848bc
--- /dev/null
+++ b/SOURCES/samba-4.4.6-fix_nss_wins.patch
@@ -0,0 +1,314 @@
+From 119825e3df9b65ea24f28a7faf39b54861d62f0c Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@samba.org>
+Date: Mon, 19 Sep 2016 16:21:31 +0200
+Subject: [PATCH] waf: Explicitly link libreplace against libnss_wins.so
+
+If we do not specify replace as a depencency here, it will not link to
+libreplace using an rpath.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=12277
+
+Signed-off-by: Andreas Schneider <asn@samba.org>
+Reviewed-by: Jeremy Allison <jra@samba.org>
+Reviewed-by: Jim McDonough <jmcd@samba.org>
+
+(cherry picked from commit d8a5565ae647352d11d622bd4e73ff4568678a7c)
+---
+ nsswitch/wscript_build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nsswitch/wscript_build b/nsswitch/wscript_build
+index f286896..ab8f8ea 100644
+--- a/nsswitch/wscript_build
++++ b/nsswitch/wscript_build
+@@ -42,7 +42,7 @@ if (Utils.unversioned_sys_platform() == 'linux' or (host_os.rfind('gnu') > -1)):
+     bld.SAMBA3_LIBRARY('nss_wins',
+                        keep_underscore=True,
+                        source='wins.c',
+-                       deps='''wbclient''',
++                       deps='wbclient replace',
+                        public_headers=[],
+                        public_headers_install=False,
+                        pc_files=[],
+-- 
+2.10.0
+
+From 33bc85d9060340e4ce3d2edecb3fb76dd85a5195 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@samba.org>
+Date: Mon, 19 Sep 2016 16:17:11 +0200
+Subject: [PATCH 1/2] nsswitch: Add missing arguments to wins gethostbyname*
+
+The errno pointer argument is missing.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269
+
+Signed-off-by: Andreas Schneider <asn@samba.org>
+Reviewed-by: Jeremy Allison <jra@samba.org>
+Reviewed-by: Jim McDonough <jmcd@samba.org>
+(cherry picked from commit 124ae4e861f048fe015bff32ace4abff4d3e6c62)
+---
+ nsswitch/wins.c | 51 +++++++++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 41 insertions(+), 10 deletions(-)
+
+diff --git a/nsswitch/wins.c b/nsswitch/wins.c
+index fc65c03..be84f2e 100644
+--- a/nsswitch/wins.c
++++ b/nsswitch/wins.c
+@@ -39,10 +39,19 @@ static pthread_mutex_t wins_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
+ #define INADDRSZ 4
+ #endif
+ 
+-NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
+-			  char *buffer, size_t buflen, int *h_errnop);
+-NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he,
+-			   char *buffer, size_t buflen, int *h_errnop);
++NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname,
++				     struct hostent *he,
++				     char *buffer,
++				     size_t buflen,
++				     int *errnop,
++				     int *h_errnop);
++NSS_STATUS _nss_wins_gethostbyname2_r(const char *name,
++				      int af,
++				      struct hostent *he,
++				      char *buffer,
++				      size_t buflen,
++				      int *errnop,
++				      int *h_errnop);
+ 
+ static char *lookup_byname_backend(const char *name)
+ {
+@@ -225,8 +234,12 @@ gethostbyname() - we ignore any domain portion of the name and only
+ handle names that are at most 15 characters long
+   **************************************************************************/
+ NSS_STATUS
+-_nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
+-			  char *buffer, size_t buflen, int *h_errnop)
++_nss_wins_gethostbyname_r(const char *hostname,
++			  struct hostent *he,
++			  char *buffer,
++			  size_t buflen,
++			  int *errnop,
++			  int *h_errnop)
+ {
+ 	NSS_STATUS nss_status = NSS_STATUS_SUCCESS;
+ 	char *ip;
+@@ -247,6 +260,7 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
+ 
+ 	ip = lookup_byname_backend(name);
+ 	if (ip == NULL) {
++		*errnop = EINVAL;
+ 		nss_status = NSS_STATUS_NOTFOUND;
+ 		goto out;
+ 	}
+@@ -254,6 +268,7 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
+ 	rc = inet_pton(AF_INET, ip, &in);
+ 	wbcFreeMemory(ip);
+ 	if (rc == 0) {
++		*errnop = errno;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -263,6 +278,7 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
+ 	namelen = strlen(name) + 1;
+ 
+ 	if ((he->h_name = get_static(&buffer, &buflen, namelen)) == NULL) {
++		*errnop = EAGAIN;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -275,18 +291,21 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
+ 		i = sizeof(char*) - i;
+ 
+ 	if (get_static(&buffer, &buflen, i) == NULL) {
++		*errnop = EAGAIN;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+ 
+ 	if ((he->h_addr_list = (char **)get_static(
+ 		     &buffer, &buflen, 2 * sizeof(char *))) == NULL) {
++		*errnop = EAGAIN;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+ 
+ 	if ((he->h_addr_list[0] = get_static(&buffer, &buflen,
+ 					     INADDRSZ)) == NULL) {
++		*errnop = EAGAIN;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -306,12 +325,14 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
+ 		i = sizeof(char*) - i;
+ 
+ 	if (get_static(&buffer, &buflen, i) == NULL) {
++		*errnop = EAGAIN;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+ 
+ 	if ((he->h_aliases = (char **)get_static(
+ 		     &buffer, &buflen, sizeof(char *))) == NULL) {
++		*errnop = EAGAIN;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -330,17 +351,27 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
+ 
+ 
+ NSS_STATUS
+-_nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he,
+-			   char *buffer, size_t buflen, int *h_errnop)
++_nss_wins_gethostbyname2_r(const char *name,
++			   int af,
++			   struct hostent *he,
++			   char *buffer,
++			   size_t buflen,
++			   int *errnop,
++			   int *h_errnop)
+ {
+ 	NSS_STATUS nss_status;
+ 
+ 	if(af!=AF_INET) {
++		*errnop = EAFNOSUPPORT;
+ 		*h_errnop = NO_DATA;
+ 		nss_status = NSS_STATUS_UNAVAIL;
+ 	} else {
+-		nss_status = _nss_wins_gethostbyname_r(
+-				name, he, buffer, buflen, h_errnop);
++		nss_status = _nss_wins_gethostbyname_r(name,
++						       he,
++						       buffer,
++						       buflen,
++						       errnop,
++						       h_errnop);
+ 	}
+ 	return nss_status;
+ }
+-- 
+2.10.0
+
+
+From b8d9c7b69509555f40335a0dd7b93ef032354b0d Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@samba.org>
+Date: Tue, 20 Sep 2016 13:26:52 +0200
+Subject: [PATCH 2/2] nsswitch: Also set h_errnop for nss_wins functions
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269
+
+Signed-off-by: Andreas Schneider <asn@samba.org>
+Reviewed-by: Jim McDonough <jmcd@samba.org>
+
+(cherry picked from commit 382345126c56e26d3dbc319f1c7c1dae3c4fafc9)
+---
+ nsswitch/wins.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/nsswitch/wins.c b/nsswitch/wins.c
+index be84f2e..dccb6dd 100644
+--- a/nsswitch/wins.c
++++ b/nsswitch/wins.c
+@@ -261,6 +261,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 	ip = lookup_byname_backend(name);
+ 	if (ip == NULL) {
+ 		*errnop = EINVAL;
++		*h_errnop = NETDB_INTERNAL;
+ 		nss_status = NSS_STATUS_NOTFOUND;
+ 		goto out;
+ 	}
+@@ -269,6 +270,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 	wbcFreeMemory(ip);
+ 	if (rc == 0) {
+ 		*errnop = errno;
++		*h_errnop = NETDB_INTERNAL;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -279,6 +281,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 
+ 	if ((he->h_name = get_static(&buffer, &buflen, namelen)) == NULL) {
+ 		*errnop = EAGAIN;
++		*h_errnop = NETDB_INTERNAL;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -292,6 +295,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 
+ 	if (get_static(&buffer, &buflen, i) == NULL) {
+ 		*errnop = EAGAIN;
++		*h_errnop = NETDB_INTERNAL;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -299,6 +303,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 	if ((he->h_addr_list = (char **)get_static(
+ 		     &buffer, &buflen, 2 * sizeof(char *))) == NULL) {
+ 		*errnop = EAGAIN;
++		*h_errnop = NETDB_INTERNAL;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -306,6 +311,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 	if ((he->h_addr_list[0] = get_static(&buffer, &buflen,
+ 					     INADDRSZ)) == NULL) {
+ 		*errnop = EAGAIN;
++		*h_errnop = NETDB_INTERNAL;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -326,6 +332,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 
+ 	if (get_static(&buffer, &buflen, i) == NULL) {
+ 		*errnop = EAGAIN;
++		*h_errnop = NETDB_INTERNAL;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+@@ -333,12 +340,14 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 	if ((he->h_aliases = (char **)get_static(
+ 		     &buffer, &buflen, sizeof(char *))) == NULL) {
+ 		*errnop = EAGAIN;
++		*h_errnop = NETDB_INTERNAL;
+ 		nss_status = NSS_STATUS_TRYAGAIN;
+ 		goto out;
+ 	}
+ 
+ 	he->h_aliases[0] = NULL;
+ 
++	*h_errnop = NETDB_SUCCESS;
+ 	nss_status = NSS_STATUS_SUCCESS;
+ 
+   out:
+-- 
+2.10.0
+
+From c91544eb234af9a13ab08f2b1e31d2915965985b Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@samba.org>
+Date: Sun, 13 Nov 2016 17:40:21 +0100
+Subject: [PATCH] nss_wins: Fix errno values for HOST_NOT_FOUND
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269
+
+Signed-off-by: Andreas Schneider <asn@samba.org>
+---
+ nsswitch/wins.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/nsswitch/wins.c b/nsswitch/wins.c
+index dccb6dd..19d3c5b 100644
+--- a/nsswitch/wins.c
++++ b/nsswitch/wins.c
+@@ -260,8 +260,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
+ 
+ 	ip = lookup_byname_backend(name);
+ 	if (ip == NULL) {
+-		*errnop = EINVAL;
+-		*h_errnop = NETDB_INTERNAL;
++		*h_errnop = HOST_NOT_FOUND;
+ 		nss_status = NSS_STATUS_NOTFOUND;
+ 		goto out;
+ 	}
+-- 
+2.10.2
+
diff --git a/SOURCES/samba-4.4.6-fix_smbclient_against_apple_and_azure.patch b/SOURCES/samba-4.4.6-fix_smbclient_against_apple_and_azure.patch
new file mode 100644
index 0000000..488e8d6
--- /dev/null
+++ b/SOURCES/samba-4.4.6-fix_smbclient_against_apple_and_azure.patch
@@ -0,0 +1,136 @@
+From 2a9e5a9a226a4628546dbaaea59ff78fe32a2352 Mon Sep 17 00:00:00 2001
+From: Stefan Metzmacher <metze@samba.org>
+Date: Thu, 1 Sep 2016 08:08:23 +0200
+Subject: [PATCH] gensec/spnego: work around missing server mechListMIC in SMB
+ servers
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=11994
+
+Signed-off-by: Stefan Metzmacher <metze@samba.org>
+Reviewed-by: Christian Ambach <ambi@samba.org>
+
+Autobuild-User(master): Christian Ambach <ambi@samba.org>
+Autobuild-Date(master): Fri Sep  2 18:10:44 CEST 2016 on sn-devel-144
+
+(cherry picked from commit 9b45ba5cd53bd513eb777590815a0b8408af64e2)
+---
+ auth/gensec/spnego.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 68 insertions(+), 1 deletion(-)
+
+diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
+index ef30ab7..5f5047a 100644
+--- a/auth/gensec/spnego.c
++++ b/auth/gensec/spnego.c
+@@ -55,9 +55,11 @@ struct spnego_state {
+ 
+ 	DATA_BLOB mech_types;
+ 	size_t num_targs;
++	bool downgraded;
+ 	bool mic_requested;
+ 	bool needs_mic_sign;
+ 	bool needs_mic_check;
++	bool may_skip_mic_check;
+ 	bool done_mic_check;
+ 
+ 	bool simulate_w2k;
+@@ -434,6 +436,7 @@ static NTSTATUS gensec_spnego_parse_negTokenInit(struct gensec_security *gensec_
+ 					 * Indicate the downgrade and request a
+ 					 * mic.
+ 					 */
++					spnego_state->downgraded = true;
+ 					spnego_state->mic_requested = true;
+ 					break;
+ 				}
+@@ -1078,7 +1081,7 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
+ 			DEBUG(3,("GENSEC SPNEGO: client preferred mech (%s) not accepted, server wants: %s\n",
+ 				 gensec_get_name_by_oid(gensec_security, spnego_state->neg_oid),
+ 				 gensec_get_name_by_oid(gensec_security, spnego.negTokenTarg.supportedMech)));
+-
++			spnego_state->downgraded = true;
+ 			spnego_state->no_response_expected = false;
+ 			talloc_free(spnego_state->sub_sec_security);
+ 			nt_status = gensec_subcontext_start(spnego_state,
+@@ -1135,6 +1138,23 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
+ 				return NT_STATUS_INVALID_PARAMETER;
+ 			}
+ 
++			if (spnego.negTokenTarg.mechListMIC.length == 0
++			    && spnego_state->may_skip_mic_check) {
++				/*
++				 * In this case we don't require
++				 * a mechListMIC from the server.
++				 *
++				 * This works around bugs in the Azure
++				 * and Apple spnego implementations.
++				 *
++				 * See
++				 * https://bugzilla.samba.org/show_bug.cgi?id=11994
++				 */
++				spnego_state->needs_mic_check = false;
++				nt_status = NT_STATUS_OK;
++				goto client_response;
++			}
++
+ 			nt_status = gensec_check_packet(spnego_state->sub_sec_security,
+ 							spnego_state->mech_types.data,
+ 							spnego_state->mech_types.length,
+@@ -1190,9 +1210,56 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
+ 					 */
+ 					new_spnego = false;
+ 				}
++
+ 				break;
+ 
+ 			case SPNEGO_ACCEPT_INCOMPLETE:
++				if (spnego.negTokenTarg.mechListMIC.length > 0) {
++					new_spnego = true;
++					break;
++				}
++
++				if (spnego_state->downgraded) {
++					/*
++					 * A downgrade should be protected if
++					 * supported
++					 */
++					break;
++				}
++
++				/*
++				 * The caller may just asked for
++				 * GENSEC_FEATURE_SESSION_KEY, this
++				 * is only reflected in the want_features.
++				 *
++				 * As it will imply
++				 * gensec_have_features(GENSEC_FEATURE_SIGN)
++				 * to return true.
++				 */
++				if (gensec_security->want_features & GENSEC_FEATURE_SIGN) {
++					break;
++				}
++				if (gensec_security->want_features & GENSEC_FEATURE_SEAL) {
++					break;
++				}
++				/*
++				 * Here we're sure our preferred mech was
++				 * selected by the server and our caller doesn't
++				 * need GENSEC_FEATURE_SIGN nor
++				 * GENSEC_FEATURE_SEAL support.
++				 *
++				 * In this case we don't require
++				 * a mechListMIC from the server.
++				 *
++				 * This works around bugs in the Azure
++				 * and Apple spnego implementations.
++				 *
++				 * See
++				 * https://bugzilla.samba.org/show_bug.cgi?id=11994
++				 */
++				spnego_state->may_skip_mic_check = true;
++				break;
++
+ 			case SPNEGO_REQUEST_MIC:
+ 				if (spnego.negTokenTarg.mechListMIC.length > 0) {
+ 					new_spnego = true;
+-- 
+2.8.0.rc3.226.g39d4020
+
diff --git a/SOURCES/samba-4.4.7-fix_group_substituion_with_ad.patch b/SOURCES/samba-4.4.7-fix_group_substituion_with_ad.patch
new file mode 100644
index 0000000..0941e07
--- /dev/null
+++ b/SOURCES/samba-4.4.7-fix_group_substituion_with_ad.patch
@@ -0,0 +1,109 @@
+From 6dfc274ce5ae036a95ac2d7f6f9182c7f5a5b50f Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@samba.org>
+Date: Mon, 19 Sep 2016 13:59:54 +0200
+Subject: [PATCH] s3-lib: Fix %G substitution in AD member environment
+
+If we are a domain member we should look up the user with the domain
+name specified else it will only work if we have
+'winbind use default domain' set.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=12276
+
+Signed-off-by: Andreas Schneider <asn@samba.org>
+Reviewed-by: Ralph Boehme <slow@samba.org>
+(cherry picked from commit 619ca5f63c47ff8b021692aaa756dcb0d883b8dd)
+---
+ source3/lib/substitute.c | 24 ++++++++++++++++++------
+ 1 file changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
+index 4e2ce9b..1f98327 100644
+--- a/source3/lib/substitute.c
++++ b/source3/lib/substitute.c
+@@ -499,15 +499,18 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx,
+ 			break;
+ 		case 'G' : {
+ 			struct passwd *pass;
++			bool is_domain_name = false;
++			const char *sep = lp_winbind_separator();
+ 
+ 			if (domain_name != NULL && domain_name[0] != '\0' &&
+-			    !strequal(domain_name, my_sam_name()))
+-			{
++			    (lp_security() == SEC_ADS ||
++			     lp_security() == SEC_DOMAIN)) {
+ 				r = talloc_asprintf(tmp_ctx,
+ 						    "%s%c%s",
+ 						    domain_name,
+-						    *lp_winbind_separator(),
++						    *sep,
+ 						    smb_name);
++				is_domain_name = true;
+ 			} else {
+ 				r = talloc_strdup(tmp_ctx, smb_name);
+ 			}
+@@ -517,9 +520,18 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx,
+ 
+ 			pass = Get_Pwnam_alloc(tmp_ctx, r);
+ 			if (pass != NULL) {
+-				a_string = realloc_string_sub(
+-					a_string, "%G",
+-					gidtoname(pass->pw_gid));
++				char *group_name;
++
++				group_name = gidtoname(pass->pw_gid);
++				if (is_domain_name) {
++					p = strchr_m(group_name, *sep);
++					if (p != NULL) {
++						group_name = p + 1;
++					}
++				}
++				a_string = realloc_string_sub(a_string,
++							      "%G",
++							      group_name);
+ 			}
+ 			TALLOC_FREE(pass);
+ 			break;
+-- 
+2.10.1
+
+From d851e487422808b6d3ba2738daa1c697e569bd27 Mon Sep 17 00:00:00 2001
+From: Volker Lendecke <vl@samba.org>
+Date: Wed, 12 Oct 2016 12:35:12 +0200
+Subject: [PATCH] lib: Fix CID 1373623 Dereference after null check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We should not overload "p", this is used in the outer loop
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=12276
+Signed-off-by: Volker Lendecke <vl@samba.org>
+Reviewed-by: Ralph Böhme <slow@samba.org>
+Reviewed-by: Jeremy Allison <jra@samba.org>
+(cherry picked from commit 6ec81ca3c196f3c4659a4e1c473759b393708d12)
+---
+ source3/lib/substitute.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
+index 1f98327..f56e2c4 100644
+--- a/source3/lib/substitute.c
++++ b/source3/lib/substitute.c
+@@ -524,9 +524,10 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx,
+ 
+ 				group_name = gidtoname(pass->pw_gid);
+ 				if (is_domain_name) {
+-					p = strchr_m(group_name, *sep);
+-					if (p != NULL) {
+-						group_name = p + 1;
++					char *group_sep;
++					group_sep = strchr_m(group_name, *sep);
++					if (group_sep != NULL) {
++						group_name = group_sep + 1;
+ 					}
+ 				}
+ 				a_string = realloc_string_sub(a_string,
+-- 
+2.10.1
+
diff --git a/SPECS/samba.spec b/SPECS/samba.spec
index c49f684..fa05aee 100644
--- a/SPECS/samba.spec
+++ b/SPECS/samba.spec
@@ -6,7 +6,7 @@
 # ctdb is enabled by default, you can disable it with: --without clustering
 %bcond_without clustering
 
-%define main_release 9
+%define main_release 12
 
 %define samba_version 4.4.4
 %define talloc_version 2.1.6
@@ -117,6 +117,9 @@ Patch6:    samba-4.4.7-fix_ads_krb5_ccname_handling.patch
 Patch7:    samba-4.4.7-fix_smbclient_cpu_usage_with_unreachable_ip.patch
 Patch8:    samba-4.4.7-fix_idmap_range_checks.patch
 Patch9:    samba-4.4.7-fix_smget_auth_callback.patch
+Patch10:   samba-4.4.6-fix_nss_wins.patch
+Patch11:   samba-4.4.7-fix_group_substituion_with_ad.patch
+Patch12:   samba-4.4.6-fix_smbclient_against_apple_and_azure.patch
 
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
@@ -711,6 +714,9 @@ and use CTDB instead.
 %patch7 -p1 -b .samba-4.4.7-fix_smbclient_cpu_usage_with_unreachable_ip.patch
 %patch8 -p1 -b .samba-4.4.7-fix_idmap_range_checks.patch
 %patch9 -p1 -b .samba-4.4.7-fix_smget_auth_callback.patch
+%patch10 -p1 -b .samba-4.4.6-fix_nss_wins.patch
+%patch11 -p1 -b .samba-4.4.7-fix_group_substituion_with_ad.patch
+%patch12 -p1 -b .samba-4.4.6-fix_smbclient_against_apple_and_azure.patch
 
 %build
 %global _talloc_lib ,talloc,pytalloc,pytalloc-util
@@ -939,7 +945,7 @@ fi
 
 %postun client
 if [ $1 -eq 0 ] ; then
-    %{_sbindir}/update-alternatives --remove cups_backend_smb %{_libexecdir}/samba/smbspool
+    %{_sbindir}/update-alternatives --remove cups_backend_smb %{_bindir}/smbspool
 fi
 
 %post client-libs -p /sbin/ldconfig
@@ -2019,6 +2025,19 @@ rm -rf %{buildroot}
 %endif # with_clustering_support
 
 %changelog
+* Tue Nov 15 2016 Andreas Schneider <asn@redhat.com> - 4.4.4-11
+- related: #1393051 - Fix return code if ip not defined in gethostbyname
+
+* Wed Nov 09 2016 Andreas Schneider <asn@redhat.com> - 4.4.4-11
+- related: #1393048 - Add missing patch to patchset
+
+* Tue Nov 08 2016 Andreas Schneider <asn@redhat.com> - 4.4.4-10
+- resolves: #1393050 - Fix linking nss_wins with libreplace
+- resolves: #1393051 - Fix nss_wins function definitions for gethostbyname*
+- resolves: #1393048 - Fix %G substitution in AD case
+- resolves: #1393052 - Fix regression of smbclient unable to connect to
+                       Apple and Azure
+
 * Wed Aug 31 2016 Andreas Schneider <asn@redhat.com> - 4.4.4-9
 - related: #1365479 - Fix idmap range check