|
Lines 38-43
import ldif
Link Here
|
| 38 |
import binascii |
38 |
import binascii |
| 39 |
|
39 |
|
| 40 |
import univention.admin.uldap |
40 |
import univention.admin.uldap |
|
|
41 |
import univention.uldap |
| 41 |
from univention.lib.i18n import Translation |
42 |
from univention.lib.i18n import Translation |
| 42 |
|
43 |
|
| 43 |
from univention.management.console.config import ucr |
44 |
from univention.management.console.config import ucr |
|
Lines 103-116
class LicenseImport(ldif.LDIFParser):
Link Here
|
| 103 |
# self.mod_list.insert( 0, ( ldap.MOD_REPLACE, atr, entry[ atr ] ) ) |
104 |
# self.mod_list.insert( 0, ( ldap.MOD_REPLACE, atr, entry[ atr ] ) ) |
| 104 |
|
105 |
|
| 105 |
def write(self, user_dn, passwd): |
106 |
def write(self, user_dn, passwd): |
| 106 |
ldap_con = ldap.open("localhost", port=int(ucr.get('ldap/server/port', 7389))) |
107 |
lo = univention.uldap.access(host=ucr['ldap/master'], port=int(ucr.get('ldap/master/port', 7389)), base=ucr['ldap/base'], binddn=user_dn, bindpw=passwd, follow_referral=True) |
| 107 |
ldap_con.simple_bind_s(user_dn, passwd) |
|
|
| 108 |
try: |
108 |
try: |
| 109 |
ldap_con.add_s(self.dn, self.addlist) |
109 |
lo.add(self.dn, self.addlist) |
| 110 |
except ldap.ALREADY_EXISTS: |
110 |
except ldap.ALREADY_EXISTS: |
| 111 |
ldap_con.delete_s(self.dn) |
111 |
lo.delete(self.dn) |
| 112 |
ldap_con.add_s(self.dn, self.addlist) |
112 |
lo.add(self.dn, self.addlist) |
| 113 |
ldap_con.unbind_s() |
113 |
lo.lo.unbind_s() |
| 114 |
|
114 |
|
| 115 |
# TODO: this should probably go into univention-lib |
115 |
# TODO: this should probably go into univention-lib |
| 116 |
# and hide urllib/urllib2 completely |
116 |
# and hide urllib/urllib2 completely |