Hello, all!
I found two problems in courier-imap-authlib:

1) it want not to be build with GCC-4.1.1 (when --with-authvchkpw):

Compiling authvchkpw.c
authvchkpw.c: In function 'auth_vchkpw':
authvchkpw.c:86: warning: implicit declaration of function 'auth_vchkpw_login'
authvchkpw.c: At top level:
authvchkpw.c:103: error: static declaration of 'auth_vchkpw_login' follows non-static declaration authvchkpw.c:86: error: previous implicit declaration of 'auth_vchkpw_login' was here
authvchkpw.c: In function 'auth_vchkpw_changepass':
authvchkpw.c:198: warning: passing argument 1 of 'parse_email' discards qualifiers from pointer target type
make[2]: *** [authvchkpw.lo] Error 1

2) it have no vpopmail roaming users support.

I created a little patch to fix this problems:

--- ./courier-authlib-0.59.3/authdaemon.c 2006-05-03 05:29:42.000000000 +0400 +++ ./courier-authlib-0.59.3/authdaemon.c 2007-06-07 17:22:06.000000000 +0400
@@ -55,6 +55,9 @@
strcat(strcat(buf, authtype), "\n");
strcat(buf, authdata);

+// by Dv ([EMAIL PROTECTED]) patch0 : for SMTP-after-IMAP with vchkpw
+ if ( getenv( "TCPREMOTEIP")) strcat( strcat( buf, getenv( "TCPREMOTEIP")), "\n");
+// by Dv ([EMAIL PROTECTED]) patch0 : for SMTP-after-IMAP with vchkpw
rc=authdaemondo(buf, callback_func, callback_arg);
free(buf);

diff -ru ./courier-authlib-0.59.3/authvchkpw.c ./courier-authlib-0.59.3/authvchkpw.c --- ./courier-authlib-0.59.3/authvchkpw.c 2007-04-22 22:53:30.000000000 +0400 +++ ./courier-authlib-0.59.3/authvchkpw.c 2007-06-07 17:43:58.000000000 +0400
@@ -78,32 +78,15 @@
}
#endif

-int auth_vchkpw(const char *service, const char *authtype, char *authdata,
- int (*callback_func)(struct authinfo *, void *),
- void *callback_arg)
-{
- if (strcmp(authtype, AUTHTYPE_LOGIN) == 0)
- return (auth_vchkpw_login(service, authdata,
- callback_func, callback_arg));
-
-#if HAVE_HMACLIB
- return (auth_vchkpw_cram(service, authtype, authdata,
- callback_func, callback_arg));
-#else
- errno=EPERM;
- return (-1);
-#endif
-
-}
-
-
-
static int auth_vchkpw_login(const char *service, char *authdata,
int (*callback_func)(struct authinfo *, void *), void *callback_arg)
{
char *user, *pass;
struct callback_info ci;
int rc;
+// by Dv ([EMAIL PROTECTED]) patch0: SMTP-after-IMAP with vchkpw
+ char *ip;
+// by Dv ([EMAIL PROTECTED]) patch0: SMTP-after-IMAP with vchkpw
/* Make sure that we have been supplied with the correct
* AUTHDATA format which is : userid<NEWLINE>password<NEWLINE>
*/
@@ -114,6 +97,9 @@
return (-1);
}

+// by Dv ([EMAIL PROTECTED]) patch0: SMTP-after-IMAP with vchkpw
+ ip = strtok( 0, "\n");
+// by Dv ([EMAIL PROTECTED]) patch0: SMTP-after-IMAP with vchkpw
ci.pass=pass;
ci.callback_func=callback_func;
ci.callback_arg=callback_arg;
@@ -135,7 +121,13 @@

/* user has been successfully auth'ed at this point */

-#if 0
+// by Dv ([EMAIL PROTECTED]) patch0: SMTP-after-IMAP with vchkpw
+//#if 0
+ if ( ip) {
+ DPRINTF( "courier-imap client IP:%s", ip);
+ setenv( "TCPREMOTEIP", ip, 1);
+ }
+// by Dv ([EMAIL PROTECTED]) patch0: SMTP-after-IMAP with vchkpw
/*
** sam - new courier-authlib never receives TCPREMOTEIP, at this
** time.
@@ -158,11 +150,32 @@
open_smtp_relay();
}
#endif
-#endif
+// by Dv ([EMAIL PROTECTED]) patch0: SMTP-after-IMAP with vchkpw
+//#endif
+// by Dv ([EMAIL PROTECTED]) patch0: SMTP-after-IMAP with vchkpw

return 0;
}

+int auth_vchkpw(const char *service, const char *authtype, char *authdata,
+ int (*callback_func)(struct authinfo *, void *),
+ void *callback_arg)
+{
+ if (strcmp(authtype, AUTHTYPE_LOGIN) == 0)
+ return (auth_vchkpw_login(service, authdata,
+ callback_func, callback_arg));
+
+#if HAVE_HMACLIB
+ return (auth_vchkpw_cram(service, authtype, authdata,
+ callback_func, callback_arg));
+#else
+ errno=EPERM;
+ return (-1);
+#endif
+
+}
+
+
static void authvchkpwclose()
{
}

--
Дворкин Дмитрий
E-mail: [EMAIL PROTECTED]

Reply via email to