Projects
Kolab:16:Testing
pykolab-python3
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 33
View file
pykolab.spec
Changed
@@ -55,7 +55,7 @@ Summary: Kolab Groupware Solution Name: pykolab -Version: 0.9.0.3 +Version: 0.9.0.4 Release: 1%{?dist} License: GPLv3+ Group: Applications/System
View file
debian.changelog
Changed
@@ -1,4 +1,4 @@ -pykolab (0.9.0.3-0~kolab4) unstable; urgency=low +pykolab (0.9.0.4-0~kolab4) unstable; urgency=low * Release of version 0.9.0
View file
pykolab-0.9.0.tar.gz/pykolab/auth/__init__.py
Changed
@@ -232,8 +232,8 @@ def find_user(self, attr, value, **kw): return self._auth.search_entry_by_attribute(attr, value, **kw) - def find_user_dn(self, login, kolabuser=False): - return self._auth._find_user_dn(login, kolabuser); + def find_user_dn(self, login, kolabuser=False, domain=None): + return self._auth._find_user_dn(login, kolabuser, domain); def list_recipient_addresses(self, user): return self._auth.list_recipient_addresses(user)
View file
pykolab-0.9.0.tar.gz/pykolab/auth/ldap/__init__.py
Changed
@@ -124,13 +124,7 @@ log.error(_l("Authentication cache failed: %r") % (errmsg)) if base_dn is None: - config_base_dn = self.config_get('base_dn') - ldap_base_dn = self._kolab_domain_root_dn(self.domain) - - if ldap_base_dn is not None and not ldap_base_dn == config_base_dn: - base_dn = ldap_base_dn - else: - base_dn = config_base_dn + base_dn = self._base_dn() try: auth_cache.set_entry(self.domain, base_dn) @@ -459,18 +453,11 @@ return entry_id'dn' unique_attribute = self.config_get('unique_attribute') - config_base_dn = self.config_get('base_dn') - ldap_base_dn = self._kolab_domain_root_dn(self.domain) - - if ldap_base_dn is not None and not ldap_base_dn == config_base_dn: - base_dn = ldap_base_dn - else: - base_dn = config_base_dn _filter = "(%s=%s)" % (unique_attribute, ldap.filter.escape_filter_chars(entry_id)) _search = self.ldap.search_ext( - base_dn, + self._base_dn(), ldap.SCOPE_SUBTREE, _filter, 'entrydn' @@ -714,19 +701,13 @@ _filter = "%s%s%s" % (__filter_prefix, _filter, __filter_suffix) - log.debug(_l("Finding recipient with filter %r") % (_filter), level=8) + base_dn = self._base_dn() + + log.debug(_l("Finding recipient with filter %r in %s") % (_filter, base_dn), level=8) if len(_filter) <= 6: return None - config_base_dn = self.config_get('base_dn') - ldap_base_dn = self._kolab_domain_root_dn(self.domain) - - if ldap_base_dn is not None and not ldap_base_dn == config_base_dn: - base_dn = ldap_base_dn - else: - base_dn = config_base_dn - _results = self.ldap.search_s( base_dn, scope=ldap.SCOPE_SUBTREE, @@ -790,13 +771,13 @@ _filter = "%s%s%s" % (__filter_prefix, _filter, __filter_suffix) - log.debug(_l("Finding resource with filter %r") % (_filter), level=8) - if len(_filter) <= 6: return None resource_base_dn = self._object_base_dn('resource') + log.debug(_l("Finding resource with filter %s in %s") % (_filter, resource_base_dn), level=8) + _results = self.ldap.search_s( resource_base_dn, scope=ldap.SCOPE_SUBTREE, @@ -1220,13 +1201,9 @@ _filter = "(%s=%s)" % (attr, ldap.filter.escape_filter_chars(value)) - config_base_dn = self.config_get('base_dn') - ldap_base_dn = self._kolab_domain_root_dn(self.domain) + base_dn = self._base_dn() - if ldap_base_dn is not None and not ldap_base_dn == config_base_dn: - base_dn = ldap_base_dn - else: - base_dn = config_base_dn + log.debug(_l("Finding entry %s in %s") % (_filter, base_dn), level=8) _results = self._search( base_dn, @@ -1321,22 +1298,14 @@ _filter = "(&%s(modifytimestamp>=%s))" % (_filter, modified_after) - log.debug(_l("Synchronization is using filter %r") % (_filter), level=8) - if mode != 0: override_search = mode else: - override_search = False + override_search = None - config_base_dn = self.config_get('base_dn') - ldap_base_dn = self._kolab_domain_root_dn(self.domain) + base_dn = self._base_dn() - if ldap_base_dn is not None and not ldap_base_dn == config_base_dn: - base_dn = ldap_base_dn - else: - base_dn = config_base_dn - - log.debug(_l("Synchronization is searching against base DN: %s") % (base_dn), level=8) + log.debug(_l("Synchronization is searching for %s in %s") % (_filter, base_dn), level=8) if callback is None: callback = self._synchronize_callback @@ -2429,14 +2398,7 @@ self._bind() entry_dn = self.entry_dn(entry_id) - - config_base_dn = self.config_get('base_dn') - ldap_base_dn = self._kolab_domain_root_dn(self.domain) - - if ldap_base_dn is not None and not ldap_base_dn == config_base_dn: - base_dn = ldap_base_dn - else: - base_dn = config_base_dn + base_dn = self._base_dn() for _type in 'user', 'group', 'sharedfolder': __filter = self.config_get('kolab_%s_filter' % (_type)) @@ -2462,14 +2424,14 @@ return None - def _find_user_dn(self, login, kolabuser=False): + def _find_user_dn(self, login, kolabuser=False, domain=None): """ Find the distinguished name (DN) for a (Kolab) user entry in LDAP. """ conf_prefix = 'kolab_' if kolabuser else '' - user_base_dn = self._object_base_dn('user', conf_prefix) + user_base_dn = self._object_base_dn('user', conf_prefix, domain) auth_attrs = self.config_get_list('auth_attributes') @@ -2682,18 +2644,12 @@ return domains - def _object_base_dn(self, objectType, prefix=''): + def _object_base_dn(self, objectType, prefix='', domain=None): """ Get configured base DN for specified Kolab object type """ - object_base_dn = self.config_get(prefix + objectType + '_base_dn') - config_base_dn = self.config_get('base_dn') - ldap_base_dn = self._kolab_domain_root_dn(self.domain) - - if ldap_base_dn is not None and not ldap_base_dn == config_base_dn: - base_dn = ldap_base_dn - else: - base_dn = config_base_dn + object_base_dn = self.config_get_raw(prefix + objectType + '_base_dn') + base_dn = self._base_dn(domain) if object_base_dn is None: object_base_dn = base_dn @@ -2702,6 +2658,15 @@ return object_base_dn + def _base_dn(self, domain=None): + config_base_dn = self.config_get('base_dn') + ldap_base_dn = self._kolab_domain_root_dn(domain if domain is not None else self.domain) + + if ldap_base_dn is not None and not ldap_base_dn == config_base_dn: + return ldap_base_dn + + return config_base_dn + def _synchronize_callback(self, *args, **kw): """ Determine the characteristics of the callback being placed, and @@ -2844,7 +2809,7 @@ attrlist=None, attrsonly=0, timeout=-1, - callback=False, + callback=None, primary_domain=None, secondary_domains= ): @@ -2860,6 +2825,8 @@ ) ) + log.debug(_l("Searching with filter %r in %s") % (filterstr, base_dn), level=8) + _search = self.ldap.search_ext( base_dn, scope=scope, @@ -2938,7 +2905,7 @@ attrlist=None, attrsonly=0, timeout=-1, - callback=False, + callback=None, primary_domain=None, secondary_domains= ): @@ -2948,6 +2915,8 @@ server_page_control = ldap.controls.libldap.SimplePagedResultsControl(size=page_size,cookie='') + log.debug(_l("Searching for %r in %s") % (filterstr, base_dn), level=8) + _search = self.ldap.search_ext( base_dn, scope=scope, @@ -3025,7 +2994,7 @@ attrlist=None, attrsonly=0, timeout=-1, - callback=False, + callback=None, primary_domain=None, secondary_domains= ): @@ -3039,7 +3008,7 @@ attrlist=None, attrsonly=0, timeout=-1, - callback=False, + callback=None, primary_domain=None, secondary_domains= ): @@ -3085,7 +3054,7 @@ attrlist=None, attrsonly=0, timeout=None, - callback=False, + callback=None, primary_domain=None, secondary_domains= ): @@ -3093,7 +3062,7 @@ if timeout is None: timeout = float(self.config_get('ldap', 'timeout', default=10)) - log.debug(_l("Searching with filter %r") % (filterstr), level=8) + log.debug(_l("Searching for %r in %s") % (filterstr, base_dn), level=8) _search = self.ldap.search( base_dn, @@ -3123,8 +3092,8 @@ attrlist=None, attrsonly=0, timeout=None, - override_search=False, - callback=False, + override_search=None, + callback=None, primary_domain=None, secondary_domains= ): @@ -3181,7 +3150,7 @@ _results = - if override_search is not False: + if override_search: _use_ldap_controls = override_search else: _use_ldap_controls = self.ldap.supported_controls
View file
pykolab-0.9.0.tar.gz/pykolab/cli/cmd_list_deleted_mailboxes.py
Changed
@@ -104,7 +104,7 @@ print("Deleted folders:") for folder in folders: - utf8_folder = imap_utf7.decode(folder).encode('utf-8') + utf8_folder = imap_utf7.decode(folder) mbox_parts = imap.parse_mailfolder(utf8_folder) ts = datetime.datetime.fromtimestamp(int(mbox_parts'hex_timestamp', 16))
View file
pykolab-0.9.0.tar.gz/pykolab/imap/cyrus.py
Changed
@@ -201,7 +201,7 @@ ) # TODO: Workaround for undelete - if len(self.lm(mailfolder)) < 1 and 'hex_timestamp' in _mailfolder: + if 'hex_timestamp' in _mailfolder: mailfolder = self.folder_utf7("DELETED/%s%s%s@%s" % ( self.separator.join(_mailfolder'path_parts'), self.separator, @@ -241,18 +241,15 @@ max_tries = 20 num_try = 0 - ann_path = "/vendor/cmu/cyrus-imapd/server" - s_ann_path = "/shared%s" % (ann_path) + ann_path = b"/vendor/cmu/cyrus-imapd/server" + s_ann_path = b"/shared%s" % (ann_path) while 1: num_try += 1 - annotations = self._getmetadata( - '"%s"' % (mailfolder), - ann_path - ) + annotations = self._getmetadata(mailfolder, ann_path) if mailfolder in annotations: - if s_ann_path in annotationsmailfolder: + if s_ann_path.encode('utf-8') in annotationsmailfolder: break if max_tries <= num_try: @@ -279,7 +276,7 @@ time.sleep(1) - server = annotationsmailfolders_ann_path + server = annotationsmailfolders_ann_path.encode('utf-8') self.mboxmailfolder = server log.debug( @@ -454,6 +451,11 @@ for undelete_folder in undelete_folders: undelete_mbox = self.parse_mailfolder(undelete_folder) + if undelete_mbox is None: + print(_("The folder to undelete does not exist") % ( + undelete_mbox + ), file=sys.stdout) + return prefix = undelete_mbox'path_parts'.pop(0) mbox = undelete_mbox'path_parts'.pop(0) @@ -499,8 +501,12 @@ ) ) - target_server = self.find_mailfolder_server(target_folder) source_server = self.find_mailfolder_server(undelete_folder) + try: + target_server = self.find_mailfolder_server(target_folder) + except cyruslib.CYRUSError as errmsg: + # This is normal for a toplevel folder, the target does not exist + target_server = source_server if hasattr(conf, 'dry_run') and not conf.dry_run: undelete_folder = self.folder_utf7(undelete_folder)
View file
pykolab-0.9.0.tar.gz/pykolab/utils.py
Changed
@@ -398,6 +398,9 @@ if 'sn' in result: result'surname' = ensure_str(result'sn').replace(' ', '') + if 'givenname' in result: + result'givenname' = ensure_str(result'givenname').replace(' ', '') + if 'mail' in result: if isinstance(result'mail', list): result'mail' = result'mail'0
View file
pykolab-0.9.0.tar.gz/wallace/module_footer.py
Changed
@@ -85,16 +85,17 @@ if not os.path.isdir(mybasepath): os.makedirs(mybasepath) - for stage in 'incoming', 'ACCEPT': + for stage in 'incoming': if not os.path.isdir(os.path.join(mybasepath, stage)): os.makedirs(os.path.join(mybasepath, stage)) + # FIXME: This section of the code is probably not needed since we do not ACCEPT the mail anymore if 'stage' in kw: log.debug(_("Issuing callback after processing to stage %s") % (kw'stage'), level=8) log.debug(_("Testing cb_action_%s()") % (kw'stage'), level=8) if hasattr(modules, 'cb_action_%s' % (kw'stage')): log.debug(_("Attempting to execute cb_action_%s()") % (kw'stage'), level=8) - exec('modules.cb_action_%s(%r, %r)' % (kw'stage','optout',filepath)) + exec('modules.cb_action_%s(%r, %r)' % (kw'stage','footer',filepath)) return log.debug(_("Executing module footer for %r, %r") % (args, kw), level=8) @@ -112,8 +113,8 @@ footer = {} footer_position = conf.get('wallace', 'footer_position') - footer_html_file = conf.get('wallace', 'footer_html') - footer_text_file = conf.get('wallace', 'footer_text') + footer_html_file = conf.get('wallace', 'footer_html') or '' + footer_text_file = conf.get('wallace', 'footer_text') or '' sender_exceptions = conf.get('wallace', 'footer_sender_exceptions') if sender_exceptions: @@ -128,14 +129,12 @@ regex = '^<>$' if re.search(regex, sender): - log.debug("Sender matches exception %s" % (item), level=8) - exec('modules.cb_action_%s(%r, %r)' % ('ACCEPT','footer', filepath)) - return + log.debug("Sender matches %s, pass along" % (item), level=8) + return filepath if not os.path.isfile(footer_text_file) and not os.path.isfile(footer_html_file): - log.warning(_("No contents configured for footer module")) - exec('modules.cb_action_%s(%r, %r)' % ('ACCEPT','footer', filepath)) - return + log.warning(_("No contents configured for footer module, pass along")) + return filepath if os.path.isfile(footer_text_file): footer'plain' = open(footer_text_file, 'r').read() @@ -148,8 +147,7 @@ footer'html' = '<p>' + footer'plain' + '</p>' if footer'plain' == "" and footer'html' == "<p></p>": - exec('modules.cb_action_%s(%r, %r)' % ('ACCEPT','footer', filepath)) - return + return filepath footer_added = False @@ -159,8 +157,7 @@ pass if _footer_added == "YES": - exec('modules.cb_action_%s(%r, %r)' % ('ACCEPT','footer', filepath)) - return + return filepath for part in message.walk(): disposition = None @@ -191,12 +188,15 @@ footer_added = set_part_content(part, content) if footer_added: - log.debug("Footer attached.") message.add_header("X-Wallace-Footer", "YES") - (fp, new_filepath) = tempfile.mkstemp(dir="/var/spool/pykolab/wallace/footer/ACCEPT") - os.write(fp, message.as_string()) - os.close(fp) - os.unlink(filepath) + (fp, new_filepath) = tempfile.mkstemp(dir="/var/spool/pykolab/wallace/footer/incoming") - exec('modules.cb_action_%s(%r, %r)' % ('ACCEPT','footer', new_filepath)) + log.debug("Footer attached, saving mail to %s and passing along" % (new_filepath), level=8) + + os.write(fp, message.as_string()) + os.close(fp) + os.unlink(filepath) + filepath = new_filepath + + return filepath
View file
pykolab-0.9.0.tar.gz/wallace/module_invitationpolicy.py
Changed
@@ -706,13 +706,15 @@ if local_domains is not None: local_domains = list(set(local_domains.keys())) - if not email_address.split('@')1 in local_domains: + domain = email_address.split('@')1 + + if not domain in local_domains: user_dn_from_email_address.cacheemail_address = None return None log.debug(_("Checking if email address %r belongs to a local user") % (email_address), level=8) - user_dn = auth.find_user_dn(email_address, True) + user_dn = auth.find_user_dn(email_address, True, domain) if isinstance(user_dn, string_types): log.debug(_("User DN: %r") % (user_dn), level=8)
View file
pykolab.dsc
Changed
@@ -2,7 +2,7 @@ Source: pykolab Binary: pykolab, kolab-cli, kolab-conf, kolab-saslauthd, kolab-server, kolab-telemetry, kolab-xml, wallace Architecture: all -Version: 0.9.0.3-1~kolab1 +Version: 0.9.0.4-1~kolab1 DEBTRANSFORM-RELEASE: 1 Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Uploaders: Paul Klos <kolab@klos2day.nl>
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.