summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-07-07 11:43:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:19:11 -0500
commitf3e71c60727366eca0f5023c83c661c36512153d (patch)
tree5b3c396acca1422bdf3c927914742966940d7ea1
parent03d116a1b7889f15f83219711477193e28fd2d04 (diff)
downloadsamba-f3e71c60727366eca0f5023c83c661c36512153d.tar.gz
samba-f3e71c60727366eca0f5023c83c661c36512153d.tar.bz2
samba-f3e71c60727366eca0f5023c83c661c36512153d.zip
r16861: Fixing crash bug when passing no domain/realm name to the CLDAP request.
Guenther (This used to be commit 863aeb621afa7dcec1bfef8e503ef8ed363e3742)
-rw-r--r--source3/libads/cldap.c10
-rw-r--r--source3/libads/ldap.c7
2 files changed, 10 insertions, 7 deletions
diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c
index 11c083a56a..f67372805f 100644
--- a/source3/libads/cldap.c
+++ b/source3/libads/cldap.c
@@ -115,10 +115,12 @@ static int send_cldap_netlogon(int sock, const char *domain,
asn1_write_BOOLEAN2(&data, False);
asn1_push_tag(&data, ASN1_CONTEXT(0));
- asn1_push_tag(&data, ASN1_CONTEXT(3));
- asn1_write_OctetString(&data, "DnsDomain", 9);
- asn1_write_OctetString(&data, domain, strlen(domain));
- asn1_pop_tag(&data);
+ if (domain) {
+ asn1_push_tag(&data, ASN1_CONTEXT(3));
+ asn1_write_OctetString(&data, "DnsDomain", 9);
+ asn1_write_OctetString(&data, domain, strlen(domain));
+ asn1_pop_tag(&data);
+ }
asn1_push_tag(&data, ASN1_CONTEXT(3));
asn1_write_OctetString(&data, "Host", 4);
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index ef4be210c6..ebffd667eb 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -122,15 +122,16 @@ BOOL ads_try_connect(ADS_STRUCT *ads, const char *server )
return False;
}
- DEBUG(5,("ads_try_connect: sending CLDAP request to %s\n", server));
+ DEBUG(5,("ads_try_connect: sending CLDAP request to %s (realm: %s)\n",
+ server, ads->config.realm));
/* this copes with inet_ntoa brokenness */
srv = SMB_STRDUP(server);
ZERO_STRUCT( cldap_reply );
-
- if ( !ads_cldap_netlogon( srv, ads->server.realm, &cldap_reply ) ) {
+
+ if ( !ads_cldap_netlogon( srv, ads->config.realm, &cldap_reply ) ) {
DEBUG(3,("ads_try_connect: CLDAP request %s failed.\n", srv));
return False;
}