diff options
author | Hans Nilsson <[email protected]> | 2016-02-25 09:48:28 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2016-02-25 09:48:28 +0100 |
commit | 761804cdda45a71b9e82e5340ca98c3ea94e4886 (patch) | |
tree | 2a387d8bbdfd15c3ad418cc78423d2b73c29c3d6 /lib | |
parent | b095a95279e452545fde76710090b6d6294852a4 (diff) | |
parent | 6446032a1b248c32c5ae89f1d362d8b0a6b09f7b (diff) | |
download | otp-761804cdda45a71b9e82e5340ca98c3ea94e4886.tar.gz otp-761804cdda45a71b9e82e5340ca98c3ea94e4886.tar.bz2 otp-761804cdda45a71b9e82e5340ca98c3ea94e4886.zip |
Merge branch 'hans/eldap/unbind/OTP-13327' into maint
Conflicts:
lib/eldap/src/eldap.erl
Diffstat (limited to 'lib')
-rw-r--r-- | lib/eldap/doc/src/eldap.xml | 3 | ||||
-rw-r--r-- | lib/eldap/src/eldap.erl | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/eldap/doc/src/eldap.xml b/lib/eldap/doc/src/eldap.xml index 70add6619d..43873e44e2 100644 --- a/lib/eldap/doc/src/eldap.xml +++ b/lib/eldap/doc/src/eldap.xml @@ -135,7 +135,8 @@ <v>Handle = handle()</v> </type> <desc> - <p>Shutdown the connection.</p> + <p>Shutdown the connection after sending an unbindRequest to the server. If the connection is tls the connection + will be closed with <c>ssl:close/1</c>, otherwise with <c>gen_tcp:close/1</c>.</p> </desc> </func> <func> diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl index f6d2e014a3..3ab96ffeb5 100644 --- a/lib/eldap/src/eldap.erl +++ b/lib/eldap/src/eldap.erl @@ -564,6 +564,7 @@ loop(Cpid, Data) -> ?MODULE:loop(Cpid, NewData); {_From, close} -> + {no_reply,_NewData} = do_unbind(Data), unlink(Cpid), exit(closed); @@ -611,7 +612,6 @@ loop(Cpid, Data) -> %%% -------------------------------------------------------------------- %%% startTLS Request %%% -------------------------------------------------------------------- - do_start_tls(Data=#eldap{using_tls=true}, _, _, _) -> {{error,tls_already_started}, Data}; do_start_tls(Data=#eldap{fd=FD} , TlsOptions, Timeout, Controls) -> @@ -946,6 +946,24 @@ do_modify_dn_0(Data, Entry, NewRDN, DelOldRDN, NewSup, Controls) -> log2(Data, "modify DN reply = ~p~n", [Resp]), check_reply(Data#eldap{id = Id}, Resp, modDNResponse). +%%%-------------------------------------------------------------------- +%%% unbindRequest +%%%-------------------------------------------------------------------- +do_unbind(Data) -> + Req = "", + log2(Data, "unbind request = ~p (has no reply)~n", [Req]), + send_request(Data#eldap.fd, Data, Data#eldap.id, {unbindRequest, Req}), + case Data#eldap.using_tls of + true -> ssl:close(Data#eldap.fd); + false -> gen_tcp:close(Data#eldap.fd) + end, + {no_reply, Data#eldap{binddn = (#eldap{})#eldap.binddn, + passwd = (#eldap{})#eldap.passwd, + fd = (#eldap{})#eldap.fd, + using_tls = false + }}. + + %%% -------------------------------------------------------------------- %%% Send an LDAP request and receive the answer %%% -------------------------------------------------------------------- |