sanity checks from Ken Cross
authorGerald Carter <jerry@samba.org>
Tue, 21 Jan 2003 01:21:33 +0000 (01:21 +0000)
committerGerald Carter <jerry@samba.org>
Tue, 21 Jan 2003 01:21:33 +0000 (01:21 +0000)
(This used to be commit 9f35846b8e0d711c9101ade9e79394219045383c)

source3/libads/ads_struct.c
source3/libads/ldap.c

index 3cdd015bf46909c02a9a5efc0e26fc497c21ff3d..c45805cd16f2fe2106999eec20aab60cd66ac666 100644 (file)
@@ -94,10 +94,10 @@ ADS_STRUCT *ads_init(const char *realm,
 
        /* we need to know if this is a foreign realm to know if we can
           use lp_ads_server() */
-       if (realm && strcasecmp(lp_realm(), realm) != 0) {
+       if (realm && *realm && strcasecmp(lp_realm(), realm) != 0) {
                ads->server.foreign = 1;
        }
-       if (workgroup && strcasecmp(lp_workgroup(), workgroup) != 0) {
+       if (workgroup && *workgroup && strcasecmp(lp_workgroup(), workgroup) != 0) {
                ads->server.foreign = 1;
        }
 
index 1743bc2dd614a3c9a28e8d5351cd2a60282090bc..0a95e019bfb5b7317a04365a6acb307a8d86e994 100644 (file)
@@ -1429,7 +1429,11 @@ ADS_STATUS ads_set_machine_sd(ADS_STRUCT *ads, const char *hostname, char *dn)
 
        if (!ADS_ERR_OK(ret)) return ret;
 
-       msg   = ads_first_entry(ads, res);
+       if ( !(msg = ads_first_entry(ads, res) )) {
+               ret = ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
+               goto ads_set_sd_error;
+       }
+
        ads_pull_sid(ads, msg, attrs[1], &sid); 
        if (!(ctx = talloc_init("sec_io_desc"))) {
                ret =  ADS_ERROR(LDAP_NO_MEMORY);