diff options
author | Espen Tveit <espen@tveit.io> | 2020-07-23 02:41:37 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2020-07-23 02:41:37 +0300 |
commit | 29c5dc10a2ec8d00b9b788dd8f15c31e2f825484 (patch) | |
tree | 2aadcfa4847ac72a99bb777cef5098488a7bb0bf /src/remmina_ssh.c | |
parent | 3ae30e73a184cb3d175c060323e91ec95bc4ae43 (diff) |
Make local variables reusable (not prefixed with type). Format code using uncrustify. Add indication that URI may be used in remmina --help. Add some examples to man page.
Diffstat (limited to 'src/remmina_ssh.c')
-rw-r--r-- | src/remmina_ssh.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/remmina_ssh.c b/src/remmina_ssh.c index 3845a29ef..2aeb0f494 100644 --- a/src/remmina_ssh.c +++ b/src/remmina_ssh.c @@ -463,6 +463,7 @@ remmina_ssh_auth_gui(RemminaSSH *ssh, RemminaProtocolWidget *gp, RemminaFile *re gchar *pwdfkey; gchar *message; gchar *current_pwd; + gchar *current_user; gint ret; size_t len; guchar *pubkey; @@ -635,12 +636,14 @@ remmina_ssh_auth_gui(RemminaSSH *ssh, RemminaProtocolWidget *gp, RemminaFile *re /* Ask for user credentials. Username cannot be changed here, * because we already sent it when opening the connection */ g_debug("Showing panel for password\n"); + current_user = g_strdup(remmina_file_get_string(remminafile, ssh->is_tunnel ? "ssh_tunnel_username" : "username")); ret = remmina_protocol_widget_panel_auth(gp, (disablepasswordstoring ? 0 : REMMINA_MESSAGE_PANEL_FLAG_SAVEPASSWORD) - | REMMINA_MESSAGE_PANEL_FLAG_USERNAME | REMMINA_MESSAGE_PANEL_FLAG_USERNAME_READONLY, + | REMMINA_MESSAGE_PANEL_FLAG_USERNAME + | (!ssh->is_tunnel ? 0 : REMMINA_MESSAGE_PANEL_FLAG_USERNAME_READONLY), ssh->is_tunnel ? _("SSH tunnel credentials") : _("SSH credentials"), - remmina_file_get_string(remminafile, ssh->is_tunnel ? "ssh_tunnel_username" : "username"), - remmina_file_get_string(remminafile, pwdfkey), + current_user, + current_pwd, NULL, NULL); if (ret == GTK_RESPONSE_OK) { @@ -651,8 +654,27 @@ remmina_ssh_auth_gui(RemminaSSH *ssh, RemminaProtocolWidget *gp, RemminaFile *re remmina_file_set_string(remminafile, pwdfkey, current_pwd); else remmina_file_set_string(remminafile, pwdfkey, NULL); + + if(!ssh->is_tunnel) { + g_free(current_user); + current_user = remmina_protocol_widget_get_username(gp); + remmina_file_set_string(remminafile, "username", current_user); + if(ssh->user != NULL) { + g_free(ssh->user); + } + ssh->user = g_strdup(current_user); + if(ssh->password != NULL) { + g_free(ssh->password); + } + ssh->password = g_strdup(current_pwd); + g_free(current_user); + return REMMINA_SSH_AUTH_RECONNECT; + } + g_free(current_user); + } else { g_free(current_pwd); + g_free(current_user); return REMMINA_SSH_AUTH_USERCANCEL; } } else { |