Changeset b75671d for unix.c


Ignore:
Timestamp:
2015-06-17T22:47:26Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
b441614
Parents:
d832164 (diff), 2f99f23 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/master' into parson

File:
1 edited

Legend:

Unmodified
Added
Removed
  • unix.c

    rd832164 rb75671d  
    212212                       argv[0], argv[0], argv[0], argv[0], argv[0]);
    213213        } else if (strcmp(argv[2], "enc") == 0) {
    214                 pass_len = arc_encode(argv[4], strlen(argv[4]), (unsigned char **) &pass_cr, argv[3], 12);
    215                 printf("%s\n", base64_encode(pass_cr, pass_len));
     214                char *encoded;
     215
     216                pass_len = arc_encode(argv[4], strlen(argv[4]), &pass_cr, argv[3], 12);
     217
     218                encoded = base64_encode(pass_cr, pass_len);
     219                printf("%s\n", encoded);
     220                g_free(encoded);
     221                g_free(pass_cr);
    216222        } else if (strcmp(argv[2], "dec") == 0) {
    217                 pass_len = base64_decode(argv[4], (unsigned char **) &pass_cr);
     223                pass_len = base64_decode(argv[4], &pass_cr);
    218224                arc_decode(pass_cr, pass_len, (char **) &pass_cl, argv[3]);
    219225                printf("%s\n", pass_cl);
     226
     227                g_free(pass_cr);
     228                g_free(pass_cl);
    220229        } else if (strcmp(argv[2], "hash") == 0) {
    221230                md5_byte_t pass_md5[21];
    222231                md5_state_t md5_state;
     232                char *encoded;
    223233
    224234                random_bytes(pass_md5 + 16, 5);
     
    228238                md5_finish(&md5_state, pass_md5);
    229239
    230                 printf("%s\n", base64_encode(pass_md5, 21));
     240                encoded = base64_encode(pass_md5, 21);
     241                printf("%s\n", encoded);
     242                g_free(encoded);
    231243        } else if (strcmp(argv[2], "unhash") == 0) {
    232244                printf("Hash %s submitted to a massive Beowulf cluster of\n"
Note: See TracChangeset for help on using the changeset viewer.