|
39 |
filter='(objectClass=*)' |
39 |
filter='(objectClass=*)' |
40 |
attributes=[] |
40 |
attributes=[] |
41 |
|
41 |
|
|
|
42 |
|
42 |
# use the modrdn listener extension |
43 |
# use the modrdn listener extension |
43 |
modrdn="1" |
44 |
modrdn="1" |
44 |
|
45 |
|
|
|
46 |
# While initialize copy all group objects into a list: |
47 |
# https://forge.univention.org/bugzilla/show_bug.cgi?id=18619#c5 |
48 |
init_mode = False |
49 |
group_objects = [] |
50 |
|
45 |
dirs = [listener.baseConfig['connector/ad/listener/dir']] |
51 |
dirs = [listener.baseConfig['connector/ad/listener/dir']] |
46 |
if listener.baseConfig.has_key('connector/listener/additionalbasenames') and listener.baseConfig['connector/listener/additionalbasenames']: |
52 |
if listener.baseConfig.has_key('connector/listener/additionalbasenames') and listener.baseConfig['connector/listener/additionalbasenames']: |
47 |
for configbasename in listener.baseConfig['connector/listener/additionalbasenames'].split(' '): |
53 |
for configbasename in listener.baseConfig['connector/listener/additionalbasenames'].split(' '): |
|
54 |
|
60 |
|
55 |
def handler(dn, new, old, command): |
61 |
def handler(dn, new, old, command): |
56 |
|
62 |
|
|
|
63 |
global group_objects |
64 |
|
57 |
listener.setuid(0) |
65 |
listener.setuid(0) |
58 |
try: |
66 |
try: |
59 |
for directory in dirs: |
67 |
for directory in dirs: |
|
76 |
object=(dn, new, old, old_dn) |
84 |
object=(dn, new, old, old_dn) |
77 |
|
85 |
|
78 |
filename=os.path.join(directory,"%f"%time.time()) |
86 |
filename=os.path.join(directory,"%f"%time.time()) |
|
|
87 |
|
88 |
if new and 'univentionGroup' in new.get('objectClass', []): |
89 |
group_objects.append(object) |
79 |
|
90 |
|
80 |
f=open(filename, 'w+') |
91 |
f=open(filename, 'w+') |
81 |
os.chmod(filename, 0600) |
92 |
os.chmod(filename, 0600) |
|
102 |
finally: |
113 |
finally: |
103 |
listener.unsetuid() |
114 |
listener.unsetuid() |
104 |
|
115 |
|
|
|
116 |
def postrun(): |
117 |
global init_mode |
118 |
if init_mode: |
119 |
listener.setuid(0) |
120 |
try: |
121 |
init_mode = False |
122 |
for object in group_objects: |
123 |
for directory in dirs: |
124 |
filename=os.path.join(directory,"%f"%time.time()) |
125 |
f=open(filename, 'w+') |
126 |
os.chmod(filename, 0600) |
127 |
cPickle.dump(object, f) |
128 |
f.close() |
129 |
finally: |
130 |
listener.unsetuid() |
105 |
|
131 |
|
106 |
def initialize(): |
132 |
def initialize(): |
|
|
133 |
global init_mode |
134 |
init_mode = True |
107 |
clean() |
135 |
clean() |
108 |
|
136 |
|