[Date Prev][Date Next]
RE: ITS#8654 - Option for LDAP client to bind to a local address
- To: "'email@example.com'" <firstname.lastname@example.org>
- Subject: RE: ITS#8654 - Option for LDAP client to bind to a local address
- From: Daniel Le <email@example.com>
- Date: Mon, 12 Jun 2017 19:34:57 +0000
- Accept-language: en-US
- Content-language: en-US
- In-reply-to: <BC204A77E2E9CD4A85A8F600C7F0BA848C0F6055@SPQCMBX01.exfo.com>
- References: <BC204A77E2E9CD4A85A8F600C7F0BA848C0F6055@SPQCMBX01.exfo.com>
- Thread-index: AdLOWxRzHaFt49MoR/+4m9haYKrgVAVVw2wg
- Thread-topic: ITS#8654 - Option for LDAP client to bind to a local address
I've got a chance to write (and test) the code to add API support for socket binding addresses.
Should I send the code diff to this openldap-devel email list for review? How to submit a patch request?
From: Daniel Le
Sent: Tuesday, May 16, 2017 6:02 PM
To: 'firstname.lastname@example.org' <email@example.com>
Subject: ITS#8654 - Option for LDAP client to bind to a local address
In reference to the enhancement request ITS#865, please comment on the following to add support for binding a local IP address to client socket. This is just an outline of changes for one local address. I am not sure whether a list of local addresses is necessary. If it is, then a new function, similarly to ldap_url_parsehosts, may be written to parse the list of local addresses and store them into a linked list. In my use case, only one IPv4 or IPv6 local address is used for binding.
- Modify ldap.h and ldap_set_option to handle the new option LDAP_OPT_LOCAL_ADDRESS.
Should it be named LDAP_OPT_CLIENT_ADDRESS, LDAP_OPT_SOCKET_BIND_ADDRESS...?
- Modify struct ldapoptions in ldap-int.h to add element "char *ldo_local_address" to hold client local address when ldap_set_option(LDAP_OPT_LOCAL_ADDRESS...) is executed.
This can char pointer can point to an IPv4 address or IPv6 address.
- ldap_connect_to_host() in os-ip.c
After the connection socket is created (ldap_int_socket) and before it is connected (ldap_pvt_connect), extract the local IP address.
If local address family (AF_INET/ AF_INET6) matches the one of the host, bind socket to the local address.