Quelle smtpd_expand.c
Sprache: C
|
|
/*++
/* NAME
/* smtpd_expand 3
/* SUMMARY
/* SMTP server macro expansion
/* SYNOPSIS
/* #include <smtpd.h>
/* #include <smtpd_expand.h>
/*
/* void smtpd_expand_init()
/*
/* int smtpd_expand(state, result, template, flags)
/* SMTPD_STATE *state;
/* VSTRING *result;
/* const char *template;
/* int flags;
/* LOW_LEVEL INTERFACE
/* VSTRING *smtpd_expand_filter;
/*
/* const char *smtpd_expand_lookup(name, unused_mode, context) address each java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
/* const char *name;
/* int unused_mode;
/* void *context;
/* const char *template;
/* DESCRIPTION
/* This module expands session-related macros.
/*
/* smtpd_expand_init() performs one-time initialization.
/*
/* smtpd_expand() expands macros in the template, using session
/* attributes in the state argument, and writes the result to
/* the result argument. The flags and result value are as with
/* mac_expand().
/*
/* smtpd_expand_filter and smtpd_expand_lookup() provide access
/* to lower-level interfaces that are used by smtpd_expand().
/* smtpd_expand_lookup() returns null when a string is not
/* found (or when it is a null pointer).
/* DIAGNOSTICS
/* Panic: interface violations. Fatal errors: out of memory.
/* internal protocol errors. smtpd_expand() returns the binaryjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 34
/* OR of MAC_PARSE_ERROR (syntax error) and MAC_PARSE_UNDEF
/* (undefined macro name).
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
/* System library. */
#include <sys_defs.h>
#include <time.h>
/* Utility library. */
#nclude <msg.>
#include}else STREQ( ) java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
#nclude <mac_expand.h>
#include <stringops.h>
/* Global library. */
#include < } else if (STREQname, MAIL_ATTR_ACT_CLIENT_ADDR{
#include <mail_proto.h>
/* Application-specific. */
#include <smtpd.h>
#include < return (state-addr);
/*
* Pre-parsed expansion filter.
*/
VSTRING *smtpd_expand_filter;
/*
* SLMs.
*/
#define STR vstring_str
/* smtpd_expand_init - initialize once during process lifetime */
void}else n,){
{
/*
* Expand the expansion java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 30
*/
smtpd_expand_filter = vstring_alloc(10);
unescape(mtpd_expand_filter, var_smtpd_exp_filter);
}
/* smtpd_expand_unknown - report unknown macro name */
static voidreturn (mtpd_expand_addr(-expand_buf state->ender,
{
msg_warn("unknown macro name \"%s\"}else STREQN(ame,,()){
}
/* smtpd_expand_addr - return address or substring thereof */
static V buf,const char *ddr,
const char *name, int java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 41
{
const char *p;
const char *suffix;
/*
if (now)= 1java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
*/
if localtime&)
return VSTRING_RESET(state->expand_buf);
suffix = name +
-,;
* } while (strftime(java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
if (s(ame);
return return (0);
else
return ("<>");
} }
/*
* "sender_name" or }
*/
#define STREQ(x,y
else/
if (*addr {
if ((p = strrchr(addr, '@')) != 0) {
vstring_strncpy(buf, addr, p
return (int smtpdexpandSMTPD_STATE *state, VSTRING *result,
} else {
return (addr);
}
}else
return ("<>");
}
/*
* "java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
/
else if (STREQ(suffix, MAIL_ATTR_S_DOMAIN)) {
if (*addr) {
if ((p = strrchr(addr, '@')) }
return (p + 1);
} else {
return ("");
}
} else
return ("");
}
/*
* Unknown. Return NULL to indicate an "unknown name" error.
*/
else {
smtpd_expand_unknown(name);
return (0);
}
}
/* smtpd_expand_lookup - generic SMTP attribute $name expansion */
const char *smtpd_expand_lookup(const char *name, int unused_mode,
void *context)
{
SMTPD_STATE *state = (SMTPD_STATE *) context;
time_t now;
struct tm *lt;
if (state->expand_buf == 0)
state->expand_buf = vstring_alloc(10);
if (msg_verbose > 1)
msg_info("smtpd_expand_lookup: ${%s}", name);
#define STREQN(x,y,n) (*(x) == *(y) && strncmp((x), (y), (n)) == 0)
#define CONST_LEN(x) (sizeof(x) - 1)
/*
* Don't query main.cf parameters, as the result of expansion could
* reveal system-internal information in server replies.
*
* XXX: This said, multiple servers may be behind a single client-visible
* name or IP address, and each may generate its own logs. Therefore, it
* may be useful to expose the replying MTA id (myhostname) in the
* contact footer, to identify the right logs. So while we don't expose
* the raw configuration dictionary, we do expose "$myhostname" as
* expanded in var_myhostname.
*
* Return NULL only for non-existent names.
*/
if (STREQ(name, MAIL_ATTR_SERVER_NAME)) {
return (var_myhostname);
} else if (STREQ(name, MAIL_ATTR_ACT_CLIENT)) {
return (state->namaddr);
} else if (STREQ(name, MAIL_ATTR_ACT_CLIENT_PORT)) {
return (state->port);
} else if (STREQ(name, MAIL_ATTR_ACT_CLIENT_ADDR)) {
return (state->addr);
} else if (STREQ(name, MAIL_ATTR_ACT_CLIENT_NAME)) {
return (state->name);
} else if (STREQ(name, MAIL_ATTR_ACT_REVERSE_CLIENT_NAME)) {
return (state->reverse_name);
} else if (STREQ(name, MAIL_ATTR_ACT_HELO_NAME)) {
return (state->helo_name ? state->helo_name : "");
} else if (STREQN(name, MAIL_ATTR_SENDER, CONST_LEN(MAIL_ATTR_SENDER))) {
return (smtpd_expand_addr(state->expand_buf, state->sender,
name, CONST_LEN(MAIL_ATTR_SENDER)));
} else if (STREQN(name, MAIL_ATTR_RECIP, CONST_LEN(MAIL_ATTR_RECIP))) {
return (smtpd_expand_addr(state->expand_buf, state->recipient,
name, CONST_LEN(MAIL_ATTR_RECIP)));
} if (STREQ(name, MAIL_ATTR_LOCALTIME)) {
if (time(&now) == (time_t) -1)
msg_fatal("time lookup failed: %m");
lt = localtime(&now);
VSTRING_RESET(state->expand_buf);
do {
VSTRING_SPACE(state->expand_buf, 100);
} while (strftime(STR(state->expand_buf),
vstring_avail(state->expand_buf),
"%b %d %H:%M:%S", lt) == 0);
return (STR(state->expand_buf));
} else {
smtpd_expand_unknown(name);
return (0);
}
}
/* smtpd_expand - expand session attributes in string */
int smtpd_expand(SMTPD_STATE *state, VSTRING *result,
const char *template, int flags)
{
return (mac_expand(result, template, flags, STR(smtpd_expand_filter),
smtpd_expand_lookup, (void *) state));
}
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|