static int pipe_transport_setup(transport_instance *tblock, address_item *addrlist, transport_feedback *dummy, uid_t uid, gid_t gid, uschar **errmsg) { pipe_transport_options_block *ob = (pipe_transport_options_block *)(tblock->options_block); addrlist = addrlist; /* Keep compiler happy */ dummy = dummy; uid = uid; gid = gid; errmsg = errmsg; ob = ob; #ifdef HAVE_SETCLASSRESOURCES if (ob->use_classresources) { struct passwd *pw = getpwuid(uid); if (pw != NULL) { login_cap_t *lc = login_getpwclass(pw); if (lc != NULL) { setclassresources(lc); login_close(lc); } } } #endif #ifdef RLIMIT_CORE if (ob->permit_coredump) { struct rlimit rl; rl.rlim_cur = RLIM_INFINITY; rl.rlim_max = RLIM_INFINITY; if (setrlimit(RLIMIT_CORE, &rl) < 0) { #ifdef SETRLIMIT_NOT_SUPPORTED if (errno != ENOSYS && errno != ENOTSUP) #endif log_write(0, LOG_MAIN, "delivery setrlimit(RLIMIT_CORE, RLIM_INFINITY) failed: %s", strerror(errno)); } } #endif return OK; }
static mode_t setlogincontext(login_cap_t *lc, const struct passwd *pwd, mode_t mymask, unsigned long flags) { if (lc) { /* Set resources */ if (flags & LOGIN_SETRESOURCES) setclassresources(lc); /* See if there's a umask override */ if (flags & LOGIN_SETUMASK) mymask = (mode_t)login_getcapnum(lc, "umask", mymask, mymask); /* Set paths */ if (flags & LOGIN_SETPATH) setclassenvironment(lc, pwd, 1); /* Set environment */ if (flags & LOGIN_SETENV) setclassenvironment(lc, pwd, 0); } return (mymask); }