|
Lines 178-184
class UniventionLDAPExtension(object):
Link Here
|
| 178 |
appidentifier = os.environ.get('UNIVENTION_APP_IDENTIFIER') |
178 |
appidentifier = os.environ.get('UNIVENTION_APP_IDENTIFIER') |
| 179 |
if appidentifier: |
179 |
if appidentifier: |
| 180 |
cmd = ["univention-directory-manager", self.udm_module_name, "modify"] + self.udm_passthrough_options + [ |
180 |
cmd = ["univention-directory-manager", self.udm_module_name, "modify"] + self.udm_passthrough_options + [ |
| 181 |
"--set", "appidentifier=%s" % (appidentifier,), |
181 |
"--append", "appidentifier=%s" % (appidentifier,), |
| 182 |
"--dn", new_object_dn, |
182 |
"--dn", new_object_dn, |
| 183 |
] |
183 |
] |
| 184 |
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
184 |
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
|
Lines 272-295
class UniventionLDAPExtension(object):
Link Here
|
| 272 |
print >>sys.stderr, "ERROR: Object not found in UDM." |
272 |
print >>sys.stderr, "ERROR: Object not found in UDM." |
| 273 |
return |
273 |
return |
| 274 |
|
274 |
|
| 275 |
app_filter = "" |
|
|
| 276 |
regex = re.compile('^ *appidentifier: (.*)$', re.M) |
275 |
regex = re.compile('^ *appidentifier: (.*)$', re.M) |
| 277 |
for appidentifier in regex.findall(stdout): |
276 |
app_filter = [ |
| 278 |
if appidentifier != "None": |
277 |
'(univentionAppID=%s)' % appId |
| 279 |
app_filter = app_filter + "(cn=%s)" % appidentifier |
278 |
for appId in regex.findall(stdout) |
| 280 |
|
279 |
if appId != "None" |
|
|
280 |
] |
| 281 |
if app_filter: |
281 |
if app_filter: |
| 282 |
cmd = ["univention-ldapsearch", "-xLLL", "(&(objectClass=univentionApp)%s)", "cn" % (app_filter,)] |
282 |
filterstr = "(&(objectClass=univentionApp)(|%s))" % (''.join(app_filter),) |
| 283 |
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
283 |
try: |
| 284 |
(stdout, stderr) = p.communicate() |
284 |
lo, ldap_position = udm_uldap.getMachineConnection() |
| 285 |
if p.returncode: |
285 |
apps = ', '.join( |
| 286 |
print >>sys.stderr, "ERROR: LDAP search failed: %s" % (stdout,) |
286 |
val[len('[en] '):] |
| 287 |
sys.exit(1) |
287 |
for _dn, attrs in lo.search(filterstr, attr=['univentionAppDescription']) |
| 288 |
if stdout: |
288 |
for val in attrs['univentionAppDescription'] |
| 289 |
regex = re.compile('^cn: (.*)$', re.M) |
289 |
if val.startswith('[en] ') |
| 290 |
apps = ",".join(regex.findall(stdout)) |
290 |
) |
| 291 |
print >>sys.stderr, "INFO: The object %s is still registered by the following apps: %s" % (objectname, apps,) |
291 |
print >> sys.stderr, "INFO: The object %s is still registered by the following apps: %s" % (objectname, apps,) |
| 292 |
sys.exit(2) |
292 |
sys.exit(2) |
|
|
293 |
except udm_errors.base as ex: |
| 294 |
print >> sys.stderr, "ERROR: LDAP search failed: %s" % (ex,) |
| 295 |
sys.exit(1) |
| 293 |
|
296 |
|
| 294 |
cmd = ["univention-directory-manager", self.udm_module_name, "delete"] + self.udm_passthrough_options + [ |
297 |
cmd = ["univention-directory-manager", self.udm_module_name, "delete"] + self.udm_passthrough_options + [ |
| 295 |
"--dn", object_dn, |
298 |
"--dn", object_dn, |
|
Lines 376-382
class UniventionLDAPSchema(UniventionLDAPExtensionWithListenerHandler):
Link Here
|
| 376 |
if not rc > -1: |
379 |
if not rc > -1: |
| 377 |
ud.debug(ud.LISTENER, ud.WARN, '%s: New version is lower than version of old object (%s), skipping update.' % (name, old_version)) |
380 |
ud.debug(ud.LISTENER, ud.WARN, '%s: New version is lower than version of old object (%s), skipping update.' % (name, old_version)) |
| 378 |
return |
381 |
return |
| 379 |
|
382 |
|
| 380 |
try: |
383 |
try: |
| 381 |
new_object_data = bz2.decompress(new.get('univentionLDAPSchemaData')[0]) |
384 |
new_object_data = bz2.decompress(new.get('univentionLDAPSchemaData')[0]) |
| 382 |
except TypeError: |
385 |
except TypeError: |
|
Lines 559-565
class UniventionLDAPACL(UniventionLDAPExtensionWithListenerHandler):
Link Here
|
| 559 |
if not rc > -1: |
562 |
if not rc > -1: |
| 560 |
ud.debug(ud.LISTENER, ud.WARN, '%s: New version is lower than version of old object (%s), skipping update.' % (name, old_version)) |
563 |
ud.debug(ud.LISTENER, ud.WARN, '%s: New version is lower than version of old object (%s), skipping update.' % (name, old_version)) |
| 561 |
return |
564 |
return |
| 562 |
|
565 |
|
| 563 |
try: |
566 |
try: |
| 564 |
new_object_data = bz2.decompress(new.get('univentionLDAPACLData')[0]) |
567 |
new_object_data = bz2.decompress(new.get('univentionLDAPACLData')[0]) |
| 565 |
except TypeError: |
568 |
except TypeError: |
|
Lines 612-619
class UniventionLDAPACL(UniventionLDAPExtensionWithListenerHandler):
Link Here
|
| 612 |
backup_ucrinfo_filename = None |
615 |
backup_ucrinfo_filename = None |
| 613 |
os.close(backup_ucrinfo_fd) |
616 |
os.close(backup_ucrinfo_fd) |
| 614 |
|
617 |
|
| 615 |
|
|
|
| 616 |
|
| 617 |
if not os.path.isdir(self.ucr_slapd_conf_subfile_dir): |
618 |
if not os.path.isdir(self.ucr_slapd_conf_subfile_dir): |
| 618 |
if os.path.exists(self.ucr_slapd_conf_subfile_dir): |
619 |
if os.path.exists(self.ucr_slapd_conf_subfile_dir): |
| 619 |
ud.debug(ud.LISTENER, ud.WARN, '%s: Directory name %s occupied, renaming blocking file.' % (name, self.ucr_slapd_conf_subfile_dir)) |
620 |
ud.debug(ud.LISTENER, ud.WARN, '%s: Directory name %s occupied, renaming blocking file.' % (name, self.ucr_slapd_conf_subfile_dir)) |
|
Lines 825-831
def option_validate_gnu_message_catalogfile(option, opt, value):
Link Here
|
| 825 |
raise OptionValueError("%s: file basename is not a registered language: %s" % (opt, value)) |
826 |
raise OptionValueError("%s: file basename is not a registered language: %s" % (opt, value)) |
| 826 |
if not MIME_DESCRIPTION.file(value).startswith('GNU message catalog'): |
827 |
if not MIME_DESCRIPTION.file(value).startswith('GNU message catalog'): |
| 827 |
raise OptionValueError("%s: file is not a GNU message catalog: %s" % (opt, value)) |
828 |
raise OptionValueError("%s: file is not a GNU message catalog: %s" % (opt, value)) |
| 828 |
|
829 |
|
| 829 |
return value |
830 |
return value |
| 830 |
|
831 |
|
| 831 |
class UCSOption (Option): |
832 |
class UCSOption (Option): |
|
Lines 911-917
def ucs_registerLDAPExtension():
Link Here
|
| 911 |
|
912 |
|
| 912 |
|
913 |
|
| 913 |
# parser.add_option("-v", "--verbose", action="count") |
914 |
# parser.add_option("-v", "--verbose", action="count") |
| 914 |
|
915 |
|
| 915 |
udm_passthrough_options = [] |
916 |
udm_passthrough_options = [] |
| 916 |
auth_options = OptionGroup(parser, "Authentication Options", |
917 |
auth_options = OptionGroup(parser, "Authentication Options", |
| 917 |
"These options are usually passed e.g. from a calling joinscript") |
918 |
"These options are usually passed e.g. from a calling joinscript") |
|
Lines 1024-1030
def ucs_unregisterLDAPExtension():
Link Here
|
| 1024 |
help="UDM hook", metavar="<hook name>") |
1025 |
help="UDM hook", metavar="<hook name>") |
| 1025 |
|
1026 |
|
| 1026 |
# parser.add_option("-v", "--verbose", action="count") |
1027 |
# parser.add_option("-v", "--verbose", action="count") |
| 1027 |
|
1028 |
|
| 1028 |
udm_passthrough_options = [] |
1029 |
udm_passthrough_options = [] |
| 1029 |
auth_options = OptionGroup(parser, "Authentication Options", |
1030 |
auth_options = OptionGroup(parser, "Authentication Options", |
| 1030 |
"These options are usually passed e.g. from a calling joinscript") |
1031 |
"These options are usually passed e.g. from a calling joinscript") |