소스 검색

Merge branch 'fish-auto-keyx-callerid' into next

* fish-auto-keyx-callerid:
  * Auto FiSH Key exchange when accepting users
  * Add a keyx()

Conflicts:
	src/chanprog.c
	src/chanprog.h
Bryan Drewery 15 년 전
부모
커밋
4af5a48c98
4개의 변경된 파일17개의 추가작업 그리고 11개의 파일을 삭제
  1. 14 0
      src/chanprog.c
  2. 1 0
      src/chanprog.h
  3. 1 11
      src/mod/server.mod/cmdsserv.c
  4. 1 0
      src/mod/server.mod/servmsg.c

+ 14 - 0
src/chanprog.c

@@ -1028,3 +1028,17 @@ void check_removed_server(bool jump_no_match) {
     }
     }
   }
   }
 }
 }
+
+void keyx(const bd::String &target) {
+  bd::String myPublicKeyB64, myPrivateKey, sharedKey;
+
+  DH1080_gen(myPrivateKey, myPublicKeyB64);
+
+  putlog(LOG_MSGS, "*", "[FiSH] Initiating DH1080 key-exchange with %s - sending my public key", target.c_str());
+  notice(target, "DH1080_INIT " + myPublicKeyB64, DP_HELP);
+  fish_data_t* fishData = new fish_data_t;
+  fishData->myPublicKeyB64 = myPublicKeyB64;
+  fishData->myPrivateKey = myPrivateKey;
+  fishData->timestamp = now;
+  FishKeys[target] = fishData;
+}

+ 1 - 0
src/chanprog.h

@@ -35,6 +35,7 @@ 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 check_removed_server(bool = 1);
 void check_removed_server(bool = 1);
+void keyx(const bd::String& target);
 
 
 extern struct chanset_t		*chanset, *chanset_default;
 extern struct chanset_t		*chanset, *chanset_default;
 extern char			admin[], origbotnick[HANDLEN + 1], origbotname[NICKLEN], jupenick[NICKLEN], botname[NICKLEN], *def_chanset;
 extern char			admin[], origbotnick[HANDLEN + 1], origbotname[NICKLEN], jupenick[NICKLEN], botname[NICKLEN], *def_chanset;

+ 1 - 11
src/mod/server.mod/cmdsserv.c

@@ -124,17 +124,7 @@ static void cmd_keyx(int idx, char *par) {
   }
   }
 
 
   char *nick = newsplit(&par);
   char *nick = newsplit(&par);
-  bd::String myPublicKeyB64, myPrivateKey, sharedKey;
-
-  DH1080_gen(myPrivateKey, myPublicKeyB64);
-
-  putlog(LOG_MSGS, "*", "[FiSH] Initiating DH1080 key-exchange with %s - sending my public key", nick);
-  notice(nick, "DH1080_INIT " + myPublicKeyB64, DP_HELP);
-  fish_data_t* fishData = new fish_data_t;
-  fishData->myPublicKeyB64 = myPublicKeyB64;
-  fishData->myPrivateKey = myPrivateKey;
-  fishData->timestamp = now;
-  FishKeys[nick] = fishData;
+  keyx(nick);
   return;
   return;
 }
 }
 
 

+ 1 - 0
src/mod/server.mod/servmsg.c

@@ -1915,6 +1915,7 @@ static int got718(char *from, char *msg)
         putlog(LOG_WALL, "*", "(CALLERID) !%s! (%s!%s) %s (Accepting user)", u->handle, nick, uhost, msg);
         putlog(LOG_WALL, "*", "(CALLERID) !%s! (%s!%s) %s (Accepting user)", u->handle, nick, uhost, 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);
+        keyx(nick);
       } 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);
       }
       }