aldap referral problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

aldap referral problem

Martijn van Duren-8
With the introduction of ber.c r1.12 I apparently broke aldap.c's
packets without referral. According to RFC4511 section 4.1.9 the
referral element is optional.
Since my change to ber.c returns an error if an element doesn't exist
(instead of stupidly copying the last element) the ber_scanf_elements
on aldap.c:410 fails if the referral element is not set.

The diff below fixes this and makes ypldap(8) and ldap(1) work again.
Applies to both instances of aldap.c.

OK?

martijn@

Index: aldap.c
===================================================================
RCS file: /cvs/src/usr.bin/ldap/aldap.c,v
retrieving revision 1.7
diff -u -p -r1.7 aldap.c
--- aldap.c 17 Jan 2019 06:18:27 -0000 1.7
+++ aldap.c 10 Sep 2019 05:17:11 -0000
@@ -407,10 +407,11 @@ aldap_parse(struct aldap *ldap)
  case LDAP_RES_MODRDN:
  case LDAP_RES_COMPARE:
  case LDAP_RES_SEARCH_RESULT:
- if (ber_scanf_elements(m->protocol_op, "{EeSeSe",
-    &m->body.res.rescode, &m->dn, &m->body.res.diagmsg, &a) != 0)
+ if (ber_scanf_elements(m->protocol_op, "{EeSe",
+    &m->body.res.rescode, &m->dn, &m->body.res.diagmsg) != 0)
  goto parsefail;
  if (m->body.res.rescode == LDAP_REFERRAL)
+ a = m->body.res.diagmsg->be_next;
  if (ber_scanf_elements(a, "{e", &m->references) != 0)
  goto parsefail;
  if (m->msg->be_sub) {