[Mimedefang] Patch: set rw-rw---- (0660) on mimedefang.sock

Philip Prindeville philipp_subx at redfish-solutions.com
Sat Dec 3 17:18:48 EST 2011


On Fedora and Centos, I'm seeing the socket being created as rwxr-x--- (0750).

To use it with postfix as a member in the defang group, it should be created as 0660 instead.

I wasn't sure about all the places that make_listening_socket()... it might be called in a couple of places where changing the modes isn't appropriate.

-------------- next part --------------
--- mimedefang-2.72/utils.c.sock-chmod	2011-06-20 08:58:23.000000000 -0600
+++ mimedefang-2.72/utils.c	2011-12-03 15:02:43.133799805 -0700
@@ -1155,6 +1155,9 @@ make_listening_socket(char const *str, i
 	    close(sock);
 	    return -1;
 	}
+
+	/* don't forget to make the socket writable by our group */
+	(void)fchmod(sock, 0660);
     }
 
     if (listen(sock, backlog) < 0) {
--- mimedefang-2.72/mimedefang.c.sock-chmod	2011-06-20 08:56:38.000000000 -0600
+++ mimedefang-2.72/mimedefang.c	2011-12-03 15:02:05.969940579 -0700
@@ -2614,7 +2614,11 @@ main(int argc, char **argv)
 
     /* Open the milter socket if library has smfi_opensocket */
 #ifdef MILTER_BUILDLIB_HAS_OPENSOCKET
-    (void) smfi_opensocket(1);
+    {
+	mode_t oldmask = umask(0117);
+	(void) smfi_opensocket(1);
+	(void) umask(oldmask);
+    }
 #endif
 
     if (ValidateHeader[0]) {


More information about the MIMEDefang mailing list