mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
Make strings const in functions that set defaults as they are
not modified.
This commit is contained in:
@@ -89,16 +89,16 @@ static const char *early_defaults[] = {
|
||||
/*
|
||||
* Local prototypes.
|
||||
*/
|
||||
static bool store_int(char *, struct sudo_defs_types *, int);
|
||||
static bool store_list(char *, struct sudo_defs_types *, int);
|
||||
static bool store_mode(char *, struct sudo_defs_types *, int);
|
||||
static int store_str(char *, struct sudo_defs_types *, int);
|
||||
static bool store_syslogfac(char *, struct sudo_defs_types *, int);
|
||||
static bool store_syslogpri(char *, struct sudo_defs_types *, int);
|
||||
static bool store_tuple(char *, struct sudo_defs_types *, int);
|
||||
static bool store_uint(char *, struct sudo_defs_types *, int);
|
||||
static bool store_float(char *, struct sudo_defs_types *, int);
|
||||
static bool list_op(char *, size_t, struct sudo_defs_types *, enum list_ops);
|
||||
static bool store_int(const char *, struct sudo_defs_types *, int);
|
||||
static bool store_list(const char *, struct sudo_defs_types *, int);
|
||||
static bool store_mode(const char *, struct sudo_defs_types *, int);
|
||||
static int store_str(const char *, struct sudo_defs_types *, int);
|
||||
static bool store_syslogfac(const char *, struct sudo_defs_types *, int);
|
||||
static bool store_syslogpri(const char *, struct sudo_defs_types *, int);
|
||||
static bool store_tuple(const char *, struct sudo_defs_types *, int);
|
||||
static bool store_uint(const char *, struct sudo_defs_types *, int);
|
||||
static bool store_float(const char *, struct sudo_defs_types *, int);
|
||||
static bool list_op(const char *, size_t, struct sudo_defs_types *, enum list_ops);
|
||||
static const char *logfac2str(int);
|
||||
static const char *logpri2str(int);
|
||||
|
||||
@@ -195,7 +195,7 @@ dump_defaults(void)
|
||||
* This is only meaningful for variables that are *optional*.
|
||||
*/
|
||||
bool
|
||||
set_default(char *var, char *val, int op)
|
||||
set_default(const char *var, const char *val, int op)
|
||||
{
|
||||
struct sudo_defs_types *cur;
|
||||
int num;
|
||||
@@ -641,7 +641,7 @@ check_defaults(int what, bool quiet)
|
||||
}
|
||||
|
||||
static bool
|
||||
store_int(char *val, struct sudo_defs_types *def, int op)
|
||||
store_int(const char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
const char *errstr;
|
||||
int i;
|
||||
@@ -664,7 +664,7 @@ store_int(char *val, struct sudo_defs_types *def, int op)
|
||||
}
|
||||
|
||||
static bool
|
||||
store_uint(char *val, struct sudo_defs_types *def, int op)
|
||||
store_uint(const char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
const char *errstr;
|
||||
unsigned int u;
|
||||
@@ -687,7 +687,7 @@ store_uint(char *val, struct sudo_defs_types *def, int op)
|
||||
}
|
||||
|
||||
static bool
|
||||
store_float(char *val, struct sudo_defs_types *def, int op)
|
||||
store_float(const char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
char *endp;
|
||||
double d;
|
||||
@@ -708,7 +708,7 @@ store_float(char *val, struct sudo_defs_types *def, int op)
|
||||
}
|
||||
|
||||
static bool
|
||||
store_tuple(char *val, struct sudo_defs_types *def, int op)
|
||||
store_tuple(const char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
struct def_values *v;
|
||||
debug_decl(store_tuple, SUDOERS_DEBUG_DEFAULTS)
|
||||
@@ -736,7 +736,7 @@ store_tuple(char *val, struct sudo_defs_types *def, int op)
|
||||
}
|
||||
|
||||
static int
|
||||
store_str(char *val, struct sudo_defs_types *def, int op)
|
||||
store_str(const char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
debug_decl(store_str, SUDOERS_DEBUG_DEFAULTS)
|
||||
|
||||
@@ -755,9 +755,9 @@ store_str(char *val, struct sudo_defs_types *def, int op)
|
||||
}
|
||||
|
||||
static bool
|
||||
store_list(char *str, struct sudo_defs_types *def, int op)
|
||||
store_list(const char *str, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
char *start, *end;
|
||||
const char *start, *end;
|
||||
debug_decl(store_list, SUDOERS_DEBUG_DEFAULTS)
|
||||
|
||||
/* Remove all old members. */
|
||||
@@ -785,7 +785,7 @@ store_list(char *str, struct sudo_defs_types *def, int op)
|
||||
}
|
||||
|
||||
static bool
|
||||
store_syslogfac(char *val, struct sudo_defs_types *def, int op)
|
||||
store_syslogfac(const char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
struct strmap *fac;
|
||||
debug_decl(store_syslogfac, SUDOERS_DEBUG_DEFAULTS)
|
||||
@@ -817,7 +817,7 @@ logfac2str(int n)
|
||||
}
|
||||
|
||||
static bool
|
||||
store_syslogpri(char *val, struct sudo_defs_types *def, int op)
|
||||
store_syslogpri(const char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
struct strmap *pri;
|
||||
debug_decl(store_syslogpri, SUDOERS_DEBUG_DEFAULTS)
|
||||
@@ -846,7 +846,7 @@ logpri2str(int n)
|
||||
}
|
||||
|
||||
static bool
|
||||
store_mode(char *val, struct sudo_defs_types *def, int op)
|
||||
store_mode(const char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
mode_t mode;
|
||||
const char *errstr;
|
||||
@@ -869,7 +869,7 @@ store_mode(char *val, struct sudo_defs_types *def, int op)
|
||||
}
|
||||
|
||||
static bool
|
||||
list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
|
||||
list_op(const char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
|
||||
{
|
||||
struct list_member *cur, *prev = NULL;
|
||||
debug_decl(list_op, SUDOERS_DEBUG_DEFAULTS)
|
||||
|
@@ -113,7 +113,7 @@ struct sudo_defs_types {
|
||||
*/
|
||||
void dump_default(void);
|
||||
bool init_defaults(void);
|
||||
bool set_default(char *var, char *val, int op);
|
||||
bool set_default(const char *var, const char *val, int op);
|
||||
bool update_defaults(int what);
|
||||
bool check_defaults(int what, bool quiet);
|
||||
|
||||
|
Reference in New Issue
Block a user