On Wed, Apr 1, 2009 at 10:36 PM, Matt Brookings <m...@inter7.com> wrote:
> 5.5 is moving towards an initialization type function, but there isn't > one as of yet. It will most likely end up being a part of the config > file API. maybe something like this in all programs having main() if (vpopmailuid == -1 || vpopmailgid == -1) vpop_uid_init(&vpopmailuid, &vpopmailgid); The function vpop_uid_init() int vpop_uid_init(uid_t *uid, gid_t *gid) { struct passwd *pw; static uid_t suid = -1; static gid_t sgid = -1; if(suid != -1 && sgid != -1) { *uid = suid; *gid = sgid; return(0); } if(!(pw = getpwnam(VPOPUSER))) { printf("getpwnam failed for user %s\n", VPOPUSER); return(-1); } *uid = suid = pw->pw_uid; *gid = sgid = pw->pw_gid; return(0); } !DSPAM:49d3a27f32681273413000!