コード例 #1
0
ファイル: bounce.c プロジェクト: j-weiss-consulting/postfix
int     bounce_one(int flags, const char *queue, const char *id,
		           const char *encoding, const char *sender,
		           const char *dsn_envid, int dsn_ret,
		           MSG_STATS *stats, RECIPIENT *rcpt,
		           const char *relay, DSN *dsn)
{
    DSN     my_dsn = *dsn;
    DSN    *dsn_res;

    /*
     * Sanity check.
     */
    if (my_dsn.status[0] != '5' || !dsn_valid(my_dsn.status)) {
	msg_warn("bounce_one: ignoring dsn code \"%s\"", my_dsn.status);
	my_dsn.status = "5.0.0";
    }

    /*
     * DSN filter (Postfix 2.12).
     */
    if (delivery_status_filter != 0
      && (dsn_res = dsn_filter_lookup(delivery_status_filter, &my_dsn)) != 0) {
	if (dsn_res->status[0] == '4')
	    return (defer_append_intern(flags, id, stats, rcpt, relay, dsn_res));
	my_dsn = *dsn_res;
    }
    return (bounce_one_intern(flags, queue, id, encoding, sender, dsn_envid,
			      dsn_ret, stats, rcpt, relay, &my_dsn));
}
コード例 #2
0
ファイル: bounce.c プロジェクト: j-weiss-consulting/postfix
int     bounce_append(int flags, const char *id, MSG_STATS *stats,
		              RECIPIENT *rcpt, const char *relay,
		              DSN *dsn)
{
    DSN     my_dsn = *dsn;
    DSN    *dsn_res;

    /*
     * Sanity check. If we're really confident, change this into msg_panic
     * (remember, this information may be under control by a hostile server).
     */
    if (my_dsn.status[0] != '5' || !dsn_valid(my_dsn.status)) {
	msg_warn("bounce_append: ignoring dsn code \"%s\"", my_dsn.status);
	my_dsn.status = "5.0.0";
    }

    /*
     * DSN filter (Postfix 2.12).
     */
    if (delivery_status_filter != 0
      && (dsn_res = dsn_filter_lookup(delivery_status_filter, &my_dsn)) != 0) {
	if (dsn_res->status[0] == '4')
	    return (defer_append_intern(flags, id, stats, rcpt, relay, dsn_res));
	my_dsn = *dsn_res;
    }
    return (bounce_append_intern(flags, id, stats, rcpt, relay, &my_dsn));
}
コード例 #3
0
ファイル: sent.c プロジェクト: ureyni/postfix.3.1
int     sent(int flags, const char *id, MSG_STATS *stats,
	             RECIPIENT *recipient, const char *relay,
	             DSN *dsn)
{
    const char *myname="sent.c Sent";
    if (msg_verbose)
 	msg_info("HU--%s Starting",myname);
    
    DSN     my_dsn = *dsn;
    DSN    *dsn_res;
    int     status;

    /*
     * Sanity check.
     */
    if (my_dsn.status[0] != '2' || !dsn_valid(my_dsn.status)) {
	msg_warn("sent: ignoring dsn code \"%s\"", my_dsn.status);
	my_dsn.status = "2.0.0";
    }

    /*
     * DSN filter (Postfix 3.0).
     */
    if (delivery_status_filter != 0
     && (dsn_res = dsn_filter_lookup(delivery_status_filter, &my_dsn)) != 0)
	my_dsn = *dsn_res;

    /*
     * MTA-requested address verification information is stored in the verify
     * service database.
     */
    if (flags & DEL_REQ_FLAG_MTA_VRFY) {
	my_dsn.action = "deliverable";
	status = verify_append(id, stats, recipient, relay, &my_dsn,
			       DEL_RCPT_STAT_OK);
	return (status);
    }

    /*
     * User-requested address verification information is logged and mailed
     * to the requesting user.
     */
    if (flags & DEL_REQ_FLAG_USR_VRFY) {
	my_dsn.action = "deliverable";
	status = trace_append(flags, id, stats, recipient, relay, &my_dsn);
	return (status);
    }

    /*
     * Normal mail delivery. May also send a delivery record to the user.
     */
    else {

	/* Readability macros: record all deliveries, or the delayed ones. */
#define REC_ALL_SENT(flags) (flags & DEL_REQ_FLAG_RECORD)
#define REC_DLY_SENT(flags, rcpt) \
	((flags & DEL_REQ_FLAG_REC_DLY_SENT) \
	&& (rcpt->dsn_notify == 0 || (rcpt->dsn_notify & DSN_NOTIFY_DELAY)))

	if (my_dsn.action == 0 || my_dsn.action[0] == 0)
	    my_dsn.action = "delivered";

	if (((REC_ALL_SENT(flags) == 0 && REC_DLY_SENT(flags, recipient) == 0)
	  || trace_append(flags, id, stats, recipient, relay, &my_dsn) == 0)
	    && ((recipient->dsn_notify & DSN_NOTIFY_SUCCESS) == 0
	|| trace_append(flags, id, stats, recipient, relay, &my_dsn) == 0)) {
	    log_adhoc(id, stats, recipient, relay, &my_dsn, "sent");
	    status = 0;
	} else {
	    VSTRING *junk = vstring_alloc(100);

	    vstring_sprintf(junk, "%s: %s service failed",
			    id, var_trace_service);
	    my_dsn.reason = vstring_str(junk);
	    my_dsn.status = "4.3.0";
	    status = defer_append(flags, id, stats, recipient, relay, &my_dsn);
	    vstring_free(junk);
	}
	return (status);
    }
}