diff options
author | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2021-07-01 12:36:22 +0300 |
---|---|---|
committer | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2021-07-01 12:36:22 +0300 |
commit | 090f854829f1b3e1cc7884d6ee8686c20e9095d7 (patch) | |
tree | d938839b4083b484e01b5d7de2bfc49f6dd67cbe /src/remmina_protocol_widget.c | |
parent | 8c0770dcf76fba24e3ed5231f9e30d2267911d87 (diff) |
WIP: SSH tunnel MFA
This MR implement the same multi facotr authenticantion mechanism used for direct SSH connection
Should fix #2544
Signed-off-by: Antenore Gatta (tmow) <antenore@simbiosi.org>
Diffstat (limited to 'src/remmina_protocol_widget.c')
-rw-r--r-- | src/remmina_protocol_widget.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/remmina_protocol_widget.c b/src/remmina_protocol_widget.c index c2fce125b..a0bebeef6 100644 --- a/src/remmina_protocol_widget.c +++ b/src/remmina_protocol_widget.c @@ -900,6 +900,8 @@ static RemminaSSHTunnel* remmina_protocol_widget_init_tunnel(RemminaProtocolWidg gint ret; gchar *msg; RemminaMessagePanel *mp; + gboolean partial = FALSE; + gboolean cont = FALSE; tunnel = remmina_ssh_tunnel_new_from_file(gp->priv->remmina_file); @@ -909,6 +911,55 @@ static RemminaSSHTunnel* remmina_protocol_widget_init_tunnel(RemminaProtocolWidg mp = remmina_protocol_widget_mpprogress(gp->cnnobj, msg, cancel_init_tunnel_cb, NULL); g_free(msg); + + + while (1) { + if (!partial) { + if (!remmina_ssh_init_session(REMMINA_SSH(tunnel))) { + REMMINA_DEBUG("init session error: %s", REMMINA_SSH(tunnel)->error); + // exit the loop here: OK + break; + } + } + + ret = remmina_ssh_auth_gui(REMMINA_SSH(tunnel), gp, gp->priv->remmina_file); + switch (ret) { + case REMMINA_SSH_AUTH_SUCCESS: + REMMINA_DEBUG("Authentication success"); + break; + case REMMINA_SSH_AUTH_PARTIAL: + REMMINA_DEBUG("Continue with the next auth method"); + partial = TRUE; + // Continue the loop: OK + continue; + break; + case REMMINA_SSH_AUTH_RECONNECT: + REMMINA_DEBUG("Reconnecting..."); + // Continue the loop: OK + continue; + break; + case REMMINA_SSH_AUTH_USERCANCEL: + REMMINA_DEBUG("Interrupted by the user"); + // TODO: exit the loop here: OK + goto BREAK; + break; + default: + REMMINA_DEBUG("Error during the authentication: %s", REMMINA_SSH(tunnel)->error); + remmina_protocol_widget_set_error(gp, REMMINA_SSH(tunnel)->error); + // TODO: exit the loop here: OK + goto BREAK; + } + + + cont = TRUE; + break; + } + + + + +#if 0 + if (!remmina_ssh_init_session(REMMINA_SSH(tunnel))) { REMMINA_DEBUG ("Cannot init SSH session with tunnel struct"); remmina_protocol_widget_set_error(gp, REMMINA_SSH(tunnel)->error); @@ -925,6 +976,13 @@ static RemminaSSHTunnel* remmina_protocol_widget_init_tunnel(RemminaProtocolWidg return NULL; } +#endif + +BREAK: + if (!cont) { + remmina_ssh_tunnel_free(tunnel); + return NULL; + } remmina_protocol_widget_mpdestroy(gp->cnnobj, mp); return tunnel; |