1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-01-20 01:52:17 +01:00
This commit is contained in:
Simon Josefsson 2008-09-01 13:14:33 +00:00
parent af09b5499c
commit 02c8dce53f

View File

@ -90,8 +90,7 @@
*/
static int
check_user_token (const char *authfile,
const char *username,
const char *usertoken)
const char *username, const char *usertoken)
{
static char buf[1024];
char *s_user, *s_token;
@ -137,8 +136,7 @@ check_user_token (const char *authfile,
*/
static int
validate_user_token (const char *authfile,
const char *username,
const char *usertoken)
const char *username, const char *usertoken)
{
int retval = 0;
@ -303,16 +301,20 @@ pam_sm_authenticate (pam_handle_t * pamh,
password_len = strlen (token_otp_with_password);
/* Getting Token value and SSH password */
strncpy((char *)token_otp, token_otp_with_password + ( password_len - TOKEN_LEN ), TOKEN_LEN);
token_password = malloc((password_len - TOKEN_LEN) + 1); // need to free this memory
strncpy ((char *) token_otp,
token_otp_with_password + (password_len - TOKEN_LEN), TOKEN_LEN);
token_password = malloc ((password_len - TOKEN_LEN) + 1);
if (token_password != NULL)
{
strncpy(token_password, token_otp_with_password, (password_len - TOKEN_LEN));
strncpy (token_password, token_otp_with_password,
(password_len - TOKEN_LEN));
token_password[(password_len - TOKEN_LEN)] = 0;
password = token_password;
}
strncpy((char *)token_id, token_otp_with_password + ( password_len - TOKEN_LEN ), TOKEN_ID_LEN);
strncpy ((char *) token_id,
token_otp_with_password + (password_len - TOKEN_LEN),
TOKEN_ID_LEN);
if (debug)
{
@ -321,7 +323,9 @@ pam_sm_authenticate (pam_handle_t * pamh,
}
/* validate the user with supplied token id */
valid_token = validate_user_token(auth_file, (const char *)user, (const char *)token_id);
valid_token =
validate_user_token (auth_file, (const char *) user,
(const char *) token_id);
if (password != NULL)
{
@ -345,9 +349,7 @@ pam_sm_authenticate (pam_handle_t * pamh,
rc = yubikey_client_request (ykc, (const char *) token_otp);
if (token_password != NULL)
{
free (token_password);
}
if (debug)
D (("libyubikey-client return value (%d): %s", rc,