[gnome-shell/gnome-3-12] networkAgent: Handle empty vpn 'keyfiles'



commit c2ae98209d0330295203eee5491095178672a177
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Wed Apr 23 08:52:37 2014 +0200

    networkAgent: Handle empty vpn 'keyfiles'
    
    Passing back no data is valid in case both secrets (group and user passwords)
    are stored.
    
    Just confirm the request in that case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728681

 js/ui/components/networkAgent.js |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index 66c4628..181aa77 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -510,10 +510,12 @@ const VPNRequestHandler = new Lang.Class({
 
     _showNewStyleDialog: function() {
         let keyfile = new GLib.KeyFile();
+        let data;
         let contentOverride;
 
         try {
-            let data = this._dataStdout.peek_buffer();
+            data = this._dataStdout.peek_buffer();
+
             keyfile.load_from_data(data.toString(), data.length,
                                    GLib.KeyFileFlags.NONE);
 
@@ -546,13 +548,16 @@ const VPNRequestHandler = new Lang.Class({
                 }
             }
         } catch(e) {
-            logError(e, 'error while reading VPN plugin output keyfile');
+            // No output is a valid case it means "both secrets are stored"
+            if (data.length > 0) {
+                logError(e, 'error while reading VPN plugin output keyfile');
 
-            this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
-            return;
+                this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
+                return;
+            }
         }
 
-        if (contentOverride.secrets.length) {
+        if (contentOverride && contentOverride.secrets.length) {
             // Only show the dialog if we actually have something to ask
             this._shellDialog = new NetworkSecretDialog(this._agent, this._requestId, this._connection, 
'vpn', [], contentOverride);
             this._shellDialog.open(global.get_current_time());


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