Justin Heesemann wrote:
> 
> hi..
> i was just wondering how the valias thing works when it is combined
> with mysql.
> so far as i know, it makes use of another mysql table. so far
> everything's ok with me.

Yes, one table with the following sql create line:
create table valias ( 
  alias varchar(100) not null, \
  domain varchar(100) not null, \
  valias_line varchar(255) not null, 
  index (alias, domain))

> are there .qmail files as well ?? 

The whole idea is that the .qmail files are moved into the database.
You would then only have one .qmail file named .qmail-default. This
file causes qmail-local to exec vdelivermail and connect the programs
with pipes (standard in has the email file descriptor pointing to
a file in /var/qmail/queue/mess/???/???. The nice thing with a file
descriptor is we can rewind it lseek(0,SEEK_SET,0L);

> what i mean is, how does qmail know
> of the aliases ?? 

By the use of .qmail-default to exec the vpopmail command
/home/vpopmail/bin/vdelivermail

vdelivermail has the following code segment:

        /* check for an alias for this TheUser@TheDomain */
        tmpstr = valias_select( TheUser, TheDomain );

        /* If found then tmpstr = the first alias line for
         * This user@domain account. valias_select commands
         * return NULL when no more are there.
         */
        while (tmpstr != NULL ) {
                found = 1;

                /* check if this is a command to run */
                if ( *tmpstr == '|' ) {
                        /* code not yet written */
                        printf("run command\n");
                        run_command_alias(tmpstr);

                /* otherwise it's a mail delivery for a local
                 * maildir or a email address 
                 * (either local or remote */
                } else {

                        /* alias lines for email addresses can be of
                         * two forms. The first form is just an email
                         * address. The second form is an ampersan &
                         * character followed by a email address
                         * Simplfy processing by not using the & part
                         */
                        if ( *tmpstr == '&' ) ++tmpstr;

                        /* send the email to tmpstr which contains
                         * the email address or Maildir location
                         */
                        deliver_alias(tmpstr);
                }

                /* get the next alias line for this user domain pair */
                tmpstr = valias_select_next();
        }

> it surely can't access the valias table, so the
> only way i could think of is, adding a .qmail-default which pipes all
> mails not going to any pop3 maildirs through some vpopmail program.

That's exactly how vpopmail/vchkpw has worked from the begining. It
uses Unix/Dan's idea of lots of small programs piped together.

> 
> in this case valias would just change the valias table, which allows
> to do this without valias (by inserting rows to that table by some own
> sql queries)

You got it. You can either use -
00 the valias command line program for remote admins or scripts
00 the valias api's for c programs or php
00 access the mysql valias table directly by any means you wish.

The table is pretty simple:
user, domain, alias_line

> and as the vpopmail php extension is not supporting valias yet (well
> at least i think it does not) i could write my own vpopmail_add_alias
> routine..

Write a php add_alias routine? That would be excellent. Then get it
in the next php4 release.

> regards..
> justin

Later
Ken

Reply via email to