/* Since the vpopmail system runs under a uid/gid * file system security, and since qmail-pop3d * is required to run as the pop users uid/gid * change to the vpasswds uid and gid */
/* 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(envbuf1, VCHKPW_USER, MAX_ENV_BUF); scat(envbuf1, pwent->pw_name, MAX_ENV_BUF); if (putenv(envbuf1) == -1) log_exit(LOG_NOTICE,7,"vchkpw: putenv(USER) failed");
/* now HOME */ scopy(envbuf2, VCHKPW_HOME, MAX_ENV_BUF); scat(envbuf2, pwent->pw_dir, MAX_ENV_BUF); if (putenv(envbuf2) == -1) log_exit(LOG_NOTICE, 8, "vchkpw: putenv(HOME) failed");
/* Now shell */ scopy(envbuf3, VCHKPW_SHELL, MAX_ENV_BUF); if (putenv(envbuf3) == -1) log_exit(LOG_NOTICE, 9, "vchkpw: putenv(SHELL) failed");
/* and a vpopuser */ scopy(envbuf4, VCHKPW_VPOPUSER, MAX_ENV_BUF); scat(envbuf4, name, MAX_ENV_BUF); if (putenv(envbuf4) == -1) log_exit(LOG_NOTICE, 9, "vchkpw: putenv(VPOPUSER) failed");
/* close the auth module connection */
/* kick off the next program and exit */ execvp(argv[1],argv+1);