Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
December
November
October
September
August
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
List overview
Download
389-commits
October 2011
----- 2025 -----
December 2025
November 2025
October 2025
September 2025
August 2025
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
389-commits@lists.fedoraproject.org
3 participants
21 discussions
Start a n
N
ew thread
ldap/schema ldap/servers
by Richard Allen Megginson
01 Oct '11
01 Oct '11
ldap/schema/02common.ldif | 5 +- ldap/servers/slapd/back-ldbm/back-ldbm.h | 8 +++ ldap/servers/slapd/back-ldbm/ldbm_config.c | 52 ++++++++++++++++++++++++ ldap/servers/slapd/back-ldbm/ldbm_config.h | 2 ldap/servers/slapd/back-ldbm/ldbm_search.c | 28 ++++++++++++- ldap/servers/slapd/back-ldbm/start.c | 20 +++++++++ ldap/servers/slapd/backend.c | 6 ++ ldap/servers/slapd/libglobs.c | 61 ++++++++++++++++++++++++++++- ldap/servers/slapd/opshared.c | 29 ++++++++++--- ldap/servers/slapd/proto-slap.h | 2 ldap/servers/slapd/slap.h | 3 + ldap/servers/slapd/slapi-private.h | 1 12 files changed, 208 insertions(+), 9 deletions(-) New commits: commit 4dc166b51794ca5920572f6c9196eabcac25ea9e Author: Rich Megginson <rmeggins(a)redhat.com> Date: Fri Sep 30 08:30:16 2011 -0600 Bug 740942 - allow resource limits to be set for paged searches independently of limits for other searches/operations
https://bugzilla.redhat.com/show_bug.cgi?id=740942
Resolves: bug 740942 Bug Description: allow resource limits to be set for paged searches independently of limits for other searches/operations Reviewed by: nhosoi (Thanks!) Branch: master Fix Description: There are now 6 new configuration variables that control global and per-user limits for simple paged result searches. If these are not present or set to 0, the corresponding non-paged limit will be used instead. For example, if nsslapd-pagedsizelimit is not set, nsslapd-sizelimit will be used. This keeps the previous behavior when the new paged limits are not set. cn=config/operational per user nsslapd-pagedsizelimit/nsPagedSizeLimit - maximum number of entries returned by a paged search cn=config,cn=ldbm database,cn=plugins,cn=config/operational per user nsslapd-pagedlookthroughlimit/nsPagedLookThroughLimit - maximum number of entries retrieved from the database by a simple paged result search nsslapd-pagedidlistscanlimit/nsPagedIDListScanLimit - maximum size of an ID list that can be loaded by a simple paged result search Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: Yes - will need to document the new attributes diff --git a/ldap/schema/02common.ldif b/ldap/schema/02common.ldif index 0193091..db8ea19 100644 --- a/ldap/schema/02common.ldif +++ b/ldap/schema/02common.ldif @@ -123,7 +123,10 @@ attributeTypes: ( 2.16.840.1.113730.3.1.570 NAME 'nsLookThroughLimit' DESC 'Bind attributeTypes: ( 2.16.840.1.113730.3.1.571 NAME 'nsSizeLimit' DESC 'Binder-based search operation size limit (entries)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' ) attributeTypes: ( 2.16.840.1.113730.3.1.572 NAME 'nsTimeLimit' DESC 'Binder-based search operation time limit (seconds)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' ) attributeTypes: ( 2.16.840.1.113730.3.1.573 NAME 'nsIdleTimeout' DESC 'Binder-based connection idle timeout (seconds)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' ) -attributeTypes: ( 2.16.840.1.113730.3.1.2106 NAME 'nsIDListScanLimit' DESC 'Binder-based search operation ID list scan limit (candidate entries)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' ) +attributeTypes: ( 2.16.840.1.113730.3.1.2106 NAME 'nsIDListScanLimit' DESC 'Binder-based search operation ID list scan limit (candidate entries)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN '389' ) +attributeTypes: ( 2.16.840.1.113730.3.1.2107 NAME 'nsPagedSizeLimit' DESC 'Binder-based simple paged search operation size limit' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN '389' ) +attributeTypes: ( 2.16.840.1.113730.3.1.2108 NAME 'nsPagedLookThroughLimit' DESC 'Binder-based simple paged search operation look through limit' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN '389' ) +attributeTypes: ( 2.16.840.1.113730.3.1.2109 NAME 'nsPagedIDListScanLimit' DESC 'Binder-based simple paged search operation ID list scan limit' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN '389' ) attributeTypes: ( 2.16.840.1.113730.3.1.574 NAME 'nsRole' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' ) attributeTypes: ( 2.16.840.1.113730.3.1.575 NAME 'nsRoleDN' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' ) attributeTypes: ( 2.16.840.1.113730.3.1.576 NAME 'nsRoleFilter' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' ) diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h index e6cab21..f5668d2 100644 --- a/ldap/servers/slapd/back-ldbm/back-ldbm.h +++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h @@ -635,6 +635,10 @@ struct ldbminfo { int li_legacy_errcode; /* 615428 -- in case legacy err code is expected */ Slapi_Counter *li_global_usn_counter; /* global USN counter */ int li_reslimit_allids_handle; /* allids aka idlistscan */ + int li_pagedlookthroughlimit; + int li_pagedallidsthreshold; + int li_reslimit_pagedlookthrough_handle; + int li_reslimit_pagedallids_handle; /* allids aka idlistscan */ }; /* li_flags could store these bits defined in ../slapi-plugin.h @@ -804,6 +808,10 @@ typedef struct _back_search_result_set #define LDBM_LOOKTHROUGHLIMIT_AT "nsLookThroughLimit" /* Name of attribute type used for binder-based look through limit */ #define LDBM_ALLIDSLIMIT_AT "nsIDListScanLimit" +/* Name of attribute type used for binder-based look through simple paged limit */ +#define LDBM_PAGEDLOOKTHROUGHLIMIT_AT "nsPagedLookThroughLimit" +/* Name of attribute type used for binder-based look through simple paged limit */ +#define LDBM_PAGEDALLIDSLIMIT_AT "nsPagedIDListScanLimit" /* OIDs for attribute types used internally */ #define LDBM_ENTRYDN_OID "2.16.840.1.113730.3.1.602" diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c index 44cda4c..83dbddd 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c @@ -165,6 +165,28 @@ static int ldbm_config_lookthroughlimit_set(void *arg, void *value, char *errorb return retval; } +static void *ldbm_config_pagedlookthroughlimit_get(void *arg) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + + return (void *) ((uintptr_t)(li->li_pagedlookthroughlimit)); +} + +static int ldbm_config_pagedlookthroughlimit_set(void *arg, void *value, char *errorbuf, int phase, int apply) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + int retval = LDAP_SUCCESS; + int val = (int) ((uintptr_t)value); + + /* Do whatever we can to make sure the data is ok. */ + + if (apply) { + li->li_pagedlookthroughlimit = val; + } + + return retval; +} + static void *ldbm_config_mode_get(void *arg) { struct ldbminfo *li = (struct ldbminfo *) arg; @@ -214,6 +236,34 @@ static int ldbm_config_allidsthreshold_set(void *arg, void *value, char *errorbu return retval; } +static void *ldbm_config_pagedallidsthreshold_get(void *arg) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + + return (void *) ((uintptr_t)(li->li_pagedallidsthreshold)); +} + +static int ldbm_config_pagedallidsthreshold_set(void *arg, void *value, char *errorbuf, int phase, int apply) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + int retval = LDAP_SUCCESS; + int val = (int) ((uintptr_t)value); + + /* Do whatever we can to make sure the data is ok. */ + + /* Catch attempts to configure a stupidly low pagedallidsthreshold */ + /* value of 0 means turn off separate paged value and use regular allids value */ + if ((val > 0) && (val < 100)) { + val = 100; + } + + if (apply) { + li->li_pagedallidsthreshold = val; + } + + return retval; +} + static void *ldbm_config_directory_get(void *arg) { struct ldbminfo *li = (struct ldbminfo *) arg; @@ -1279,6 +1329,8 @@ static config_info ldbm_config[] = { {CONFIG_USE_LEGACY_ERRORCODE, CONFIG_TYPE_ONOFF, "off", &ldbm_config_legacy_errcode_get, &ldbm_config_legacy_errcode_set, 0}, {CONFIG_ENTRYRDN_SWITCH, CONFIG_TYPE_ONOFF, "on", &ldbm_config_entryrdn_switch_get, &ldbm_config_entryrdn_switch_set, CONFIG_FLAG_ALWAYS_SHOW}, {CONFIG_ENTRYRDN_NOANCESTORID, CONFIG_TYPE_ONOFF, "off", &ldbm_config_entryrdn_noancestorid_get, &ldbm_config_entryrdn_noancestorid_set, 0 /* no show */}, + {CONFIG_PAGEDLOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedlookthroughlimit_get, &ldbm_config_pagedlookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, + {CONFIG_PAGEDIDLISTSCANLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedallidsthreshold_get, &ldbm_config_pagedallidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {NULL, 0, NULL, NULL, NULL, 0} }; diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h index ffbc39f..aac085b 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.h +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h @@ -85,7 +85,9 @@ struct config_info { #define CONFIG_INSTANCE "nsslapd-instance" #define CONFIG_LOOKTHROUGHLIMIT "nsslapd-lookthroughlimit" +#define CONFIG_PAGEDLOOKTHROUGHLIMIT "nsslapd-pagedlookthroughlimit" #define CONFIG_IDLISTSCANLIMIT "nsslapd-idlistscanlimit" +#define CONFIG_PAGEDIDLISTSCANLIMIT "nsslapd-pagedidlistscanlimit" #define CONFIG_DIRECTORY "nsslapd-directory" #define CONFIG_MODE "nsslapd-mode" #define CONFIG_DBCACHESIZE "nsslapd-dbcachesize" diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c index 94341c5..66ec886 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_search.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c @@ -71,8 +71,10 @@ compute_lookthrough_limit( Slapi_PBlock *pb, struct ldbminfo *li ) { Slapi_Connection *conn = NULL; int limit; + Slapi_Operation *op; slapi_pblock_get( pb, SLAPI_CONNECTION, &conn); + slapi_pblock_get( pb, SLAPI_OPERATION, &op); if ( slapi_reslimit_get_integer_limit( conn, li->li_reslimit_lookthrough_handle, &limit ) @@ -93,6 +95,18 @@ compute_lookthrough_limit( Slapi_PBlock *pb, struct ldbminfo *li ) } } + if (op && (op->o_flags & OP_FLAG_PAGED_RESULTS)) { + if ( slapi_reslimit_get_integer_limit( conn, + li->li_reslimit_pagedlookthrough_handle, &limit ) + != SLAPI_RESLIMIT_STATUS_SUCCESS ) { + PR_Lock(li->li_config_mutex); + if (li->li_pagedlookthroughlimit) { + limit = li->li_pagedlookthroughlimit; + } + /* else set above */ + PR_Unlock(li->li_config_mutex); + } + } return( limit ); } @@ -101,8 +115,10 @@ compute_allids_limit( Slapi_PBlock *pb, struct ldbminfo *li ) { Slapi_Connection *conn = NULL; int limit; + Slapi_Operation *op; slapi_pblock_get( pb, SLAPI_CONNECTION, &conn); + slapi_pblock_get( pb, SLAPI_OPERATION, &op); if ( slapi_reslimit_get_integer_limit( conn, li->li_reslimit_allids_handle, &limit ) @@ -111,7 +127,17 @@ compute_allids_limit( Slapi_PBlock *pb, struct ldbminfo *li ) limit = li->li_allidsthreshold; PR_Unlock(li->li_config_mutex); } - + if (op && (op->o_flags & OP_FLAG_PAGED_RESULTS)) { + if ( slapi_reslimit_get_integer_limit( conn, + li->li_reslimit_pagedallids_handle, &limit ) + != SLAPI_RESLIMIT_STATUS_SUCCESS ) { + PR_Lock(li->li_config_mutex); + if (li->li_pagedallidsthreshold) { + limit = li->li_pagedallidsthreshold; + } + PR_Unlock(li->li_config_mutex); + } + } return( limit ); } diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c index 9e18086..dabbca5 100644 --- a/ldap/servers/slapd/back-ldbm/start.c +++ b/ldap/servers/slapd/back-ldbm/start.c @@ -96,6 +96,26 @@ ldbm_back_start( Slapi_PBlock *pb ) return SLAPI_FAIL_GENERAL; } + /* register with the binder-based resource limit subsystem so that */ + /* pagedlookthroughlimit can be supported on a per-connection basis. */ + if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT, + LDBM_PAGEDLOOKTHROUGHLIMIT_AT, &li->li_reslimit_pagedlookthrough_handle ) + != SLAPI_RESLIMIT_STATUS_SUCCESS ) { + LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for pagedlookthroughlimit\n", + 0, 0, 0 ); + return SLAPI_FAIL_GENERAL; + } + + /* register with the binder-based resource limit subsystem so that */ + /* pagedallidslimit (aka idlistscanlimit) can be supported on a per-connection basis. */ + if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT, + LDBM_PAGEDALLIDSLIMIT_AT, &li->li_reslimit_pagedallids_handle ) + != SLAPI_RESLIMIT_STATUS_SUCCESS ) { + LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for pagedallidslimit\n", + 0, 0, 0 ); + return SLAPI_FAIL_GENERAL; + } + /* If the db directory hasn't been set yet, we need to set it to * the default. */ if (NULL == li->li_directory || '\0' == li->li_directory[0]) { diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c index 6796439..de852c8 100644 --- a/ldap/servers/slapd/backend.c +++ b/ldap/servers/slapd/backend.c @@ -74,6 +74,7 @@ be_init( Slapi_Backend *be, const char *type, const char *name, int isprivate, i "plugin %s, instance %s\n", type, name); } be->be_sizelimit = sizelimit; + be->be_pagedsizelimit = config_get_pagedsizelimit(); be->be_timelimit = timelimit; /* maximum group nesting level before giving up */ be->be_maxnestlevel = SLAPD_DEFAULT_GROUPNESTLEVEL; @@ -582,6 +583,11 @@ void be_set_timelimit(Slapi_Backend * be, int timelimit) be->be_timelimit = timelimit; } +void be_set_pagedsizelimit(Slapi_Backend * be, int sizelimit) +{ + be->be_pagedsizelimit = sizelimit; +} + int slapi_back_get_info(Slapi_Backend *be, int cmd, void **info) { diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c index ce6188b..928d648 100644 --- a/ldap/servers/slapd/libglobs.c +++ b/ldap/servers/slapd/libglobs.c @@ -645,7 +645,10 @@ static struct config_get_and_set { {CONFIG_VALIDATE_CERT_ATTRIBUTE, config_set_validate_cert_switch, NULL, 0, (void**)&global_slapdFrontendConfig.validate_cert, CONFIG_SPECIAL_VALIDATE_CERT_SWITCH, - (ConfigGetFunc)config_get_validate_cert_switch} + (ConfigGetFunc)config_get_validate_cert_switch}, + {CONFIG_PAGEDSIZELIMIT_ATTRIBUTE, config_set_pagedsizelimit, + NULL, 0, + (void**)&global_slapdFrontendConfig.pagedsizelimit, CONFIG_INT, NULL}, #ifdef MEMPOOL_EXPERIMENTAL ,{CONFIG_MEMPOOL_SWITCH_ATTRIBUTE, config_set_mempool_switch, NULL, 0, @@ -937,6 +940,7 @@ FrontendConfig_init () { cfg->slapd_type = 0; cfg->versionstring = SLAPD_VERSION_STR; cfg->sizelimit = SLAPD_DEFAULT_SIZELIMIT; + cfg->pagedsizelimit = 0; cfg->timelimit = SLAPD_DEFAULT_TIMELIMIT; cfg->anon_limits_dn = slapi_ch_strdup(""); cfg->schemacheck = LDAP_ON; @@ -1594,6 +1598,49 @@ config_set_sizelimit( const char *attrname, char *value, char *errorbuf, int app return retVal; } +int +config_set_pagedsizelimit( const char *attrname, char *value, char *errorbuf, int apply ) { + int retVal = LDAP_SUCCESS; + long pagedsizelimit; + char *endp = NULL; + Slapi_Backend *be; + char *cookie; + + slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); + + if ( config_value_is_null( attrname, value, errorbuf, 0 )) { + return LDAP_OPERATIONS_ERROR; + } + + errno = 0; + pagedsizelimit = strtol(value, &endp, 10); + + if ( *endp != '\0' || errno == ERANGE || pagedsizelimit < -1 ) { + PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, pagedsizelimit must range from -1 to %ld", + attrname, value, LONG_MAX ); + retVal = LDAP_OPERATIONS_ERROR; + return retVal; + } + + if (apply) { + + CFG_LOCK_WRITE(slapdFrontendConfig); + + slapdFrontendConfig->pagedsizelimit= pagedsizelimit; + cookie = NULL; + be = slapi_get_first_backend(&cookie); + while (be) { + be->be_pagedsizelimit = slapdFrontendConfig->pagedsizelimit; + be = slapi_get_next_backend(cookie); + } + + CFG_UNLOCK_WRITE(slapdFrontendConfig); + slapi_ch_free ((void **)&cookie); + + } + return retVal; +} + int config_set_pw_storagescheme( const char *attrname, char *value, char *errorbuf, int apply ) { int retVal = LDAP_SUCCESS; @@ -3729,6 +3776,18 @@ config_get_sizelimit() { return retVal; } +int +config_get_pagedsizelimit() { + slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); + int retVal; + + CFG_LOCK_READ(slapdFrontendConfig); + retVal = slapdFrontendConfig->pagedsizelimit; + CFG_UNLOCK_READ(slapdFrontendConfig); + + return retVal; +} + char * config_get_pw_storagescheme() { slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c index d533d01..1af97c6 100644 --- a/ldap/servers/slapd/opshared.c +++ b/ldap/servers/slapd/opshared.c @@ -1355,6 +1355,7 @@ iterate(Slapi_PBlock *pb, Slapi_Backend *be, int send_result, static int timelimit_reslimit_handle = -1; static int sizelimit_reslimit_handle = -1; +static int pagedsizelimit_reslimit_handle = -1; /* * Register size and time limit with the binder-based resource limits @@ -1363,18 +1364,17 @@ static int sizelimit_reslimit_handle = -1; int search_register_reslimits( void ) { - int rc1, rc2; + int rc1, rc2, rc3; rc1 = slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT, "nsSizeLimit" , &sizelimit_reslimit_handle ); rc2 = slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT, "nsTimeLimit", &timelimit_reslimit_handle ); + rc3 = slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT, + "nsPagedSizeLimit", &pagedsizelimit_reslimit_handle ); - if ( rc1 != SLAPI_RESLIMIT_STATUS_SUCCESS ) { - return( rc1 ); - } else { - return( rc2 ); - } + return (rc1 != SLAPI_RESLIMIT_STATUS_SUCCESS) ? rc1 : + ((rc2 != SLAPI_RESLIMIT_STATUS_SUCCESS) ? rc2 : rc3); } @@ -1397,11 +1397,13 @@ compute_limits (Slapi_PBlock *pb) int isCertAuth; Slapi_ComponentId *component_id = NULL; Slapi_Backend *be; + Slapi_Operation *op; slapi_pblock_get (pb, SLAPI_SEARCH_TIMELIMIT, &requested_timelimit); slapi_pblock_get (pb, SLAPI_SEARCH_SIZELIMIT, &requested_sizelimit); slapi_pblock_get (pb, SLAPI_REQUESTOR_ISROOT, &isroot); slapi_pblock_get (pb, SLAPI_BACKEND, &be); + slapi_pblock_get (pb, SLAPI_OPERATION, &op); /* If the search belongs to the client authentication process, take the value at @@ -1471,6 +1473,21 @@ compute_limits (Slapi_PBlock *pb) } } + if (op && (op->o_flags & OP_FLAG_PAGED_RESULTS)) { + if ( slapi_reslimit_get_integer_limit( pb->pb_conn, + pagedsizelimit_reslimit_handle, &max_sizelimit ) + != SLAPI_RESLIMIT_STATUS_SUCCESS ) { + /* + * no limit associated with binder/connection or some other error + * occurred. use the default maximum. + */ + if ( be->be_pagedsizelimit ) { + max_sizelimit = be->be_pagedsizelimit; + } + /* else was already set above */ + } + } + if ( requested_sizelimit ) { /* requested limit should be applied to all (including root) */ if ( isroot ) { diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h index 72ef58e..0ff2296 100644 --- a/ldap/servers/slapd/proto-slap.h +++ b/ldap/servers/slapd/proto-slap.h @@ -280,6 +280,7 @@ int config_set_anon_limits_dn( const char *attrname, char *value, char *errorbuf int config_set_slapi_counters( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_srvtab( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_sizelimit( const char *attrname, char *value, char *errorbuf, int apply ); +int config_set_pagedsizelimit( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_lastmod( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_nagle( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_accesscontrol( const char *attrname, char *value, char *errorbuf, int apply ); @@ -412,6 +413,7 @@ char *config_get_anon_limits_dn(); int config_get_slapi_counters(); char *config_get_srvtab(); int config_get_sizelimit(); +int config_get_pagedsizelimit(); char *config_get_pw_storagescheme(); int config_get_pw_change(); int config_get_pw_history(); diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h index 4dce915..98ba79c 100644 --- a/ldap/servers/slapd/slap.h +++ b/ldap/servers/slapd/slap.h @@ -1225,6 +1225,7 @@ typedef struct backend { Slapi_RWLock *vlvSearchList_lock; void *vlvSearchList; Slapi_Counter *be_usn_counter; /* USN counter; one counter per backend */ + int be_pagedsizelimit; /* size limit for this backend for simple paged result searches */ } backend; enum @@ -1792,6 +1793,7 @@ typedef struct _slapdEntryPoints { #define CONFIG_DATABASE_ATTRIBUTE "nsslapd-database" #define CONFIG_PLUGIN_ATTRIBUTE "nsslapd-plugin" #define CONFIG_SIZELIMIT_ATTRIBUTE "nsslapd-sizelimit" +#define CONFIG_PAGEDSIZELIMIT_ATTRIBUTE "nsslapd-pagedsizelimit" #define CONFIG_TIMELIMIT_ATTRIBUTE "nsslapd-timelimit" #define CONFIG_SUFFIX_ATTRIBUTE "nsslapd-suffix" #define CONFIG_READONLY_ATTRIBUTE "nsslapd-readonly" @@ -2182,6 +2184,7 @@ typedef struct _slapdFrontendConfig { int entryusn_global; /* Entry USN: Use global counter */ char *allowed_to_delete_attrs;/* list of config attrs allowed to delete */ char *entryusn_import_init; /* Entry USN: determine the initital value of import */ + int pagedsizelimit; } slapdFrontendConfig_t; /* possible values for slapdFrontendConfig_t.schemareplace */ diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h index 34183a8..6f1e2ca 100644 --- a/ldap/servers/slapd/slapi-private.h +++ b/ldap/servers/slapd/slapi-private.h @@ -655,6 +655,7 @@ typedef struct index_config }IndexConfig; void be_set_sizelimit(Slapi_Backend * be, int sizelimit); +void be_set_pagedsizelimit(Slapi_Backend * be, int sizelimit); void be_set_timelimit(Slapi_Backend * be, int timelimit); int be_isdeleted( const Slapi_Backend *be );
1
0
0
0
← Newer
1
2
3
Older →
Jump to page:
1
2
3
Results per page:
10
25
50
100
200