|
Lines 64-69
s4connector_search = False
Link Here
|
| 64 |
# FIXME: What is the use of the following line? |
64 |
# FIXME: What is the use of the following line? |
| 65 |
# __path__.append("users") |
65 |
# __path__.append("users") |
| 66 |
|
66 |
|
|
|
67 |
|
| 67 |
# manages properties |
68 |
# manages properties |
| 68 |
class base(object): |
69 |
class base(object): |
| 69 |
def __init__(self, co, lo, position, dn='', superordinate = None ): |
70 |
def __init__(self, co, lo, position, dn='', superordinate = None ): |
|
Lines 299-305
class base(object):
Link Here
|
| 299 |
return self.descriptions.keys() |
300 |
return self.descriptions.keys() |
| 300 |
|
301 |
|
| 301 |
def items(self): |
302 |
def items(self): |
| 302 |
|
|
|
| 303 |
# this returns emtpy strings resp. empty lists for attributes not set |
303 |
# this returns emtpy strings resp. empty lists for attributes not set |
| 304 |
r=[] |
304 |
r=[] |
| 305 |
for key in self.keys(): |
305 |
for key in self.keys(): |
|
Lines 456-462
class base(object):
Link Here
|
| 456 |
|
456 |
|
| 457 |
|
457 |
|
| 458 |
class simpleLdap(base): |
458 |
class simpleLdap(base): |
| 459 |
|
|
|
| 460 |
def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): |
459 |
def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): |
| 461 |
global s4connector_present |
460 |
global s4connector_present |
| 462 |
global s4connector_search |
461 |
global s4connector_search |
|
Lines 528-534
class simpleLdap(base):
Link Here
|
| 528 |
def description(self): |
527 |
def description(self): |
| 529 |
if self.dn: |
528 |
if self.dn: |
| 530 |
rdn = self.lo.explodeDn(self.dn)[0] |
529 |
rdn = self.lo.explodeDn(self.dn)[0] |
| 531 |
return rdn[rdn.find('=')+1:] |
530 |
return rdn[rdn.find('=') + 1:] |
| 532 |
else: |
531 |
else: |
| 533 |
return 'none' |
532 |
return 'none' |
| 534 |
|
533 |
|
|
Lines 546-579
class simpleLdap(base):
Link Here
|
| 546 |
self.exceptions=[] |
545 |
self.exceptions=[] |
| 547 |
|
546 |
|
| 548 |
# remove all properties which do not belong to chosen options |
547 |
# remove all properties which do not belong to chosen options |
| 549 |
|
|
|
| 550 |
chosen_options = None |
| 551 |
descriptions = None |
| 552 |
|
| 553 |
try: |
548 |
try: |
| 554 |
# these might not be set by an inheriting module |
549 |
# these might not be set by an inheriting module |
| 555 |
chosen_options = self.options |
550 |
chosen_options = self.options |
| 556 |
descriptions = self.descriptions |
551 |
descriptions = self.descriptions |
| 557 |
except: |
552 |
except: |
| 558 |
pass |
553 |
chosen_options = None |
|
|
554 |
descriptions = None |
| 559 |
|
555 |
|
| 560 |
if chosen_options and descriptions: |
556 |
if chosen_options and descriptions: |
| 561 |
for desc in descriptions: |
557 |
for desc in descriptions: |
| 562 |
propoptions = descriptions[desc].options |
558 |
propoptions = descriptions[desc].options |
| 563 |
|
559 |
|
| 564 |
if (propoptions==[]): |
560 |
if not propoptions: |
| 565 |
# property applies to all options |
561 |
# property applies to all options |
| 566 |
continue |
562 |
continue |
| 567 |
|
563 |
|
| 568 |
shortcut = False |
564 |
if set(propoptions) & set(chosen_options): |
| 569 |
|
565 |
# this property applies to one of the chosen options, |
| 570 |
for i in propoptions: |
566 |
# jump to next option |
| 571 |
if i in chosen_options: |
|
|
| 572 |
# this property applies to one of the chosen options, |
| 573 |
# jump to next option |
| 574 |
shortcut = True |
| 575 |
continue |
| 576 |
if shortcut: |
| 577 |
continue |
567 |
continue |
| 578 |
|
568 |
|
| 579 |
# if we've come here, we found a property that does not apply |
569 |
# if we've come here, we found a property that does not apply |
|
Lines 594-600
class simpleLdap(base):
Link Here
|
| 594 |
ml.append(('objectClass', self.oldattr.get('objectClass', []), self.oldattr.get('objectClass', [])+['univentionPolicyReference'])) |
584 |
ml.append(('objectClass', self.oldattr.get('objectClass', []), self.oldattr.get('objectClass', [])+['univentionPolicyReference'])) |
| 595 |
ml.append(('univentionPolicyReference', self.oldpolicies, self.policies)) |
585 |
ml.append(('univentionPolicyReference', self.oldpolicies, self.policies)) |
| 596 |
|
586 |
|
| 597 |
|
|
|
| 598 |
return ml |
587 |
return ml |
| 599 |
|
588 |
|
| 600 |
def _create(self): |
589 |
def _create(self): |
|
Lines 719-725
class simpleLdap(base):
Link Here
|
| 719 |
self.save() |
708 |
self.save() |
| 720 |
return self.dn |
709 |
return self.dn |
| 721 |
|
710 |
|
| 722 |
#+++# MODIFY #+++# |
711 |
#+++# MODIFY #+++# |
| 723 |
def _modify(self, modify_childs=1, ignore_license=0): |
712 |
def _modify(self, modify_childs=1, ignore_license=0): |
| 724 |
self.exceptions=[] |
713 |
self.exceptions=[] |
| 725 |
|
714 |
|
|
Lines 744-750
class simpleLdap(base):
Link Here
|
| 744 |
# iterate over all properties and call checkLdap() of corresponding syntax |
733 |
# iterate over all properties and call checkLdap() of corresponding syntax |
| 745 |
self._call_checkLdap_on_all_property_syntaxes() |
734 |
self._call_checkLdap_on_all_property_syntaxes() |
| 746 |
|
735 |
|
| 747 |
#+++# MODLIST #+++# |
736 |
#+++# MODLIST #+++# |
| 748 |
ml=self._ldap_modlist() |
737 |
ml=self._ldap_modlist() |
| 749 |
# custom attributes |
738 |
# custom attributes |
| 750 |
m=univention.admin.modules.get(self.module) |
739 |
m=univention.admin.modules.get(self.module) |
|
Lines 781-787
class simpleLdap(base):
Link Here
|
| 781 |
ml.remove(i) |
770 |
ml.remove(i) |
| 782 |
ml.extend( addlist ) |
771 |
ml.extend( addlist ) |
| 783 |
|
772 |
|
| 784 |
|
|
|
| 785 |
else: |
773 |
else: |
| 786 |
if deleteObjectClass == '1' and not self.info.has_key(pname): |
774 |
if deleteObjectClass == '1' and not self.info.has_key(pname): |
| 787 |
# value is empty, should delete objectClass and Values |
775 |
# value is empty, should delete objectClass and Values |
|
Lines 829-835
class simpleLdap(base):
Link Here
|
| 829 |
ml.append( ('objectClass', self.oldattr.get('objectClass'), current_ocs+[prop.objClass]) ) |
817 |
ml.append( ('objectClass', self.oldattr.get('objectClass'), current_ocs+[prop.objClass]) ) |
| 830 |
|
818 |
|
| 831 |
else: |
819 |
else: |
| 832 |
|
|
|
| 833 |
if prop.syntax == 'boolean' and self.info.has_key(prop.name) and self.info[prop.name] == '0': |
820 |
if prop.syntax == 'boolean' and self.info.has_key(prop.name) and self.info[prop.name] == '0': |
| 834 |
# syntax is boolean and value == 0 ==> remove |
821 |
# syntax is boolean and value == 0 ==> remove |
| 835 |
dellist = [] |
822 |
dellist = [] |
|
Lines 1009-1016
class simpleLdap(base):
Link Here
|
| 1009 |
self.policyObjects[policy_type]=univention.admin.objects.get(policy_module, None, self.lo, policy_position) |
996 |
self.policyObjects[policy_type]=univention.admin.objects.get(policy_module, None, self.lo, policy_position) |
| 1010 |
self.policyObjects[policy_type].copyIdentifier(self) |
997 |
self.policyObjects[policy_type].copyIdentifier(self) |
| 1011 |
self._init_ldap_search( self.policyObjects[ policy_type ] ) |
998 |
self._init_ldap_search( self.policyObjects[ policy_type ] ) |
| 1012 |
else: |
|
|
| 1013 |
pass |
| 1014 |
|
999 |
|
| 1015 |
return self.policyObjects[policy_type] |
1000 |
return self.policyObjects[policy_type] |
| 1016 |
|
1001 |
|
|
Lines 1122-1128
class simpleComputer( simpleLdap ):
Link Here
|
| 1122 |
zoneName.reverse( ) |
1107 |
zoneName.reverse( ) |
| 1123 |
relativeDomainName = relativeDomainName.split( '.' ) |
1108 |
relativeDomainName = relativeDomainName.split( '.' ) |
| 1124 |
relativeDomainName.reverse( ) |
1109 |
relativeDomainName.reverse( ) |
| 1125 |
return '%s.%s' % ( string.join( zoneName, '.' ) , string.join( relativeDomainName, '.' ) ) |
1110 |
return '.'.join(zoneName + relativeDomainName) |
| 1126 |
|
1111 |
|
| 1127 |
def __ip_from_ptr_ipv6( self, zoneName, relativeDomainName ): |
1112 |
def __ip_from_ptr_ipv6( self, zoneName, relativeDomainName ): |
| 1128 |
fullName = relativeDomainName + '.' + zoneName.replace('.ip6.arpa', '') |
1113 |
fullName = relativeDomainName + '.' + zoneName.replace('.ip6.arpa', '') |
|
Lines 1408-1420
class simpleComputer( simpleLdap ):
Link Here
|
| 1408 |
object[ 'host' ] = object[ 'host' ].replace( old_name, new_name ) |
1393 |
object[ 'host' ] = object[ 'host' ].replace( old_name, new_name ) |
| 1409 |
object.modify( ) |
1394 |
object.modify( ) |
| 1410 |
|
1395 |
|
| 1411 |
|
|
|
| 1412 |
def __remove_from_dhcp_object( self, position = None, name = None, oldname = None, mac = None, ip = None ): |
1396 |
def __remove_from_dhcp_object( self, position = None, name = None, oldname = None, mac = None, ip = None ): |
| 1413 |
# if we got the mac addres, then we remove the object |
1397 |
# if we got the mac addres, then we remove the object |
| 1414 |
# if we only got the ip addres, we remove the ip address |
1398 |
# if we only got the ip addres, we remove the ip address |
| 1415 |
|
1399 |
|
| 1416 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dhcp object: position="%s", name="%s", oldname="%s", mac="%s", ip="%s"' % ( position, name, oldname, mac, ip ) ) |
1400 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dhcp object: position="%s", name="%s", oldname="%s", mac="%s", ip="%s"' % ( position, name, oldname, mac, ip ) ) |
| 1417 |
|
1401 |
|
| 1418 |
dn = None |
1402 |
dn = None |
| 1419 |
|
1403 |
|
| 1420 |
tmppos = univention.admin.uldap.position( self.position.getDomain( ) ) |
1404 |
tmppos = univention.admin.uldap.position( self.position.getDomain( ) ) |
|
Lines 1494-1504
class simpleComputer( simpleLdap ):
Link Here
|
| 1494 |
for dn2, attributes2 in self.lo.search(scope='domain', attr=[ 'zoneName' ], filter='(&(relativeDomainName=%s)(objectClass=dNSZone))' % name, unique=0 ): |
1478 |
for dn2, attributes2 in self.lo.search(scope='domain', attr=[ 'zoneName' ], filter='(&(relativeDomainName=%s)(objectClass=dNSZone))' % name, unique=0 ): |
| 1495 |
self.lo.modify( dn, [('pTRRecord', '%s.%s.' % (name, attributes2['zoneName'][0]), '')] ) |
1479 |
self.lo.modify( dn, [('pTRRecord', '%s.%s.' % (name, attributes2['zoneName'][0]), '')] ) |
| 1496 |
|
1480 |
|
| 1497 |
zone = univention.admin.handlers.dns.reverse_zone.object( self.co, self.lo, self.position, zoneDN) |
1481 |
zone = univention.admin.handlers.dns.reverse_zone.object( self.co, self.lo, self.position, zoneDN) |
| 1498 |
zone.open() |
1482 |
zone.open() |
| 1499 |
zone.modify() |
1483 |
zone.modify() |
| 1500 |
|
1484 |
|
| 1501 |
|
|
|
| 1502 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dns reverse object: dnsEntryZoneReverse="%s", name="%s", ip="%s"' % ( dnsEntryZoneReverse, name, ip ) ) |
1485 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dns reverse object: dnsEntryZoneReverse="%s", name="%s", ip="%s"' % ( dnsEntryZoneReverse, name, ip ) ) |
| 1503 |
if dnsEntryZoneReverse: |
1486 |
if dnsEntryZoneReverse: |
| 1504 |
rdn = self.calc_dns_reverse_entry_name( ip, dnsEntryZoneReverse ) |
1487 |
rdn = self.calc_dns_reverse_entry_name( ip, dnsEntryZoneReverse ) |
|
Lines 1519-1525
class simpleComputer( simpleLdap ):
Link Here
|
| 1519 |
modify(rdn, zone) |
1502 |
modify(rdn, zone) |
| 1520 |
except univention.admin.uexceptions.noObject: |
1503 |
except univention.admin.uexceptions.noObject: |
| 1521 |
pass |
1504 |
pass |
| 1522 |
pass |
1505 |
|
| 1523 |
def __add_dns_reverse_object( self, name, zoneDn, ip ): |
1506 |
def __add_dns_reverse_object( self, name, zoneDn, ip ): |
| 1524 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should create a dns reverse object: zoneDn="%s", name="%s", ip="%s"' % ( zoneDn, name, ip ) ) |
1507 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should create a dns reverse object: zoneDn="%s", name="%s", ip="%s"' % ( zoneDn, name, ip ) ) |
| 1525 |
if name and zoneDn and ip: |
1508 |
if name and zoneDn and ip: |
|
Lines 1644-1651
class simpleComputer( simpleLdap ):
Link Here
|
| 1644 |
for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter): |
1627 |
for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter): |
| 1645 |
self.lo.modify(dn, [('pTRRecord', '', ptrrecord)]) |
1628 |
self.lo.modify(dn, [('pTRRecord', '', ptrrecord)]) |
| 1646 |
|
1629 |
|
| 1647 |
|
|
|
| 1648 |
|
| 1649 |
def __remove_related_ptrrecords(self, zoneDN, ip): |
1630 |
def __remove_related_ptrrecords(self, zoneDN, ip): |
| 1650 |
ptrrecord = '%s.%s.' % (self.info['name'], zoneDN.split('=')[1].split(',')[0]) |
1631 |
ptrrecord = '%s.%s.' % (self.info['name'], zoneDN.split('=')[1].split(',')[0]) |
| 1651 |
ip_split = ip.split('.') |
1632 |
ip_split = ip.split('.') |
|
Lines 1655-1661
class simpleComputer( simpleLdap ):
Link Here
|
| 1655 |
for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter): |
1636 |
for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter): |
| 1656 |
if ptrrecord in attributes['pTRRecord']: |
1637 |
if ptrrecord in attributes['pTRRecord']: |
| 1657 |
self.lo.modify(dn, [('pTRRecord', ptrrecord, '')]) |
1638 |
self.lo.modify(dn, [('pTRRecord', ptrrecord, '')]) |
| 1658 |
|
|
|
| 1659 |
|
1639 |
|
| 1660 |
def check_common_name_length(self): |
1640 |
def check_common_name_length(self): |
| 1661 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'check_common_name_length with self["ip"] = %r and self["dnsEntryZoneForward"] = %r' % (self['ip'], self['dnsEntryZoneForward'], )) |
1641 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'check_common_name_length with self["ip"] = %r and self["dnsEntryZoneForward"] = %r' % (self['ip'], self['dnsEntryZoneForward'], )) |
|
Lines 1779-1785
class simpleComputer( simpleLdap ):
Link Here
|
| 1779 |
else: |
1759 |
else: |
| 1780 |
self.lo.modify( dn, [ ( 'aRecord', '' , ip ) ] ) |
1760 |
self.lo.modify( dn, [ ( 'aRecord', '' , ip ) ] ) |
| 1781 |
|
1761 |
|
| 1782 |
|
|
|
| 1783 |
def __add_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias ): |
1762 |
def __add_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias ): |
| 1784 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'add a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) ) |
1763 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'add a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) ) |
| 1785 |
if name and dnsForwardZone and dnsAliasZoneContainer and alias: |
1764 |
if name and dnsForwardZone and dnsAliasZoneContainer and alias: |
|
Lines 1798-1804
class simpleComputer( simpleLdap ):
Link Here
|
| 1798 |
else: |
1777 |
else: |
| 1799 |
# thow exeption, cNAMERecord is single value |
1778 |
# thow exeption, cNAMERecord is single value |
| 1800 |
raise univention.admin.uexceptions.dnsAliasAlreadyUsed, _('DNS alias is already in use.') |
1779 |
raise univention.admin.uexceptions.dnsAliasAlreadyUsed, _('DNS alias is already in use.') |
| 1801 |
pass |
|
|
| 1802 |
|
1780 |
|
| 1803 |
def __remove_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias = None ): |
1781 |
def __remove_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias = None ): |
| 1804 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'remove a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) ) |
1782 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'remove a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) ) |
|
Lines 1845-1853
class simpleComputer( simpleLdap ):
Link Here
|
| 1845 |
pass |
1823 |
pass |
| 1846 |
|
1824 |
|
| 1847 |
def _ldap_post_modify( self ): |
1825 |
def _ldap_post_modify( self ): |
| 1848 |
|
1826 |
self.__multiip |= len(self['mac']) > 1 or len(self['ip']) > 1 |
| 1849 |
if len ( self[ 'mac' ] ) > 1 or len( self[ 'ip' ] ) > 1: |
|
|
| 1850 |
self.__multiip = True |
| 1851 |
|
1827 |
|
| 1852 |
for entry in self.__changes[ 'dhcpEntryZone' ][ 'remove' ]: |
1828 |
for entry in self.__changes[ 'dhcpEntryZone' ][ 'remove' ]: |
| 1853 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'simpleComputer: dhcp check: removed: %s' % entry ) |
1829 |
univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'simpleComputer: dhcp check: removed: %s' % entry ) |
|
Lines 1900-1906
class simpleComputer( simpleLdap ):
Link Here
|
| 1900 |
else: |
1876 |
else: |
| 1901 |
self.__add_dns_reverse_object( self[ 'name' ], dn, ip ) |
1877 |
self.__add_dns_reverse_object( self[ 'name' ], dn, ip ) |
| 1902 |
|
1878 |
|
| 1903 |
|
|
|
| 1904 |
for entry in self.__changes[ 'dnsEntryZoneAlias' ][ 'remove' ]: |
1879 |
for entry in self.__changes[ 'dnsEntryZoneAlias' ][ 'remove' ]: |
| 1905 |
dnsForwardZone, dnsAliasZoneContainer, alias = entry |
1880 |
dnsForwardZone, dnsAliasZoneContainer, alias = entry |
| 1906 |
if not alias: |
1881 |
if not alias: |
|
Lines 1963-1969
class simpleComputer( simpleLdap ):
Link Here
|
| 1963 |
self.__update_groups_after_namechange() |
1938 |
self.__update_groups_after_namechange() |
| 1964 |
self.__rename_dhcp_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] ) |
1939 |
self.__rename_dhcp_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] ) |
| 1965 |
self.__rename_dns_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] ) |
1940 |
self.__rename_dns_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] ) |
| 1966 |
pass |
|
|
| 1967 |
|
1941 |
|
| 1968 |
if self.ipRequest == 1 and self[ 'ip' ]: |
1942 |
if self.ipRequest == 1 and self[ 'ip' ]: |
| 1969 |
for ipAddress in self[ 'ip' ]: |
1943 |
for ipAddress in self[ 'ip' ]: |
|
Lines 1981-1997
class simpleComputer( simpleLdap ):
Link Here
|
| 1981 |
|
1955 |
|
| 1982 |
def __remove_associated_domain( self, entry ): |
1956 |
def __remove_associated_domain( self, entry ): |
| 1983 |
dn, ip = self.__split_dns_line( entry ) |
1957 |
dn, ip = self.__split_dns_line( entry ) |
| 1984 |
domain = string.join(ldap.explode_rdn(dn)[0].split('=')[1:], '=') |
1958 |
domain = ldap.explode_rdn(dn)[0].split('=', 1)[1] |
| 1985 |
if self.info.get('domain', None) == domain: |
1959 |
if self.info.get('domain', None) == domain: |
| 1986 |
self.info['domain'] = None |
1960 |
self.info['domain'] = None |
| 1987 |
|
1961 |
|
| 1988 |
def __set_associated_domain( self, entry ): |
1962 |
def __set_associated_domain( self, entry ): |
| 1989 |
dn, ip = self.__split_dns_line( entry ) |
1963 |
dn, ip = self.__split_dns_line( entry ) |
| 1990 |
domain = string.join(ldap.explode_rdn(dn)[0].split('=')[1:], '=') |
1964 |
domain = ldap.explode_rdn(dn)[0].split('=', 1)[1] |
| 1991 |
if not self.info.get('domain', None): |
1965 |
if not self.info.get('domain', None): |
| 1992 |
self.info['domain'] = domain |
1966 |
self.info['domain'] = domain |
| 1993 |
|
1967 |
|
| 1994 |
|
|
|
| 1995 |
def _ldap_modlist( self ): |
1968 |
def _ldap_modlist( self ): |
| 1996 |
self.__changes = { 'mac': {'remove': [ ], 'add': [ ]}, 'ip': {'remove': [ ], 'add': [ ]}, 'name': None, |
1969 |
self.__changes = { 'mac': {'remove': [ ], 'add': [ ]}, 'ip': {'remove': [ ], 'add': [ ]}, 'name': None, |
| 1997 |
'dnsEntryZoneForward': { 'remove': [ ], 'add': [ ] }, |
1970 |
'dnsEntryZoneForward': { 'remove': [ ], 'add': [ ] }, |
|
Lines 2029-2041
class simpleComputer( simpleLdap ):
Link Here
|
| 2029 |
newAaaaRecord = [] |
2002 |
newAaaaRecord = [] |
| 2030 |
if oldAddresses != newAddresses: |
2003 |
if oldAddresses != newAddresses: |
| 2031 |
if oldAddresses: |
2004 |
if oldAddresses: |
| 2032 |
for address in oldAddresses: |
2005 |
for address in oldAddresses: |
| 2033 |
if ':' in address: # IPv6 |
2006 |
if ':' in address: # IPv6 |
| 2034 |
oldAaaaRecord.append(address) |
2007 |
oldAaaaRecord.append(address) |
| 2035 |
else: |
2008 |
else: |
| 2036 |
oldARecord.append(address) |
2009 |
oldARecord.append(address) |
| 2037 |
if newAddresses: |
2010 |
if newAddresses: |
| 2038 |
for address in newAddresses: |
2011 |
for address in newAddresses: |
| 2039 |
if ':' in address: # IPv6 |
2012 |
if ':' in address: # IPv6 |
| 2040 |
newAaaaRecord.append(ipaddr.IPv6Address(address).exploded) |
2013 |
newAaaaRecord.append(ipaddr.IPv6Address(address).exploded) |
| 2041 |
else: |
2014 |
else: |
|
Lines 2075-2093
class simpleComputer( simpleLdap ):
Link Here
|
| 2075 |
continue |
2048 |
continue |
| 2076 |
self.__changes[ 'ip' ][ 'remove' ].append( ipAddress ) |
2049 |
self.__changes[ 'ip' ][ 'remove' ].append( ipAddress ) |
| 2077 |
|
2050 |
|
| 2078 |
|
|
|
| 2079 |
if self.hasChanged( 'name' ): |
2051 |
if self.hasChanged( 'name' ): |
| 2080 |
ml.append( ( 'sn', self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] ) ) |
2052 |
ml.append( ( 'sn', self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] ) ) |
| 2081 |
self.__changes[ 'name' ] = ( self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] ) |
2053 |
self.__changes[ 'name' ] = ( self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] ) |
| 2082 |
|
2054 |
|
| 2083 |
if self.hasChanged('ip') or self.hasChanged('mac'): |
2055 |
if self.hasChanged('ip') or self.hasChanged('mac'): |
| 2084 |
|
|
|
| 2085 |
if len(self.info.get('ip', [])) == 1 and len(self.info.get('mac', [])) == 1 and len(self.info.get('dhcpEntryZone', [])): |
2056 |
if len(self.info.get('ip', [])) == 1 and len(self.info.get('mac', [])) == 1 and len(self.info.get('dhcpEntryZone', [])): |
| 2086 |
# In this special case, we assume the mapping between ip/mac address to be |
2057 |
# In this special case, we assume the mapping between ip/mac address to be |
| 2087 |
# unique. The dhcp entry needs to contain the mac address (as sepcified by |
2058 |
# unique. The dhcp entry needs to contain the mac address (as sepcified by |
| 2088 |
# the ldap search for dhcp entries), the ip address may not correspond to |
2059 |
# the ldap search for dhcp entries), the ip address may not correspond to |
| 2089 |
# the ip address associated with the computer ldap object, but this would |
2060 |
# the ip address associated with the computer ldap object, but this would |
| 2090 |
# be erroneous anyway. We therefore update the dhcp entry to correspond to |
2061 |
# be erroneous anyway. We therefore update the dhcp entry to correspond to |
| 2091 |
# the current ip and mac address. (Bug #20315) |
2062 |
# the current ip and mac address. (Bug #20315) |
| 2092 |
dn, ip, mac = self.__split_dhcp_line( self.info['dhcpEntryZone'][0] ) |
2063 |
dn, ip, mac = self.__split_dhcp_line( self.info['dhcpEntryZone'][0] ) |
| 2093 |
|
2064 |
|
|
Lines 2171-2182
class simpleComputer( simpleLdap ):
Link Here
|
| 2171 |
else: |
2142 |
else: |
| 2172 |
raise univention.admin.uexceptions.invalidDNSAliasEntry, _('The DNS alias entry for this host should contain the zone name, the alias zone container LDAP-DN and the alias.') |
2143 |
raise univention.admin.uexceptions.invalidDNSAliasEntry, _('The DNS alias entry for this host should contain the zone name, the alias zone container LDAP-DN and the alias.') |
| 2173 |
|
2144 |
|
| 2174 |
if len ( self[ 'mac' ] ) < 2 and len( self[ 'ip' ] ) < 2: |
2145 |
self.__multiip = len(self['mac']) > 1 or len(self['ip']) > 1 |
| 2175 |
self.__multiip = False |
|
|
| 2176 |
else: |
| 2177 |
self.__multiip = True |
| 2178 |
|
2146 |
|
| 2179 |
ml = ml + super( simpleComputer, self )._ldap_modlist( ) |
2147 |
ml += super(simpleComputer, self)._ldap_modlist() |
| 2180 |
|
2148 |
|
| 2181 |
return ml |
2149 |
return ml |
| 2182 |
|
2150 |
|
|
Lines 2191-2196
class simpleComputer( simpleLdap ):
Link Here
|
| 2191 |
subnet=ldap.explode_dn(reverseDN, 1)[0].replace('.in-addr.arpa','').split('.') |
2159 |
subnet=ldap.explode_dn(reverseDN, 1)[0].replace('.in-addr.arpa','').split('.') |
| 2192 |
ip=sip.split('.') |
2160 |
ip=sip.split('.') |
| 2193 |
return self.calc_dns_reverse_entry_name_do(4, subnet, ip) |
2161 |
return self.calc_dns_reverse_entry_name_do(4, subnet, ip) |
|
|
2162 |
|
| 2194 |
def calc_dns_reverse_entry_name_do(self, maxLength, zoneNet, ip): |
2163 |
def calc_dns_reverse_entry_name_do(self, maxLength, zoneNet, ip): |
| 2195 |
zoneNet.reverse() |
2164 |
zoneNet.reverse() |
| 2196 |
if not ip[:len(zoneNet)] == zoneNet: |
2165 |
if not ip[:len(zoneNet)] == zoneNet: |
|
Lines 2222-2228
class simpleComputer( simpleLdap ):
Link Here
|
| 2222 |
else: |
2191 |
else: |
| 2223 |
self.__modify_dhcp_object( dn, self[ 'name' ], ip, mac ) |
2192 |
self.__modify_dhcp_object( dn, self[ 'name' ], ip, mac ) |
| 2224 |
|
2193 |
|
| 2225 |
|
|
|
| 2226 |
for entry in self.__changes[ 'dnsEntryZoneForward' ][ 'remove' ]: |
2194 |
for entry in self.__changes[ 'dnsEntryZoneForward' ][ 'remove' ]: |
| 2227 |
dn, ip = self.__split_dns_line( entry ) |
2195 |
dn, ip = self.__split_dns_line( entry ) |
| 2228 |
if not ip and not self.__multiip: |
2196 |
if not ip and not self.__multiip: |
|
Lines 2314-2320
class simpleComputer( simpleLdap ):
Link Here
|
| 2314 |
groupObject = univention.admin.objects.get(univention.admin.modules.get('groups/group'), self.co, self.lo, self.position, group) |
2282 |
groupObject = univention.admin.objects.get(univention.admin.modules.get('groups/group'), self.co, self.lo, self.position, group) |
| 2315 |
groupObject.fast_member_remove( [ self.dn ], self.oldattr.get('uid',[]), ignore_license=1 ) |
2283 |
groupObject.fast_member_remove( [ self.dn ], self.oldattr.get('uid',[]), ignore_license=1 ) |
| 2316 |
|
2284 |
|
| 2317 |
|
|
|
| 2318 |
def __update_groups_after_namechange(self): |
2285 |
def __update_groups_after_namechange(self): |
| 2319 |
oldname = self.oldinfo.get('name') |
2286 |
oldname = self.oldinfo.get('name') |
| 2320 |
newname = self.info.get('name') |
2287 |
newname = self.info.get('name') |
|
Lines 2356-2362
class simpleComputer( simpleLdap ):
Link Here
|
| 2356 |
|
2323 |
|
| 2357 |
self.lo.modify(group, [('uniqueMember', oldUniqueMembers, newUniqueMembers), ('memberUid', oldMemberUids, newMemberUids)]) |
2324 |
self.lo.modify(group, [('uniqueMember', oldUniqueMembers, newUniqueMembers), ('memberUid', oldMemberUids, newMemberUids)]) |
| 2358 |
|
2325 |
|
| 2359 |
|
|
|
| 2360 |
def update_groups(self): |
2326 |
def update_groups(self): |
| 2361 |
if not self.hasChanged('groups') and \ |
2327 |
if not self.hasChanged('groups') and \ |
| 2362 |
not ('oldPrimaryGroupDn' in self.__dict__ and self.oldPrimaryGroupDn) and \ |
2328 |
not ('oldPrimaryGroupDn' in self.__dict__ and self.oldPrimaryGroupDn) and \ |
|
Lines 2400-2406
class simpleComputer( simpleLdap ):
Link Here
|
| 2400 |
groupObject['hosts'].remove(self.dn) |
2366 |
groupObject['hosts'].remove(self.dn) |
| 2401 |
groupObject.modify(ignore_license=1) |
2367 |
groupObject.modify(ignore_license=1) |
| 2402 |
|
2368 |
|
| 2403 |
|
|
|
| 2404 |
def primary_group(self): |
2369 |
def primary_group(self): |
| 2405 |
if not self.hasChanged('primaryGroup'): |
2370 |
if not self.hasChanged('primaryGroup'): |
| 2406 |
return |
2371 |
return |
|
Lines 2545-2553
class simpleComputer( simpleLdap ):
Link Here
|
| 2545 |
self.__saved_dhcp_entry = network_object['dhcpEntryZone'] |
2510 |
self.__saved_dhcp_entry = network_object['dhcpEntryZone'] |
| 2546 |
|
2511 |
|
| 2547 |
self.old_network=value |
2512 |
self.old_network=value |
| 2548 |
else: |
|
|
| 2549 |
pass |
| 2550 |
|
| 2551 |
|
2513 |
|
| 2552 |
elif key == 'ip': |
2514 |
elif key == 'ip': |
| 2553 |
self.ip_freshly_set = True |
2515 |
self.ip_freshly_set = True |
|
Lines 2581-2588
class simpleComputer( simpleLdap ):
Link Here
|
| 2581 |
if raise_after: |
2543 |
if raise_after: |
| 2582 |
raise raise_after |
2544 |
raise raise_after |
| 2583 |
|
2545 |
|
| 2584 |
class simpleLdapSub(simpleLdap): |
|
|
| 2585 |
|
2546 |
|
|
|
2547 |
class simpleLdapSub(simpleLdap): |
| 2586 |
def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): |
2548 |
def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): |
| 2587 |
base.__init__(self, co, lo, position, dn, superordinate ) |
2549 |
base.__init__(self, co, lo, position, dn, superordinate ) |
| 2588 |
|
2550 |
|
|
Lines 2601-2609
class simpleLdapSub(simpleLdap):
Link Here
|
| 2601 |
if hasattr(self,"_ldap_post_remove"): |
2563 |
if hasattr(self,"_ldap_post_remove"): |
| 2602 |
self._ldap_post_remove() |
2564 |
self._ldap_post_remove() |
| 2603 |
|
2565 |
|
|
|
2566 |
|
| 2604 |
class simplePolicy(simpleLdap): |
2567 |
class simplePolicy(simpleLdap): |
| 2605 |
def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): |
2568 |
def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): |
| 2606 |
|
|
|
| 2607 |
self.resultmode=0 |
2569 |
self.resultmode=0 |
| 2608 |
self.dn=dn |
2570 |
self.dn=dn |
| 2609 |
|
2571 |
|
|
Lines 2786-2792
class simplePolicy(simpleLdap):
Link Here
|
| 2786 |
self.policy_result() |
2748 |
self.policy_result() |
| 2787 |
|
2749 |
|
| 2788 |
if self.polinfo.has_key(key): |
2750 |
if self.polinfo.has_key(key): |
| 2789 |
|
|
|
| 2790 |
if self.polinfo[key] != newvalue or self.polinfo_more[key]['policy'] == self.cloned or ( self.info.has_key( key ) and self.info[ key ] != newvalue ): |
2751 |
if self.polinfo[key] != newvalue or self.polinfo_more[key]['policy'] == self.cloned or ( self.info.has_key( key ) and self.info[ key ] != newvalue ): |
| 2791 |
if self.polinfo_more[key]['fixed'] and self.polinfo_more[key]['policy'] != self.cloned: |
2752 |
if self.polinfo_more[key]['fixed'] and self.polinfo_more[key]['policy'] != self.cloned: |
| 2792 |
raise univention.admin.uexceptions.policyFixedAttribute, key |
2753 |
raise univention.admin.uexceptions.policyFixedAttribute, key |
|
Lines 2795-2803
class simplePolicy(simpleLdap):
Link Here
|
| 2795 |
if self.hasChanged(key): |
2756 |
if self.hasChanged(key): |
| 2796 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'polinfo: key:%s hasChanged' % (key) ) |
2757 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'polinfo: key:%s hasChanged' % (key) ) |
| 2797 |
self.changes=1 |
2758 |
self.changes=1 |
| 2798 |
return |
2759 |
return |
| 2799 |
else: |
|
|
| 2800 |
return |
| 2801 |
|
2760 |
|
| 2802 |
# this object did not exist before |
2761 |
# this object did not exist before |
| 2803 |
if not self.oldinfo: |
2762 |
if not self.oldinfo: |