This is very good, however you may want to move this out of vmysql.c and put it directly in vpopmail.c for the add_user routine.
vlimits isn't only for mysql. It also uses the .qmailadmin-limits file for non-mysql implementations. So the structure & function vget_limits() is valid with or without mysql. Thanks, Brian > this enforces the disable_* vlimits: > e.g: if vlimits.disable_imap=1 it is the same as if every user has the NO_IMAP > gid flag set. > i'm going to post (a very similar one) tomorrow for .qmail-limits files. > is there vlimit support being added for postgres/sybase/oracle ? > > > --- vpopmail-orig-5.3.19/vmysql.c 2003-03-05 18:09:47.000000000 +0100 > +++ vpopmail-new-5.3.19/vmysql.c 2003-03-25 16:22:13.000000000 +0100 > @@ -327,6 +327,10 @@ > uid_t myuid; > uid_t uid; > gid_t gid; > +#ifdef ENABLE_MYSQL_LIMITS > + struct vlimits limits; > +#endif > + > > vget_assign(domain,NULL,156,&uid,&gid); > myuid = geteuid(); > @@ -406,6 +410,35 @@ > return(NULL); > } > mysql_free_result(res_read); > +#ifdef ENABLE_MYSQL_LIMITS > + if (vget_limits (in_domain,&limits) == 0) { > + int mask = 0; > + if (limits.disable_pop) { > + mask += NO_POP; > + } > + if (limits.disable_smtp) { > + mask += NO_SMTP; > + } > + if (limits.disable_imap) { > + mask += NO_IMAP; > + } > + if (limits.disable_passwordchanging) { > + mask += NO_PASSWD_CHNG; > + } > + if (limits.disable_relay) { > + mask += NO_RELAY; > + } > + if (limits.disable_webmail) { > + mask += NO_WEBMAIL; > + } > + if (limits.disable_dialup) { > + mask += NO_DIALUP; > + } > + > + vpw.pw_gid = vpw.pw_gid | mask; > + } > +#endif > + > return(&vpw); > } > >