Hi all. We had an issue where we have pop3 users across multiple realms trying 
to authenticate. All users's uids in ldap contained the realm and this caused 
us a small problem in that quite a number of users would try to authenticate 
with their pop login, just using the username and not appending the realm. We 
wrote a small patch that would allow us to add a realm into a control file. 
This allows our users to send only the user part of the login and we can 
append whatever we like to the username. In our case, we needed the 
'@ourdomain.com' because of the ldap entry.
If anyone is interested, I have attached the patch for inspection/criticism.
Cheers.
-- 
Scott Ryan
Telkom Internet
--- qmail-popup.c       2004-08-11 12:08:41.000000000 +0200
+++ qmail-popup1.c      2004-08-11 13:38:13.000000000 +0200
@@ -14,8 +14,12 @@
 #include "readwrite.h"
 #include "timeoutread.h"
 #include "timeoutwrite.h"
+#include "auto_qmail.h"
+#include "control.h"
+#include "env.h"

 void die(void) { _exit(1); }
+void die_control() { err("unable to read controls"); die(); }

 int saferead(int fd, void *buf, int len)
 {
@@ -182,8 +186,38 @@
 }
 void pop3_pass(char *arg)
 {
+/* POP Suffix Patch Ver 1.0
+   Scott Ryan / Roux Joubert
+*/
+       stralloc loginprefix = {0};
+       char user_buf[4096];
+       char hostfile[4096];
+       int  user_origlen = 0;
+
   if (!seenuser) { err_wantuser(); return; }
   if (!*arg) { err_syntax(); return; }
+
+  if (chdir(auto_qmail) == -1) die_control();
+
+  strcpy(hostfile, "control/pop3suffix");
+  strcat(hostfile, hostname);
+  if (control_rldef(&loginprefix,hostfile,0,(char *) 0) != 1)
+  control_rldef(&loginprefix,"control/pop3loginprefix",1,(char *) 0);
+
+  /*Save the original length of the username */
+  user_origlen = username.len -1;
+
+  if (loginprefix.len && loginprefix.len + username.len < sizeof(user_buf))
+  {
+       memset(user_buf, '\0', sizeof(user_buf));
+       strncpy(user_buf, username.s, username.len);
+       strncat(user_buf, loginprefix.s, loginprefix.len);
+
+       if (!stralloc_copyb(&username, user_buf, strlen(user_buf)+1 )) die_nomem();
+   }
+   stralloc_0(&loginprefix);
+   /* ---------------------------------------------------------------- */
+
   doanddie(username.s,username.len,arg);
 }
 void pop3_apop(char *arg)
 --- Makefile.telkom     2004-08-11 13:45:40.000000000 +0200
+++ Makefile    2004-08-11 13:56:33.000000000 +0200
@@ -1749,11 +1749,11 @@
        chmod 755 qmail-pop3d.run

 qmail-popup: \
-load qmail-popup.o commands.o timeoutread.o timeoutwrite.o now.o \
-case.a fd.a sig.a wait.a stralloc.a alloc.a substdio.a error.a str.a \
+load qmail-popup.o commands.o timeoutread.o timeoutwrite.o now.o control.o auto_qmail.o env.a getln.a\
+open.a case.a fd.a sig.a wait.a stralloc.a alloc.a substdio.a error.a str.a \
 fs.a socket.lib
        ./load qmail-popup commands.o timeoutread.o timeoutwrite.o \
-       now.o case.a fd.a sig.a wait.a stralloc.a alloc.a \
+       now.o control.o auto_qmail.o env.a getln.a open.a case.a fd.a sig.a wait.a stralloc.a alloc.a \
        substdio.a error.a str.a fs.a  `cat socket.lib`

 qmail-popup.0: \

Reply via email to