Changeset dd34575 for storage_xml.c
- Timestamp:
- 2008-04-02T13:28:23Z (17 years ago)
- Branches:
- master
- Children:
- 6ff51ff, 85d7b85
- Parents:
- 0db75ad (diff), fa75134 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
r0db75ad rdd34575 80 80 char *nick = xml_attr( attr_names, attr_values, "nick" ); 81 81 char *pass = xml_attr( attr_names, attr_values, "password" ); 82 md5_byte_t *pass_dec = NULL;82 int st; 83 83 84 84 if( !nick || !pass ) … … 87 87 "Missing attributes for %s element", element_name ); 88 88 } 89 else if( base64_decode( pass, &pass_dec ) != 21 ) 90 { 89 else if( ( st = md5_verify_password( xd->given_pass, pass ) ) == -1 ) 90 { 91 xd->pass_st = XML_PASS_WRONG; 91 92 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, 92 93 "Error while decoding password attribute" ); 93 94 } 95 else if( st == 0 ) 96 { 97 if( xd->pass_st != XML_PASS_CHECK_ONLY ) 98 xd->pass_st = XML_PASS_OK; 99 } 94 100 else 95 101 { 96 md5_byte_t pass_md5[16]; 97 md5_state_t md5_state; 98 int i; 99 100 md5_init( &md5_state ); 101 md5_append( &md5_state, (md5_byte_t*) xd->given_pass, strlen( xd->given_pass ) ); 102 md5_append( &md5_state, (md5_byte_t*) pass_dec + 16, 5 ); /* Hmmm, salt! */ 103 md5_finish( &md5_state, pass_md5 ); 104 105 for( i = 0; i < 16; i ++ ) 106 { 107 if( pass_dec[i] != pass_md5[i] ) 108 { 109 xd->pass_st = XML_PASS_WRONG; 110 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, 111 "Password mismatch" ); 112 break; 113 } 114 } 115 116 /* If we reached the end of the loop, it was a match! */ 117 if( i == 16 ) 118 { 119 if( xd->pass_st != XML_PASS_CHECK_ONLY ) 120 xd->pass_st = XML_PASS_OK; 121 } 122 } 123 124 g_free( pass_dec ); 102 xd->pass_st = XML_PASS_WRONG; 103 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, 104 "Password mismatch" ); 105 } 125 106 } 126 107 else if( xd->pass_st < XML_PASS_OK ) … … 428 409 int pass_len; 429 410 430 pass_len = arc_encode( acc->pass, strlen( acc->pass ), (unsigned char**) &pass_cr, irc->password );411 pass_len = arc_encode( acc->pass, strlen( acc->pass ), (unsigned char**) &pass_cr, irc->password, 12 ); 431 412 pass_b64 = base64_encode( pass_cr, pass_len ); 432 413 g_free( pass_cr );
Note: See TracChangeset
for help on using the changeset viewer.