Просмотр исходного кода

* Removed old (non-nat-fixed) link encryption code

svn: 1772
Bryan Drewery 21 лет назад
Родитель
Сommit
e940fb593c
2 измененных файлов с 2 добавлено и 65 удалено
  1. 0 64
      src/enclink.c
  2. 2 1
      src/enclink.h

+ 0 - 64
src/enclink.c

@@ -73,69 +73,6 @@ static void ghost_link_nat(int idx, direction_t direction)
   }
 }
 
-static void ghost_link(int idx, direction_t direction)
-{
-  int snum = findanysnum(dcc[idx].sock);
-
-  if (snum >= 0) {
-    char initkey[33] = "", *tmp2 = NULL;
-    char tmp[256] = "";
-    char *keyp = NULL, *nick1 = NULL, *nick2 = NULL;
-    size_t key_len = 0;
-    port_t port = 0;
-
-    if (direction == TO) {
-      keyp = socklist[snum].ikey;
-      key_len = sizeof(socklist[snum].ikey);
-      nick1 = dcc[idx].nick;
-      nick2 = conf.bot->nick;
-
-      struct sockaddr_in sa;
-      socklen_t socklen = sizeof(sa);
-
-      egg_bzero(&sa, socklen);
-      getsockname(socklist[snum].sock, (struct sockaddr *) &sa, &socklen);
-      port = sa.sin_port;
-    } else if (direction == FROM) {
-      keyp = socklist[snum].okey;
-      key_len = sizeof(socklist[snum].okey);
-      nick1 = conf.bot->nick;
-      nick2 = dcc[idx].nick;
-      port = htons(dcc[idx].port);
-    }
-
-    /* initkey-gen */
-    /* bdhash port mynick conf.bot->nick */
-    sprintf(tmp, "%s@%4x@%s@%s", settings.bdhash, port, nick1, nick2);
-    strlcpy(keyp, SHA1(tmp), key_len);
-    putlog(LOG_DEBUG, "@", "Link hash for %s: %s", dcc[idx].nick, tmp);
-    putlog(LOG_DEBUG, "@", "outkey (%d): %s", strlen(keyp), keyp);
-
-    if (direction == FROM) {
-      make_rand_str(initkey, 32);       /* set the initial out/in link key to random chars. */
-      socklist[snum].oseed = random();
-      socklist[snum].iseed = socklist[snum].oseed;
-      tmp2 = encrypt_string(settings.salt2, initkey);
-      putlog(LOG_BOTS, "*", "Sending encrypted link handshake to %s...", dcc[idx].nick);
-
-      socklist[snum].encstatus = 1;
-      socklist[snum].gz = 1;
-
-      link_send(idx, "elink %s %d\n", tmp2, socklist[snum].oseed);
-      free(tmp2);
-      strcpy(socklist[snum].okey, initkey);
-      strcpy(socklist[snum].ikey, initkey);
-    } else {
-      socklist[snum].encstatus = 1;
-      socklist[snum].gz = 1;
-    }
-  } else {
-    putlog(LOG_MISC, "*", "Couldn't find socket for %s connection?? Shouldn't happen :/", dcc[idx].nick);
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-  }
-}
-
 static int
 prand(int *seed, int range)
 {
@@ -327,7 +264,6 @@ void link_parse(int idx, char *buf)
 
 struct enc_link enclink[] = {
   { "ghost+nat", LINK_GHOSTNAT, ghost_link_nat, ghost_write, ghost_read, ghost_parse },
-  { "ghost", LINK_GHOST, ghost_link, ghost_write, ghost_read, ghost_parse },
   { "cleartext", LINK_CLEARTEXT, NULL, NULL, NULL, NULL },
   { NULL, 0, NULL, NULL, NULL, NULL }
 };

+ 2 - 1
src/enclink.h

@@ -7,8 +7,9 @@
 
 #include <sys/types.h>
 
+/* must leave old ones in here */
 enum {
-        LINK_GHOST = 0,
+        LINK_GHOST = 0,	/* attic */
 	LINK_GHOSTNAT,
         LINK_GHOSTSHA1,
         LINK_GHOSTMD5,