97 const char *myname =
"deliver_dotforward";
104 int forward_found =
NO;
107 char *saved_forward_path;
131 msg_warn(
"error looking up passwd info for %s: %m",
194 next = saved_forward_path;
198 expand_status =
local_expand(path, lhs, &state, &usr_attr,
204 msg_info(
"%s: path %s expand_status %d look_status %d", myname,
205 STR(path), expand_status, lookup_status);
206 if (lookup_status >= 0) {
228 if (lookup_status >= 0) {
235 "forward via file: %s",
STR(path));
241 if (S_ISREG(st.st_mode) == 0) {
242 msg_warn(
"file %s is not a regular file",
STR(path));
243 }
else if (st.st_uid != 0 && st.st_uid != usr_attr.
uid) {
244 msg_warn(
"file %s has bad owner uid %ld",
245 STR(path), (
long) st.st_uid);
246 }
else if (st.st_mode & 002) {
248 }
else if ((fd =
open_as(
STR(path), O_RDONLY, 0, usr_attr.
uid, usr_attr.
gid)) < 0) {
270 if (addr_count > 0) {
299 myfree(saved_forward_path);
303 return (forward_found);
int mypwnam_err(const char *name, struct mypasswd **result)
#define BOUNCE_ATTR(attr)
char * mystrdup(const char *str)
DSN_BUF * dsb_update(DSN_BUF *dsb, const char *status, const char *action, const char *mtype, const char *mname, const char *dtype, const char *dtext, const char *format,...)
int trace_append(int flags, const char *id, MSG_STATS *stats, RECIPIENT *rcpt, const char *relay, DSN *dsn)
int open_as(const char *path, int flags, int mode, uid_t euid, gid_t egid)
char * mystrtok(char **src, const char *sep)
DELIVER_REQUEST * request
#define BOUNCE_FLAGS(request)
int been_here(BH_TABLE *dup_filter, const char *fmt,...)
int deliver_dotforward(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp)
int vstream_fclose(VSTREAM *stream)
void msg_warn(const char *fmt,...)
VSTRING * vstring_alloc(ssize_t len)
#define LOCAL_EXP_EXTENSION_MATCHED
bool var_frozen_delivered
DSN_BUF * dsb_simple(DSN_BUF *dsb, const char *status, const char *format,...)
int been_here_check(BH_TABLE *dup_filter, const char *fmt,...)
void mypwfree(struct mypasswd *mypwd)
int lstat_as(const char *path, struct stat *st, uid_t euid, gid_t egid)
#define SET_USER_ATTR(usr_attr, pwd, level)
#define DSN_NOTIFY_SUCCESS
int local_expand(VSTRING *, const char *, LOCAL_STATE *, USER_ATTR *, const char *)
VSTRING * vstring_free(VSTRING *vp)
int defer_append(int flags, const char *id, MSG_STATS *stats, RECIPIENT *rcpt, const char *relay, DSN *dsn)
char * var_fwd_exp_filter
int sent(int flags, const char *id, MSG_STATS *stats, RECIPIENT *recipient, const char *relay, DSN *dsn)
#define MSG_LOG_STATE(m, p)
int close_on_exec(int fd, int on)
#define DEL_REQ_FLAG_MTA_VRFY
VSTREAM * vstream_fdopen(int fd, int flags)
int deliver_token_stream(LOCAL_STATE, USER_ATTR, VSTREAM *, int *)
void msg_info(const char *fmt,...)