|
55 |
attributes = ['univentionPrinterSpoolHost', 'univentionPrinterModel', 'univentionPrinterURI', 'univentionPrinterLocation', 'description', 'univentionPrinterSambaName', 'univentionPrinterPricePerPage', 'univentionPrinterPricePerJob', 'univentionPrinterQuotaSupport', 'univentionPrinterGroupMember', 'univentionPrinterACLUsers', 'univentionPrinterACLGroups', 'univentionPrinterACLtype', 'univentionPrinterUseClientDriver', ] |
55 |
attributes = ['univentionPrinterSpoolHost', 'univentionPrinterModel', 'univentionPrinterURI', 'univentionPrinterLocation', 'description', 'univentionPrinterSambaName', 'univentionPrinterPricePerPage', 'univentionPrinterPricePerJob', 'univentionPrinterQuotaSupport', 'univentionPrinterGroupMember', 'univentionPrinterACLUsers', 'univentionPrinterACLGroups', 'univentionPrinterACLtype', 'univentionPrinterUseClientDriver', ] |
56 |
|
56 |
|
57 |
EMPTY = ('',) |
57 |
EMPTY = ('',) |
58 |
reload_samba_in_postrun = None |
|
|
59 |
|
58 |
|
60 |
|
59 |
|
61 |
def lpadmin(args): |
60 |
def lpadmin(args): |
|
123 |
printer_is_group = False |
122 |
printer_is_group = False |
124 |
quota_support = False |
123 |
quota_support = False |
125 |
samba_force_printername = listener.baseConfig.is_true('samba/force_printername', True) |
124 |
samba_force_printername = listener.baseConfig.is_true('samba/force_printername', True) |
126 |
global reload_samba_in_postrun |
|
|
127 |
reload_samba_in_postrun = True |
128 |
|
125 |
|
129 |
changes = [] |
126 |
changes = [] |
130 |
|
127 |
|
|
177 |
|
174 |
|
178 |
if (filter_match(new) or filter_match(old)): |
175 |
if (filter_match(new) or filter_match(old)): |
179 |
change_affects_this_host = True |
176 |
change_affects_this_host = True |
180 |
reload_samba_in_postrun = True # default, if it isn't done earlier |
|
|
181 |
|
177 |
|
182 |
if filter_match(old): |
178 |
if filter_match(old): |
183 |
if 'cn' in changes or not filter_match(new): |
179 |
if 'cn' in changes or not filter_match(new): |
|
438 |
|
434 |
|
439 |
|
435 |
|
440 |
def reload_smbd(): |
436 |
def reload_smbd(): |
441 |
global reload_samba_in_postrun |
|
|
442 |
listener.setuid(0) |
437 |
listener.setuid(0) |
443 |
try: |
438 |
try: |
444 |
ucr_handlers.commit(listener.configRegistry, ['/etc/samba/smb.conf']) |
439 |
ucr_handlers.commit(listener.configRegistry, ['/etc/samba/smb.conf']) |
445 |
if os.path.exists('/etc/init.d/samba'): |
440 |
if os.path.exists('/etc/init.d/smbd'): |
446 |
subprocess.call(('/etc/init.d/samba', 'reload')) |
441 |
subprocess.call(('/etc/init.d/smbd', 'reload')) |
447 |
elif os.path.exists('/usr/bin/pkill'): |
442 |
elif os.path.exists('/usr/bin/pkill'): |
448 |
ud.debug(ud.LISTENER, ud.WARN, "cups-printers: pkill -HUP smbd") |
443 |
ud.debug(ud.LISTENER, ud.WARN, "cups-printers: pkill -HUP smbd") |
449 |
subprocess.call(('/usr/bin/pkill', '-HUP', 'smbd')) |
444 |
subprocess.call(('/usr/bin/pkill', '-HUP', 'smbd')) |
|
451 |
ud.debug(ud.LISTENER, ud.ERROR, "cups-printers: Cannot reload smbd: Both /etc/init.d/samba and pkill are missing") |
446 |
ud.debug(ud.LISTENER, ud.ERROR, "cups-printers: Cannot reload smbd: Both /etc/init.d/samba and pkill are missing") |
452 |
finally: |
447 |
finally: |
453 |
listener.unsetuid() |
448 |
listener.unsetuid() |
454 |
reload_samba_in_postrun = False # flag that this has been done. |
|
|
455 |
|
449 |
|
456 |
|
450 |
|
457 |
def initialize(): |
451 |
def initialize(): |
|
476 |
os.rmdir('/etc/samba/printers.conf.d') |
470 |
os.rmdir('/etc/samba/printers.conf.d') |
477 |
finally: |
471 |
finally: |
478 |
listener.unsetuid() |
472 |
listener.unsetuid() |
479 |
|
|
|
480 |
|
481 |
def postrun(): |
482 |
global reload_samba_in_postrun |
483 |
if reload_samba_in_postrun: |
484 |
reload_smbd() |