Hi all,

I need that qpopper (4.0.3) opens mailboxes without retrieving the UID value from /etc/passwd (while authentication information are retrieved through PAM). I've made a patch that seems to work. All you need is to chown/chgrp mailboxes with the UID/GID specified in the patch.

=== cut ===
--- popper.h    Sat Jun  2 04:24:36 2001
+++ popper.h    Tue Jun 12 21:21:07 2001
@@ -248,6 +248,15 @@
 #  define BLOCK_UID   10 /* UID's <= this value are not allowed to access email */
 #endif /* BLOCK_UID */
 
+#ifdef USE_PAM
+#  ifndef DUMMY_UID
+#    define DUMMY_UID   1000 /* UID/GID that will open every mailbox */
+#    define DUMMY_GID   500
+#    define DUMMY_DIR   "/tmp"
+#    define DUMMY_SH    "/bin/false"
+#  endif /* DUMMY_UID */
+#endif /* USE_PAM */
+
 #define DIG_SIZE    16
 
 typedef struct _pop_tls             pop_tls;            /* defined in pop_tls.h */
--- pop_user.c  Sat Jun  2 08:21:14 2001
+++ pop_user.c  Tue Jun 12 21:21:04 2001
@@ -203,6 +203,15 @@
     strlcpy ( p->authid, p->user, sizeof(p->authid) );  /* userid is also authentication id */
 #endif /* SCRAM */
 
+#ifdef DUMMY_UID
+    p->pw.pw_name = strdup(p->user);
+    p->pw.pw_passwd = "";
+    p->pw.pw_uid = DUMMY_UID;
+    p->pw.pw_gid = DUMMY_GID;
+    p->pw.pw_gecos = "";
+    p->pw.pw_dir = DUMMY_DIR;
+    p->pw.pw_shell = DUMMY_SH;
+#else
     /*
      * Cache passwd struct for use later; this memory gets freed at the end
      * of the session.
@@ -214,6 +223,7 @@
         DEBUG_LOG2 ( p, "home (%d): '%s'",
                      strlen(p->pw.pw_dir), p->pw.pw_dir );
     }
+#endif
    
 #ifdef SCRAM_ONLY
     return ( pop_auth_fail ( p, POP_FAILURE, HERE,
=== cut ===

Bye.

Nhan NGO DINH
OCIC Missionary Service
OCICNet System Administrator

e-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]
http://www.ocic.org/missions (OCIC Missionary Service Web Site)
http://www.ocicnet.net (OCICNet Web Site)

Reply via email to