[Dovecot] file descriptor errors

Christian Rößner cr at sys4.de
Wed Dec 4 13:47:32 EET 2013


Hi,

Am 04.12.2013 um 10:50 schrieb Christian Rößner <cr at sys4.de>:

> Hi,
> 
> I use dovecot 2.2.9 on Gentoo Linux and I get lots of these erors in my log file:
> 
> Dec  4 08:53:37 mx dovecot: auth: Error: close failed in file object destructor:
> Dec  4 08:53:37 mx dovecot: auth: Error: IOError: [Errno 9] Bad file descriptor
> 

I found the problem, but do not know, if my solution is okay. It is the checkpassword script that I wrote in python:

…
	# Return data to Dovecot
	try:
		fd = os.fdopen(dovecot_out, "w")
	except:
		sl.syslog(sl.LOG_ERR,
			  "Can not write to FD 4")
		sys.exit(1)
	os.write(fd.fileno(),
		 "\tuserdb_uid=%i"
		 "\tuserdb_gid=%i"
		 % (uid, gid))
	#os.close(fd.fileno())

	try:
		os.putenv('USER', username)
		os.putenv('HOME', local_part_dir)
	except:
		sl.syslog(sl.LOG_WARN,
			  "Can not set environment variables“)
…

When it comes to the os.close(fd.fileno()) call dovecot throws an error. So for now, I leave the file descriptor open and wait for the script to terminate. I thought, I would have to close the descriptor after using it, do I?

-Christian Rößner

--
[*] sys4 AG

http://sys4.de, +49 (89) 30 90 46 64
Franziskanerstraße 15, 81669 München

Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer
Aufsichtsratsvorsitzender: Florian Kirstein

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://dovecot.org/pipermail/dovecot/attachments/20131204/f392217c/attachment-0001.bin>


More information about the dovecot mailing list