s3:winbind: fail ads_cached_connection_connect() if realm == NULL
authorMichael Adam <obnox@samba.org>
Thu, 29 Aug 2013 14:38:08 +0000 (16:38 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 29 Aug 2013 16:54:28 +0000 (18:54 +0200)
This prevents segfaults when e.g. a previous SMB_STRDUP failed..

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Aug 29 18:54:28 CEST 2013 on sn-devel-104

source3/winbindd/winbindd_ads.c

index c33b1bc3bf1182da5f895cac114824c5fffb12a3..4c2638900ffa1cb609e7c932147ca27ef9e5d7e4 100644 (file)
@@ -86,6 +86,10 @@ static ADS_STATUS ads_cached_connection_connect(ADS_STRUCT **adsp,
        struct sockaddr_storage dc_ss;
        fstring dc_name;
 
+       if (realm == NULL) {
+               return ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+       }
+
        /* we don't want this to affect the users ccache */
        setenv("KRB5CCNAME", WINBIND_CCACHE_NAME, 1);