Hack to bypass timeseal decoder master
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 3 Jan 2019 09:02:29 +0000 (10:02 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 3 Jan 2019 09:09:08 +0000 (10:09 +0100)
The decription of timeseal data is now done by the ICS itself, rather
than by the external timeseal decoder process. The process is still started,
though, and the logic for testing whether it was initialized and should be
used is not altered. The ICS just refrains from ever sending any data
to it for decoding.

lasker-2.2.3/src/timeseal.c

index baeea06..1047e5e 100644 (file)
@@ -105,9 +105,35 @@ int timeseal_parse(char *command, struct connection_t *con)
        if (timeseal_globals.decoder_conn <= 0) return 1;
        
        /* are they using timeseal on this connection? */
-       if (!con->timeseal_init && !con->timeseal) return 1;
-       
-       t = decode(command);
+        if (!con->timeseal_init && !con->timeseal) return 1;
+       
+#if 1
+       {
+       static char *key="Timestamp (FICS) v1.0 - programmed by Henrik Gram.";
+#define SWAP(X,Y) { int h = buf[i+X]; buf[i+X] = buf[i+Y]; buf[i+Y] = h; }
+               unsigned char buf[1024]; int i, l, offs;
+               snprintf(buf, 1010, "%s\n", command);
+               offs = command[strlen(command)-1] & 0x7F;
+               l = strlen(buf);
+               for(i=0; buf[i] != '\n'; i++)
+                       buf[i] = ((buf[i] + 32) ^ key[(i+offs)%50]) & 0x7F;
+               for(i=0; i<l; i+=12) {
+                       SWAP(0,11); SWAP(4,7); SWAP(2,9);
+               }
+               t = 0;
+               for(i=0; buf[i]; i++) if(buf[i] == 0x18) {
+                       buf[i++] = 0;
+                       for(l=i; buf[l]; l++) if(buf[l] == 0x19) {
+                               buf[l] = 0; t = atoi(buf + i);
+                               break;
+                       }
+                       break;
+               }
+               if(t) strcpy(command, buf);
+       }
+#else
+       t = decode((unsigned char *) command);
+#endif
        
        if (t == 0) {
                /* this wasn't encoded using timeseal */