]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10356 libldap: implement LDAP_OPT_REFHOPLIMIT
authorHoward Chu <hyc@openldap.org>
Thu, 12 Jun 2025 16:38:32 +0000 (17:38 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 20 Jun 2025 02:35:44 +0000 (02:35 +0000)
doc/man/man3/ldap_get_option.3
doc/man/man5/ldap.conf.5
libraries/libldap/init.c
libraries/libldap/options.c

index 67d38886b1b6213bd6e31c914335c4d0c7093d21..45e91a28e5115001d617efaffc7a02d2a718aed5 100644 (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).
index d47481d6eda797fe5421f0f95a73a247d080a717..c1b0eaa06fe9a68c96a56d22612cfcfd073c3562 100644 (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)
index 90fc34c5a6e304bc51f698c4ab54e19a25f4e04d..4195142d415c5afb78d3b0a4628df6d7cef64656 100644 (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,
index 218d5445a7f9e50dbd895b991e26f113a58abe41..a7798d413582ce365e5350795c1b9458083320cd 100644 (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;