Changeset d28f3b35
- Timestamp:
- 2006-06-18T23:07:28Z (18 years ago)
- Branches:
- master
- Children:
- d028a77
- Parents:
- 10efa91
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
r10efa91 rd28f3b35 26 26 #define BITLBEE_CORE 27 27 #include "bitlbee.h" 28 #include "md5.h" 28 29 29 30 typedef enum … … 81 82 "Missing attributes for %s element", element_name ); 82 83 } 83 else if( strcmp( nick, xd->given_nick ) == 0 &&84 strcmp( pass, xd->given_pass ) == 0 )85 {86 if( xd->pass_st != XML_PASS_CHECK_ONLY )87 xd->pass_st = XML_PASS_OK;88 }89 84 else 90 85 { 91 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, 92 XML_PASS_ERRORMSG ); 86 md5_byte_t pass_md5[16]; 87 md5_state_t md5_state; 88 int pass_match, i, j; 89 90 md5_init( &md5_state ); 91 md5_append( &md5_state, xd->given_pass, strlen( xd->given_pass ) ); 92 md5_finish( &md5_state, pass_md5 ); 93 94 for( i = 0; i < 16 && pass[i*2] && pass[i*2+1]; i ++ ) 95 { 96 sscanf( pass + i * 2, "%2x", &j ); 97 if( j != pass_md5[i] ) 98 break; 99 } 100 /* 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 ) 104 { 105 if( xd->pass_st != XML_PASS_CHECK_ONLY ) 106 xd->pass_st = XML_PASS_OK; 107 } 108 else 109 { 110 g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, 111 XML_PASS_ERRORMSG ); 112 } 93 113 } 94 114 }
Note: See TracChangeset
for help on using the changeset viewer.