|
Lines 54-59
attributes = []
Link Here
|
| 54 |
|
54 |
|
| 55 |
FN_PID = '/var/run/ucs-school-user-logonscript-daemon.pid' |
55 |
FN_PID = '/var/run/ucs-school-user-logonscript-daemon.pid' |
| 56 |
time_me = listener.configRegistry.is_true('ucsschool/userlogon/benchmark') |
56 |
time_me = listener.configRegistry.is_true('ucsschool/userlogon/benchmark') |
|
|
57 |
lo = None |
| 57 |
|
58 |
|
| 58 |
|
59 |
|
| 59 |
class Log(object): |
60 |
class Log(object): |
|
Lines 180-196
def handle_user(dn, new, old, lo, user_queue):
Link Here
|
| 180 |
|
181 |
|
| 181 |
|
182 |
|
| 182 |
def handler(dn, new, old): |
183 |
def handler(dn, new, old): |
|
|
184 |
global lo |
| 185 |
|
| 183 |
timer.reset_timer() |
186 |
timer.reset_timer() |
| 184 |
timer.add_timing('handler start') |
187 |
timer.add_timing('handler start') |
| 185 |
|
188 |
|
| 186 |
attrs = new if new else old |
189 |
attrs = new if new else old |
| 187 |
|
190 |
|
|
|
191 |
timer.add_timing('handler init 0') |
| 188 |
listener.setuid(0) |
192 |
listener.setuid(0) |
| 189 |
try: |
193 |
try: |
| 190 |
lo = getMachineConnection()[0] |
194 |
timer.add_timing('handler init 1') |
|
|
195 |
if not lo: |
| 196 |
lo = getMachineConnection()[0] |
| 197 |
timer.add_timing('handler init 2') |
| 191 |
user_queue = SqliteQueue(logger=Log) |
198 |
user_queue = SqliteQueue(logger=Log) |
| 192 |
|
199 |
timer.add_timing('handler init 3') |
| 193 |
timer.add_timing('handler init') |
|
|
| 194 |
|
200 |
|
| 195 |
# identify object |
201 |
# identify object |
| 196 |
if users_user_module.identify(dn, attrs): |
202 |
if users_user_module.identify(dn, attrs): |
|
Lines 267-272
def clean():
Link Here
|
| 267 |
listener.unsetuid() |
273 |
listener.unsetuid() |
| 268 |
|
274 |
|
| 269 |
|
275 |
|
|
|
276 |
def prerun(): |
| 277 |
global lo |
| 278 |
timer.add_timing('prerun start') |
| 279 |
if not lo: |
| 280 |
listener.setuid(0) |
| 281 |
try: |
| 282 |
lo = getMachineConnection()[0] |
| 283 |
finally: |
| 284 |
listener.unsetuid() |
| 285 |
timer.add_timing('prerun end') |
| 286 |
|
| 287 |
|
| 270 |
def postrun(): |
288 |
def postrun(): |
|
|
289 |
global lo |
| 290 |
timer.add_timing('postrun start') |
| 291 |
if lo: |
| 292 |
lo.unbind() |
| 293 |
lo = None |
| 294 |
timer.add_timing('postrun end') |
| 295 |
|
| 271 |
if time_me: |
296 |
if time_me: |
| 272 |
Log.process('Timer total:\n{!s}'.format('\n'.join(timer.sprint_timer_total()))) |
297 |
Log.process('Timer total:\n{!s}'.format('\n'.join(timer.sprint_timer_total()))) |