*/
int
-deliver_message(uschar * id, BOOL forced, BOOL give_up)
+deliver_message(const uschar * id, BOOL forced, BOOL give_up)
{
int i, rc;
int final_yield = DELIVER_ATTEMPTED_NORMAL;
*/
static void
-exim_usage(uschar *progname)
+exim_usage(const uschar * progname)
{
/* Handle specific program invocation variants */
*/
int
-main(int argc, char **cargv)
+main(int argc, char ** cargv)
{
-uschar **argv = USS cargv;
+const uschar ** argv = CUSS cargv;
int arg_receive_timeout = -1;
int arg_smtp_receive_timeout = -1;
int arg_error_handling = error_handling;
BOOL verify_as_sender = FALSE;
BOOL rcpt_verify_quota = FALSE;
BOOL version_printed = FALSE;
-uschar *alias_arg = NULL;
-uschar *called_as = US"";
-uschar *cmdline_syslog_name = NULL;
-uschar *start_queue_run_id = NULL;
-uschar *stop_queue_run_id = NULL;
-uschar *expansion_test_message = NULL;
+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;
-uschar *malware_test_file = NULL;
+const uschar *malware_test_file = NULL;
uschar *real_sender_address;
uschar *originator_home = US"/";
size_t sz;
for (i = 1; i < argc; i++)
{
BOOL badarg = FALSE;
- uschar * arg = argv[i];
- uschar * argrest;
+ const uschar * arg = argv[i];
+ const uschar * argrest;
uschar switchchar;
/* An argument not starting with '-' is the start of a recipients list;
case 'I':
if (Ustrlen(argrest) >= 1 && *argrest == ':')
{
- uschar *p = argrest+1;
+ const uschar * p = argrest+1;
info_flag = CMDINFO_HELP;
if (Ustrlen(p))
if (strcmpic(p, CUS"sieve") == 0)
#else
{
int ptr = 0;
- macro_item *m;
+ macro_item * m;
uschar name[24];
- uschar *s = argrest;
+ const uschar * s = argrest;
opt_D_used = TRUE;
while (isspace(*s)) s++;
*(sender_address = store_get(1, GET_UNTAINTED)) = '\0'; /* Ensure writeable memory */
else
{
- uschar * temp = argrest + Ustrlen(argrest) - 1;
+ const uschar * temp = argrest + Ustrlen(argrest) - 1;
while (temp >= argrest && isspace(*temp)) temp--;
if (temp >= argrest && *temp == '.') f_end_dot = TRUE;
allow_domain_literals = TRUE;
/* -oB: Set a connection message max value for remote deliveries */
case 'B':
{
- uschar * p = argrest;
+ const uschar * p = argrest;
if (!*p)
if (i+1 < argc && isdigit((argv[i+1][0])))
p = argv[++i];
if (bi_command && *bi_command)
{
int i = 0;
- uschar *argv[3];
+ const uschar * argv[3];
argv[i++] = bi_command; /* nonexpanded option so assume untainted */
if (alias_arg) argv[i++] = alias_arg;
argv[i++] = NULL;
exim_fail("exim: missing recipient for quota check\n");
else
{
- verify_quota(argv[recipients_arg]);
+ verify_quota(US argv[recipients_arg]); /*XXX we lose track of const here */
exim_exit(EXIT_SUCCESS);
}
{
int rcount = 0;
int count = argc - recipients_arg;
- uschar **list = argv + recipients_arg;
+ const uschar ** list = argv + recipients_arg;
/* These options cannot be changed dynamically for non-SMTP messages */
*/
BOOL
-filter_runtest(int fd, uschar *filename, BOOL is_system, BOOL dot_ended)
+filter_runtest(int fd, const uschar * filename, BOOL is_system, BOOL dot_ended)
{
int rc, filter_type;
BOOL yield;
extern void deliver_local(address_item *, BOOL);
extern address_item *deliver_make_addr(uschar *, BOOL);
extern void delivery_log(int, address_item *, int, uschar *);
-extern int deliver_message(uschar *, BOOL, BOOL);
+extern int deliver_message(const uschar *, BOOL, BOOL);
extern void deliver_msglog(const char *, ...) PRINTF_FUNCTION(1,2);
extern void deliver_set_expansions(address_item *);
extern int deliver_split_address(address_item *);
extern int filter_interpret(const uschar *, int, address_item **, uschar **);
extern BOOL filter_personal(string_item *, BOOL);
-extern BOOL filter_runtest(int, uschar *, BOOL, BOOL);
+extern BOOL filter_runtest(int, const uschar *, BOOL, BOOL);
extern BOOL filter_system_interpret(address_item **, uschar **);
extern uschar * fn_hdrs_added(void);
extern void mainlog_close(void);
#ifdef WITH_CONTENT_SCAN
extern int malware(const uschar *, BOOL, int);
-extern int malware_in_file(uschar *);
+extern int malware_in_file(const uschar *);
extern void malware_init(void);
extern gstring * malware_show_supported(gstring *);
#endif
extern void proxy_protocol_setup(void);
#endif
-extern BOOL queue_action(uschar *, int, uschar **, int, int);
+extern BOOL queue_action(const uschar *, int, const uschar **, int, int);
extern void queue_check_only(void);
extern unsigned queue_count(void);
extern unsigned queue_count_cached(void);
-extern void queue_list(int, uschar **, int);
+extern void queue_list(int, const uschar **, int);
#ifndef DISABLE_QUEUE_RAMP
extern void queue_notify_daemon(const uschar * hostname);
#endif
-extern void queue_run(qrunner *, uschar *, uschar *, BOOL);
+extern void queue_run(qrunner *, const uschar *, const uschar *, BOOL);
extern int random_number(int);
extern const uschar *rc_to_string(int);
extern uschar *readconf_find_option(void *);
extern void readconf_main(BOOL);
extern void readconf_options_from_list(optionlist *, unsigned, const uschar *, uschar *);
-extern BOOL readconf_print(const uschar *, uschar *, BOOL);
+extern BOOL readconf_print(const uschar *, const uschar *, BOOL);
extern uschar *readconf_printtime(int);
extern const uschar *readconf_readname(uschar *, int, const uschar *);
extern int readconf_readtime(const uschar *, int, BOOL);
const uschar *, const uschar *, const uschar *,
address_item **, uschar **);
extern void sigalrm_handler(int);
-extern void single_queue_run(qrunner *, uschar *, uschar *);
+extern void single_queue_run(qrunner *, const uschar *, const uschar *);
extern int smtp_boundsock(smtp_connect_args *);
extern void smtp_closedown(uschar *);
extern void smtp_command_timeout_exit(void) NORETURN;
extern FILE *spool_mbox(unsigned long *, const uschar *, uschar **);
#endif
extern void spool_clear_header_globals(void);
-extern BOOL spool_move_message(uschar *, uschar *, uschar *, uschar *);
-extern int spool_open_datafile(uschar *);
+extern BOOL spool_move_message(const uschar *, const uschar *, const uschar *, const uschar *);
+extern int spool_open_datafile(const uschar *);
extern int spool_open_temp(uschar *);
extern int spool_read_header(uschar *, BOOL, BOOL);
extern uschar *spool_sender_from_msgid(const uschar *);
-extern int spool_write_header(uschar *, int, uschar **);
+extern int spool_write_header(const uschar *, int, uschar **);
extern int stdin_getc(unsigned);
extern int stdin_feof(void);
extern int stdin_ferror(void);
# endif
static inline uschar *
-spool_q_sname(const uschar * purpose, const uschar * q, uschar * subdir)
+spool_q_sname(const uschar * purpose, const uschar * q, const uschar * subdir)
{
return string_sprintf("%s%s%s%s%s",
q, *q ? "/" : "",
}
static inline uschar *
-spool_sname(const uschar * purpose, uschar * subdir)
+spool_sname(const uschar * purpose, const uschar * subdir)
{
return spool_q_sname(purpose, queue_name, subdir);
}
#else
gid_t config_gid = 0;
#endif
-uschar *config_main_filelist = US CONFIGURE_FILE
+const uschar * config_main_filelist = US CONFIGURE_FILE
"\0<-----------Space to patch configure_filename->";
uschar *config_main_filename = NULL;
uschar *config_main_directory = NULL;
int filter_n[FILTER_VARIABLE_COUNT];
int filter_sn[FILTER_VARIABLE_COUNT];
int filter_test = FTEST_NONE;
-uschar *filter_test_sfile = NULL;
-uschar *filter_test_ufile = NULL;
+const uschar * filter_test_sfile = NULL;
+const uschar * filter_test_ufile = NULL;
uschar *filter_thisaddress = NULL;
int finduser_retries = 0;
uid_t fixed_never_users[] = { FIXED_NEVER_USERS };
int message_utf8_downconvert = 0; /* -1 ifneeded; 0 never; 1 always */
#endif
uschar message_subdir[2] = { 0, 0 };
-uschar *message_reference = NULL;
+const uschar *message_reference= NULL;
/* MIME ACL expandables */
#ifdef WITH_CONTENT_SCAN
uschar *originator_name = NULL;
uid_t originator_uid;
uschar *override_local_interfaces = NULL;
-uschar *override_pid_file_path = NULL;
+const uschar *override_pid_file_path = NULL;
BOOL panic_coredump = FALSE;
pcre2_general_context * pcre_gen_ctx = NULL;
pcre2_compile_context * pcre_mlc_cmp_ctx = NULL;
uschar *percent_hack_domains = NULL;
-uschar *pid_file_path = US PID_FILE_PATH
+const uschar *pid_file_path = US PID_FILE_PATH
"\0<--------------Space to patch pid_file_path->";
#ifndef DISABLE_PIPE_CONNECT
uschar *pipe_connect_advertise_hosts = US"*";
int sending_port = -1;
SIGNAL_BOOL sigalrm_seen = FALSE;
const uschar *sigalarm_setter = NULL;
-uschar **sighup_argv = NULL;
+const uschar **sighup_argv = NULL;
int slow_lookup_log = 0; /* millisecs, zero disables */
int smtp_accept_count = 0;
int smtp_accept_max = 20;
const uschar *submission_domain = NULL;
const uschar *submission_name = NULL;
int syslog_facility = LOG_MAIL;
-uschar *syslog_processname = US"exim";
+const uschar *syslog_processname= US"exim";
uschar *system_filter = NULL;
uschar *system_filter_directory_transport = NULL;
extern const uschar *config_filename; /* Configuration file name */
extern gid_t config_gid; /* Additional group owner */
extern int config_lineno; /* Line number */
-extern uschar *config_main_filelist; /* List of possible config files */
+extern const uschar *config_main_filelist; /* List of possible config files */
extern uschar *config_main_filename; /* File name actually used */
extern uschar *config_main_directory; /* Directory where the main config file was found */
extern uid_t config_uid; /* Additional owner */
extern int filter_n[FILTER_VARIABLE_COUNT]; /* filter variables */
extern int filter_sn[FILTER_VARIABLE_COUNT]; /* variables set by system filter */
extern int filter_test; /* Filter test type */
-extern uschar *filter_test_sfile; /* System filter test file */
-extern uschar *filter_test_ufile; /* User filter test file */
+extern const uschar *filter_test_sfile;/* System filter test file */
+extern const uschar *filter_test_ufile;/* User filter test file */
extern uschar *filter_thisaddress; /* For address looping */
extern int finduser_retries; /* Retry count for getpwnam() */
extern uid_t fixed_never_users[]; /* Can't be overridden */
const extern pcre2_code *regex_UTF8; /* For recognizing SMTPUTF8 settings */
#endif
extern uschar message_subdir[]; /* Subdirectory for messages */
-extern uschar *message_reference; /* Reference for error messages */
+extern const uschar *message_reference;/* Reference for error messages */
/* MIME ACL expandables */
#ifdef WITH_CONTENT_SCAN
extern uschar *originator_name; /* Full name of same */
extern uid_t originator_uid; /* Uid of ditto */
extern uschar *override_local_interfaces; /* Value of -oX argument */
-extern uschar *override_pid_file_path; /* Value of -oP argument */
+extern const uschar *override_pid_file_path; /* Value of -oP argument */
extern BOOL panic_coredump; /* SEGV rather than exit, on LOG_PANIC_DIE */
extern pcre2_general_context * pcre_gen_ctx; /* pcre memory management */
extern pcre2_compile_context * pcre_mlc_cmp_ctx;
extern uschar *percent_hack_domains; /* Local domains for which '% operates */
-extern uschar *pid_file_path; /* For writing daemon pids */
+extern const uschar *pid_file_path; /* For writing daemon pids */
#ifndef DISABLE_PIPE_CONNECT
extern uschar *pipe_connect_advertise_hosts; /* for banner/EHLO pipelining */
#endif
extern int sending_port; /* Port of outgoing interface */
extern SIGNAL_BOOL sigalrm_seen; /* Flag for sigalrm_handler */
extern const uschar *sigalarm_setter; /* For debug, set to callpoint of alarm() */
-extern uschar **sighup_argv; /* Args for re-execing after SIGHUP */
+extern const uschar **sighup_argv; /* Args for re-execing after SIGHUP */
extern int slow_lookup_log; /* Log DNS lookups taking longer than N millisecs */
extern int smtp_accept_count; /* Count of connections */
extern BOOL smtp_accept_keepalive; /* Set keepalive on incoming */
extern BOOL syslog_duplication; /* FALSE => no duplicate logging */
extern int syslog_facility; /* As defined by Syslog.h */
extern BOOL syslog_pid; /* TRUE if PID on syslogs */
-extern uschar *syslog_processname; /* 'ident' param to openlog() */
+extern const uschar *syslog_processname; /* 'ident' param to openlog() */
extern BOOL syslog_timestamp; /* TRUE if time on syslogs */
extern uschar *system_filter; /* Name of system filter file */
where true means malware was found (condition applies)
*/
int
-malware_in_file(uschar *eml_filename)
+malware_in_file(const uschar * eml_filename)
{
uschar message_id_buf[64];
int ret;
*/
void
-queue_run(qrunner * q, uschar * start_id, uschar * stop_id, BOOL recurse)
+queue_run(qrunner * q, const uschar * start_id, const uschar * stop_id, BOOL recurse)
{
BOOL force_delivery = q->queue_run_force
|| deliver_selectstring || deliver_selectstring_sender;
void
-single_queue_run(qrunner * q, uschar * start_id, uschar * stop_id)
+single_queue_run(qrunner * q, const uschar * start_id, const uschar * stop_id)
{
DEBUG(D_queue_run) debug_printf("Single queue run%s%s%s%s\n",
start_id ? US" starting at " : US"",
*/
void
-queue_list(int option, uschar ** list, int count)
+queue_list(int option, const uschar ** list, int count)
{
int subcount;
int now = (int)time(NULL);
*/
BOOL
-queue_action(uschar * id, int action, uschar ** argv, int argc,
+queue_action(const uschar * id, int action, const uschar ** argv, int argc,
int recipients_arg)
{
BOOL yield = TRUE;
*/
BOOL
-readconf_print(const uschar *name, uschar *type, BOOL no_labels)
+readconf_print(const uschar * name, const uschar * type, BOOL no_labels)
{
BOOL names_only = FALSE;
optionlist *ol2 = NULL;
{
int sep = 0;
struct stat statbuf;
-uschar *s, *filename;
-const uschar *list = config_main_filelist;
+uschar * s, * filename;
+const uschar * list = config_main_filelist;
/* Loop through the possible file names */
if (syslog_facility_str)
{
int i;
- uschar *s = syslog_facility_str;
+ uschar * s = syslog_facility_str;
if ((Ustrlen(syslog_facility_str) >= 4) &&
(strncmpic(syslog_facility_str, US"log_", 4) == 0))
if (*pid_file_path)
{
- if (!(s = expand_string(pid_file_path)))
+ const uschar * t = expand_cstring(pid_file_path);
+ if (!t)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to expand pid_file_path "
"\"%s\": %s", pid_file_path, expand_string_message);
- pid_file_path = s;
+ pid_file_path = t;
}
/* Set default value of process_log_path */
*/
int
-spool_open_datafile(uschar * id)
+spool_open_datafile(const uschar * id)
{
struct stat statbuf;
flock_t lock_data;
*/
int
-spool_write_header(uschar * id, int where, uschar ** errmsg)
+spool_write_header(const uschar * id, int where, uschar ** errmsg)
{
int fd, size_correction;
FILE * fp;
Arguments:
dir base directory name
- dq destiinationqueue name
+ dq destination queue name
subdir subdirectory name
id message id
suffix suffix to add to id
*/
static BOOL
-make_link(uschar * dir, uschar * dq, uschar * subdir, uschar * id, uschar * suffix,
- uschar * from, uschar * to, BOOL noentok)
+make_link(const uschar * dir, const uschar * dq, const uschar * subdir, const uschar * id,
+ const uschar * suffix, const uschar * from, const uschar * to, BOOL noentok)
{
uschar * fname = spool_fname(string_sprintf("%s%s", from, dir), subdir, id, suffix);
uschar * tname = spool_q_fname(string_sprintf("%s%s", to, dir), dq, subdir, id, suffix);
*/
static BOOL
-break_link(uschar * dir, uschar * subdir, uschar * id, uschar * suffix, uschar * from,
- BOOL noentok)
+break_link(const uschar * dir, const uschar * subdir, const uschar * id,
+ const uschar * suffix, const uschar * from, BOOL noentok)
{
uschar * fname = spool_fname(string_sprintf("%s%s", from, dir), subdir, id, suffix);
if (Uunlink(fname) < 0 && (!noentok || errno != ENOENT))
*/
BOOL
-spool_move_message(uschar * id, uschar * subdir, uschar * from, uschar * to)
+spool_move_message(const uschar * id, const uschar * subdir,
+ const uschar * from, const uschar * to)
{
uschar * dest_qname = queue_name_dest ? queue_name_dest : queue_name;