Univention Bugzilla – Attachment 4749 Details for
Bug 28248
Globales Limit für die maximale Anzahl vom LDAP abzufragender Objekte
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch zum Aktivieren des Sizelimits
udm-sizelimit.patch (text/plain), 5.10 KB, created by
Alexander Kläser
on 2012-10-25 18:32:47 CEST
(
hide
)
Description:
Patch zum Aktivieren des Sizelimits
Filename:
MIME Type:
Creator:
Alexander Kläser
Created:
2012-10-25 18:32:47 CEST
Size:
5.10 KB
patch
obsolete
>--- /usr/share/pyshared/univention/management/console/modules/udm/__init__.py.orig 2012-10-25 07:53:23.000000000 +0200 >+++ /usr/share/pyshared/univention/management/console/modules/udm/__init__.py 2012-10-24 16:18:53.000000000 +0200 >@@ -54,6 +54,8 @@ > > import univention.directory.reports as udr > >+from univention.management.console.protocol.definitions import * >+ > from .udm_ldap import UDM_Error, UDM_Module, UDM_Settings, check_license, ldap_dn2path, get_module, read_syntax_choices, list_objects, LDAP_Connection, LDAP_ConnectionError, set_credentials, container_modules > from .tools import LicenseError, LicenseImport > _ = Translation( 'univention-management-console-module-udm' ).translate >@@ -103,6 +105,10 @@ > if not isinstance( result, BaseException ): > return False > >+ if isinstance( result, (udm_errors.ldapSizelimitExceeded, udm_errors.ldapTimeout ) ): >+ self.finished( request.id, None, result.args[0], success = False, status = MODULE_ERR_COMMAND_FAILED ) >+ return True >+ > msg = '%s\n%s: %s\n' % ( ''.join( traceback.format_tb( thread.exc_info[ 2 ] ) ), thread.exc_info[ 0 ].__name__, str( thread.exc_info[ 1 ] ) ) > MODULE.process( 'An internal error occurred: %s' % msg ) > self.finished( request.id, None, msg, False ) >--- /usr/share/pyshared/univention/management/console/modules/udm/udm_ldap.py.orig 2012-10-24 13:50:15.000000000 +0200 >+++ /usr/share/pyshared/univention/management/console/modules/udm/udm_ldap.py 2012-10-24 18:00:25.000000000 +0200 >@@ -33,6 +33,7 @@ > > import operator > import threading >+import gc > > from univention.management.console import Translation > from univention.management.console.modules import Base, UMC_OptionTypeError, UMC_OptionMissing, UMC_CommandError >@@ -131,6 +132,8 @@ > _ldap_connection = lo > _ldap_position = po > return ret >+ except (udm_errors.ldapSizelimitExceeded, udm_errors.ldapTimeout), e: >+ raise e > except ( LDAPError, udm_errors.base ), e: > MODULE.info( 'LDAP operation for user %s has failed' % _user_dn ) > try: >@@ -149,6 +152,8 @@ > _ldap_connection = lo > _ldap_position = po > return ret >+ except (udm_errors.ldapSizelimitExceeded, udm_errors.ldapTimeout), e: >+ raise e > except udm_errors.base, e: > raise LDAP_ConnectionError( str( e ) ) > >@@ -390,14 +395,26 @@ > filter_s = '%s=%s' % ( attribute, value ) > > MODULE.info( 'Searching for LDAP objects: container = %s, filter = %s, superordinate = %s' % ( container, filter_s, superordinate ) ) >+ result = None > try: >- return self.module.lookup( None, ldap_connection, filter_s, base = container, superordinate = superordinate, scope = scope ) >+ result = self.module.lookup( None, ldap_connection, filter_s, base = container, superordinate = superordinate, scope = scope, sizelimit = int(ucr.get('directory/manager/web/sizelimit', '2000')) ) > except udm_errors.insufficientInformation, e: > return [] >+ except udm_errors.ldapTimeout, e: >+ raise udm_errors.ldapTimeout( _('The query you have entered timed out. Please narrow down your search by specifiying more query parameters') ) >+ except udm_errors.ldapSizelimitExceeded, e: >+ raise udm_errors.ldapSizelimitExceeded( _('The query you have entered yields too many matching entries. Please narrow down your search by specifiying more query parameters. The current size limit of %s can be configured with the UCR variable directory/manager/web/sizelimit.') % ucr.get('directory/manager/web/sizelimit', '2000') ) > except ( LDAPError, udm_errors.ldapError ), e: > raise e > except udm_errors.base, e: > raise UDM_Error( str( e ) ) >+ >+ # call the garbage collector manually as many parallel request may cause the >+ # process to use too much memory >+ MODULE.info('Triggering garbage collection') >+ gc.collect() >+ >+ return result > > @LDAP_Connection > def get( self, ldap_dn = None, superordinate = None, attributes = [], ldap_connection = None, ldap_position = None ): >--- /usr/share/pyshared/univention/admin/uexceptions.py.orig 2012-10-24 14:15:30.000000000 +0200 >+++ /usr/share/pyshared/univention/admin/uexceptions.py 2012-10-24 15:03:27.000000000 +0200 >@@ -52,6 +52,12 @@ > class ldapError(base): > message=_('LDAP Error') > >+class ldapTimeout(base): >+ message=_('The specified timeout for the LDAP search has been exceeded.') >+ >+class ldapSizelimitExceeded(base): >+ message=_('The specified size limit for the LDAP search has been exceeded.') >+ > class insufficientInformation(base): > message=_('Information provided is not sufficient.') > >--- /usr/share/pyshared/univention/admin/uldap.py.orig 2012-10-24 14:46:02.000000000 +0200 >+++ /usr/share/pyshared/univention/admin/uldap.py 2012-10-24 15:03:10.000000000 +0200 >@@ -321,6 +321,10 @@ > raise univention.admin.uexceptions.noObject, _err2str(msg) > except ldap.INAPPROPRIATE_MATCHING, msg: > raise univention.admin.uexceptions.insufficientInformation, _err2str(msg) >+ except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED), msg: >+ raise univention.admin.uexceptions.ldapTimeout, _err2str(msg) >+ except ldap.SIZELIMIT_EXCEEDED, msg: >+ raise univention.admin.uexceptions.ldapSizelimitExceeded, _err2str(msg) > except ldap.LDAPError, msg: > raise univention.admin.uexceptions.ldapError, _err2str(msg) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 28248
:
4740
|
4748
| 4749