OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Proposed patch 20031231: pickup: log original queue id for mail owned by postfix.

Victor.Duchovnimorganstanley.com
Date: Fri Jan 02 2004 - 13:14:25 CST


As discussed before it is potentially useful to log the original queue id
(instead of the submitor's uid) when pickup processes messages in the
maildrop queue that belong the the "postfix" ($mail_owner) user.

The messages in question were presumably requeued via "postsuper -r", and
logging the old queue id assists in message tracking. Even if the
assumption is false the slightly different log format discloses the
submitting uid, so no information is lost.

An open question is whether in this case the additional "Received: " line
should also be suppressed (not implemented by this patch).

Index: src/pickup/pickup.c
--- src/pickup/pickup.c 30 Jul 2003 04:37:07 -0000 1.1.1.8
+++ src/pickup/pickup.c 2 Jan 2004 19:13:56 -0000
-234,6 +234,7
 {
     time_t now = time((time_t *) 0);
     int status;
+ char *name;

     /*
      * Protect against time-warped time stamps. Warn about mail that has been
-282,8 +283,19
                  info->id, (long) info->st.st_uid);
         return (REMOVE_MESSAGE_FILE);
     }
- msg_info("%s: uid=%d from=<%s>", info->id,
- (int) info->st.st_uid, info->sender);
+
+ /*
+ * For messages belonging to $mail_owner log the old queue id instead of
+ * the submitting uid. This supports message tracking for mail requeued
+ * via "postsuper -r".
+ */
+ if (info->st.st_uid == var_owner_uid) {
+ name = (name = strrchr(info->path, '/')) ? name + 1 : info->path;
+ msg_info("%s: orig_id=%s from=<%s>", info->id, name, info->sender);
+ } else {
+ msg_info("%s: uid=%d from=<%s>", info->id,
+ (int) info->st.st_uid, info->sender);
+ }

     /*
      * Message content segment. Send a dummy message length. Prepend a

--
        Viktor.