Explorar el Código

Add a reason when initiating FiSH key exchange

Bryan Drewery hace 10 años
padre
commit
1c2c29868a
Se han modificado 5 ficheros con 8 adiciones y 6 borrados
  1. 1 0
      doc/UPDATES.md
  2. 3 2
      src/chanprog.cc
  3. 1 1
      src/chanprog.h
  4. 1 1
      src/mod/server.mod/cmdsserv.cc
  5. 2 2
      src/mod/server.mod/servmsg.cc

+ 1 - 0
doc/UPDATES.md

@@ -21,6 +21,7 @@
   * Disallow negative 'chanset limit' (#96).
   * Disallow negative 'chanset limit' (#96).
   * Raise server cycle time from 15 to 30 seconds and add
   * Raise server cycle time from 15 to 30 seconds and add
     'set server-cycle-wait for configuring it. (#81)
     'set server-cycle-wait for configuring it. (#81)
+  * Show reason when initiating FiSH Key exchange
 
 
 # 1.4.6
 # 1.4.6
   * Disable demo TCL support by default to prevent confusion during build.
   * Disable demo TCL support by default to prevent confusion during build.

+ 3 - 2
src/chanprog.cc

@@ -913,14 +913,15 @@ void notice(bd::String target, bd::String msg, int idx) {
 }
 }
 
 
 
 
-void keyx(const bd::String &target) {
+void keyx(const bd::String &target, const char *reason) {
   bd::String myPublicKeyB64, myPrivateKey, sharedKey;
   bd::String myPublicKeyB64, myPrivateKey, sharedKey;
 
 
   DH1080_gen(myPrivateKey, myPublicKeyB64);
   DH1080_gen(myPrivateKey, myPublicKeyB64);
 
 
   fish_data_t* fishData = FishKeys.contains(target) ? FishKeys[target] : new fish_data_t;
   fish_data_t* fishData = FishKeys.contains(target) ? FishKeys[target] : new fish_data_t;
   fishData->sharedKey.clear();
   fishData->sharedKey.clear();
-  putlog(LOG_MSGS, "*", "[FiSH] Initiating DH1080 key-exchange with %s - sending my public key", target.c_str());
+  putlog(LOG_MSGS, "*", "[FiSH] Initiating DH1080 key-exchange with %s - "
+      "sending my public key (%s)", target.c_str(), reason);
   notice(target, "DH1080_INIT " + myPublicKeyB64, DP_HELP);
   notice(target, "DH1080_INIT " + myPublicKeyB64, DP_HELP);
   fishData->myPublicKeyB64 = myPublicKeyB64;
   fishData->myPublicKeyB64 = myPublicKeyB64;
   fishData->myPrivateKey = myPrivateKey;
   fishData->myPrivateKey = myPrivateKey;

+ 1 - 1
src/chanprog.h

@@ -33,7 +33,7 @@ void load_internal_users();
 void setup_HQ(int);
 void setup_HQ(int);
 void privmsg(bd::String target, bd::String msg, int idx);
 void privmsg(bd::String target, bd::String msg, int idx);
 void notice(bd::String target, bd::String msg, int idx);
 void notice(bd::String target, bd::String msg, int idx);
-void keyx(const bd::String& target);
+void keyx(const bd::String& target, const char *);
 void set_fish_key(char *, bd::String);
 void set_fish_key(char *, bd::String);
 struct userrec *check_chanlist(const char *);
 struct userrec *check_chanlist(const char *);
 struct userrec *check_chanlist_hand(const char *);
 struct userrec *check_chanlist_hand(const char *);

+ 1 - 1
src/mod/server.mod/cmdsserv.cc

@@ -124,7 +124,7 @@ static void cmd_keyx(int idx, char *par) {
   }
   }
 
 
   char *nick = newsplit(&par);
   char *nick = newsplit(&par);
-  keyx(nick);
+  keyx(nick, "Requested");
   return;
   return;
 }
 }
 
 

+ 2 - 2
src/mod/server.mod/servmsg.cc

@@ -799,7 +799,7 @@ static int gotmsg(char *from, char *msg)
         if (my_u && FishKeys.contains(nick)) {
         if (my_u && FishKeys.contains(nick)) {
           // FiSH paranoid mode. Invalidate the current key and re-key-exchange with the user.
           // FiSH paranoid mode. Invalidate the current key and re-key-exchange with the user.
           if (fish_paranoid) {
           if (fish_paranoid) {
-            keyx(nick);
+            keyx(nick, "fish-paranoid is set");
           }
           }
         }
         }
       }
       }
@@ -1978,7 +1978,7 @@ static int got718(char *from, char *msg)
         dprintf(DP_HELP, "ACCEPT %s\n", nick);
         dprintf(DP_HELP, "ACCEPT %s\n", nick);
         dprintf(DP_HELP, "PRIVMSG %s :You have been accepted. Please send your message again.\n", nick);
         dprintf(DP_HELP, "PRIVMSG %s :You have been accepted. Please send your message again.\n", nick);
         if (fish_auto_keyx) {
         if (fish_auto_keyx) {
-          keyx(nick);
+          keyx(nick, "Callerid accepted");
         }
         }
       } else {
       } else {
         putlog(LOG_WALL, "*", "(CALLERID) !%s! (%s!%s) %s (User is not +o or +v)", u->handle, nick, uhost, msg);
         putlog(LOG_WALL, "*", "(CALLERID) !%s! (%s!%s) %s (User is not +o or +v)", u->handle, nick, uhost, msg);