[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2.99.51-pre3 available



Thanks, Magnus.  Except for one problem, your patch was good.  The
problem was that, since the shadow password file is only readable by
'root' and the 'smtpserver' runs as unprivileged user 'daemon',
'smtpserver' has insufficient privilege to read '/etc/shadow'.  If
I re-write 'zpwmatch()' as below, authentication works:

int zpwmatch(uname, password)
     char *uname, *password;
{
    struct spwd *spw;
    char *cr;
    
    runasrootuser();
    if (lckpwdf() == -1)
	spw = NULL;
    else {
	spw = getspnam(uname);
	ulckpwdf(); /* Not much we can do here anyway if it fails */
    }
    runastrusteduser();

    if (spw == NULL) return 0; /* No such user */
    cr = crypt(password, spw->sp_pwdp);

    return (strcmp(cr, spw->sp_pwdp) == 0);
}

-- 
Roy Bixler
The University of Chicago Press
rcb@press-gopher.uchicago.edu