View | Details | Raw Unified | Return to bug 31800
Collapse All | Expand All

(-)samba-shares.py (-12 / +19 lines)
 Lines 224-229    Link Here 
224
		finally:
224
		finally:
225
			listener.unsetuid()
225
			listener.unsetuid()
226
226
227
	if ( not (new and old) ) or (new['univentionShareSambaName'][0] != old['univentionShareSambaName'][0]):
228
		global ucr_handlers
229
		listener.setuid(0)
230
		try:
231
			run_ucs_commit = False
232
			if not os.path.exists('/etc/samba/shares.conf'):
233
				run_ucs_commit = True
234
			fp = open('/etc/samba/shares.conf.temp', 'w')
235
			print >>fp, '# Warning: This file is auto-generated and will be overwritten by \n#          univention-directory-listener module. \n#          Please edit the following file instead: \n#          /etc/samba/local.conf \n  \n# Warnung: Diese Datei wurde automatisch generiert und wird durch ein \n#          univention-directory-listener Modul überschrieben werden. \n#          Ergänzungen können an folgende Datei vorgenommen werden: \n# \n#          /etc/samba/local.conf \n#'
236
237
			for f in os.listdir('/etc/samba/shares.conf.d'):
238
				print >>fp, 'include = %s' % os.path.join('/etc/samba/shares.conf.d', f)
239
			fp.close()
240
			os.rename('/etc/samba/shares.conf.temp', '/etc/samba/shares.conf')
241
			if run_ucs_commit:
242
				ucr_handlers.commit(listener.configRegistry, ['/etc/samba/smb.conf'])
243
		finally:
244
			listener.unsetuid()
245
227
def initialize():
246
def initialize():
228
	if not os.path.exists('/etc/samba/shares.conf.d'):
247
	if not os.path.exists('/etc/samba/shares.conf.d'):
229
		listener.setuid(0)
248
		listener.setuid(0)
 Lines 255-274    Link Here 
255
		listener.unsetuid()
274
		listener.unsetuid()
256
275
257
def postrun():
276
def postrun():
258
	global ucr_handlers
259
	listener.setuid(0)
277
	listener.setuid(0)
260
	try:
278
	try:
261
		run_ucs_commit = False
262
		if not os.path.exists('/etc/samba/shares.conf'):
263
			run_ucs_commit = True
264
		fp = open('/etc/samba/shares.conf', 'w')
265
		print >>fp, '# Warning: This file is auto-generated and will be overwritten by \n#          univention-directory-listener module. \n#          Please edit the following file instead: \n#          /etc/samba/local.conf \n  \n# Warnung: Diese Datei wurde automatisch generiert und wird durch ein \n#          univention-directory-listener Modul überschrieben werden. \n#          Ergänzungen können an folgender Datei vorgenommen werden: \n# \n#          /etc/samba/local.conf \n#'
266
267
		for f in os.listdir('/etc/samba/shares.conf.d'):
268
			print >>fp, 'include = %s' % os.path.join('/etc/samba/shares.conf.d', f)
269
		fp.close()
270
		if run_ucs_commit:
271
			ucr_handlers.commit(listener.configRegistry, ['/etc/samba/smb.conf'])
272
		initscript='/etc/init.d/samba4'
279
		initscript='/etc/init.d/samba4'
273
		os.spawnv(os.P_WAIT, initscript, ['samba4', 'reload'])
280
		os.spawnv(os.P_WAIT, initscript, ['samba4', 'reload'])
274
	finally:
281
	finally:

Return to bug 31800