summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-01-21 01:21:33 +0000
committerGerald Carter <jerry@samba.org>2003-01-21 01:21:33 +0000
commit8308ec6979d8d71903cb82963827d194d8c7bff3 (patch)
tree319c2839052539d15190bc123e53202a16f3f17a /source3
parent51d3f6175041a3bf2d292997f137f129aaca83fb (diff)
downloadsamba-8308ec6979d8d71903cb82963827d194d8c7bff3.tar.gz
samba-8308ec6979d8d71903cb82963827d194d8c7bff3.tar.bz2
samba-8308ec6979d8d71903cb82963827d194d8c7bff3.zip
sanity checks from Ken Cross
(This used to be commit 9f35846b8e0d711c9101ade9e79394219045383c)
Diffstat (limited to 'source3')
-rw-r--r--source3/libads/ads_struct.c4
-rw-r--r--source3/libads/ldap.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index 3cdd015bf4..c45805cd16 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -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;
}
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 1743bc2dd6..0a95e019bf 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -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);