Hello, Nowadays, I am working on vpopmail+LDAP environment. As you know, --enable-valias is only works on SQL backends, So when you create an alias over qmailadmin, we can't get this information. I would like to make user lookup on LDAP on my SMTP GW server. Because of the problem described above, aliases are not stored on LDAP and the mails come to alias address are rejected on GW.
To solve the problem, I added the following patch to the vpopmail 5.4.25. This patch will call onchange script with valias_insert_first cmd. I know that there is already valias_insert. But it is triggered even if you change to content of the .qmail-xxx alias. What I wanted to do here. Only call valias_insert_first when a new/fresh alias file is created. Then,you can create a script to add/delete LDAP entries for the aliases. I was trying to do same stuff for ezmlm mailing lists + qmailadmin. But John M. Simpson already made it :) http://qmail.jms1.net/vpopmail/qmailadmin-1.2.11-onchange.patch Thanks. # diff -ruN vpalias.c.orig vpalias.c --- vpalias.c.orig 2007-05-22 06:59:01.000000000 +0300 +++ vpalias.c 2008-01-14 11:25:32.000000000 +0200 @@ -114,6 +114,7 @@ int valias_insert( char *alias, char *domain, char *alias_line) { int i; + int firstalias = 0; char *tmpstr; char Dir[156]; char *p; @@ -140,6 +141,14 @@ Dir[i++] = (*p == '.' ? ':' : *p); Dir[i] = '\0'; +#ifdef ONCHANGE_SCRIPT + if ( (fs = fopen(Dir, "r")) == NULL ) { + if (errno == ENOENT) { /* the file is not exist, so it is a new .qmail-xxx file */ + firstalias = 1; + } + } +#endif + if ( (fs = fopen(Dir, "a")) == NULL ) { return(-1); } @@ -154,6 +163,10 @@ /* tell other programs that data has changed */ snprintf ( onchange_buf, MAX_BUFF, "[EMAIL PROTECTED] - %s", alias, domain, alias_line ); call_onchange ( "valias_insert" ); + if(firstalias == 1) + snprintf ( onchange_buf, MAX_BUFF, "%s %s, alias, domain); + call_onchange ( "valias_insert_first"); + } } #endif -- Ismail YENIGUL Yönetici/Manager Servis ve Destek Bölümü/System Services and Support Division Tel: +90 216 344 07 15 Fax: +90 216 344 07 16 http://www.endersys.com.tr !DSPAM:478b2d73310541993387059!
vpopmail-5.4.25-onchange-vpalias.patch
Description: Binary data
