diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-07-18 07:45:16 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:28:48 -0500 |
commit | 07c034f7c443689749c2b4b138acb991da575c3a (patch) | |
tree | aae8514c1fc60df21a43352c80e1d20804c38607 /source3/libads/ldap.c | |
parent | e0c4034393a05acba9b6ba7dd015cfc3e6d46c0f (diff) | |
download | samba-07c034f7c443689749c2b4b138acb991da575c3a.tar.gz samba-07c034f7c443689749c2b4b138acb991da575c3a.tar.bz2 samba-07c034f7c443689749c2b4b138acb991da575c3a.zip |
r23945: add infrastructure to select plain, sign or seal LDAP connection
metze
(This used to be commit 2075c05b3d8baa7d6d8510cd962471a5781740a6)
Diffstat (limited to 'source3/libads/ldap.c')
-rw-r--r-- | source3/libads/ldap.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index fe7add5e75..0b73229736 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -372,8 +372,9 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads) ADS_STATUS status; NTSTATUS ntstatus; - ads->ldap.last_attempt = time(NULL); - ads->ldap.ld = NULL; + ZERO_STRUCT(ads->ldap); + ads->ldap.last_attempt = time(NULL); + ads->ldap.wrap_type = ADS_SASLWRAP_TYPE_PLAIN; /* try with a user specified server */ @@ -423,6 +424,11 @@ got_connection: if (ads->auth.flags & ADS_AUTH_NO_BIND) { return ADS_SUCCESS; } + + ads->ldap.mem_ctx = talloc_new("ads LDAP connection memory"); + if (!ads->ldap.mem_ctx) { + return ADS_ERROR_NT(NT_STATUS_NO_MEMORY); + } /* Otherwise setup the TCP LDAP session */ @@ -475,6 +481,13 @@ void ads_disconnect(ADS_STRUCT *ads) ldap_unbind(ads->ldap.ld); ads->ldap.ld = NULL; } + if (ads->ldap.wrap_ops && ads->ldap.wrap_ops->disconnect) { + ads->ldap.wrap_ops->disconnect(ads); + } + if (ads->ldap.mem_ctx) { + talloc_free(ads->ldap.mem_ctx); + } + ZERO_STRUCT(ads->ldap); } /* |