int recipients_list_max = 0;
BOOL running_in_test_harness=FALSE;
-uschar *sender_address = NULL;
+const uschar *sender_address = NULL;
uschar *sender_fullhost = NULL;
uschar *sender_helo_name = NULL;
uschar *sender_host_address = NULL;
extern void create_dialog(uschar *, uschar *);
extern void create_stripchart(Widget, uschar *);
extern void debug(char *, ...);
-extern dest_item *find_dest(queue_item *, uschar *, int, BOOL);
+extern dest_item *find_dest(queue_item *, const uschar *, int, BOOL);
extern queue_item *find_queue(uschar *, int, int);
extern void init(int, uschar **);
extern void menu_create(Widget, XEvent *, String *, Cardinal *);
"*", which it does for error messages. */
dest_item *
-find_dest(queue_item *q, uschar *name, int action, BOOL caseless)
+find_dest(queue_item * q, const uschar * name, int action, BOOL caseless)
{
-dest_item *dd;
-dest_item **d = &(q->destinations);
+dest_item * dd;
+dest_item ** d = &q->destinations;
-while (*d != NULL)
+while (*d)
{
if ((caseless? strcmpic(name,(*d)->address) : Ustrcmp(name,(*d)->address))
== 0)
{
- dest_item *ddd;
-
if (action != dest_remove) return *d;
dd = *d;
*d = dd->next;
/* Unset any parent pointers that were to this address */
- for (ddd = q->destinations; ddd != NULL; ddd = ddd->next)
- {
+ for (dest_item * ddd = q->destinations; ddd; ddd = ddd->next)
if (ddd->parent == dd) ddd->parent = NULL;
- }
return NULL;
}
- d = &((*d)->next);
+ d = &(*d)->next;
}
if (action != dest_add) return NULL;
else
{
q->update_time = q->input_time = received_time.tv_sec;
- if ((p = strstric(sender_address+1, qualify_domain, FALSE)) != NULL &&
- *(--p) == '@') *p = 0;
+ /* deconst ok; strstric is actually safe */
+ if ((p = strstric(US sender_address+1, qualify_domain, FALSE)) != NULL &&
+ *--p == '@') *p = 0;
}
/* If we didn't read the whole header successfully, generate an error
if (recipients_list)
for (i = 0; i < recipients_count; i++)
{
- uschar * r = recipients_list[i].address;
+ const uschar * r = recipients_list[i].address;
if (tree_search(tree_nonrecipients, r) == NULL)
{
- if ((p = strstric(r+1, qualify_domain, FALSE)) != NULL &&
+ /* deconst ok; strstric is actually safe */
+ if ((p = strstric(US r+1, qualify_domain, FALSE)) != NULL &&
*(--p) == '@') *p = 0;
(void)find_dest(q, r, dest_add, FALSE);
}
for (i = 0; i < recipients_count; i++)
{
uschar * pp;
- uschar * r = recipients_list[i].address;
+ const uschar * r = recipients_list[i].address;
tree_node * node;
if (!(node = tree_search(tree_nonrecipients, r)))
node = tree_search(tree_nonrecipients, string_copylc(r));
- if ((pp = strstric(r+1, qualify_domain, FALSE)) && *(--pp) == '@')
+ /* deconst ok; strstric is actually safe */
+ if ((pp = strstric(US r+1, qualify_domain, FALSE)) && *(--pp) == '@')
*pp = 0;
if (!node)
(void)find_dest(p, r, dest_add, FALSE);
BOOL success_on_redirect = FALSE;
BOOL quota = FALSE;
int quota_pos_cache = QUOTA_POS_DEFAULT, quota_neg_cache = QUOTA_NEG_DEFAULT;
-address_item *sender_vaddr = NULL;
-uschar *verify_sender_address = NULL;
-uschar *pm_mailfrom = NULL;
-uschar *se_mailfrom = NULL;
+address_item * sender_vaddr = NULL;
+const uschar * verify_sender_address = NULL;
+uschar * pm_mailfrom = NULL;
+uschar * se_mailfrom = NULL;
/* Some of the verify items have slash-separated options; some do not. Diagnose
an error if options are given for items that don't expect them.
int acl_where = ACL_WHERE_UNKNOWN;
int
-acl_check(int where, uschar *recipient, uschar *s, uschar **user_msgptr,
- uschar **log_msgptr)
+acl_check(int where, const uschar * recipient, uschar * s,
+ uschar ** user_msgptr, uschar ** log_msgptr)
{
int rc;
address_item adb;
int transport_count; /* returned transport count value */
BOOL done; /* no more data needed */
uschar *msg; /* error message */
- uschar *return_path; /* return_path for these addresses */
+ const uschar *return_path; /* return_path for these addresses */
} pardata;
/* Values for the process_recipients variable */
static struct pollfd *parpoll;
static int return_count;
static uschar *frozen_info = US"";
-static uschar *used_return_path = NULL;
+static const uschar * used_return_path = NULL;
*/
address_item *
-deliver_make_addr(uschar *address, BOOL copy)
+deliver_make_addr(const uschar * address, BOOL copy)
{
address_item * addr = store_get(sizeof(address_item), GET_UNTAINTED);
*addr = address_defaults;
*/
static BOOL
-same_strings(uschar *one, uschar *two)
+same_strings(const uschar * one, const uschar * two)
{
if (one == two) return TRUE; /* Includes the case where both NULL */
if (!one || !two) return FALSE;
msg_event_raise(const uschar * event, const address_item * addr)
{
const uschar * save_domain = deliver_domain;
-uschar * save_local = deliver_localpart;
+const uschar * save_local = deliver_localpart;
const uschar * save_host = deliver_host;
const uschar * save_address = deliver_host_address;
const int save_port = deliver_host_port;
* Generate local part for logging *
*************************************************/
-static uschar *
-string_get_lpart_sub(const address_item * addr, uschar * s)
+static const uschar *
+string_get_lpart_sub(const address_item * addr, const uschar * s)
{
#ifdef SUPPORT_I18N
if (testflag(addr, af_utf8_downcvt))
{
- uschar * t = string_localpart_utf8_to_alabel(s, NULL);
+ const uschar * t = string_localpart_utf8_to_alabel(s, NULL);
return t ? t : s; /* t is NULL on a failed conversion */
}
#endif
static gstring *
string_get_localpart(address_item * addr, gstring * yield)
{
-uschar * s;
+const uschar * s;
if (testflag(addr, af_include_affixes) && (s = addr->prefix))
yield = string_cat(yield, string_get_lpart_sub(addr, s));
int
deliver_split_address(address_item * addr)
{
-uschar * address = addr->address;
+const uschar * address = addr->address;
uschar * domain;
uschar * t;
int len;
this, Jan 1999.] We know the syntax is valid, so this can be done by simply
removing quoting backslashes and any unquoted doublequotes. */
-t = addr->cc_local_part = store_get(len+1, address);
+addr->cc_local_part = t = store_get(len+1, address);
while(len-- > 0)
{
int c = *address++;
}
else *t++ = c;
}
-*t = 0;
+*t = '\0';
/* We do the percent hack only for those domains that are listed in
percent_hack_domains. A loop is required, to copy with multiple %-hacks. */
if (percent_hack_domains)
{
int rc;
- uschar *new_address = NULL;
- uschar *local_part = addr->cc_local_part;
+ uschar * new_address = NULL;
+ const uschar * local_part = addr->cc_local_part;
deliver_domain = addr->domain; /* set $domain */
*/
static BOOL
-print_address_information(address_item *addr, FILE *f, uschar *si, uschar *sc,
- uschar *se)
+print_address_information(address_item * addr, FILE * f, uschar * si,
+ uschar * sc, uschar * se)
{
BOOL yield = TRUE;
-uschar *printed = US"";
-address_item *ancestor = addr;
+const uschar * printed = US"";
+address_item * ancestor = addr;
while (ancestor->parent) ancestor = ancestor->parent;
fprintf(f, "%s", CS si);
else
{
- uschar *s = addr->address;
- uschar *ss;
+ const uschar * s = addr->address;
+ const uschar * ss;
if (addr->address[0] == '>') { ss = US"mail"; s++; }
else if (addr->address[0] == '|') ss = US"pipe";
if (ancestor != addr)
{
- uschar *original = ancestor->onetime_parent;
+ const uschar * original = ancestor->onetime_parent;
if (!original) original= ancestor->address;
if (strcmpic(original, printed) != 0)
fprintf(f, "%s(%sgenerated from %s)", sc,
if (!p->transport)
{
- address_item *badp = p;
+ address_item * badp = p;
p = p->next;
if (!addr_last) addr_new = p; else addr_last->next = p;
badp->local_part = badp->address; /* Needed for log line */
#ifndef DISABLE_EVENT
if (process_recipients != RECIP_ACCEPT && event_action)
{
- uschar * save_local = deliver_localpart;
+ const uschar * save_local = deliver_localpart;
const uschar * save_domain = deliver_domain;
- uschar * addr = new->address, * errmsg = NULL;
+ const uschar * addr = new->address;
+ uschar * errmsg = NULL;
int start, end, dom;
if (!parse_extract_address(addr, &errmsg, &start, &end, &dom, TRUE))
for (i = 0; i < recipients_count; i++)
{
- uschar *r = recipients_list[i].address;
+ const uschar * r = recipients_list[i].address;
if (Ustrcmp(otaddr->onetime_parent, r) == 0) t = i;
if (Ustrcmp(otaddr->address, r) == 0) break;
}
if (sender_address[0])
{
- uschar * s = addr->prop.errors_address;
+ const uschar * s = addr->prop.errors_address;
if (!s) s = sender_address;
if (Ustrstr(recipients, s) == NULL)
recipients = string_sprintf("%s%s%s", recipients,
Returns: the local part, quoted if necessary
*/
-uschar *
-local_part_quote(uschar *lpart)
+const uschar *
+local_part_quote(const uschar * lpart)
{
BOOL needs_quote = FALSE;
gstring * g;
-for (uschar * t = lpart; !needs_quote && *t != 0; t++)
- {
+for (const uschar * t = lpart; !needs_quote && *t; t++)
needs_quote = !isalnum(*t) && strchr("!#$%&'*+-/=?^_`{|}~", *t) == NULL &&
(*t != '.' || t == lpart || t[1] == 0);
- }
if (!needs_quote) return lpart;
for (;;)
{
- uschar *nq = US Ustrpbrk(lpart, "\\\"");
- if (nq == NULL)
+ uschar * nq = US Ustrpbrk(lpart, "\\\"");
+ if (!nq)
{
g = string_cat(g, lpart);
break;
BOOL verify_as_sender = FALSE;
BOOL rcpt_verify_quota = FALSE;
BOOL version_printed = FALSE;
-const uschar *alias_arg = NULL;
-const uschar *called_as = US"";
-const uschar *cmdline_syslog_name = NULL;
-const uschar *start_queue_run_id = NULL;
-const uschar *stop_queue_run_id = NULL;
-const uschar *expansion_test_message = NULL;
-const uschar *ftest_domain = NULL;
-const uschar *ftest_localpart = NULL;
-const uschar *ftest_prefix = NULL;
-const uschar *ftest_suffix = NULL;
-uschar *log_oneline = NULL;
-const uschar *malware_test_file = NULL;
-uschar *real_sender_address;
-uschar *originator_home = US"/";
+const uschar * alias_arg = NULL;
+const uschar * called_as = US"";
+const uschar * cmdline_syslog_name = NULL;
+const uschar * start_queue_run_id = NULL;
+const uschar * stop_queue_run_id = NULL;
+const uschar * expansion_test_message = NULL;
+const uschar * ftest_domain = NULL;
+const uschar * ftest_localpart = NULL;
+const uschar * ftest_prefix = NULL;
+const uschar * ftest_suffix = NULL;
+uschar * log_oneline = NULL;
+const uschar * malware_test_file = NULL;
+const uschar * real_sender_address;
+uschar * originator_home = US"/";
size_t sz;
struct passwd *pw;
if (i+1 < argc) argrest = argv[++i]; else { badarg = TRUE; break; }
(void) exim_str_fail_toolong(argrest, EXIM_DISPLAYMAIL_MAX, "-f");
if (!*argrest)
- *(sender_address = store_get(1, GET_UNTAINTED)) = '\0'; /* Ensure writeable memory */
+ {
+ uschar * s = store_get(1, GET_UNTAINTED); /* Ensure writeable memory */
+ *s = '\0';
+ sender_address = s;
+ }
else
{
const uschar * temp = argrest + Ustrlen(argrest) - 1;
/* A recipients list is available only during system message filtering,
during ACL processing after DATA, and while expanding pipe commands
generated from a system filter, but not elsewhere. Note that this does
-not check for comman in the elements, and uses comma-space as seperator -
+not check for commas in the elements, and uses comma-space as seperator -
so cannot be used as an exim list as-is. */
static uschar *
fn_recipients(void)
{
-uschar * s;
gstring * g = NULL;
if (!f.enable_dollar_recipients) return NULL;
for (int i = 0; i < recipients_count; i++)
{
- s = recipients_list[i].address;
+ const uschar * s = recipients_list[i].address;
g = string_append2_listele_n(g, US", ", s, Ustrlen(s));
}
gstring_release_unused(g);
/* Everything else... */
extern acl_block *acl_read(uschar *(*)(void), uschar **);
-extern int acl_check(int, uschar *, uschar *, uschar **, uschar **);
+extern int acl_check(int, const uschar *, uschar *, uschar **, uschar **);
extern uschar *acl_current_verb(void);
extern int acl_eval(int, uschar *, uschar **, uschar **);
extern uschar *acl_standalone_setvar(const uschar *);
const uschar *, bit_table *, int, uschar *, int);
extern void delete_pid_file(void);
extern void deliver_local(address_item *, BOOL);
-extern address_item *deliver_make_addr(uschar *, BOOL);
+extern address_item *deliver_make_addr(const uschar *, BOOL);
extern void delivery_log(int, address_item *, int, uschar *);
extern int deliver_message(const uschar *, BOOL, BOOL);
extern void deliver_msglog(const char *, ...) PRINTF_FUNCTION(1,2);
extern int ipv6_nmtoa(int *, uschar *);
-extern uschar *local_part_quote(uschar *);
+extern const uschar *local_part_quote(const uschar *);
extern int log_open_as_exim(const uschar * const);
extern void log_close_all(void);
extern int mime_regex(const uschar **, BOOL);
extern void mime_set_anomaly(int);
#endif
-extern uschar *moan_check_errorcopy(uschar *);
+extern uschar *moan_check_errorcopy(const uschar *);
extern BOOL moan_skipped_syntax_errors(uschar *, error_block *, uschar *,
BOOL, uschar *);
extern void moan_smtp_batch(uschar *, const char *, ...) PRINTF_FUNCTION(2,3);
-extern BOOL moan_send_message(uschar *, int, error_block *eblock,
+extern BOOL moan_send_message(const uschar *, int, error_block *eblock,
header_line *, FILE *, uschar *);
extern void moan_tell_someone(uschar *, address_item *,
const uschar *, const char *, ...) PRINTF_FUNCTION(4,5);
extern void read_message_body(BOOL);
extern void receive_bomb_out(uschar *, uschar *) NORETURN;
extern BOOL receive_check_fs(int);
-extern BOOL receive_check_set_sender(uschar *);
+extern BOOL receive_check_set_sender(const uschar *);
extern BOOL receive_msg(BOOL);
extern int_eximarith_t receive_statvfs(BOOL, int *);
extern void receive_swallow_smtp(void);
, unsigned, unsigned, unsigned
#endif
);
-extern uschar *transport_rcpt_address(address_item *, BOOL);
+extern const uschar *transport_rcpt_address(address_item *, BOOL);
extern BOOL transport_set_up_command(const uschar ***, const uschar *,
unsigned, int, address_item *, const uschar *, uschar **);
extern void transport_update_waiting(host_item *, uschar *);
extern void transport_write_reset(int);
extern BOOL transport_write_string(int, const char *, ...);
extern BOOL transport_headers_send(transport_ctx *,
- BOOL (*)(transport_ctx *, uschar *, int));
+ BOOL (*)(transport_ctx *, const uschar *, int));
extern gstring * transport_show_supported(gstring *);
extern BOOL transport_write_message(transport_ctx *, int);
extern void tree_add_duplicate(const uschar *, address_item *);
extern int verify_check_given_host(const uschar **, const host_item *);
extern int verify_check_this_host(const uschar **, unsigned int *,
const uschar*, const uschar *, const uschar **);
-extern address_item *verify_checked_sender(uschar *);
+extern address_item *verify_checked_sender(const uschar *);
extern void verify_get_ident(int);
extern void verify_quota(uschar *);
extern int verify_quota_call(const uschar *, int, int, uschar **);
extern BOOL verify_sender_preliminary(int *, uschar **);
extern void version_init(void);
-extern BOOL write_chunk(transport_ctx *, uschar *, int);
+extern BOOL write_chunk(transport_ctx *, const uschar *, int);
extern ssize_t write_to_fd_buf(int, const uschar *, size_t);
extern uschar *wrap_header(const uschar *, unsigned, unsigned, const uschar *, unsigned);
}
};
-uschar *address_file = NULL;
-uschar *address_pipe = NULL;
+const uschar *address_file = NULL;
+const uschar *address_pipe = NULL;
tree_node *addresslist_anchor = NULL;
int addresslist_count = 0;
gid_t *admin_groups = NULL;
int body_zerocount = 0;
uschar *bounce_message_file = NULL;
uschar *bounce_message_text = NULL;
-uschar *bounce_recipient = NULL;
+const uschar *bounce_recipient = NULL;
int bounce_return_linesize_limit = 998;
int bounce_return_size_limit = 100*1024;
uschar *bounce_sender_authentication = NULL;
int deliver_host_port = 0;
uschar *deliver_in_buffer = NULL;
ino_t deliver_inode = 0;
-uschar *deliver_localpart = NULL;
+const uschar *deliver_localpart= NULL;
uschar *deliver_localpart_data = NULL;
-uschar *deliver_localpart_orig = NULL;
-uschar *deliver_localpart_parent = NULL;
-uschar *deliver_localpart_prefix = NULL;
-uschar *deliver_localpart_prefix_v = NULL;
-uschar *deliver_localpart_suffix = NULL;
-uschar *deliver_localpart_suffix_v = NULL;
+const uschar *deliver_localpart_orig = NULL;
+const uschar *deliver_localpart_parent = NULL;
+const uschar *deliver_localpart_prefix = NULL;
+const uschar *deliver_localpart_prefix_v = NULL;
+const uschar *deliver_localpart_suffix = NULL;
+const uschar *deliver_localpart_suffix_v = NULL;
uschar *deliver_out_buffer = NULL;
int deliver_queue_load_max = -1;
address_item *deliver_recipients = NULL;
tree_node *ratelimiters_conn = NULL;
tree_node *ratelimiters_mail = NULL;
uschar *raw_active_hostname = NULL;
-uschar *raw_sender = NULL;
-uschar **raw_recipients = NULL;
+const uschar *raw_sender = NULL;
+const uschar **raw_recipients = NULL;
int raw_recipients_count = 0;
int rcpt_count = 0;
int receive_messagecount = 0;
int receive_timeout = 0;
int received_count = 0;
-uschar *received_for = NULL;
+const uschar *received_for = NULL;
/* This is the default text for Received headers generated by Exim. The
date will be automatically added on the end. */
int retry_interval_max = 24*60*60;
int retry_maximum_timeout = 0; /* set from retry config */
retry_config *retries = NULL;
-uschar *return_path = NULL;
+const uschar *return_path = NULL;
int rewrite_existflags = 0;
uschar *rfc1413_hosts = US"@[]";
int rfc1413_query_timeout = 0;
uschar *search_error_message = NULL;
uschar *self_hostname = NULL;
-uschar *sender_address = NULL;
+const uschar *sender_address = NULL;
unsigned int sender_address_cache[(MAX_NAMED_LIST * 2)/32];
uschar *sender_address_data = NULL;
-uschar *sender_address_unrewritten = NULL;
+const uschar *sender_address_unrewritten = NULL;
uschar *sender_data = NULL;
unsigned int sender_domain_cache[(MAX_NAMED_LIST * 2)/32];
uschar *sender_fullhost = NULL;
extern uschar *acl_wherenames[]; /* Names for messages */
extern address_item *addr_duplicate; /* Duplicate address list */
extern address_item address_defaults; /* Default data for address item */
-extern uschar *address_file; /* Name of file when delivering to one */
-extern uschar *address_pipe; /* Pipe command when delivering to one */
+extern const uschar *address_file; /* Name of file when delivering to one */
+extern const uschar *address_pipe; /* Pipe command when delivering to one */
extern tree_node *addresslist_anchor; /* Tree of defined address lists */
extern int addresslist_count; /* Number defined */
extern gid_t *admin_groups; /* List of admin groups */
extern int body_8bitmime; /* sender declared BODY= ; 7=7BIT, 8=8BITMIME */
extern uschar *bounce_message_file; /* Template file */
extern uschar *bounce_message_text; /* One-liner */
-extern uschar *bounce_recipient; /* When writing an errmsg */
+extern const uschar *bounce_recipient; /* When writing an errmsg */
extern BOOL bounce_return_body; /* Include body in returned message */
extern int bounce_return_linesize_limit; /* Max line length in return */
extern BOOL bounce_return_message; /* Include message in bounce */
extern int deliver_host_port; /* Address for remote delivery filter */
extern uschar *deliver_in_buffer; /* Buffer for copying file */
extern ino_t deliver_inode; /* Inode for appendfile */
-extern uschar *deliver_localpart; /* The local part for delivery */
+extern const uschar *deliver_localpart;/* The local part for delivery */
extern uschar *deliver_localpart_data; /* From local part lookup (de-tainted) */
-extern uschar *deliver_localpart_orig; /* The original local part for delivery */
-extern uschar *deliver_localpart_parent; /* The parent local part for delivery */
-extern uschar *deliver_localpart_prefix; /* The stripped prefix, if any */
-extern uschar *deliver_localpart_prefix_v; /* The stripped-prefix variable portion, if any */
-extern uschar *deliver_localpart_suffix; /* The stripped suffix, if any */
-extern uschar *deliver_localpart_suffix_v; /* The stripped-suffix variable portion, if any */
+extern const uschar *deliver_localpart_orig; /* The original local part for delivery */
+extern const uschar *deliver_localpart_parent; /* The parent local part for delivery */
+extern const uschar *deliver_localpart_prefix; /* The stripped prefix, if any */
+extern const uschar *deliver_localpart_prefix_v; /* The stripped-prefix variable portion, if any */
+extern const uschar *deliver_localpart_suffix; /* The stripped suffix, if any */
+extern const uschar *deliver_localpart_suffix_v; /* The stripped-suffix variable portion, if any */
extern uschar *deliver_out_buffer; /* Buffer for copying file */
extern int deliver_queue_load_max; /* Different value for queue running */
extern address_item *deliver_recipients; /* Current set of addresses */
extern tree_node *ratelimiters_conn; /* Results of connection ratelimit checks */
extern tree_node *ratelimiters_mail; /* Results of per-mail ratelimit checks */
extern uschar *raw_active_hostname; /* Pre-expansion */
-extern uschar *raw_sender; /* Before rewriting */
-extern uschar **raw_recipients; /* Before rewriting */
+extern const uschar *raw_sender; /* Before rewriting */
+extern const uschar **raw_recipients; /* Before rewriting */
extern int raw_recipients_count;
extern const uschar * rc_names[]; /* Mostly for debug output */
extern int rcpt_count; /* Count of RCPT commands in a message */
extern int receive_messagecount; /* Mainly for BSMTP errors */
extern int receive_timeout; /* For non-SMTP acceptance */
extern int received_count; /* Count of Received: headers */
-extern uschar *received_for; /* For "for" field */
+extern const uschar *received_for; /* For "for" field */
extern uschar *received_header_text; /* Definition of Received: header */
extern int received_headers_max; /* Max count of Received: headers */
extern struct timeval received_time; /* Time the message started to be received */
extern int retry_data_expire; /* When to expire retry data */
extern int retry_interval_max; /* Absolute maximum */
extern int retry_maximum_timeout; /* The maximum timeout */
-extern uschar *return_path; /* Return path for a message */
+extern const uschar *return_path; /* Return path for a message */
extern BOOL return_path_remove; /* Remove return-path headers */
extern int rewrite_existflags; /* Indicate which headers have rewrites */
extern uschar *rfc1413_hosts; /* RFC hosts */
extern uschar *self_hostname; /* Self host after routing->directors */
extern unsigned int sender_address_cache[(MAX_NAMED_LIST * 2)/32]; /* Cache bits for sender */
extern uschar *sender_address_data; /* address_data from sender verify */
-extern uschar *sender_address_unrewritten; /* Set if rewritten by verify */
+extern const uschar *sender_address_unrewritten; /* Set if rewritten by verify */
extern uschar *sender_data; /* lookup result for senders */
extern unsigned int sender_domain_cache[(MAX_NAMED_LIST * 2)/32]; /* Cache bits for sender domain */
extern uschar *sender_fullhost; /* Sender host name + address */
routers that generated them. */
typedef struct recipient_item {
- uschar *address; /* the recipient address */
+ const uschar *address; /* the recipient address */
int pno; /* parent number for "one_time" alias, or -1 */
- uschar *errors_to; /* the errors_to address or NULL */
+ const uschar *errors_to; /* the errors_to address or NULL */
uschar *orcpt; /* DSN orcpt */
int dsn_flags; /* DSN flags */
#ifdef EXPERIMENTAL_BRIGHTMAIL
extern uschar *received_protocol; /* Name of incoming protocol */
extern int recipients_count; /* Number of recipients */
extern recipient_item *recipients_list;/* List of recipient addresses */
-extern unsigned char *sender_address; /* Sender address */
+extern const unsigned char *sender_address; /* Sender address */
extern uschar *sender_host_address; /* IP address of sender, as chars */
extern uschar *sender_host_authenticated; /* Name of authentication mechanism */
extern uschar *sender_host_name; /* Host name from lookup */
extern int lss_match_local_part(uschar *, uschar *, BOOL);
extern int lss_match_address(uschar *, uschar *, BOOL);
extern int lss_match_host(uschar *, uschar *, uschar *);
-extern void receive_add_recipient(uschar *, int);
-extern BOOL receive_remove_recipient(uschar *);
+extern void receive_add_recipient(const uschar *, int);
+extern BOOL receive_remove_recipient(const uschar *);
extern uschar *rfc2047_decode(uschar *, BOOL, const uschar *, int, int *,
uschar **);
extern int smtp_fflush(void);
&& g->ptr < LOG_BUFFER_SIZE - 6
&& raw_recipients_count > 0)
{
- int i;
g = string_fmt_append_f(g, SVFMT_TAINT_NOCHK, " for", NULL);
- for (i = 0; i < raw_recipients_count; i++)
+ for (int i = 0; i < raw_recipients_count; i++)
{
- uschar * s = raw_recipients[i];
+ const uschar * s = raw_recipients[i];
if (LOG_BUFFER_SIZE - g->ptr < Ustrlen(s) + 3) break;
g = string_fmt_append_f(g, SVFMT_TAINT_NOCHK, " %s", s);
}
*/
BOOL
-moan_send_message(uschar *recipient, int ident, error_block *eblock,
- header_line *headers, FILE *message_file, uschar *firstline)
+moan_send_message(const uschar * recipient, int ident, error_block * eblock,
+ header_line * headers, FILE * message_file, uschar * firstline)
{
int written = 0;
int fd;
fprintf(f, "\nThe following address(es) have yet to be delivered:\n");
for (; addr; addr = addr->next)
{
- uschar * parent = addr->parent ? addr->parent->address : NULL;
+ const uschar * parent = addr->parent ? addr->parent->address : NULL;
fprintf(f, " %s", addr->address);
if (parent) fprintf(f, " <%s>", parent);
if (addr->basic_errno > 0) fprintf(f, ": %s", strerror(addr->basic_errno));
*/
uschar *
-moan_check_errorcopy(uschar *recipient)
+moan_check_errorcopy(const uschar * recipient)
{
-uschar *item, *localpart, *domain;
-const uschar *listptr = errors_copy;
+uschar * item;
+const uschar * localpart, * domain;
+const uschar * listptr = errors_copy;
uschar *yield = NULL;
int sep = 0;
int llen;
-if (errors_copy == NULL) return NULL;
+if (!errors_copy) return NULL;
/* Set up pointer to the local part and domain, and compute the
length of the local part. */
localpart = recipient;
domain = Ustrrchr(recipient, '@');
-if (domain == NULL) return NULL; /* should not occur, but avoid crash */
+if (!domain) return NULL; /* should not occur, but avoid crash */
llen = domain++ - recipient;
/* Scan through the configured items */
else if ( deliver_selectstring_sender
&& !(f.deliver_selectstring_sender_regex
? regex_match(selectstring_regex_sender, sender_address, -1, NULL)
- : (strstric(sender_address, deliver_selectstring_sender, FALSE)
+ : (strstric_c(sender_address, deliver_selectstring_sender, FALSE)
!= NULL)
) )
{
int i;
for (i = 0; i < recipients_count; i++)
{
- uschar *address = recipients_list[i].address;
+ const uschar * address = recipients_list[i].address;
if ( (f.deliver_selectstring_regex
? regex_match(selectstring_regex, address, -1, NULL)
- : (strstric(address, deliver_selectstring, FALSE) != NULL)
+ : (strstric_c(address, deliver_selectstring, FALSE) != NULL)
)
&& tree_search(tree_nonrecipients, address) == NULL
)
tree_search(tree_nonrecipients, recipients_list[i].address);
if (!delivered)
{
- uschar * save_local = deliver_localpart;
+ const uschar * save_local = deliver_localpart;
const uschar * save_domain = deliver_domain;
- uschar * addr = recipients_list[i].address, * errmsg = NULL;
+ const uschar * addr = recipients_list[i].address;
+ uschar * errmsg = NULL;
int start, end, dom;
if (!parse_extract_address(addr, &errmsg, &start, &end, &dom, TRUE))
*/
static BOOL
-rda_read_string(int fd, uschar **sp)
+rda_read_string(int fd, uschar ** sp)
{
int len;
for (;;)
{
int i, reply_options;
- address_item *addr;
- uschar *recipient;
- uschar *expandn[EXPAND_MAXN + 2];
+ address_item * addr;
+ uschar * recipient, * s;
+ uschar * expandn[EXPAND_MAXN + 2];
/* First string is the address; NULL => end of addresses */
if ( read(fd, &addr->mode, sizeof(addr->mode)) != sizeof(addr->mode)
|| read(fd, &addr->flags, sizeof(addr->flags)) != sizeof(addr->flags)
- || !rda_read_string(fd, &addr->prop.errors_address)
+ || !rda_read_string(fd, &s)
|| read(fd, &i, sizeof(i)) != sizeof(i)
)
goto DISASTER;
+ addr->prop.errors_address = s;
addr->prop.ignore_error = (i != 0);
/* Next comes a possible setting for $thisaddress and any numerical
*/
BOOL
-receive_check_set_sender(uschar *newsender)
+receive_check_set_sender(const uschar * newsender)
{
-uschar *qnewsender;
+const uschar * qnewsender;
if (f.trusted_caller) return TRUE;
if (!newsender || !untrusted_set_sender) return FALSE;
qnewsender = Ustrchr(newsender, '@')
*/
void
-receive_add_recipient(uschar * recipient, int pno)
+receive_add_recipient(const uschar * recipient, int pno)
{
if (recipients_count >= recipients_list_max)
{
*/
BOOL
-receive_remove_recipient(uschar *recipient)
+receive_remove_recipient(const uschar * recipient)
{
DEBUG(D_receive) debug_printf("receive_remove_recipient(\"%s\") called\n",
recipient);
/* Loop through recipients, responses must be in same order received */
for (unsigned int c = 0; recipients_count > c; c++)
{
- uschar * addr= recipients_list[c].address;
+ const uschar * addr = recipients_list[c].address;
uschar * msg= US"PRDR R=<%s> %s";
uschar * code;
DEBUG(D_receive)
{
int start, end, pdomain;
int count = 0;
- uschar *save_localpart;
- const uschar *save_domain;
- uschar *error, *new;
+ const uschar * save_localpart;
+ const uschar * save_domain;
+ uschar * error, * new;
const uschar * newparsed;
/* Come back here for a repeat after a successful rewrite. We do this
*/
static BOOL
-check_router_conditions(router_instance *r, address_item *addr, int verify,
- struct passwd **pw, uschar **perror)
+check_router_conditions(router_instance * r, address_item * addr, int verify,
+ struct passwd ** pw, uschar ** perror)
{
int rc;
-uschar *check_local_part;
-unsigned int *localpart_cache;
+uschar * check_local_part;
+unsigned int * localpart_cache;
/* Reset variables to hold a home directory and data from lookup of a domain or
local part, and ensure search_find_defer is unset, in case there aren't any
required. Also, we only use the match cache for local parts that have not had
a prefix or suffix stripped. */
+check_local_part = string_copy(addr->cc_local_part);
if (!addr->prefix && !addr->suffix)
- {
localpart_cache = addr->localpart_cache;
- check_local_part = addr->cc_local_part;
- }
else
{
localpart_cache = NULL;
- check_local_part = string_copy(addr->cc_local_part);
if (addr->prefix)
check_local_part += Ustrlen(addr->prefix);
if (addr->suffix)
(accept_router_options_block *)(rblock->options_block);
*/
int rc;
-uschar *errors_to;
-uschar *remove_headers;
-header_line *extra_headers;
+const uschar * errors_to;
+uschar * remove_headers;
+header_line * extra_headers;
DEBUG(D_route) debug_printf("%s router called for %s\n domain = %s\n",
rblock->name, addr->address, addr->domain);
while (generated)
{
- address_item *parent;
- address_item *next = generated;
- uschar *errors_address = next->prop.errors_address;
+ address_item * next = generated, * parent;
+ const uschar * errors_address = next->prop.errors_address;
generated = next->next;
next->parent = addr;
extern void rf_change_domain(address_item *, const uschar *, BOOL, address_item **);
extern uschar *rf_expand_data(address_item *, uschar *, int *);
extern int rf_get_errors_address(address_item *, router_instance *,
- int, uschar **);
+ int, const uschar **);
extern int rf_get_munge_headers(address_item *, router_instance *,
header_line **, uschar **);
extern BOOL rf_get_transport(uschar *, transport_instance **, address_item *,
*/
int
-rf_get_errors_address(address_item *addr, router_instance *rblock,
- int verify, uschar **errors_to)
+rf_get_errors_address(address_item * addr, router_instance * rblock,
+ int verify, const uschar ** errors_to)
{
uschar *s;
*errors_to = addr->prop.errors_address;
-if (rblock->errors_to == NULL) return OK;
+if (!rblock->errors_to) return OK;
s = expand_string(rblock->errors_to);
else
{
BOOL save_address_test_mode = f.address_test_mode;
- int save1 = 0;
+ const uschar * save_sender = sender_address;
int i;
const uschar ***p;
const uschar *address_expansions_save[ADDRESS_EXPANSIONS_COUNT];
address_item *snew = deliver_make_addr(s, FALSE);
if (sender_address)
- {
- save1 = sender_address[0];
- sender_address[0] = 0;
- }
+ sender_address = US"";
for (i = 0, p = address_expansions; *p;)
address_expansions_save[i++] = **p++;
for (i = 0, p = address_expansions; *p; )
**p++ = address_expansions_save[i++];
- if (sender_address) sender_address[0] = save1;
+ sender_address = save_sender;
}
return OK;
Return: OK/FAIL */
int
-spf_process(const uschar **listptr, uschar *spf_envelope_sender, int action)
+spf_process(const uschar ** listptr, const uschar * spf_envelope_sender,
+ int action)
{
int sep = 0;
const uschar *list = *listptr;
gstring * spf_lib_version_report(gstring *);
BOOL spf_init(void);
BOOL spf_conn_init(uschar *, uschar *);
-int spf_process(const uschar **, uschar *, int);
+int spf_process(const uschar **, const uschar *, int);
void spf_response_debug(SPF_response_t *);
#define SPF_PROCESS_NORMAL 0
if (n < 3 || big_buffer[0] != '<' || big_buffer[n-2] != '>')
goto SPOOL_FORMAT_ERROR;
-sender_address = store_get(n-2, GET_TAINTED);
-Ustrncpy(sender_address, big_buffer+1, n-3);
-sender_address[n-3] = 0;
+ {
+ uschar * s = store_get(n-2, GET_TAINTED);
+ Ustrncpy(s, big_buffer+1, n-3);
+ s[n-3] = '\0';
+ sender_address = s;
+ }
where = US"time";
if (Ufgets(big_buffer, big_buffer_size, fp) == NULL) goto SPOOL_READ_ERROR;
uschar *address_data; /* arbitrary data to keep with the address */
uschar *domain_data; /* from "domains" lookup */
uschar *localpart_data; /* from "local_parts" lookup */
- uschar *errors_address; /* where to send errors (NULL => sender) */
+ const uschar *errors_address; /* where to send errors (NULL => sender) */
header_line *extra_headers; /* additional headers */
uschar *remove_headers; /* list of those to remove */
void *variables; /* router-vasriables */
reply_item *reply; /* data for autoreply */
retry_item *retries; /* chain of retry information */
- uschar *address; /* address being delivered or routed */
+ const uschar *address; /* address being delivered or routed */
uschar *unique; /* used for disambiguating */
- uschar *cc_local_part; /* caseful local part */
- uschar *lc_local_part; /* lowercased local part */
- uschar *local_part; /* points to cc or lc version */
- uschar *prefix; /* stripped prefix of local part */
- uschar *prefix_v; /* variable part of above */
- uschar *suffix; /* stripped suffix of local part */
- uschar *suffix_v; /* variable part of above */
+ const uschar *cc_local_part; /* caseful local part */
+ const uschar *lc_local_part; /* lowercased local part */
+ const uschar *local_part; /* points to cc or lc version */
+ const uschar *prefix; /* stripped prefix of local part */
+ const uschar *prefix_v; /* variable part of above */
+ const uschar *suffix; /* stripped suffix of local part */
+ const uschar *suffix_v; /* variable part of above */
const uschar *domain; /* working domain (lower cased) */
uschar *address_retry_key; /* retry key including full address */
uschar *message; /* error message */
uschar *user_message; /* error message that can be sent over SMTP
or quoted in bounce message */
- uschar *onetime_parent; /* saved original parent for onetime */
+ const uschar *onetime_parent; /* saved original parent for onetime */
uschar **pipe_expandn; /* numeric expansions for pipe from filter */
uschar *return_filename; /* name of return file */
uschar *self_hostname; /* after self=pass */
*/
BOOL
-write_chunk(transport_ctx * tctx, uschar *chunk, int len)
+write_chunk(transport_ctx * tctx, const uschar * chunk, int len)
{
-uschar *start = chunk;
-uschar *end = chunk + len;
+const uschar * start = chunk;
+const uschar * end = chunk + len;
int mlen = DELIVER_OUT_BUFFER_SIZE - nl_escape_length - 2;
/* The assumption is made that the check string will never stretch over move
for possible escaping. The code for the non-NL route should be as fast as
possible. */
-for (uschar * ptr = start; ptr < end; ptr++)
+for (const uschar * ptr = start; ptr < end; ptr++)
{
int ch, len;
Returns: a string
*/
-uschar *
+const uschar *
transport_rcpt_address(address_item *addr, BOOL include_affixes)
{
uschar *at;
*/
BOOL
transport_headers_send(transport_ctx * tctx,
- BOOL (*sendfn)(transport_ctx * tctx, uschar * s, int len))
+ BOOL (*sendfn)(transport_ctx * tctx, const uschar * s, int len))
{
const uschar * list;
transport_instance * tblock = tctx ? tctx->tblock : NULL;
address_pipe_argv = store_get((address_pipe_max_args+1)*sizeof(uschar *), GET_UNTAINTED);
/* +1 because addr->local_part[0] == '|' since af_force_command is set */
- s = expand_string(addr->local_part + 1);
+ s = expand_cstring(addr->local_part + 1);
if (!s || !*s)
{
*/
static void
-notify_comsat(uschar *user, off_t offset)
+notify_comsat(const uschar * user, off_t offset)
{
struct servent *sp;
host_item host;
*/
static BOOL
-set_up_direct_command(const uschar *** argvptr, uschar * cmd,
+set_up_direct_command(const uschar *** argvptr, const uschar * cmd,
BOOL expand_arguments, int expand_fail, address_item * addr, uschar * tname,
pipe_transport_options_block * ob)
{
*/
static BOOL
-set_up_shell_command(const uschar ***argvptr, uschar *cmd,
- BOOL expand_arguments, int expand_fail, address_item *addr, uschar *tname)
+set_up_shell_command(const uschar *** argvptr, const uschar * cmd,
+ BOOL expand_arguments, int expand_fail, address_item * addr, uschar * tname)
{
const uschar **argv;
}
g = string_cat(g, q);
- argv[2] = (cmd = string_from_gstring(g)) ? expand_string(cmd) : NULL;
+ argv[2] = (cmd = string_from_gstring(g)) ? expand_cstring(cmd) : NULL;
}
else
- argv[2] = expand_string(cmd);
+ argv[2] = expand_cstring(cmd);
f.enable_dollar_recipients = FALSE;
int timeout = ob->timeout;
BOOL written_ok = FALSE;
BOOL expand_arguments;
-const uschar **argv;
-uschar *envp[50];
-const uschar *envlist = ob->environment;
-uschar *cmd, *ss;
-uschar *eol = ob->use_crlf ? US"\r\n" : US"\n";
+const uschar ** argv;
+uschar * envp[50];
+const uschar * envlist = ob->environment;
+const uschar * cmd;
+uschar * ss;
+uschar * eol = ob->use_crlf ? US"\r\n" : US"\n";
transport_ctx tctx = {
.tblock = tblock,
.addr = addr,
deferred_event_raise(address_item * addr, host_item * host, uschar * evstr)
{
uschar * action = addr->transport->event_action;
-const uschar * save_domain;
-uschar * save_local;
+const uschar * save_domain, * save_local;
if (!action)
return;
typedef struct smtp_compare_s
{
- uschar * current_sender_address;
+ const uschar * current_sender_address;
struct transport_instance * tblock;
} smtp_compare_t;
*/
static uschar *
-smtp_local_identity(uschar * sender, struct transport_instance * tblock)
+smtp_local_identity(const uschar * sender, struct transport_instance * tblock)
{
address_item * addr1;
uschar * if1 = US"";
#ifndef DISABLE_TLS
uschar * tlsc1 = US"";
#endif
-uschar * save_sender_address = sender_address;
+const uschar * save_sender_address = sender_address;
uschar * local_identity = NULL;
smtp_transport_options_block * ob = SOB tblock->options_block;
sx->pending_MAIL = TRUE; /* The block starts with MAIL */
{
- uschar * s = sx->from_addr;
+ const uschar * s = sx->from_addr;
#ifdef SUPPORT_I18N
uschar * errstr = NULL;
{
int cmds_sent;
BOOL no_flush;
- uschar * rcpt_addr;
+ const uschar * rcpt_addr;
#ifdef EXPERIMENTAL_ESMTP_LIMITS
if ( sx->single_rcpt_domain /* restriction on domains */
/* smtp connect context */
typedef struct {
- uschar * from_addr;
+ const uschar * from_addr;
address_item * addrlist;
smtp_connect_args conn_args;
*/
static BOOL
-cached_callout_lookup(address_item * addr, uschar * address_key,
- uschar * from_address, int * opt_ptr, uschar ** pm_ptr,
+cached_callout_lookup(address_item * addr, const uschar * address_key,
+ const uschar * from_address, int * opt_ptr, uschar ** pm_ptr,
int * yield, uschar ** failure_ptr,
dbdata_callout_cache * new_domain_record, int * old_domain_res)
{
*/
static void
cache_callout_write(dbdata_callout_cache * dom_rec, const uschar * domain,
- int done, dbdata_callout_cache_address * addr_rec, uschar * address_key)
+ int done, dbdata_callout_cache_address * addr_rec, const uschar * address_key)
{
open_db dbblock;
-open_db *dbm_file = NULL;
+open_db * dbm_file = NULL;
/* If we get here with done == TRUE, a successful callout happened, and yield
will be set OK or FAIL according to the response to the RCPT command.
int yield = OK;
int old_domain_cache_result = ccache_accept;
BOOL done = FALSE;
-uschar *address_key;
-uschar *from_address;
-uschar *random_local_part = NULL;
-const uschar *save_deliver_domain = deliver_domain;
-uschar **failure_ptr = options & vopt_is_recipient
+const uschar * address_key;
+const uschar * from_address;
+uschar * random_local_part = NULL;
+const uschar * save_deliver_domain = deliver_domain;
+uschar ** failure_ptr = options & vopt_is_recipient
? &recipient_verify_failure : &sender_verify_failure;
dbdata_callout_cache new_domain_record;
dbdata_callout_cache_address new_address_record;
if (random_local_part)
{
- uschar * main_address = addr->address;
+ const uschar * main_address = addr->address;
const uschar * rcpt_domain = addr->domain;
#ifdef SUPPORT_I18N
if (done)
{
- uschar * main_address = addr->address;
+ const uschar * main_address = addr->address;
/*XXX oops, affixes */
addr->address = string_sprintf("postmaster@%.1000s", addr->domain);
static BOOL
-_cutthrough_puts(uschar * cp, int n)
+_cutthrough_puts(const uschar * cp, int n)
{
while(n--)
{
/* Buffered output of counted data block. Return boolean success */
static BOOL
-cutthrough_puts(uschar * cp, int n)
+cutthrough_puts(const uschar * cp, int n)
{
if (cutthrough.cctx.sock < 0) return TRUE;
if (_cutthrough_puts(cp, n)) return TRUE;
/* tctx arg only to match write_chunk() */
static BOOL
-cutthrough_write_chunk(transport_ctx * tctx, uschar * s, int len)
+cutthrough_write_chunk(transport_ctx * tctx, const uschar * s, int len)
{
-uschar * s2;
+const uschar * s2;
while(s && (s2 = Ustrchr(s, '\n')))
{
if(!cutthrough_puts(s, s2-s) || !cutthrough_put_nl())
int verify_type = expn ? v_expn :
f.address_test_mode ? v_none :
options & vopt_is_recipient ? v_recipient : v_sender;
-address_item *addr_list;
-address_item *addr_new = NULL;
-address_item *addr_remote = NULL;
-address_item *addr_local = NULL;
-address_item *addr_succeed = NULL;
-uschar **failure_ptr = options & vopt_is_recipient
+address_item * addr_list;
+address_item * addr_new = NULL;
+address_item * addr_remote = NULL;
+address_item * addr_local = NULL;
+address_item * addr_succeed = NULL;
+uschar ** failure_ptr = options & vopt_is_recipient
? &recipient_verify_failure : &sender_verify_failure;
-uschar *ko_prefix, *cr;
-uschar *address = vaddr->address;
-uschar *save_sender;
+uschar * ko_prefix, * cr;
+const uschar * address = vaddr->address;
+const uschar * save_sender;
uschar null_sender[] = { 0 }; /* Ensure writeable memory */
/* Clear, just in case */
if (global_rewrite_rules)
{
- uschar *old = address;
- /* deconst ok as address was not const */
- address = US rewrite_address(address, options & vopt_is_recipient, FALSE,
+ const uschar * old = address;
+ address = rewrite_address(address, options & vopt_is_recipient, FALSE,
global_rewrite_rules, rewrite_existflags);
if (address != old)
{
if (tf.hosts && (!host_list || tf.hosts_override))
{
uschar *s;
- const uschar *save_deliver_domain = deliver_domain;
- uschar *save_deliver_localpart = deliver_localpart;
+ const uschar * save_deliver_domain = deliver_domain;
+ const uschar * save_deliver_localpart = deliver_localpart;
host_list = NULL; /* Ignore the router's hosts */
for (int i = 0; i < recipients_count; i++)
{
BOOL found = FALSE;
- uschar *address = recipients_list[i].address;
+ const uschar * address = recipients_list[i].address;
for (header_line * h = header_list; !found && h; h = h->next)
{
- uschar *colon, *s;
+ uschar * colon, * s;
if (h->type != htype_to && h->type != htype_cc) continue;
*/
address_item *
-verify_checked_sender(uschar *sender)
+verify_checked_sender(const uschar * sender)
{
for (address_item * addr = sender_verified_list; addr; addr = addr->next)
if (Ustrcmp(sender, addr->address) == 0) return addr;