libssh2_userauth_authenticated: make it work as documented
The man page clearly says it returns 1 for "already authenticated" but the code said non-zero. I changed the code to use 1 now, as that is also non-zero but it gets the benefit that it now matches the documentation. Using 1 instead of non-zero is better for two reasons: 1. We have the opportunity to introduce other return codes in the future for things like error and what not. 2. We don't expose the internal bitmask variable value.
Этот коммит содержится в:
родитель
ba190d34c6
Коммит
4ae71b4838
@ -179,12 +179,12 @@ libssh2_userauth_list(LIBSSH2_SESSION * session, const char *user,
|
||||
* libssh2_userauth_authenticated
|
||||
*
|
||||
* Returns: 0 if not yet authenticated
|
||||
* non-zero is already authenticated
|
||||
* 1 if already authenticated
|
||||
*/
|
||||
LIBSSH2_API int
|
||||
libssh2_userauth_authenticated(LIBSSH2_SESSION * session)
|
||||
{
|
||||
return session->state & LIBSSH2_STATE_AUTHENTICATED;
|
||||
return (session->state & LIBSSH2_STATE_AUTHENTICATED)?1:0;
|
||||
}
|
||||
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user