diff options
author | Sumit Bose <sbose@redhat.com> | 2015-06-26 17:55:23 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-08-04 14:41:03 +0200 |
commit | f9a027877ecdd697a052f6135963fb3726692310 (patch) | |
tree | d482618a67836964b6778078cdfe7f9209cf70b7 /src/util/authtok.h | |
parent | 1b9a3d516341560ccf8b5f9fab0886f3d05defce (diff) | |
download | sssd-f9a027877ecdd697a052f6135963fb3726692310.tar.gz sssd-f9a027877ecdd697a052f6135963fb3726692310.tar.xz sssd-f9a027877ecdd697a052f6135963fb3726692310.zip |
authok: add support for Smart Card related authtokens
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/util/authtok.h')
-rw-r--r-- | src/util/authtok.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/util/authtok.h b/src/util/authtok.h index cb3662708..f1a01a423 100644 --- a/src/util/authtok.h +++ b/src/util/authtok.h @@ -223,4 +223,45 @@ errno_t sss_authtok_set_2fa(struct sss_auth_token *tok, errno_t sss_authtok_get_2fa(struct sss_auth_token *tok, const char **fa1, size_t *fa1_len, const char **fa2, size_t *fa2_len); + +/** + * @brief Set a Smart Card pin into a an auth token, replacing any previous data + * + * @param tok A pointer to a sss_auth_token structure to change, also + * used as a memory context to allocate the internal data. + * @param pin A string + * @param len The length of the string or, if 0 is passed, + * then strlen(password) will be used internally. + * + * @return EOK on success + * ENOMEM on error + */ +errno_t sss_authtok_set_sc_pin(struct sss_auth_token *tok, const char *pin, + size_t len); + +/** + * @brief Returns a Smart Card pin as const string if the auth token is of + * type SSS_AUTHTOK_TYPE_SC_PIN, otherwise it returns an error + * + * @param tok A pointer to an sss_auth_token + * @param pin A pointer to a const char *, that will point to a null + * terminated string + * @param len The length of the pin string + * + * @return EOK on success + * ENOENT if the token is empty + * EACCESS if the token is not a Smart Card pin token + */ +errno_t sss_authtok_get_sc_pin(struct sss_auth_token *tok, const char **pin, + size_t *len); + +/** + * @brief Sets an auth token to type SSS_AUTHTOK_TYPE_SC_KEYPAD, replacing any + * previous data + * + * @param tok A pointer to a sss_auth_token structure to change, also + * used as a memory context to allocate the internal data. + */ +void sss_authtok_set_sc_keypad(struct sss_auth_token *tok); + #endif /* __AUTHTOK_H__ */ |