Example #1
0
 /// <summary>
 /// Signals all clients.
 /// </summary>
 /// <param name="signal">The signal.</param>
 public virtual void SignalAll(KeePassRPC.DataExchangeModel.Signal signal)
 {
     foreach (KeePassRPCClientConnection client in _RPCClientConnections)
     {
         client.Signal(signal, CallbackMethodName);
     }
 }
Example #2
0
 internal void SignalAllManagedRPCClients(KeePassRPC.DataExchangeModel.Signal signal)
 {
     lock (_lockRPCClientManagers)
     {
         foreach (KeePassRPCClientManager manager in _RPCClientManagers.Values)
         {
             manager.SignalAll(signal);
         }
     }
 }
Example #3
0
        /// <summary>
        /// Sends the specified signal to the client.
        /// </summary>
        /// <param name="signal">The signal.</param>
        public void Signal(KeePassRPC.DataExchangeModel.Signal signal, string methodName)
        {
            try
            {
                Jayrock.Json.JsonObject call = new Jayrock.Json.JsonObject();
                call["id"]     = ++_currentCallBackId;
                call["method"] = methodName;
                call["params"] = new int[] { (int)signal };

                StringBuilder sb = new StringBuilder();
                Jayrock.Json.Conversion.JsonConvert.Export(call, sb);
                byte[] bytes = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
                this.ConnectionStreamWrite(bytes);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("ERROR! Please click on this box, press CTRL-C on your keyboard and paste into a new post on the KeeFox forum (http://keefox.org/help/forum). Doing this will help other people to use KeeFox without any unexpected error messages like this. Please briefly describe what you were doing when the problem occurred, which version of KeeFox, KeePass and Firefox you use and what other security software you run on your machine. Thanks! Technical detail follows: " + ex.ToString());
            }
        }
Example #4
0
        /// <summary>
        /// Sends the specified signal to the client.
        /// </summary>
        /// <param name="signal">The signal.</param>
        public void Signal(KeePassRPC.DataExchangeModel.Signal signal, string methodName)
        {
            try
            {
                Jayrock.Json.JsonObject call = new Jayrock.Json.JsonObject();
                call["id"]     = ++_currentCallBackId;
                call["method"] = methodName;
                call["params"] = new int[] { (int)signal };

                StringBuilder sb = new StringBuilder();
                Jayrock.Json.Conversion.JsonConvert.Export(call, sb);
                byte[] bytes = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
                this.ConnectionStreamWrite(bytes);
            }
            catch (System.IO.IOException)
            {
                // Sometimes a connection is unexpectedly closed e.g. by Firefox
                // or (more likely) dodgy security "protection". From one year's
                // worth of bug reports (35) 100% of unexpected application
                // exceptions were IOExceptions.
                //
                // We will now ignore this type of exception and allow KeeFox to
                // re-establish the link to KeePass as part of its regular polling loop.
                //
                // The requested KPRPC signal will never be recieved by KeeFox
                // but this should be OK in practice becuase KeeFox will
                // re-establish the relevant state information as soon as it reconnects.
                //
                // BUT: the exception to this rule is when KeeFox fails to receive the
                // "shutdown" signal - it then gets itself in an inconsistent state
                // and has no opportunity to recover until KeePass is running again.
                return;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("ERROR! Please click on this box, press CTRL-C on your keyboard and paste into a new post on the KeeFox forum (http://keefox.org/help/forum). Doing this will help other people to use KeeFox without any unexpected error messages like this. Please briefly describe what you were doing when the problem occurred, which version of KeeFox, KeePass and Firefox you use and what other security software you run on your machine. Thanks! Technical detail follows: " + ex.ToString());
            }
        }
Example #5
0
 /// <summary>
 /// We don't know how to signal null clients so we skip it
 /// </summary>
 /// <param name="signal">The signal.</param>
 public override void SignalAll(KeePassRPC.DataExchangeModel.Signal signal)
 {
     return;
 }