Re: Help - custom vpopmail
Rick Romero <[email protected]>
| Newsgroups | gmane.mail.vpopmail |
|---|---|
| Message-ID | <[email protected]> |
Quoting Rick Romero <[email protected]>: >> Quoting Timo Sirainen <[email protected]>: > >>> On Tue, 2010-11-16 at 10:30 -0600, Rick Romero wrote: > >> > > >> >>  So I modified my vpopmail install to write an additional field > >> into the > >> >> lastauth table. My custom vpopmail writes the remote IP into > >> remote_ip, > >> >> and the auth type into a 'type' field. I tested with qmail's > >> POP3 daemon to > >> >> verify vchkpw would fill the table correcly. > >> >> > >> >>  But I'm not sure how to get dovecot to do it: > >> >> > >> >>  I know this is close, but there is something not right in > >> >> src/auth/userdb-vpopmail.c line 99. > >> >>  vset_lastauth(vpop_user, vpop_domain, &auth_request->remote_ip, > >> >> t_strdup_noconst(auth_request->service)); > >> > > >> > 1) You need to modify vpopmail's vset_lastauth() function to actually > >> > support this. > >> > > >> > 2) Once you do have the extra field (const char *ip) added, > you can use: > >> > > >> > vset_lastauth(vpop_user, vpop_domain, > >> >     net_ip2addr(&auth_request->remote_ip), > >> >     t_strdup_noconst(auth_request->service)); > >> > >  I can't get dovecot to write to lastauth at all (vpopmail-5.4.32 & dovecot-2.0.7) I can't even restore old functionality. lastauth IS populating for other users on these versions- right? I changed my vmysql.c in vpopmail-5.4.32 to the following and re-compiled a stock dovecot (I even removed the lib/dovecot/* and libexec/dovecot/* directories before reinstall). This SHOULD allow both 3 parameter and 4 parameter calls. I know it works for 4 args, because my vchkpw works as stated above using qmail-pop3d (on alt port) and vchkpw. int vset_lastauth(char *user, char *domain, char *remoteip , ...) {  int err;  char *authtype;    if ( (err=vauth_open_update()) != 0 ) return(err);    va_list ap;    va_start(ap,remoteip);    authtype = va_arg(ap, char *);    if (authtype == NULL){authtype="unknown";}    qnprintf( SqlBufUpdate, SQL_BUF_SIZE, "replace into lastauth set user='%s', domain='%s', \ remote_ip='%s', timestamp=%lu, type='%s'", user, domain, remoteip, time(NULL), authtype);    if (mysql_query(&mysql_update,SqlBufUpdate)) {        vcreate_lastauth_table();        if (mysql_query(&mysql_update,SqlBufUpdate)) {            fprintf(stderr, "vmysql: sql error[f]: %s\n", mysql_error(&mysql_update));        }    }    return(0); } How should I change this to log all attempts. Rick !DSPAM:4ce49acb32712121752182!