Check error returns from strupper_m() (in all reasonable places).
[mat/samba.git] / source3 / winbindd / winbindd_ads.c
index 854e12c53b619ad6a7bc0a3ae765ffaf7c0d11d9..4efd829cb9d0e7cb79e04242375a447e01e15a17 100644 (file)
@@ -99,7 +99,10 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
                        return NULL;
                }
                ads->auth.realm = SMB_STRDUP( ads->server.realm );
-               strupper_m( ads->auth.realm );
+               if (!strupper_m( ads->auth.realm )) {
+                       ads_destroy( &ads );
+                       return NULL;
+               }
        }
        else {
                struct winbindd_domain *our_domain = domain;
@@ -114,7 +117,10 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
 
                if ( our_domain->alt_name[0] != '\0' ) {
                        ads->auth.realm = SMB_STRDUP( our_domain->alt_name );
-                       strupper_m( ads->auth.realm );
+                       if (!strupper_m( ads->auth.realm )) {
+                               ads_destroy( &ads );
+                               return NULL;
+                       }
                }
                else
                        ads->auth.realm = SMB_STRDUP( lp_realm() );