Changeset ece2cd2


Ignore:
Timestamp:
2006-06-20T21:48:28Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
9b46b64
Parents:
2befb95
Message:

xml_save() now stores the password's md5sum too. Kind of ... important..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • storage_xml.c

    r2befb95 rece2cd2  
    343343static storage_status_t xml_save( irc_t *irc, int overwrite )
    344344{
    345         char path[512], *path2;
     345        char path[512], *path2, md5_buf[33];
    346346        set_t *set;
    347347        nick_t *nick;
    348348        account_t *acc;
    349         int fd;
     349        int fd, i;
     350        md5_byte_t pass_md5[16];
     351        md5_state_t md5_state;
     352       
     353        if( irc->password == NULL )
     354        {
     355                irc_usermsg( irc, "Please register yourself if you want to save your settings." );
     356                return STORAGE_OTHER_ERROR;
     357        }
    350358       
    351359        g_snprintf( path, sizeof( path ) - 2, "%s%s%s", global.conf->configdir, irc->nick, ".xml" );
     
    361369        }
    362370       
    363         if( !xml_printf( fd, "<user nick=\"%s\" password=\"%s\">\n", irc->nick, irc->password ) )
     371        md5_init( &md5_state );
     372        md5_append( &md5_state, (md5_byte_t*) irc->password, strlen( irc->password ) );
     373        md5_finish( &md5_state, pass_md5 );
     374        for( i = 0; i < 16; i ++ )
     375                g_snprintf( md5_buf + i * 2, 3, "%02x", pass_md5[i] );
     376       
     377        if( !xml_printf( fd, "<user nick=\"%s\" password=\"%s\">\n", irc->nick, md5_buf ) )
    364378                goto write_error;
    365379       
Note: See TracChangeset for help on using the changeset viewer.