Changeset 8b6b740


Ignore:
Timestamp:
2010-03-11T11:15:36Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
547c94c, be609ff
Parents:
75ec2c8
Message:

Document the new -x flag in one useful location and make it a bit better at
argument checking to avoid ugly (even though harmless) segfaults. Also skip
any md5: prefix that may be present when checking hashes.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.conf

    r75ec2c8 r8b6b740  
    5555##
    5656## Password the user should enter when logging into a closed BitlBee server.
    57 ## You can also have an MD5-encrypted password here. Format: "md5:", followed
    58 ## by a hash as generated for the <user password=""> attribute in a BitlBee
    59 ## XML file (for now there's no easier way to generate the hash).
     57## You can also have a BitlBee-style MD5 hash here. Format: "md5:", followed
     58## by a hash as generated by "bitlbee -x hash <password>".
    6059##
    6160# AuthPassword = ItllBeBitlBee   ## Heh.. Our slogan. ;-)
  • unix.c

    r75ec2c8 r8b6b740  
    173173        unsigned char *pass_cr, *pass_cl;
    174174       
    175         if( argc < 3 )
     175        if( argc < 4 || ( strcmp( argv[2], "hash" ) != 0 &&
     176                          strcmp( argv[2], "unhash" ) != 0 && argc < 5 ) )
    176177        {
    177178                printf( "Supported:\n"
     
    214215        else if( strcmp( argv[2], "chkhash" ) == 0 )
    215216        {
    216                 int st = md5_verify_password( argv[4], argv[3] );
     217                char *hash = strncmp( argv[3], "md5:", 4 ) == 0 ? argv[3] + 4 : argv[3];
     218                int st = md5_verify_password( argv[4], hash );
    217219               
    218220                printf( "Hash %s given password.\n", st == 0 ? "matches" : "does not match" );
Note: See TracChangeset for help on using the changeset viewer.