commit:     31aa8f44b17b5139a6aad2cb874dd886308a4958
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 16 15:50:24 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Sep 16 15:50:35 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31aa8f44

net-misc/dhcp: fix build with USE="ldap -ipv6" #559832

 net-misc/dhcp/dhcp-4.3.3.ebuild                    |  1 +
 .../files/dhcp-4.3.3-ldap-ipv6-client-id.patch     | 81 ++++++++++++++++++++++
 2 files changed, 82 insertions(+)

diff --git a/net-misc/dhcp/dhcp-4.3.3.ebuild b/net-misc/dhcp/dhcp-4.3.3.ebuild
index b5a75fa..a2c42d4 100644
--- a/net-misc/dhcp/dhcp-4.3.3.ebuild
+++ b/net-misc/dhcp/dhcp-4.3.3.ebuild
@@ -62,6 +62,7 @@ src_prepare() {
        epatch "${FILESDIR}"/${PN}-4.2.4-always-accept-4.patch #437108
        epatch "${FILESDIR}"/${PN}-4.2.5-iproute2-path.patch #480636
        epatch "${FILESDIR}"/${PN}-4.2.5-bindtodevice-inet6.patch #471142
+       epatch "${FILESDIR}"/${PN}-4.3.3-ldap-ipv6-client-id.patch #559832
 
        # Brand the version with Gentoo
        sed -i \

diff --git a/net-misc/dhcp/files/dhcp-4.3.3-ldap-ipv6-client-id.patch 
b/net-misc/dhcp/files/dhcp-4.3.3-ldap-ipv6-client-id.patch
new file mode 100644
index 0000000..2a7f818
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.3.3-ldap-ipv6-client-id.patch
@@ -0,0 +1,81 @@
+https://bugs.gentoo.org/559832
+
+the get_client_id func is used outside of IPv6 code, so don't store it in the
+IPv6-specific dhcpv6.c file.  otherwise, building w/out IPv6 & w/ldap yields:
+dhcpd-ldap.o: In function 'find_client_in_ldap':
+ldap.c:(.text+0x4774): undefined reference to 'get_client_id'
+
+--- a/server/dhcpleasequery.c
++++ b/server/dhcpleasequery.c
+@@ -33,6 +33,34 @@
+  *       DoS'ed by DHCPLEASEQUERY message.
+  */
+ 
++/*
++ * Get the client identifier from the packet.
++ */
++isc_result_t
++get_client_id(struct packet *packet, struct data_string *client_id) {
++      struct option_cache *oc;
++
++      /*
++       * Verify our client_id structure is empty.
++       */
++      if ((client_id->data != NULL) || (client_id->len != 0)) {
++              return DHCP_R_INVALIDARG;
++      }
++
++      oc = lookup_option(&dhcpv6_universe, packet->options, D6O_CLIENTID);
++      if (oc == NULL) {
++              return ISC_R_NOTFOUND;
++      }
++
++      if (!evaluate_option_cache(client_id, packet, NULL, NULL,
++                                 packet->options, NULL,
++                                 &global_scope, oc, MDL)) {
++              return ISC_R_FAILURE;
++      }
++
++      return ISC_R_SUCCESS;
++}
++
+ /* 
+  * If you query by hardware address or by client ID, then you may have
+  * more than one IP address for your query argument. We need to do two
+--- a/server/dhcpv6.c
++++ b/server/dhcpv6.c
+@@ -392,34 +392,6 @@ generate_new_server_duid(void) {
+ }
+ 
+ /*
+- * Get the client identifier from the packet.
+- */
+-isc_result_t
+-get_client_id(struct packet *packet, struct data_string *client_id) {
+-      struct option_cache *oc;
+-
+-      /*
+-       * Verify our client_id structure is empty.
+-       */
+-      if ((client_id->data != NULL) || (client_id->len != 0)) {
+-              return DHCP_R_INVALIDARG;
+-      }
+-
+-      oc = lookup_option(&dhcpv6_universe, packet->options, D6O_CLIENTID);
+-      if (oc == NULL) {
+-              return ISC_R_NOTFOUND;
+-      }
+-
+-      if (!evaluate_option_cache(client_id, packet, NULL, NULL,
+-                                 packet->options, NULL,
+-                                 &global_scope, oc, MDL)) {
+-              return ISC_R_FAILURE;
+-      }
+-
+-      return ISC_R_SUCCESS;
+-}
+-
+-/*
+  * Message validation, defined in RFC 3315, sections 15.2, 15.5, 15.7:
+  *
+  *    Servers MUST discard any Solicit messages that do not include a

Reply via email to