[gnome-commander] Remove unused auth member from GnomeCmdCon objects



commit 2cde309d284c0c2e88d7d04761a0925c153162ab
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Tue Oct 5 22:42:20 2021 +0200

    Remove unused auth member from GnomeCmdCon objects
    
    We don't want to store connection passwords, so removing this member. It
    was actually not used anywhere.

 src/dialogs/gnome-cmd-con-dialog.cc    | 12 +---------
 src/dialogs/gnome-cmd-remote-dialog.cc |  4 ++--
 src/gnome-cmd-con-remote.cc            |  3 +--
 src/gnome-cmd-con-remote.h             |  4 ++--
 src/gnome-cmd-con.cc                   |  9 ++++----
 src/gnome-cmd-con.h                    | 42 +++++++++++++---------------------
 6 files changed, 26 insertions(+), 48 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-con-dialog.cc b/src/dialogs/gnome-cmd-con-dialog.cc
index f969039e..38d99bed 100644
--- a/src/dialogs/gnome-cmd-con-dialog.cc
+++ b/src/dialogs/gnome-cmd-con-dialog.cc
@@ -62,8 +62,6 @@ struct GnomeCmdConnectDialog::Private
     string *alias {nullptr};
     string uri_str;
 
-    GnomeCmdCon::Authentication auth {GnomeCmdCon::SAVE_PERMANENTLY};
-
     GtkWidget *required_table {nullptr};
     GtkWidget *optional_table {nullptr};
 
@@ -312,12 +310,10 @@ gboolean GnomeCmdConnectDialog::verify_uri()
         return FALSE;
     }
 
-    priv->auth = type==CON_ANON_FTP ? GnomeCmdCon::NOT_REQUIRED : GnomeCmdCon::SAVE_PERMANENTLY;
-
     if (type==CON_ANON_FTP)
         user = "anonymous";
 
-    gnome_cmd_con_make_uri (uri, (ConnectionMethodID) type, priv->auth==GnomeCmdCon::SAVE_PERMANENTLY, uri, 
server, share, port, folder, domain, user, password);
+    gnome_cmd_con_make_uri (uri, (ConnectionMethodID) type, uri, server, share, port, folder, domain, user, 
password);
 
     if (type==CON_URI && !uri_is_valid(uri.c_str()))
     {
@@ -514,8 +510,6 @@ GnomeCmdConRemote *gnome_cmd_connect_dialog_new (gboolean has_alias)
 
     gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->type_combo), CON_SSH);
 
-    dialog->priv->auth = GnomeCmdCon::SAVE_PERMANENTLY;
-
     gint response = gtk_dialog_run (*dialog);
 
     GnomeCmdConRemote *server = nullptr;
@@ -529,7 +523,6 @@ GnomeCmdConRemote *gnome_cmd_connect_dialog_new (gboolean has_alias)
         GnomeCmdCon *con = GNOME_CMD_CON (server);
 
         con->method = (ConnectionMethodID) gtk_combo_box_get_active (GTK_COMBO_BOX 
(dialog->priv->type_combo));
-        con->auth = dialog->priv->auth;
     }
 
     gtk_widget_destroy (*dialog);
@@ -549,8 +542,6 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
 
     gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->type_combo), con->method);
 
