Fixes a bug in addvars() which was causing environment variables not to be added correctly. Thanks to Alexandre "dude" Fiori. diff -ruN qmail-1.03-7.05/qmail-smtpd.c qmail-1.03-7.06/qmail-smtpd.c --- qmail-1.03-7.05/qmail-smtpd.c 2008-05-12 16:06:46.000000000 -0400 +++ qmail-1.03-7.06/qmail-smtpd.c 2008-01-23 09:25:44.000000000 -0500 @@ -1116,6 +1116,9 @@ out("\r\n"); } +/* addvars() - find and add environment variables after encrypted password + in cdb data. if doit=0, only PASSWORD_EXPIRES is searched for. this way + expired passwords don't get their extra vars if password is expired. */ void addvars(s,doit) char *s; int doit; @@ -1123,6 +1126,7 @@ char *n; char *v; int x; + int y; n = s; @@ -1131,15 +1135,17 @@ if (','==*n) n++ ; x = str_chr(n,'='); if (!n[x]) return ; - n[x]=0; if (n[x+1]!='\"') return ; v = n+x+2 ; - x = str_chr(v,'\"'); - if (!v[x]) return ; - v[x]=0; + y = str_chr(v,'\"'); + if (!v[y]) return ; if(!str_diff(n,"PASSWORD_EXPIRES")) scan_ulong(v,&pw_expire); - if(doit) env_put2(n,v); - n = v+x+1; + if(doit) { + n[x]=0; + v[y]=0; + env_put2(n,v); + } + n = v+y+1; } }