The new base 64 encoder adds linebreaks, we need to remove them again for the list...
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 22 Dec 2014 18:45:39 +0000 (19:45 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 22 Dec 2014 18:45:39 +0000 (19:45 +0100)
citadel/modules/listsub/serv_listsub.c

index 889926ac48d250bd5717d7645c5d2500dfd4eaab..ada4bbadd64e2323be4d29a903020104f4d87cbe 100644 (file)
 void listsub_generate_token(char *buf) {
        char sourcebuf[SIZ];
        static int seq = 0;
 void listsub_generate_token(char *buf) {
        char sourcebuf[SIZ];
        static int seq = 0;
+       size_t len;
 
        /* Theo, please sit down and shut up.  This key doesn't have to be
         * tinfoil-hat secure, it just needs to be reasonably unguessable
         * and unique.
         */
 
        /* Theo, please sit down and shut up.  This key doesn't have to be
         * tinfoil-hat secure, it just needs to be reasonably unguessable
         * and unique.
         */
-       sprintf(sourcebuf, "%lx",
+       len = sprintf(sourcebuf, "%lx",
                (long) (++seq + getpid() + time(NULL))
        );
 
        /* Convert it to base64 so it looks cool */     
                (long) (++seq + getpid() + time(NULL))
        );
 
        /* Convert it to base64 so it looks cool */     
-       CtdlEncodeBase64(buf, sourcebuf, strlen(sourcebuf), 0);
+       len = CtdlEncodeBase64(buf, sourcebuf, len, 0);
+       if (buf[len - 1] == '\n') {
+               buf[len - 1] = '\0';
+       }
 }
 
 const RoomNetCfg ActiveSubscribers[] = {listrecp, digestrecp};
 }
 
 const RoomNetCfg ActiveSubscribers[] = {listrecp, digestrecp};