-    dialog->priv->auth = con->auth;
-
     if (con->alias)
     {
         dialog->priv->alias = new string(con->alias);
@@ -669,7 +660,6 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
 
 
         con->method = (ConnectionMethodID) gtk_combo_box_get_active (GTK_COMBO_BOX 
(dialog->priv->type_combo));
-        con->auth = dialog->priv->auth;
 
         gnome_cmd_con_remote_set_tooltips (server, host);
 
diff --git a/src/dialogs/gnome-cmd-remote-dialog.cc b/src/dialogs/gnome-cmd-remote-dialog.cc
index 7101e709..ba5a2e31 100644
--- a/src/dialogs/gnome-cmd-remote-dialog.cc
+++ b/src/dialogs/gnome-cmd-remote-dialog.cc
@@ -102,8 +102,8 @@ inline void set_server (GtkListStore *store, GtkTreeIter *iter, GnomeCmdConRemot
 
     gtk_list_store_set (store, iter,
                         COL_METHOD, gnome_cmd_con_get_icon_name (con->method),
-                        COL_LOCK, con->auth==GnomeCmdCon::SAVE_PERMANENTLY ? GTK_STOCK_DIALOG_AUTHENTICATION 
: NULL,
-                        COL_AUTH, con->auth,
+                        COL_LOCK, nullptr,
+                        COL_AUTH, 0, // ToDo: Remove?
                         COL_NAME, gnome_cmd_con_get_alias (con),
                         COL_CON, con,
                         COL_FTP_CON, server,                // FIXME: to be removed
diff --git a/src/gnome-cmd-con-remote.cc b/src/gnome-cmd-con-remote.cc
index cd8ea64f..2cfaa381 100644
--- a/src/gnome-cmd-con-remote.cc
+++ b/src/gnome-cmd-con-remote.cc
@@ -257,7 +257,7 @@ GtkType gnome_cmd_con_remote_get_type ()
 /**
  * Logic for setting up a new remote connection accordingly to the given uri_str.
  */
-GnomeCmdConRemote *gnome_cmd_con_remote_new (const gchar *alias, const string &uri_str, 
GnomeCmdCon::Authentication auth)
+GnomeCmdConRemote *gnome_cmd_con_remote_new (const gchar *alias, const string &uri_str)
 {
     auto server = static_cast<GnomeCmdConRemote*> (g_object_new (GNOME_CMD_TYPE_CON_REMOTE, nullptr));
 
@@ -304,7 +304,6 @@ GnomeCmdConRemote *gnome_cmd_con_remote_new (const gchar *alias, const string &u
     gnome_cmd_con_remote_set_tooltips (server, host);
 
     con->method = gnome_cmd_con_get_scheme (uri_str.c_str());
-    con->auth = con->method==CON_ANON_FTP ? GnomeCmdCon::NOT_REQUIRED : GnomeCmdCon::SAVE_FOR_SESSION;
 
     g_free (path);
     g_free(host);
diff --git a/src/gnome-cmd-con-remote.h b/src/gnome-cmd-con-remote.h
index 79d451e7..b1b53a93 100644
--- a/src/gnome-cmd-con-remote.h
+++ b/src/gnome-cmd-con-remote.h
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file gnome-cmd-con-remote.h
  * @copyright (C) 2001-2006 Marcus Bjurman\n
  * @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -44,6 +44,6 @@ struct GnomeCmdConRemoteClass
 
 GtkType gnome_cmd_con_remote_get_type ();
 
-GnomeCmdConRemote *gnome_cmd_con_remote_new (const gchar *alias, const std::string &uri_str, 
GnomeCmdCon::Authentication auth=GnomeCmdCon::SAVE_PERMANENTLY);
+GnomeCmdConRemote *gnome_cmd_con_remote_new (const gchar *alias, const std::string &uri_str);
 
 void gnome_cmd_con_remote_set_tooltips (GnomeCmdConRemote *con, const gchar *host_name);
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index 409a8003..70b2002a 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -178,7 +178,6 @@ static void init (GnomeCmdCon *con)
     con->alias = nullptr;
     con->uri = nullptr;
     con->method = CON_URI;
-    con->auth = GnomeCmdCon::NOT_REQUIRED;
 
     con->base_path = nullptr;
     con->base_info = nullptr;
@@ -603,12 +602,12 @@ const gchar *gnome_cmd_con_get_icon_name (ConnectionMethodID method)
 }
 
 
-string &__gnome_cmd_con_make_uri (string &s, const gchar *method, gboolean use_auth, string &server, string 
&port, string &folder, string &user, string &password)
+string &__gnome_cmd_con_make_uri (string &s, const gchar *method, string &server, string &port, string 
&folder, string &user, string &password)
 {
     user = stringify (g_strescape (user.c_str(), nullptr));
     password = stringify (g_strescape (password.c_str(), nullptr));
 
-    if (!password.empty() && !use_auth)
+    if (!password.empty())
     {
         user += ':';
         user += password;
@@ -639,12 +638,12 @@ string &__gnome_cmd_con_make_uri (string &s, const gchar *method, gboolean use_a
 }
 
 #ifdef HAVE_SAMBA
-std::string &gnome_cmd_con_make_smb_uri (std::string &uriString, gboolean use_auth, std::string &server, 
std::string &share, std::string &folder, std::string &domain, std::string &user, std::string &password)
+std::string &gnome_cmd_con_make_smb_uri (std::string &uriString, std::string &server, std::string &share, 
std::string &folder, std::string &domain, std::string &user, std::string &password)
 {
     user = stringify (g_strescape (user.c_str(), nullptr));
     password = stringify (g_strescape (password.c_str(), nullptr));
 
-    if (!password.empty() && !use_auth)
+    if (!password.empty())
     {
         user += ':';
         user += password;
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index 3e30b21c..5ed1e112 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -75,18 +75,9 @@ struct GnomeCmdCon
         OPEN_NOT_STARTED
     };
 
-    enum Authentication
-    {
-        SAVE_NEVER,
-        SAVE_FOR_SESSION,
-        SAVE_PERMANENTLY,
-        NOT_REQUIRED
-    };
-
     gchar               *alias;                 // coded as UTF-8
     gchar               *uri;
     ConnectionMethodID  method;
-    Authentication      auth;
 
     gchar               *username;
     gchar               *hostname;
@@ -461,7 +452,7 @@ inline ConnectionMethodID gnome_cmd_con_get_scheme (const gchar *uriString)
     return retValue;
 }
 
-std::string &__gnome_cmd_con_make_uri (std::string &s, const gchar *method, gboolean use_auth, std::string 
&server, std::string &port, std::string &folder, std::string &user, std::string &password);
+std::string &__gnome_cmd_con_make_uri (std::string &s, const gchar *method, std::string &server, std::string 
&port, std::string &folder, std::string &user, std::string &password);
 
 inline std::string &gnome_cmd_con_make_custom_uri (std::string &s, const std::string &uri)
 {
@@ -480,52 +471,51 @@ inline std::string &gnome_cmd_con_make_custom_uri (std::string &s, const std::st
     return s;
 }
 
-inline std::string &gnome_cmd_con_make_ssh_uri (std::string &s, gboolean use_auth, std::string &server, 
std::string &port, std::string &folder, std::string &user, std::string &password)
+inline std::string &gnome_cmd_con_make_ssh_uri (std::string &s, std::string &server, std::string &port, 
std::string &folder, std::string &user, std::string &password)
 {
-    return __gnome_cmd_con_make_uri (s, "sftp://";, use_auth, server, port, folder, user, password);
+    return __gnome_cmd_con_make_uri (s, "sftp://";, server, port, folder, user, password);
 }
 
-inline std::string &gnome_cmd_con_make_ftp_uri (std::string &s, gboolean use_auth, std::string &server, 
std::string &port, std::string &folder, std::string &user, std::string &password)
+inline std::string &gnome_cmd_con_make_ftp_uri (std::string &s, std::string &server, std::string &port, 
std::string &folder, std::string &user, std::string &password)
 {
     if (user=="anonymous")
     {
-        use_auth = FALSE;
         password = gnome_cmd_data_get_ftp_anonymous_password ();
     }
 
-    return __gnome_cmd_con_make_uri (s, "ftp://";, use_auth, server, port, folder, user, password);
+    return __gnome_cmd_con_make_uri (s, "ftp://";, server, port, folder, user, password);
 }
 
 #ifdef HAVE_SAMBA
-std::string &gnome_cmd_con_make_smb_uri (std::string &s, gboolean use_auth, std::string &server, std::string 
&share, std::string &folder, std::string &domain, std::string &user, std::string &password);
+std::string &gnome_cmd_con_make_smb_uri (std::string &s, std::string &server, std::string &share, 
std::string &folder, std::string &domain, std::string &user, std::string &password);
 #endif
 
-inline std::string &gnome_cmd_con_make_dav_uri (std::string &s, gboolean use_auth, std::string &server, 
std::string &port, std::string &folder, std::string &user, std::string &password)
+inline std::string &gnome_cmd_con_make_dav_uri (std::string &s, std::string &server, std::string &port, 
std::string &folder, std::string &user, std::string &password)
 {
-    return __gnome_cmd_con_make_uri (s, "dav://", use_auth, server, port, folder, user, password);
+    return __gnome_cmd_con_make_uri (s, "dav://", server, port, folder, user, password);
 }
 
-inline std::string &gnome_cmd_con_make_davs_uri (std::string &s, gboolean use_auth, std::string &server, 
std::string &port, std::string &folder, std::string &user, std::string &password)
+inline std::string &gnome_cmd_con_make_davs_uri (std::string &s, std::string &server, std::string &port, 
std::string &folder, std::string &user, std::string &password)
 {
-    return __gnome_cmd_con_make_uri (s, "davs://", use_auth, server, port, folder, user, password);
+    return __gnome_cmd_con_make_uri (s, "davs://", server, port, folder, user, password);
 }
 
-inline std::string &gnome_cmd_con_make_uri (std::string &s, ConnectionMethodID method, gboolean use_auth, 
std::string &uri, std::string &server, std::string &share, std::string &port, std::string &folder, 
std::string &domain, std::string &user, std::string &password)
+inline std::string &gnome_cmd_con_make_uri (std::string &s, ConnectionMethodID method, std::string &uri, 
std::string &server, std::string &share, std::string &port, std::string &folder, std::string &domain, 
std::string &user, std::string &password)
 {
     switch (method)
     {
         case CON_FTP:
-        case CON_ANON_FTP:  return gnome_cmd_con_make_ftp_uri (s, use_auth, server, port, folder, user, 
password);
+        case CON_ANON_FTP:  return gnome_cmd_con_make_ftp_uri (s, server, port, folder, user, password);
 
-        case CON_SSH:       return gnome_cmd_con_make_ssh_uri (s, use_auth, server, port, folder, user, 
password);
+        case CON_SSH:       return gnome_cmd_con_make_ssh_uri (s, server, port, folder, user, password);
 
 #ifdef HAVE_SAMBA
-        case CON_SMB:       return gnome_cmd_con_make_smb_uri (s, use_auth, server, share, folder, domain, 
user, password);
+        case CON_SMB:       return gnome_cmd_con_make_smb_uri (s, server, share, folder, domain, user, 
password);
 #endif
 
-        case CON_DAV:       return gnome_cmd_con_make_dav_uri (s, use_auth, server, port, folder, user, 
password);
+        case CON_DAV:       return gnome_cmd_con_make_dav_uri (s, server, port, folder, user, password);
 
-        case CON_DAVS:      return gnome_cmd_con_make_davs_uri (s, use_auth, server, port, folder, user, 
password);
+        case CON_DAVS:      return gnome_cmd_con_make_davs_uri (s, server, port, folder, user, password);
 
         case CON_URI:       return gnome_cmd_con_make_custom_uri (s, uri);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]