--- /dev/null
+From 580eabc2c9dfe29d719a026ff8f6ac3d2ead1983 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@samba.org>
+Date: Tue, 8 Sep 2015 16:48:08 +0200
+Subject: [PATCH] PATCHSET28: pam_winbind: Fix a segfault if initialization
+ fails
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=11502
+
+Signed-off-by: Andreas Schneider <asn@samba.org>
+Reviewed-by: Michael Adam <obnox@samba.org>
+
+Autobuild-User(master): Michael Adam <obnox@samba.org>
+Autobuild-Date(master): Tue Sep 8 21:39:21 CEST 2015 on sn-devel-104
+
+(cherry picked from commit 7d84cd6e40024fd361ea21635f7befed40f0e41f)
+---
+ nsswitch/pam_winbind.c | 19 ++++++++-----------
+ 1 file changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
+index d126494..cfaa5f1 100644
+--- a/nsswitch/pam_winbind.c
++++ b/nsswitch/pam_winbind.c
+@@ -2465,7 +2465,7 @@ static int _pam_delete_cred(pam_handle_t *pamh, int flags,
+
+ retval = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
+ if (retval) {
+- goto out;
++ return retval;
+ }
+
+ _PAM_LOG_FUNCTION_ENTER("_pam_delete_cred", ctx);
+@@ -2600,7 +2600,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
+
+ retval = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
+ if (retval) {
+- goto out;
++ return retval;
+ }
+
+ _PAM_LOG_FUNCTION_ENTER("pam_sm_authenticate", ctx);
+@@ -2752,7 +2752,7 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
+
+ ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
+ if (ret) {
+- goto out;
++ return ret;
+ }
+
+ _PAM_LOG_FUNCTION_ENTER("pam_sm_setcred", ctx);
+@@ -2782,8 +2782,6 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
+ break;
+ }
+
+- out:
+-
+ _PAM_LOG_FUNCTION_LEAVE("pam_sm_setcred", ctx, ret);
+
+ TALLOC_FREE(ctx);
+@@ -2806,7 +2804,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
+
+ ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
+ if (ret) {
+- goto out;
++ return ret;
+ }
+
+ _PAM_LOG_FUNCTION_ENTER("pam_sm_acct_mgmt", ctx);
+@@ -2901,7 +2899,7 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags,
+
+ ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
+ if (ret) {
+- goto out;
++ return ret;
+ }
+
+ _PAM_LOG_FUNCTION_ENTER("pam_sm_open_session", ctx);
+@@ -2910,7 +2908,7 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags,
+ /* check and create homedir */
+ ret = _pam_mkhomedir(ctx);
+ }
+- out:
++
+ _PAM_LOG_FUNCTION_LEAVE("pam_sm_open_session", ctx, ret);
+
+ TALLOC_FREE(ctx);
+@@ -2927,12 +2925,11 @@ int pam_sm_close_session(pam_handle_t *pamh, int flags,
+
+ ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
+ if (ret) {
+- goto out;
++ return ret;
+ }
+
+ _PAM_LOG_FUNCTION_ENTER("pam_sm_close_session", ctx);
+
+-out:
+ _PAM_LOG_FUNCTION_LEAVE("pam_sm_close_session", ctx, ret);
+
+ TALLOC_FREE(ctx);
+@@ -3012,7 +3009,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
+
+ ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
+ if (ret) {
+- goto out;
++ return ret;
+ }
+
+ _PAM_LOG_FUNCTION_ENTER("pam_sm_chauthtok", ctx);
+--
+2.5.0
+