Univention Bugzilla – Attachment 9166 Details for
Bug 34648
Invalid pickle files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
34648-invalid-pickle-s4-421.patch
34648-invalid-pickle-s4-421.patch (text/plain), 2.99 KB, created by
Lukas Oyen
on 2017-09-04 10:52 CEST
(
hide
)
Description:
34648-invalid-pickle-s4-421.patch
Filename:
MIME Type:
Creator:
Lukas Oyen
Created:
2017-09-04 10:52 CEST
Size:
2.99 KB
patch
obsolete
>From 6456d8f721c8d6e5372b8356b6adb4aa8cffdf5c Mon Sep 17 00:00:00 2001 >From: Lukas Oyen <oyen@univention.de> >Date: Mon, 4 Sep 2017 10:51:16 +0200 >Subject: [PATCH] Bug #34648: s4c: save invalid pickle files as `<NORESYNC>` > >--- > .../modules/univention/s4connector/__init__.py | 23 +++++++++++++--------- > 1 file changed, 14 insertions(+), 9 deletions(-) > >diff --git a/services/univention-s4-connector/modules/univention/s4connector/__init__.py b/services/univention-s4-connector/modules/univention/s4connector/__init__.py >index 6a2443f..f73415d 100644 >--- a/services/univention-s4-connector/modules/univention/s4connector/__init__.py >+++ b/services/univention-s4-connector/modules/univention/s4connector/__init__.py >@@ -569,8 +569,12 @@ class ucs: > _d = ud.function('ldap._get_config_items') > return self.config.items(section) > >- def _save_rejected_ucs(self, filename, dn): >+ def _save_rejected_ucs(self, filename, dn, resync=True): > _d = ud.function('ldap._save_rejected_ucs') >+ if not resync: >+ # Note that unescaped <> are invalid in DNs. See also: >+ # `_list_rejected_ucs()`. >+ dn = '<NORESYNC>' + dn > modstring_dn = univention.s4connector.s4.compatible_modstring(dn) > self._set_config_option('UCS rejected', filename, modstring_dn) > >@@ -584,10 +588,11 @@ class ucs: > > def _list_rejected_ucs(self): > _d = ud.function('ldap._list_rejected_ucs') >- result = [] >- for i in self._get_config_items('UCS rejected'): >- result.append(i) >- return result >+ rejected = self._get_config_items('UCS rejected') >+ # Note that unescaped <> are invalid in DNs. See also: >+ # `_save_rejected_ucs()`. >+ return [(fn, dn) for (fn, dn) in rejected >+ if not dn.startswith('<NORESYNC>')] > > def _list_rejected_filenames_ucs(self): > _d = ud.function('ldap._list_rejected_filenames_ucs') >@@ -748,10 +753,10 @@ class ucs: > return True # file not found so there's nothing to sync > except (cPickle.UnpicklingError, EOFError) as e: > message = 'file emtpy' if isinstance(e, EOFError) else e.message >- ud.debug(ud.LDAP, ud.WARN, >+ ud.debug(ud.LDAP, ud.ERROR, > '__sync_file_from_ucs: invalid pickle file {}: {}'.format(filename, message)) > # ignore corrupted pickle file, but save as rejected to not try again >- self._save_rejected_ucs(filename, 'unknown') >+ self._save_rejected_ucs(filename, 'unknown', resync=False) > return False > > if dn == 'cn=Subschema': >@@ -1098,10 +1103,10 @@ class ucs: > continue # file not found so there's nothing to sync > except (cPickle.UnpicklingError, EOFError) as e: > message = 'file emtpy' if isinstance(e, EOFError) else e.message >- ud.debug(ud.LDAP, ud.WARN, >+ ud.debug(ud.LDAP, ud.ERROR, > 'poll_ucs: invalid pickle file {}: {}'.format(filename, message)) > # ignore corrupted pickle file, but save as rejected to not try again >- self._save_rejected_ucs(filename, 'unknown') >+ self._save_rejected_ucs(filename, 'unknown', resync=False) > continue > > for i in [0, 1]: # do it twice if the LDAP connection was closed >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 34648
:
9005
|
9148
|
9166
|
9167