82 const char *myname =
"deliver_include";
111 msg_warn(
":include:%s uses a relative path", path);
113 "mail system configuration error");
118 msg_warn(
"unable to lookup :include: file %s: %m", path);
120 "mail system configuration error");
124 if (S_ISREG(st.st_mode) == 0) {
125 msg_warn(
":include: file %s is not a regular file", path);
127 "mail system configuration error");
131 if (st.st_mode & S_IWOTH) {
132 msg_warn(
":include: file %s is world writable", path);
134 "mail system configuration error");
159 if (usr_attr.
uid == 0) {
160 if ((errno =
mypwuid_err(st.st_uid, &file_pwd)) != 0 || file_pwd == 0) {
161 msg_warn(errno ?
"cannot find username for uid %ld: %m" :
162 "cannot find username for uid %ld", (
long) st.st_uid);
163 msg_warn(
"%s: cannot find :include: file owner username", path);
165 "mail system configuration error");
169 if (file_pwd->
pw_uid != 0)
198 #define FOPEN_AS(p,u,g) ((fd = open_as(p,O_RDONLY,0,u,g)) >= 0 ? \
199 vstream_fdopen(fd,O_RDONLY) : 0)
202 msg_warn(
"cannot open include file %s: %m", path);
204 "mail system configuration error");
#define BOUNCE_ATTR(attr)
int mypwuid_err(uid_t uid, struct mypasswd **result)
int deliver_include(LOCAL_STATE state, USER_ATTR usr_attr, char *path)
DELIVER_REQUEST * request
#define BOUNCE_FLAGS(request)
int bounce_append(int flags, const char *id, MSG_STATS *stats, RECIPIENT *rcpt, const char *relay, DSN *dsn)
int stat_as(const char *path, struct stat *st, uid_t euid, gid_t egid)
int been_here(BH_TABLE *dup_filter, const char *fmt,...)
int vstream_fclose(VSTREAM *stream)
void msg_warn(const char *fmt,...)
DSN_BUF * dsb_simple(DSN_BUF *dsb, const char *status, const char *format,...)
void mypwfree(struct mypasswd *mypwd)
#define SET_USER_ATTR(usr_attr, pwd, level)
#define FOPEN_AS(p, u, g)
#define vstream_fileno(vp)
int defer_append(int flags, const char *id, MSG_STATS *stats, RECIPIENT *rcpt, const char *relay, DSN *dsn)
#define MSG_LOG_STATE(m, p)
int close_on_exec(int fd, int on)
int deliver_token_stream(LOCAL_STATE, USER_ATTR, VSTREAM *, int *)