On 05/11/17 10:04, Philippe Meunier wrote:
Hello,

I'm running a default OpenSMTPD on OpenBSD 6.1 (and several previous
versions of it before).  I've noticed that OpenSMTPD creates two
directories in /var/spool/smtpd/purge every time it is started but never
deletes these directories when shutting down.  This might be fine on an
email server that's always up and running but this is on a laptop computer
that's turned on and off several times a day...  The result is that I have
now hundreds of these empty directories in /var/sppol/smtpd/purge and just
doing an "ls" in that directory is very noticeably slow as a result.  I
obviously can easily delete all these directories but it's kind of annoying
to have to do that by hand every few months, so:
- is there any special reason why OpenSMTPD doesn't clean up after itself
when it shuts down?
- out of curiosity, what are these folders for anyway?  I've look at all
the man pages related to OpenSMTPD and there's no explanation I could find
for the purge directory anywhere...

Thanks,

Philippe



I think its because the directory is owned by _smtpq and it looks like the intent was to clean up these files in purge_task(). However, it is running as _smtpd and can't rmtree() because of this. Of course that is if I have interpreted this correctly.
Index: smtpd.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v
retrieving revision 1.288
diff -u -p -u -r1.288 smtpd.c
--- smtpd.c	9 Jan 2017 09:53:23 -0000	1.288
+++ smtpd.c	12 May 2017 01:53:14 -0000
@@ -1194,8 +1194,8 @@ purge_task(void)
 			log_warn("warn: purge_task: fork");
 			break;
 		case 0:
-			if ((pw = getpwnam(SMTPD_USER)) == NULL)
-				fatalx("unknown user " SMTPD_USER);
+			if ((pw = getpwnam(SMTPD_QUEUE_USER)) == NULL)
+				fatalx("unknown user " SMTPD_QUEUE_USER);
 			if (chroot(PATH_SPOOL PATH_PURGE) == -1)
 				fatal("smtpd: chroot");
 			if (chdir("/") == -1)

Reply via email to