diff --git a/plugins/sudoers/digestname.c b/plugins/sudoers/digestname.c index e501de474..f70b48fb1 100644 --- a/plugins/sudoers/digestname.c +++ b/plugins/sudoers/digestname.c @@ -29,7 +29,7 @@ #include "parse.h" const char * -digest_type_to_name(int digest_type) +digest_type_to_name(unsigned int digest_type) { const char *digest_name; debug_decl(digest_type_to_name, SUDOERS_DEBUG_UTIL); diff --git a/plugins/sudoers/filedigest.c b/plugins/sudoers/filedigest.c index 24807aa6c..e59cc7a6a 100644 --- a/plugins/sudoers/filedigest.c +++ b/plugins/sudoers/filedigest.c @@ -34,7 +34,8 @@ #include "sudo_digest.h" unsigned char * -sudo_filedigest(int fd, const char *file, int digest_type, size_t *digest_len) +sudo_filedigest(int fd, const char *file, unsigned int digest_type, + size_t *digest_len) { unsigned char *file_digest = NULL; unsigned char buf[32 * 1024]; @@ -46,7 +47,7 @@ sudo_filedigest(int fd, const char *file, int digest_type, size_t *digest_len) *digest_len = sudo_digest_getlen(digest_type); if (*digest_len == (size_t)-1) { - sudo_warnx(U_("unsupported digest type %d for %s"), digest_type, file); + sudo_warnx(U_("unsupported digest type %u for %s"), digest_type, file); goto bad; } diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index b45bcdfe3..977bc5e5e 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -164,7 +164,7 @@ static bool add_userspec(struct member *, struct privilege *); static struct defaults *new_default(char *, char *, short); static struct member *new_member(char *, int); static struct sudo_command *new_command(char *, char *); -static struct command_digest *new_digest(int, char *); +static struct command_digest *new_digest(unsigned int, char *); static void alias_error(const char *name, int errnum); #line 165 "gram.c" @@ -3548,7 +3548,7 @@ new_command(char *cmnd, char *args) } static struct command_digest * -new_digest(int digest_type, char *digest_str) +new_digest(unsigned int digest_type, char *digest_str) { struct command_digest *digest; debug_decl(new_digest, SUDOERS_DEBUG_PARSER); diff --git a/plugins/sudoers/gram.y b/plugins/sudoers/gram.y index b579f22c7..4c4b29791 100644 --- a/plugins/sudoers/gram.y +++ b/plugins/sudoers/gram.y @@ -81,7 +81,7 @@ static bool add_userspec(struct member *, struct privilege *); static struct defaults *new_default(char *, char *, short); static struct member *new_member(char *, int); static struct sudo_command *new_command(char *, char *); -static struct command_digest *new_digest(int, char *); +static struct command_digest *new_digest(unsigned int, char *); static void alias_error(const char *name, int errnum); %} @@ -1365,7 +1365,7 @@ new_command(char *cmnd, char *args) } static struct command_digest * -new_digest(int digest_type, char *digest_str) +new_digest(unsigned int digest_type, char *digest_str) { struct command_digest *digest; debug_decl(new_digest, SUDOERS_DEBUG_PARSER); diff --git a/plugins/sudoers/parse.h b/plugins/sudoers/parse.h index b958331af..c012696a7 100644 --- a/plugins/sudoers/parse.h +++ b/plugins/sudoers/parse.h @@ -466,10 +466,10 @@ int parse_timeout(const char *timestr); time_t parse_gentime(const char *expstr); /* filedigest.c */ -unsigned char *sudo_filedigest(int fd, const char *file, int digest_type, size_t *digest_len); +unsigned char *sudo_filedigest(int fd, const char *file, unsigned int digest_type, size_t *digest_len); /* digestname.c */ -const char *digest_type_to_name(int digest_type); +const char *digest_type_to_name(unsigned int digest_type); /* parse.c */ struct sudo_nss_list; diff --git a/plugins/sudoers/regress/parser/check_digest.c b/plugins/sudoers/regress/parser/check_digest.c index c784b2b04..4449bb0a5 100644 --- a/plugins/sudoers/regress/parser/check_digest.c +++ b/plugins/sudoers/regress/parser/check_digest.c @@ -46,7 +46,8 @@ static const char *test_strings[NUM_TESTS] = { }; static unsigned char * -check_digest(int digest_type, const char *buf, size_t buflen, size_t *digest_len) +check_digest(unsigned int digest_type, const char *buf, size_t buflen, + size_t *digest_len) { char tfile[] = "digest.XXXXXX"; unsigned char *digest = NULL; @@ -86,7 +87,7 @@ main(int argc, char *argv[]) unsigned char *digest; unsigned int i, j; size_t digest_len; - int digest_type; + unsigned int digest_type; initprogname(argc > 0 ? argv[0] : "check_digest"); diff --git a/plugins/sudoers/toke.c b/plugins/sudoers/toke.c index e91b13a45..700589ad3 100644 --- a/plugins/sudoers/toke.c +++ b/plugins/sudoers/toke.c @@ -3095,7 +3095,7 @@ struct sudolinebuf sudolinebuf; /* sudoers line being parsed. */ static bool continued, sawspace; static int prev_state; -static int digest_type = -1; +static unsigned int digest_type = SUDO_DIGEST_INVALID; static bool pop_include(void); static yy_size_t sudoers_input(char *buf, yy_size_t max_size); @@ -5654,7 +5654,7 @@ init_lexer(void) keepopen = false; sawspace = false; continued = false; - digest_type = -1; + digest_type = SUDO_DIGEST_INVALID; prev_state = INITIAL; BEGIN INITIAL; diff --git a/plugins/sudoers/toke.l b/plugins/sudoers/toke.l index c732645eb..548b111b3 100644 --- a/plugins/sudoers/toke.l +++ b/plugins/sudoers/toke.l @@ -61,7 +61,7 @@ struct sudolinebuf sudolinebuf; /* sudoers line being parsed. */ static bool continued, sawspace; static int prev_state; -static int digest_type = -1; +static unsigned int digest_type = SUDO_DIGEST_INVALID; static bool pop_include(void); static yy_size_t sudoers_input(char *buf, yy_size_t max_size); @@ -1107,7 +1107,7 @@ init_lexer(void) keepopen = false; sawspace = false; continued = false; - digest_type = -1; + digest_type = SUDO_DIGEST_INVALID; prev_state = INITIAL; BEGIN INITIAL;