userauth: Handle partial success ie when server needs more authentications#1757
Open
LarsNordin-LNdata wants to merge 6 commits into
Open
userauth: Handle partial success ie when server needs more authentications#1757LarsNordin-LNdata wants to merge 6 commits into
LarsNordin-LNdata wants to merge 6 commits into
Conversation
Includes new error LIBSSH2_ERROR_PARIAL_SUCCESS
Member
|
This MR appears to be incomplete. But more importantly, we can't introduce a new error code without breaking the ABI. |
LarsNordin-LNdata
added a commit
to LarsNordin-LNdata/libssh2
that referenced
this pull request
Dec 11, 2025
I have implemented authentication gssapi-with-mic (Issue libssh2#707) as described by RFC4462, without gssapi KEX implementation. The implementation also handles partial success (new error LIBSSH2_ERROR_PARTIAL_SUCCESS, the same as pull request libssh2#1757) and USERAUTH_BANNER during message exchange. Errors in GSSAPI handling are returned as LIBSSH2_ERROR_GSSAPI_FAILURE. I have a working example/ssh2 on both Linux and Windows (I only add call to libssh2_userauth_gssapi_with_mic() in ssh2.c) Test have been made on Linux (with command kinit first) and Windows (logged in as domain user aduser01). The domain is SYSTEM.SE (uppercase is needed for Kerberos to work…) and the name of the SSH-server is sl.system.se. The linux client and the linux SSH-server is a member of the domain. example/ssh2 sl.system.se aduser01@SYSTEM.SE "" -K date and the date of the server is displayed. The new functions are int libssh2_userauth_gssapi_with_mic(LIBSSH2_SESSION *session, const char *username, const char *hostname) int libssh2_userauth_gssapi_with_mic_ex(LIBSSH2_SESSION *session, const char *username, size_t username_len, const char *hostname, size_t hostname_len, int delegation_flag); where hostname is the host (not IP) used in the connection. Delegation_flag is set to false (0) when libssh2_userauth_gssapi_with_mic() is called Changes are made in the following files (all with “#ifdef LIBSSH2_GSSAPI” for the added code): src/misc.[ch]: added function void _libssh2_store_u8(unsigned char **buf, uint8_t value) and int _libssh2_store_bytes(unsigned char **buf, const unsigned char *mem, size_t len) _libssh2_store_bytes() is needed due to the length in one message is u8 (and not u32) src/userauth.c: Main implementation (approx. 1200 lines) src/libssh2_priv.h: additional members of session structure and new MSG-definitions include/libssh2.h: function definition and new error codes examples/ssh2.c: code to use new function incl. handling of hostname instead of IP-address (attached) docs/libssh2_userauth_gssapi_with_mic.md and /libssh2_userauth_gssapi_with_mic_ex.md; New man-pages CMakeLists.txt: option -DLIBSSH2_GSSAPI_ENABLE=ON enables this function and additional libraries needed are added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Includes new error LIBSSH2_ERROR_PARTIAL_SUCCESS
Also added a check for state3 in public key
if(session->userauth_pblc_state == libssh2_NB_state_sent3) {
No updated manual yet