libads/ldap.c: return an error instead of crashing when no realm is given
authorStefan Metzmacher <metze@samba.org>
Mon, 24 Nov 2008 14:07:56 +0000 (15:07 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 24 Nov 2008 14:30:11 +0000 (15:30 +0100)
The bug was triggered by "net ads info -S 127.8.7.6" (where 127.8.7.6 doesn't exist)
and "disable netbios = yes".

metze

Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit e2a60d2e1fd7455f08e73f8d1c513ca240c0f0af)

source/libads/ldap.c

index fa27415b3b1158c61c7b2bc471e17bd572a17de4..a83477394304c924cd01394b629e0a25c7395e5a 100644 (file)
@@ -301,11 +301,11 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
                        if ( use_own_domain )
                                c_realm = lp_workgroup();
                }
+       }
 
-               if ( !c_realm || !*c_realm ) {
-                       DEBUG(0,("ads_find_dc: no realm or workgroup!  Don't know what to do\n"));
-                       return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */
-               }
+       if ( !c_realm || !*c_realm ) {
+               DEBUG(0,("ads_find_dc: no realm or workgroup!  Don't know what to do\n"));
+               return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */
        }
 
        realm = c_realm;