Changeset d028a77
- Timestamp:
- 2006-06-19T11:52:34Z (19 years ago)
- Branches:
- master
- Children:
- 84e9cea
- Parents:
- d28f3b35
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
rd28f3b35 rd028a77 86 86 md5_byte_t pass_md5[16]; 87 87 md5_state_t md5_state; 88 int pass_match,i, j;88 int i, j; 89 89 90 90 md5_init( &md5_state ); 91 md5_append( &md5_state, xd->given_pass, strlen( xd->given_pass ) );91 md5_append( &md5_state, (md5_byte_t*) xd->given_pass, strlen( xd->given_pass ) ); 92 92 md5_finish( &md5_state, pass_md5 ); 93 93 94 for( i = 0; i < 16 && pass[i*2] && pass[i*2+1]; i ++ )94 for( i = 0; i < 16; i ++ ) 95 95 { 96 sscanf( pass + i * 2, "%2x", &j ); 96 if( !isxdigit( pass[i*2] ) || !isxdigit( pass[i*2+1] ) || 97 sscanf( pass + i * 2, "%2x", &j ) != 1 ) 98 { 99 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, 100 "Incorrect password MD5-hash" ); 101 break; 102 } 97 103 if( j != pass_md5[i] ) 104 { 105 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, 106 XML_PASS_ERRORMSG ); 98 107 break; 108 } 99 109 } 110 100 111 /* If we reached the end of the loop, it was a match! */ 101 pass_match = i == 16; 102 103 if( strcmp( nick, xd->given_nick ) == 0 && pass_match ) 112 if( i == 16 ) 104 113 { 105 114 if( xd->pass_st != XML_PASS_CHECK_ONLY ) 106 115 xd->pass_st = XML_PASS_OK; 107 }108 else109 {110 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,111 XML_PASS_ERRORMSG );112 116 } 113 117 }
Note: See TracChangeset
for help on using the changeset viewer.