*** vchkpw.c.original Mon Jan 22 14:01:45 2001
 --- vchkpw.c Mon Jan 22 14:13:21 2001
 ***************
 *** 316,338 ****
        * is required to run as the pop users uid/gid
        * change to the vpasswds uid and gid
        */
 - if (setgid(pwent->pw_gid) == -1) {
 - log_exit(LOG_NOTICE, 4, "vchkpw: setgid() failed");
 - }

 ! /* captn' changing group permissions, Eye Eye! */
 ! if (setuid(pwent->pw_uid) == -1) {
 ! log_exit(LOG_NOTICE, 5, "vchkpw: setuid() failed");
 ! }

 ! /* hop into thier email directory */
 ! if (chdir(pwent->pw_dir) == -1) {

 ! /* if the dir does not exist, create it */
 ! if (vmake_maildir(pwent->pw_dir, pwent->pw_uid, pwent->pw_gid)==-1) {
 ! log_exit(LOG_NOTICE, 5, "vchkpw: make user dir failed");
   }
   }
   /* set up some environment variables */
   scopy(buf,"USER=",sizeof(buf));
   scat(buf,pwent->pw_name,sizeof(buf));
 --- 316,347 ----
        * is required to run as the pop users uid/gid
        * change to the vpasswds uid and gid
        */

 !      /* Only call setgid/setuid if being called by root
 !       * otherwise assume being called by user for auth purposes only
 !       * ie, smtp auth
 !       */

 ! if (getuid() == 0) {
 ! if (setgid(pwent->pw_gid) == -1) {
 ! log_exit(LOG_NOTICE, 4, "vchkpw: setgid() failed");
 ! }

 ! /* captn' changing group permissions, Eye Eye! */
 ! if (setuid(pwent->pw_uid) == -1) {
 ! log_exit(LOG_NOTICE, 5, "vchkpw: setuid() failed");
 ! }
 !
 ! /* hop into thier email directory */
 ! if (chdir(pwent->pw_dir) == -1) {
 !
 ! /* if the dir does not exist, create it */
 ! if (vmake_maildir(pwent->pw_dir, pwent->pw_uid, pwent->pw_gid)==-1) {
 ! log_exit(LOG_NOTICE, 5, "vchkpw: make user dir failed");
 ! }
   }
   }
 +
   /* set up some environment variables */
   scopy(buf,"USER=",sizeof(buf));
   scat(buf,pwent->pw_name,sizeof(buf));


