summaryrefslogtreecommitdiff
path: root/source3/libads/ldap.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-08-31 04:14:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:39:01 -0500
commit2fcd113f5507f643fcf80d5a9770ce72aa121ba8 (patch)
tree29bd85c741a4c43b3fdfdf8d5d6e8481bf044b67 /source3/libads/ldap.c
parentcceb492250ce7e273cdc48c030048c0879a7265a (diff)
downloadsamba-2fcd113f5507f643fcf80d5a9770ce72aa121ba8.tar.gz
samba-2fcd113f5507f643fcf80d5a9770ce72aa121ba8.tar.bz2
samba-2fcd113f5507f643fcf80d5a9770ce72aa121ba8.zip
r17945: Store the server and client sitenames in the ADS
struct so we can see when they match - only create the ugly krb5 hack when they do. Jeremy. (This used to be commit 9be4ecf24b6b5dacf4c2891bddb072fa7543753f)
Diffstat (limited to 'source3/libads/ldap.c')
-rw-r--r--source3/libads/ldap.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 1d192895d9..60e4c9f5b7 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -115,6 +115,27 @@ static int ldap_search_with_timeout(LDAP *ld,
return result;
}
+#ifdef HAVE_KRB5
+/**********************************************
+ Do client and server sitename match ?
+**********************************************/
+
+BOOL ads_sitename_match(ADS_STRUCT *ads)
+{
+ if (ads->config.server_site_name == NULL &&
+ ads->config.client_site_name == NULL ) {
+ return True;
+ }
+ if (ads->config.server_site_name &&
+ ads->config.client_site_name &&
+ strequal(ads->config.server_site_name,
+ ads->config.client_site_name)) {
+ return True;
+ }
+ return False;
+}
+#endif
+
/*
try a connection to a given ldap server, returning True and setting the servers IP
in the ads struct if successful
@@ -157,6 +178,8 @@ BOOL ads_try_connect(ADS_STRUCT *ads, const char *server )
SAFE_FREE(ads->config.realm);
SAFE_FREE(ads->config.bind_path);
SAFE_FREE(ads->config.ldap_server_name);
+ SAFE_FREE(ads->config.server_site);
+ SAFE_FREE(ads->config.client_site);
SAFE_FREE(ads->server.workgroup);
ads->config.flags = cldap_reply.flags;
@@ -164,6 +187,15 @@ BOOL ads_try_connect(ADS_STRUCT *ads, const char *server )
strupper_m(cldap_reply.domain);
ads->config.realm = SMB_STRDUP(cldap_reply.domain);
ads->config.bind_path = ads_build_dn(ads->config.realm);
+ if (*cldap_reply.server_site_name) {
+ ads->config.server_site_name =
+ SMB_STRDUP(cldap_reply.server_site_name);
+ }
+ if (*cldap_reply.client_site_name) {
+ ads->config.server_site_name =
+ SMB_STRDUP(cldap_reply.server_site_name);
+ }
+
ads->server.workgroup = SMB_STRDUP(cldap_reply.netbios_domain);
ads->ldap_port = LDAP_PORT;