[pan2] small changes to pw handling



commit aff65cd525c6b105e1298c5de97f4c8101a8dcd6
Author: Heinrich MÃller <henmull src gnome org>
Date:   Thu Apr 5 20:29:31 2012 +0200

    small changes to pw handling

 pan/data-impl/data-impl.cc |    8 +++++---
 pan/data-impl/server.cc    |   36 ++++++++++++++++++------------------
 pan/tasks/nntp-pool.cc     |    4 +---
 3 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/pan/data-impl/data-impl.cc b/pan/data-impl/data-impl.cc
index bdd251f..f38d6a1 100644
--- a/pan/data-impl/data-impl.cc
+++ b/pan/data-impl/data-impl.cc
@@ -163,11 +163,13 @@ DataImpl :: password_decrypt (PasswordData& pw) const
     NULL);
 
   std::string tmp;
-  if (pwd) tmp = pwd;
-  gnome_keyring_free_password(pwd);
+  if (pwd)
+  { tmp = pwd;
+    gnome_keyring_free_password(pwd);
+  }
   pw.pw = tmp;
 
-  return ret;
+  return (pwd ? GNOME_KEYRING_RESULT_OK : GNOME_KEYRING_RESULT_DENIED) ;
 }
 #endif
 
diff --git a/pan/data-impl/server.cc b/pan/data-impl/server.cc
index 6cacf45..82d1b77 100644
--- a/pan/data-impl/server.cc
+++ b/pan/data-impl/server.cc
@@ -227,24 +227,24 @@ DataImpl :: get_server_auth (const Quark   & server,
     PasswordData pw;
     pw.server = s->host;
     pw.user = s->username;
-    GnomeKeyringResult res (password_decrypt(pw));
-    switch (res)
-    {
-      case GNOME_KEYRING_RESULT_NO_MATCH:
-        Log::add_info_va(_("There seems to be no Password set for Server %s."), s->host.c_str());
-        break;
-
-      case GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON:
-        Log::add_urgent_va (_("The Gnome keyring denied access to the Passwords."), s->host.c_str());
-        break;
-
-      case GNOME_KEYRING_RESULT_OK:
-        setme_password.assign(pw.pw.str, pw.pw.len);
-        break;
-
-      default:
-        break;
-    }
+    password_decrypt(pw);
+//    switch (res)
+//    {
+//      case GNOME_KEYRING_RESULT_NO_MATCH:
+//        Log::add_info_va(_("There seems to be no Password set for Server %s."), s->host.c_str());
+//        break;
+//
+//      case GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON:
+//        Log::add_urgent_va (_("The Gnome keyring denied access to the Passwords."), s->host.c_str());
+//        break;
+//
+//      case GNOME_KEYRING_RESULT_OK:
+//        setme_password.assign(pw.pw.str, pw.pw.len);
+//        break;
+//
+//      default:
+//        break;
+//    }
 #endif
   }
 
diff --git a/pan/tasks/nntp-pool.cc b/pan/tasks/nntp-pool.cc
index e4ca0ec..9b20cc7 100644
--- a/pan/tasks/nntp-pool.cc
+++ b/pan/tasks/nntp-pool.cc
@@ -171,7 +171,7 @@ NNTP_Pool :: on_socket_created (const StringView  & host,
                                 Socket            * socket)
 {
   std::string user, pass;
-  _server_info.get_server_auth (_server, user, pass);
+  ok = ok && _server_info.get_server_auth (_server, user, pass);
   debug("on socket created "<<host<<" "<<ok<<" "<<socket<<" "<<pass);
   if (!ok)
   {
@@ -182,8 +182,6 @@ NNTP_Pool :: on_socket_created (const StringView  & host,
   {
     // okay, we at least we established a connection.
     // now try to handshake and pass the buck to on_nntp_done().
-    std::string user, pass;
-    _server_info.get_server_auth (_server, user, pass);
     NNTP * nntp = new NNTP (_server, user, pass, socket);
     nntp->handshake (this);
   }



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