#include <grp.h>
typedef struct {
- char *name;
+ const char *name;
int *flag;
} have_item;
typedef struct {
- char *name;
+ const char *name;
char *data;
} save_item;
-static char *db_opts[] = { "", "USE_DB", "USE_GDBM", "USE_TDB" };
+static const char *db_opts[] = { "", "USE_DB", "USE_GDBM", "USE_TDB" };
static int have_ipv6 = 0;
static int have_iconv = 0;
int isgroup = name[10] == 'G';
uid_t uid = 0;
gid_t gid = 0;
- char *s;
- char *username = NULL;
- char *user = getenv(name);
+ const char *s;
+ const char *username = NULL;
+ const char *user = getenv(name);
if (user == NULL) user = "";
while (isspace((unsigned char)(*user))) user++;
while (isspace(*user)) user++;
username = user;
}
-
- else if (isgroup)
+else if (isgroup)
{
struct group *gr = getgrnam(user);
if (gr == NULL)
we save up the text until we do get the newline. */
void
-debug_printf(char *format, ...)
+debug_printf(const char *format, ...)
{
va_list ap;
va_start(ap, format);
}
void
-debug_vprintf(char *format, va_list ap)
+debug_vprintf(const char *format, va_list ap)
{
if (debug_file == NULL) return;
*/
BOOL
-directory_make(uschar *parent, uschar *name, int mode, BOOL panic)
+directory_make(const uschar *parent, const uschar *name,
+ int mode, BOOL panic)
{
BOOL use_chown = parent == spool_directory && geteuid() == root_uid;
-uschar *p, *slash;
+uschar *p;
+const uschar *slash;
int c = 1;
struct stat statbuf;
uschar buffer[256];
if (parent == NULL)
{
p = buffer + 1;
- slash = parent = US"";
+ slash = parent = CUS"";
}
else
{
int pathnamelen = len + (int)strlen(LOOKUP_MODULE_DIR) + 2;
void *dl;
struct lookup_module_info *info;
- char *errormsg;
+ const char *errormsg;
/* SRH: am I being paranoid here or what? */
if (pathnamelen > big_buffer_size) {
*/
void
-set_process_info(char *format, ...)
+set_process_info(const char *format, ...)
{
int len;
va_list ap;
*/
FILE *
-modefopen(uschar *filename, char *options, mode_t mode)
+modefopen(const uschar *filename, const char *options, mode_t mode)
{
mode_t saved_umask = umask(0777);
FILE *f = Ufopen(filename, options);
*/
static void *
-set_readline(char * (**fn_readline_ptr)(char *),
- char * (**fn_addhist_ptr)(char *))
+set_readline(char * (**fn_readline_ptr)(const char *),
+ void (**fn_addhist_ptr)(const char *))
{
void *dlhandle;
void *dlhandle_curses = dlopen("libcurses.so", RTLD_GLOBAL|RTLD_LAZY);
if (dlhandle != NULL)
{
- *fn_readline_ptr = (char *(*)(char*))dlsym(dlhandle, "readline");
- *fn_addhist_ptr = (char *(*)(char*))dlsym(dlhandle, "add_history");
+ /* Checked manual pages; at least in GNU Readline 6.1, the prototypes are:
+ * char * readline (const char *prompt);
+ * void add_history (const char *string);
+ */
+ *fn_readline_ptr = (char *(*)(const char*))dlsym(dlhandle, "readline");
+ *fn_addhist_ptr = (void(*)(const char*))dlsym(dlhandle, "add_history");
}
else
{
*/
static uschar *
-get_stdinput(char *(*fn_readline)(char *), char *(*fn_addhist)(char *))
+get_stdinput(char *(*fn_readline)(const char *), void(*fn_addhist)(const char *))
{
int i;
int size = 0;
else
{
- char *(*fn_readline)(char *) = NULL;
- char *(*fn_addhist)(char *) = NULL;
+ char *(*fn_readline)(const char *) = NULL;
+ void (*fn_addhist)(const char *) = NULL;
#ifdef USE_READLINE
void *dlhandle = set_readline(&fn_readline, &fn_addhist);
/* This is global because it's defined in the headers and compilers grumble
if it is made static. */
-uschar *hex_digits = US"0123456789abcdef";
+const uschar *hex_digits = CUS"0123456789abcdef";
#ifdef STRERROR_FROM_ERRLIST
BOOL restore_times = FALSE;
char *filename;
char *lockname = NULL, *hitchname = NULL;
-char *primary_hostname, *command;
+char *primary_hostname;
+const char *command;
struct utsname s;
char buffer[256];
char tempname[256];
/* Type for main variable table */
typedef struct {
- char *name;
- int type;
- void *value;
+ const char *name;
+ int type;
+ void *value;
} var_entry;
/* Type for entries pointing to address/length pairs. Not currently
/* For textual hashes */
-static char *hashcodes = "abcdefghijklmnopqrtsuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789";
+static const char *hashcodes = "abcdefghijklmnopqrtsuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789";
enum { HMAC_MD5, HMAC_SHA1 };
one (it can have \n anywhere). Then the file names and once_repeat, which may
not contain \n. */
-static char *mailargs[] = { /* "to" must be first, and */
- "to", /* "cc" and "bcc" must follow */
+static const char *mailargs[] = { /* "to" must be first, and */
+ "to", /* "cc" and "bcc" must follow */
"cc",
"bcc",
"from",
cond_above, cond_below, cond_errormsg, cond_firsttime,
cond_manualthaw, cond_foranyaddress };
-static char *cond_names[] = {
+static const char *cond_names[] = {
"and", "or", "personal",
"begins", "BEGINS", "ends", "ENDS",
"is", "IS", "matches", "MATCHES", "contains",
"CONTAINS", "delivered", "above", "below", "error_message",
"first_delivery", "manually_thawed", "foranyaddress" };
-static char *cond_not_names[] = {
+static const char *cond_not_names[] = {
"", "", "not personal",
"does not begin", "does not BEGIN",
"does not end", "does not END",
/* Tables of binary condition words and their corresponding types. Not easy
to amalgamate with the above because of the different variants. */
-static char *cond_words[] = {
+static const char *cond_words[] = {
"BEGIN",
"BEGINS",
"CONTAIN",
mail_command, noerror_command, pipe_command, save_command, seen_command,
testprint_command, unseen_command, vacation_command };
-static char *command_list[] = {
+static const char *command_list[] = {
"add", "defer", "deliver", "elif", "else", "endif", "finish",
"fail", "freeze", "headers", "if", "logfile", "logwrite", "mail",
"noerror", "pipe", "save", "seen", "testprint", "unseen", "vacation"
static void
print_condition(condition_block *c, BOOL toplevel)
{
-char *name = (c->testfor)? cond_names[c->type] : cond_not_names[c->type];
+const char *name = (c->testfor)? cond_names[c->type] : cond_not_names[c->type];
switch(c->type)
{
case cond_personal:
case cond_ENDS:
case cond_above:
case cond_below:
- debug_printf("%s %s %s", c->left.u, (char *)name, c->right.u);
+ debug_printf("%s %s %s", c->left.u, name, c->right.u);
break;
case cond_and:
extern void debug_print_ids(uschar *);
extern void debug_print_string(uschar *);
extern void debug_print_tree(tree_node *);
-extern void debug_vprintf(char *, va_list);
+extern void debug_vprintf(const char *, va_list);
extern void decode_bits(unsigned int *, unsigned int *,
int, int, uschar *, bit_table *, int, uschar *, int);
extern address_item *deliver_make_addr(uschar *, BOOL);
#ifdef WITH_OLD_DEMIME
extern int demime(uschar **);
#endif
-extern BOOL directory_make(uschar *, uschar *, int, BOOL);
+extern BOOL directory_make(const uschar *, const uschar *, int, BOOL);
#ifndef DISABLE_DKIM
extern BOOL dkim_transport_write_message(address_item *, int, int,
int, uschar *, uschar *, uschar *, uschar *, rewrite_rule *,
extern BOOL filter_runtest(int, uschar *, BOOL, BOOL);
extern BOOL filter_system_interpret(address_item **, uschar **);
-extern void header_add(int, char *, ...);
+extern void header_add(int, const char *, ...);
extern int header_checkname(header_line *, BOOL);
extern BOOL header_match(uschar *, BOOL, BOOL, string_item *, int, ...);
extern int host_address_extract_port(uschar *);
extern uschar *moan_check_errorcopy(uschar *);
extern BOOL moan_skipped_syntax_errors(uschar *, error_block *, uschar *,
BOOL, uschar *);
-extern void moan_smtp_batch(uschar *, char *, ...);
-extern void moan_tell_someone(uschar *, address_item *, uschar *, char *,
- ...);
+extern void moan_smtp_batch(uschar *, const char *, ...);
+extern void moan_tell_someone(uschar *, address_item *,
+ const uschar *, const char *, ...);
extern BOOL moan_to_sender(int, error_block *, header_line *, FILE *, BOOL);
extern void moan_write_from(FILE *);
-extern FILE *modefopen(uschar *, char *, mode_t);
+extern FILE *modefopen(const uschar *, const char *, mode_t);
extern uschar *parse_extract_address(uschar *, uschar **, int *, int *, int *,
BOOL);
int *);
extern void *search_open(uschar *, int, int, uid_t *, gid_t *);
extern void search_tidyup(void);
-extern void set_process_info(char *, ...);
+extern void set_process_info(const char *, ...);
extern void sha1_end(sha1 *, const uschar *, int, uschar *);
extern void sha1_mid(sha1 *, const uschar *);
extern void sha1_start(sha1 *);
extern BOOL smtp_start_session(void);
extern int smtp_ungetc(int);
extern BOOL smtp_verify_helo(void);
-extern int smtp_write_command(smtp_outblock *, BOOL, char *, ...);
+extern int smtp_write_command(smtp_outblock *, BOOL, const char *, ...);
#ifdef WITH_CONTENT_SCAN
extern int spam(uschar **);
extern FILE *spool_mbox(unsigned long *, uschar *);
extern uschar *string_copylc(uschar *);
extern uschar *string_copynlc(uschar *, int);
extern uschar *string_dequote(uschar **);
-extern BOOL string_format(uschar *, int, char *, ...);
+extern BOOL string_format(uschar *, int, const char *, ...);
extern uschar *string_format_size(int, uschar *);
extern int string_interpret_escape(uschar **);
extern int string_is_ip_address(uschar *, int *);
extern uschar *string_log_address(address_item *, BOOL, BOOL);
extern uschar *string_nextinlist(uschar **, int *, uschar *, int);
-extern uschar *string_open_failed(int, char *, ...);
+extern uschar *string_open_failed(int, const char *, ...);
extern uschar *string_printing2(uschar *, BOOL);
extern uschar *string_split_message(uschar *);
-extern BOOL string_vformat(uschar *, int, char *, va_list);
-extern int strcmpic(uschar *, uschar *);
-extern int strncmpic(uschar *, uschar *, int);
+extern BOOL string_vformat(uschar *, int, const char *, va_list);
+extern int strcmpic(const uschar *, const uschar *);
+extern int strncmpic(const uschar *, const uschar *, int);
extern uschar *strstric(uschar *, uschar *, BOOL);
extern uschar *tod_stamp(int);
address_item *, uschar *, uschar **);
extern void transport_update_waiting(host_item *, uschar *);
extern BOOL transport_write_block(int, uschar *, int);
-extern BOOL transport_write_string(int, char *, ...);
+extern BOOL transport_write_string(int, const char *, ...);
extern BOOL transport_write_message(address_item *, int, int, int, uschar *,
uschar *, uschar *, uschar *, rewrite_rule *, int);
extern void tree_add_duplicate(uschar *, address_item *);
BOOL helo_verified = FALSE;
BOOL helo_verify_failed = FALSE;
uschar *helo_verify_hosts = NULL;
-uschar *hex_digits = US"0123456789abcdef";
+const uschar *hex_digits = CUS"0123456789abcdef";
uschar *hold_domains = NULL;
BOOL host_checking = FALSE;
BOOL host_checking_callout = FALSE;
/* MIME ACL expandables */
#ifdef WITH_CONTENT_SCAN
int mime_anomaly_level = 0;
-uschar *mime_anomaly_text = NULL;
+const uschar *mime_anomaly_text = NULL;
uschar *mime_boundary = NULL;
uschar *mime_charset = NULL;
uschar *mime_content_description = NULL;
extern BOOL helo_verified; /* True if HELO verified */
extern BOOL helo_verify_failed; /* True if attempt failed */
extern uschar *helo_verify_hosts; /* Hard check HELO argument for these */
-extern uschar *hex_digits; /* Used in several places */
+extern const uschar *hex_digits; /* Used in several places */
extern uschar *hold_domains; /* Hold up deliveries to these */
extern BOOL host_find_failed_syntax;/* DNS syntax check failure */
extern BOOL host_checking_callout; /* TRUE if real callout wanted */
/* MIME ACL expandables */
#ifdef WITH_CONTENT_SCAN
extern int mime_anomaly_level;
-extern uschar *mime_anomaly_text;
+extern const uschar *mime_anomaly_text;
extern uschar *mime_boundary;
extern uschar *mime_charset;
extern uschar *mime_content_description;
*/
BOOL
-header_testname(header_line *h, uschar *name, int len, BOOL notdel)
+header_testname(header_line *h, const uschar *name, int len, BOOL notdel)
{
uschar *tt;
if (h->type == '*' && notdel) return FALSE;
header_testname() above. */
BOOL
-header_testname_incomplete(header_line *h, uschar *name, int len, BOOL notdel)
+header_testname_incomplete(header_line *h, const uschar *name,
+ int len, BOOL notdel)
{
if (h->type == '*' && notdel) return FALSE;
if (h->text == NULL || strncmpic(h->text, name, len) != 0) return FALSE;
static void
header_add_backend(BOOL after, uschar *name, BOOL topnot, int type,
- char *format, va_list ap)
+ const char *format, va_list ap)
{
header_line *h, *new;
header_line **hptr;
void
header_add_at_position(BOOL after, uschar *name, BOOL topnot, int type,
- char *format, ...)
+ const char *format, ...)
{
va_list ap;
va_start(ap, format);
*/
void
-header_add(int type, char *format, ...)
+header_add(int type, const char *format, ...)
{
va_list ap;
va_start(ap, format);
*/
void
-header_remove(int occ, uschar *name)
+header_remove(int occ, const uschar *name)
{
header_line *h;
int hcount = 0;
/* Entries in lists options are in this form. */
typedef struct {
- char *name;
- int type;
- void *value;
+ const char *name;
+ int type;
+ void *value;
} optionlist;
/*Structure for holding information about an envelope address. The errors_to
extern pid_t child_open(uschar **, uschar **, int, int *, int *, BOOL);
extern pid_t child_open_exim(int *);
extern pid_t child_open_exim2(int *, uschar *, uschar *);
-extern void debug_printf(char *, ...) PRINTF_FUNCTION(1,2);
+extern void debug_printf(const char *, ...) PRINTF_FUNCTION(1,2);
extern uschar *expand_string(uschar *);
-extern void header_add(int, char *, ...);
-extern void header_add_at_position(BOOL, uschar *, BOOL, int, char *, ...);
-extern void header_remove(int, uschar *);
-extern BOOL header_testname(header_line *, uschar *, int, BOOL);
-extern BOOL header_testname_incomplete(header_line *, uschar *, int, BOOL);
-extern void log_write(unsigned int, int, char *format, ...);
+extern void header_add(int, const char *, ...);
+extern void header_add_at_position(BOOL, uschar *, BOOL, int, const char *, ...);
+extern void header_remove(int, const uschar *);
+extern BOOL header_testname(header_line *, const uschar *, int, BOOL);
+extern BOOL header_testname_incomplete(header_line *, const uschar *, int, BOOL);
+extern void log_write(unsigned int, int, const char *format, ...);
extern int lss_b64decode(uschar *, uschar **);
extern uschar *lss_b64encode(uschar *, int);
extern int lss_match_domain(uschar *, uschar *);
extern BOOL receive_remove_recipient(uschar *);
extern uschar *rfc2047_decode(uschar *, BOOL, uschar *, int, int *, uschar **);
extern int smtp_fflush(void);
-extern void smtp_printf(char *, ...) PRINTF_FUNCTION(1,2);
-extern void smtp_vprintf(char *, va_list);
+extern void smtp_printf(const char *, ...) PRINTF_FUNCTION(1,2);
+extern void smtp_vprintf(const char *, va_list);
extern uschar *string_copy(uschar *);
extern uschar *string_copyn(uschar *, int);
-extern uschar *string_sprintf(char *, ...);
+extern uschar *string_sprintf(const char *, ...);
/* End of local_scan.h */
*/
void
-log_write(unsigned int selector, int flags, char *format, ...)
+log_write(unsigned int selector, int flags, const char *format, ...)
{
uschar *ptr;
int length, rc;
/* Table of recognized DNS record types and their integer values. */
-static char *type_names[] = {
+static const char *type_names[] = {
"a",
#if HAVE_IPV6
"aaaa",
int
lf_check_file(int fd, uschar *filename, int s_type, int modemask, uid_t *owners,
- gid_t *owngroups, char *type, uschar **errmsg)
+ gid_t *owngroups, const char *type, uschar **errmsg)
{
int i;
struct stat statbuf;
/* Header for the functions that are shared by the lookups */
-extern int lf_check_file(int, uschar *, int, int, uid_t *, gid_t *, char *,
- uschar **);
+extern int lf_check_file(int, uschar *, int, int, uid_t *, gid_t *,
+ const char *, uschar **);
extern uschar *lf_quote(uschar *, uschar *, int, uschar *, int *, int *);
extern int lf_sqlperform(uschar *, uschar *, uschar *, uschar *, uschar **,
uschar **, BOOL *, int(*)(uschar *, uschar *, uschar **,
}
}
else {
- char *drweb_s = NULL;
+ const char *drweb_s = NULL;
if (drweb_rc & DERR_READ_ERR) drweb_s = "read error";
if (drweb_rc & DERR_NOMEMORY) drweb_s = "no memory";
static int mksd_scan_packed(int sock, uschar *scan_filename)
{
struct iovec iov[3];
- char *cmd = "MSQ\n";
+ const char *cmd = "MSQ\n";
uschar av_buffer[1024];
- iov[0].iov_base = cmd;
+ iov[0].iov_base = (void *) cmd;
iov[0].iov_len = 3;
iov[1].iov_base = CS scan_filename;
iov[1].iov_len = Ustrlen(scan_filename);
- iov[2].iov_base = cmd + 3;
+ iov[2].iov_base = (void *) cmd + 3;
iov[2].iov_len = 1;
if (mksd_writev (sock, iov, 3) < 0)
give info on detected "problems" in MIME
encodings. Those are defined in mime.h. */
-void mime_set_anomaly(int level, char *text) {
+void mime_set_anomaly(int level, const char *text) {
mime_anomaly_level = level;
- mime_anomaly_text = US text;
+ mime_anomaly_text = CUS text;
}
*/
void
-moan_tell_someone(uschar *who, address_item *addr, uschar *subject,
- char *format, ...)
+moan_tell_someone(uschar *who, address_item *addr,
+ const uschar *subject, const char *format, ...)
{
FILE *f;
va_list ap;
*/
void
-moan_smtp_batch(uschar *cmd_buffer, char *format, ...)
+moan_smtp_batch(uschar *cmd_buffer, const char *format, ...)
{
va_list ap;
int yield = (receive_messagecount > 0)? 1 : 2;
signal numbers. I've been extra cautious with the ifdef's here. Probably more
than is necessary... */
-char *
-os_strsignal(int n)
+const char *
+os_strsignal(const int n)
{
switch (n)
{
exit codes into text, but this function is implemented this way so that if any
OS does have such a thing, it could be used instead of this build-in one. */
-char *
-os_strexit(int n)
+const char *
+os_strexit(const int n)
{
switch (n)
{
extern ip_address_item *os_common_find_running_interfaces(void);
#endif
-extern int os_getloadavg(void);
-extern void os_restarting_signal(int, void (*)(int));
-extern void os_non_restarting_signal(int, void (*)(int));
-extern char *os_strexit(int); /* char to match os_strsignal */
-extern char *os_strsignal(int); /* char to match strsignal in some OS */
+extern int os_getloadavg(void);
+extern void os_restarting_signal(int, void (*)(int));
+extern void os_non_restarting_signal(int, void (*)(int));
+extern const char *os_strexit(int); /* char to match os_strsignal */
+extern const char *os_strsignal(int); /* char to match strsignal in some OS */
/* End of osfunctions.h */
/*
* Write X into an opened file (or stdout if fout == NULL)
*/
-int mpi_write_file( char *p, mpi *X, int radix, FILE *fout )
+int mpi_write_file( const char *p, mpi *X, int radix, FILE *fout )
{
int n, ret;
size_t slen;
*
* \note Set fout == NULL to print X on the console.
*/
-int mpi_write_file( char *p, mpi *X, int radix, FILE *fout );
+int mpi_write_file( const char *p, mpi *X, int radix, FILE *fout );
/**
* \brief Import X from unsigned binary data, big endian
/* -------------------------------------------------------------------------- */
/* A bunch of list constants */
-char *pdkim_querymethods[] = {
+const char *pdkim_querymethods[] = {
"dns/txt",
NULL
};
-char *pdkim_algos[] = {
+const char *pdkim_algos[] = {
"rsa-sha256",
"rsa-sha1",
NULL
};
-char *pdkim_canons[] = {
+const char *pdkim_canons[] = {
"simple",
"relaxed",
NULL
};
-char *pdkim_hashes[] = {
+const char *pdkim_hashes[] = {
"sha256",
"sha1",
NULL
};
-char *pdkim_keytypes[] = {
+const char *pdkim_keytypes[] = {
"rsa",
NULL
};
typedef struct pdkim_combined_canon_entry {
- char *str;
+ const char *str;
int canon_headers;
int canon_body;
} pdkim_combined_canon_entry;
};
-char *pdkim_verify_status_str(int status) {
+const char *pdkim_verify_status_str(int status) {
switch(status) {
case PDKIM_VERIFY_NONE: return "PDKIM_VERIFY_NONE";
case PDKIM_VERIFY_INVALID: return "PDKIM_VERIFY_INVALID";
default: return "PDKIM_VERIFY_UNKNOWN";
}
}
-char *pdkim_verify_ext_status_str(int ext_status) {
+const char *pdkim_verify_ext_status_str(int ext_status) {
switch(ext_status) {
case PDKIM_VERIFY_FAIL_BODY: return "PDKIM_VERIFY_FAIL_BODY";
case PDKIM_VERIFY_FAIL_MESSAGE: return "PDKIM_VERIFY_FAIL_MESSAGE";
/* -------------------------------------------------------------------------- */
/* Print debugging functions */
#ifdef PDKIM_DEBUG
-void pdkim_quoteprint(FILE *stream, char *data, int len, int lf) {
+void pdkim_quoteprint(FILE *stream, const char *data, int len, int lf) {
int i;
- unsigned char *p = (unsigned char *)data;
+ const unsigned char *p = (const unsigned char *)data;
for (i=0;i<len;i++) {
- int c = p[i];
+ const int c = p[i];
switch (c) {
case ' ' : fprintf(stream,"{SP}"); break;
case '\t': fprintf(stream,"{TB}"); break;
if (lf)
fputc('\n',stream);
}
-void pdkim_hexprint(FILE *stream, char *data, int len, int lf) {
+void pdkim_hexprint(FILE *stream, const char *data, int len, int lf) {
int i;
- unsigned char *p = (unsigned char *)data;
+ const unsigned char *p = (const unsigned char *)data;
for (i=0;i<len;i++) {
- int c = p[i];
+ const int c = p[i];
fprintf(stream,"%02x",c);
}
if (lf)
/* -------------------------------------------------------------------------- */
/* A small "growing string" implementation to escape malloc/realloc hell */
-pdkim_str *pdkim_strnew (char *cstr) {
+pdkim_str *pdkim_strnew (const char *cstr) {
unsigned int len = cstr?strlen(cstr):0;
pdkim_str *p = malloc(sizeof(pdkim_str));
if (p == NULL) return NULL;
else p->str[p->len] = '\0';
return p;
}
-char *pdkim_strncat(pdkim_str *str, char *data, int len) {
+char *pdkim_strncat(pdkim_str *str, const char *data, int len) {
if ((str->allocated - str->len) < (len+1)) {
/* Extend the buffer */
int num_frags = ((len+1)/PDKIM_STR_ALLOC_FRAG)+1;
str->str[str->len] = '\0';
return str->str;
}
-char *pdkim_strcat(pdkim_str *str, char *cstr) {
+char *pdkim_strcat(pdkim_str *str, const char *cstr) {
return pdkim_strncat(str, cstr, strlen(cstr));
}
char *pdkim_numcat(pdkim_str *str, unsigned long num) {
the passed colon-separated "list", starting at entry
"start". Returns the position of the header name in
the list. */
-int header_name_match(char *header,
- char *tick,
- int do_tick) {
+int header_name_match(const char *header,
+ char *tick,
+ int do_tick) {
char *hname;
char *lcopy;
char *p;
/* -------------------------------------------------------------------------- */
-int pdkim_update_bodyhash(pdkim_ctx *ctx, char *data, int len) {
+int pdkim_update_bodyhash(pdkim_ctx *ctx, const char *data, int len) {
pdkim_signature *sig = ctx->sig;
/* Cache relaxed version of data */
char *relaxed_data = NULL;
/* Traverse all signatures, updating their hashes. */
while (sig != NULL) {
/* Defaults to simple canon (no further treatment necessary) */
- char *canon_data = data;
- int canon_len = len;
+ const char *canon_data = data;
+ int canon_len = len;
if (sig->canon_body == PDKIM_CANON_RELAXED) {
/* Relax the line if not done already */
if (relaxed_data == NULL) {
int seen_wsp = 0;
- char *p = data;
+ const char *p = data;
int q = 0;
relaxed_data = malloc(len+1);
if (relaxed_data == NULL) return PDKIM_ERR_OOM;
/* Names for testing rewriting */
-static char *rrname[] = {
+static const char *rrname[] = {
" sender",
" from",
" to",
typedef struct where_list_block {
int bit;
- uschar *string;
+ const uschar *string;
} where_list_block;
static where_list_block where_list[] = {
- { rewrite_sender, US"sender:" },
- { rewrite_from, US"from:" },
- { rewrite_to, US"to:" },
- { rewrite_cc, US"cc:" },
- { rewrite_bcc, US"bcc:" },
- { rewrite_replyto, US"reply-to:" },
- { rewrite_envfrom, US"env-from" },
- { rewrite_envto, US"env-to" },
- { rewrite_smtp, US"smtp recipient" },
- { rewrite_smtp|rewrite_smtp_sender, US"smtp sender" }
+ { rewrite_sender, CUS"sender:" },
+ { rewrite_from, CUS"from:" },
+ { rewrite_to, CUS"to:" },
+ { rewrite_cc, CUS"cc:" },
+ { rewrite_bcc, CUS"bcc:" },
+ { rewrite_replyto, CUS"reply-to:" },
+ { rewrite_envfrom, CUS"env-from" },
+ { rewrite_envto, CUS"env-to" },
+ { rewrite_smtp, CUS"smtp recipient" },
+ { rewrite_smtp|rewrite_smtp_sender, CUS"smtp sender" }
};
static int where_list_size = sizeof(where_list)/sizeof(where_list_block);
(debug_selector & D_rewrite) != 0)
{
int i;
- uschar *where = US"?";
+ const uschar *where = CUS"?";
for (i = 0; i < where_list_size; i++)
{
/* Structure for SMTP command list */
typedef struct {
- char *name;
+ const char *name;
int len;
short int cmd;
short int has_arg;
*/
void
-smtp_printf(char *format, ...)
+smtp_printf(const char *format, ...)
{
va_list ap;
call another vararg function, only a function which accepts a va_list. */
void
-smtp_vprintf(char *format, va_list ap)
+smtp_vprintf(const char *format, va_list ap)
{
BOOL yield;
*/
int
-smtp_write_command(smtp_outblock *outblock, BOOL noflush, char *format, ...)
+smtp_write_command(smtp_outblock *outblock, BOOL noflush, const char *format, ...)
{
int count;
int rc = 0;
*/
uschar *
-string_sprintf(char *format, ...)
+string_sprintf(const char *format, ...)
{
va_list ap;
uschar buffer[STRING_SPRINTF_BUFFER_SIZE];
*/
int
-strncmpic(uschar *s, uschar *t, int n)
+strncmpic(const uschar *s, const uschar *t, int n)
{
while (n--)
{
*/
int
-strcmpic(uschar *s, uschar *t)
+strcmpic(const uschar *s, const uschar *t)
{
while (*s != 0)
{
*/
BOOL
-string_format(uschar *buffer, int buflen, char *format, ...)
+string_format(uschar *buffer, int buflen, const char *format, ...)
{
BOOL yield;
va_list ap;
BOOL
-string_vformat(uschar *buffer, int buflen, char *format, va_list ap)
+string_vformat(uschar *buffer, int buflen, const char *format, va_list ap)
{
enum { L_NORMAL, L_SHORT, L_LONG, L_LONGLONG, L_LONGDOUBLE };
BOOL yield = TRUE;
int width, precision;
-char *fp = format; /* Deliberately not unsigned */
+const char *fp = format; /* Deliberately not unsigned */
uschar *p = buffer;
uschar *last = buffer + buflen - 1;
int length = L_NORMAL;
int *nptr;
int slen;
- char *null = "NULL"; /* ) These variables */
- char *item_start, *s; /* ) are deliberately */
+ const char *null = "NULL"; /* ) These variables */
+ const char *item_start, *s; /* ) are deliberately */
char newformat[16]; /* ) not unsigned */
/* Non-% characters just get copied verbatim */
*/
uschar *
-string_open_failed(int eno, char *format, ...)
+string_open_failed(int eno, const char *format, ...)
{
va_list ap;
uschar buffer[1024];
*/
BOOL
-transport_write_string(int fd, char *format, ...)
+transport_write_string(int fd, const char *format, ...)
{
va_list ap;
va_start(ap, format);
enum { mbf_unix, mbf_mbx, mbf_smail, mbf_maildir, mbf_mailstore };
-static char *mailbox_formats[] = {
+static const char *mailbox_formats[] = {
"unix", "mbx", "smail", "maildir", "mailstore" };
*/
static BOOL
-lmtp_write_command(int fd, char *format, ...)
+lmtp_write_command(int fd, const char *format, ...)
{
int count, rc;
va_list ap;
{
int i;
struct stat statbuf;
-char *subdirs[] = { "/tmp", "/new", "/cur" };
+const char *subdirs[] = { "/tmp", "/new", "/cur" };
DEBUG(D_transport)
debug_printf("ensuring maildir directories exist in %s\n", path);
for (i = 0; i < 4; i++)
{
int j;
- uschar *dir, *mdir;
+ const uschar *dir, *mdir;
if (i == 0)
{
- mdir = US"";
+ mdir = CUS"";
dir = path;
}
else
{
- mdir = US subdirs[i-1];
+ mdir = CUS subdirs[i-1];
dir = mdir + 1;
}
*/
static void PRINTF_FUNCTION(2,3)
-respond_printf(FILE *f, char *format, ...)
+respond_printf(FILE *f, const char *format, ...)
{
va_list ap;