7 /* mark queue file as corrupt
9 /* #include <mark_corrupt.h>
11 /* char *mark_corrupt(src)
14 /* The \fBmark_corrupt\fR() routine marks the specified open
15 /* queue file as corrupt, and returns a suitable delivery status
16 /* so that the queue manager will do the right thing.
20 /* The Secure Mailer license must be distributed with this software.
23 /* IBM T.J. Watson Research
25 /* Yorktown Heights, NY 10598, USA
34 /* Utility library. */
38 #include <set_eugid.h>
42 #include <mail_queue.h>
43 #include <mail_params.h>
44 #include <deliver_request.h>
45 #include <mark_corrupt.h>
47 /* mark_corrupt - mark queue file as corrupt */
49 int mark_corrupt(VSTREAM
*src
)
51 const char *myname
= "mark_corrupt";
56 * If not running as the mail system, change privileges first.
58 if ((saved_uid
= geteuid()) != var_owner_uid
) {
59 saved_gid
= getegid();
60 set_eugid(var_owner_uid
, var_owner_gid
);
64 * For now, the result value is -1; this may become a bit mask, or
65 * something even more advanced than that, when the delivery status
66 * becomes more than just done/deferred.
68 msg_warn("corrupted queue file: %s", VSTREAM_PATH(src
));
69 if (fchmod(vstream_fileno(src
), MAIL_QUEUE_STAT_CORRUPT
))
70 msg_fatal("%s: fchmod %s: %m", myname
, VSTREAM_PATH(src
));
75 if (saved_uid
!= var_owner_uid
)
76 set_eugid(saved_uid
, saved_gid
);
78 return (DEL_STAT_DEFER
);