1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-03-15 18:29:16 +01:00

Fix pointer signedness warnings.

This commit is contained in:
Fredrik Thulin 2011-12-06 11:56:52 +01:00
parent f03314e59c
commit fa8a9ff074
3 changed files with 14 additions and 11 deletions

View File

@ -438,7 +438,7 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
{
char *userfile = NULL, *tmpfile = NULL;
FILE *f = NULL;
unsigned char buf[CR_RESPONSE_SIZE + 16], response_hex[CR_RESPONSE_SIZE * 2 + 1];
char buf[CR_RESPONSE_SIZE + 16], response_hex[CR_RESPONSE_SIZE * 2 + 1];
int ret, fd;
unsigned int flags = 0;
@ -535,7 +535,7 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
* Check YubiKey response against the expected response
*/
yubikey_hex_encode(response_hex, (char *)buf, response_len);
yubikey_hex_encode(response_hex, buf, response_len);
if (memcmp(buf, state.response, response_len) == 0) {
ret = PAM_SUCCESS;

15
util.c
View File

@ -128,9 +128,9 @@ init_yubikey(YK_KEY **yk)
}
int challenge_response(YK_KEY *yk, int slot,
unsigned char *challenge, unsigned int len,
char *challenge, unsigned int len,
bool hmac, unsigned int flags, bool verbose,
unsigned char *response, int res_size, int *res_len)
char *response, int res_size, int *res_len)
{
int yk_cmd;
unsigned int response_len = 0;
@ -186,8 +186,6 @@ get_user_challenge_file(YK_KEY *yk, const char *chalresp_path, const char *usern
{
/* Getting file from user home directory, i.e. ~/.yubico/challenge, or
* from a system wide directory.
*
* Format is hex(challenge):hex(response):slot num
*/
/* The challenge to use is located in a file in the user's home directory,
@ -221,7 +219,12 @@ get_user_challenge_file(YK_KEY *yk, const char *chalresp_path, const char *usern
int
load_chalresp_state(FILE *f, CR_STATE *state)
{
unsigned char challenge_hex[CR_CHALLENGE_SIZE * 2 + 1], response_hex[CR_RESPONSE_SIZE * 2 + 1];
/*
* Load the current challenge and expected response information from a file handle.
*
* Format is hex(challenge):hex(response):slot num
*/
char challenge_hex[CR_CHALLENGE_SIZE * 2 + 1], response_hex[CR_RESPONSE_SIZE * 2 + 1];
int slot;
int r;
@ -273,7 +276,7 @@ load_chalresp_state(FILE *f, CR_STATE *state)
int
write_chalresp_state(FILE *f, CR_STATE *state)
{
unsigned char challenge_hex[CR_CHALLENGE_SIZE * 2 + 1], response_hex[CR_RESPONSE_SIZE * 2 + 1];
char challenge_hex[CR_CHALLENGE_SIZE * 2 + 1], response_hex[CR_RESPONSE_SIZE * 2 + 1];
int fd;
memset(challenge_hex, 0, sizeof(challenge_hex));

View File

@ -85,7 +85,7 @@ report_yk_error()
int
parse_args(int argc, char **argv,
int *slot, bool *verbose,
unsigned char **action,
char **action,
int *exit_code)
{
int c;
@ -116,7 +116,7 @@ parse_args(int argc, char **argv,
}
int
do_add_hmac_chalresp(YK_KEY *yk, uint8_t slot, bool verbose, unsigned char *output_dir, int *exit_code)
do_add_hmac_chalresp(YK_KEY *yk, uint8_t slot, bool verbose, char *output_dir, int *exit_code)
{
unsigned char buf[CR_RESPONSE_SIZE + 16];
CR_STATE state;
@ -191,7 +191,7 @@ main(int argc, char **argv)
/* Options */
bool verbose = false;
unsigned char *action = ACTION_ADD_HMAC_CHALRESP;
char *action = ACTION_ADD_HMAC_CHALRESP;
int slot = 1;
ykp_errno = 0;