ITS#10356 libldap: implement LDAP_OPT_REFHOPLIMIT

This commit is contained in:
Howard Chu 2025-06-12 17:38:32 +01:00 committed by Quanah Gibson-Mount
parent 585e6aa9a5
commit 76e1492809
4 changed files with 28 additions and 4 deletions

View file

@ -295,10 +295,17 @@ or
.BR outvalue
must be
.BR "int *" .
.\".TP
.\".B LDAP_OPT_REFHOPLIMIT
.\"This option is OpenLDAP specific.
.\"It is not currently implemented.
.TP
.B LDAP_OPT_REFHOPLIMIT
Set the maximum number of referrals to chase for a request.
.BR invalue
must be
.BR "const int *" ;
.BR outvalue
must be a
.BR "int *" .
They cannot be NULL.
This option is OpenLDAP specific.
.TP
.B LDAP_OPT_RESTART
Determines whether the library should implicitly restart connections (FIXME).

View file

@ -208,6 +208,10 @@ Note that the command line tools
.\".B RESTART <on/true/yes/off/false/no>
.\"Determines whether the library should implicitly restart connections (FIXME).
.TP
.B REFHOPLIMIT <integer>
Specified the maximum number of referrals to follow when performing a
request. The number should be a positive integer. The default is 5.
.TP
.B SIZELIMIT <integer>
Specifies a size limit (number of entries) to use when performing searches.
The number should be a non-negative integer. \fISIZELIMIT\fP of zero (0)

View file

@ -82,6 +82,8 @@ static const struct ol_attribute {
{0, ATTR_OPT_INT, "VERSION", NULL, LDAP_OPT_PROTOCOL_VERSION},
{0, ATTR_KV, "DEREF", deref_kv, /* or &deref_kv[0] */
offsetof(struct ldapoptions, ldo_deref)},
{0, ATTR_INT, "REFHOPLIMIT", NULL,
offsetof(struct ldapoptions, ldo_refhoplimit)},
{0, ATTR_INT, "SIZELIMIT", NULL,
offsetof(struct ldapoptions, ldo_sizelimit)},
{0, ATTR_INT, "TIMELIMIT", NULL,

View file

@ -216,6 +216,11 @@ ldap_get_option(
rc = LDAP_OPT_SUCCESS;
break;
case LDAP_OPT_REFHOPLIMIT:
* (int *) outvalue = lo->ldo_refhoplimit;
rc = LDAP_OPT_SUCCESS;
break;
case LDAP_OPT_SIZELIMIT:
* (int *) outvalue = lo->ldo_sizelimit;
rc = LDAP_OPT_SUCCESS;
@ -836,6 +841,7 @@ ldap_set_option(
/* options which cannot withstand invalue == NULL */
case LDAP_OPT_DEREF:
case LDAP_OPT_REFHOPLIMIT:
case LDAP_OPT_SIZELIMIT:
case LDAP_OPT_TIMELIMIT:
case LDAP_OPT_PROTOCOL_VERSION:
@ -881,6 +887,11 @@ ldap_set_option(
rc = LDAP_OPT_SUCCESS;
break;
case LDAP_OPT_REFHOPLIMIT:
lo->ldo_refhoplimit = * (const int *) invalue;
rc = LDAP_OPT_SUCCESS;
break;
case LDAP_OPT_SIZELIMIT:
/* FIXME: check value for protocol compliance? */
lo->ldo_sizelimit = * (const int *) invalue;