]> jfr.im git - irc/UndernetIRC/gnuworld.git/commitdiff
Generate 160 bit key and not 80
authorMrBean <redacted>
Sat, 26 May 2012 19:53:19 +0000 (23:53 +0400)
committerMrBean <redacted>
Sat, 26 May 2012 19:53:19 +0000 (23:53 +0400)
mod.cservice/SETCommand.cc

index d86907aa59be7dc3e7dabbd0e477d54282574632..ec4354e73a97a44f0e470ad10109315a7a2947b7 100755 (executable)
@@ -284,16 +284,16 @@ if( st[1][0] != '#' ) // Didn't find a hash?
                                }
                                if(string_upper(st[3]) == "-FORCE") {
                                        //Create a random hex string 168bit long
-                                       char str_key2[10];
-                                       char hex_key[21];
+                                       char str_key2[20];
+                                       char hex_key[41];
                                        srand(clock()*745+time(NULL));
                                        hex_key[0] = 0;
-                                       for(int i=0; i < 10; i++) {
+                                       for(int i=0; i < 20; i++) {
                                                str_key2[i]=((rand() %95) + 32);
                                                sprintf(hex_key+(i*2),"%02x",str_key2[i] & 0xFF);
                                        }       
                                        char* key;
-                                       int res = oath_base32_encode(str_key2,10,&key,NULL);
+                                       int res = oath_base32_encode(str_key2,20,&key,NULL);
                                        if(res != OATH_OK) {
                                                bot->Notice(theClient,"Failed to enable TOTP authentication, please contact a cservice representitive");
                                                return true;