Browse code

a minor bug fixed.

Jan Janak authored on 13/03/2003 00:00:06
Showing 1 changed files
... ...
@@ -46,7 +46,7 @@
46 46
 #define MESSAGE_500 "Server Internal Error"
47 47
 
48 48
 
49
-static inline int get_ha1(str* _user, str* _domain, str* _realm, char* _table, char* _ha1)
49
+static inline int get_ha1(str* _user, str* _domain, str _realm, char* _table, char* _ha1)
50 50
 {
51 51
 	db_key_t keys[2];
52 52
 	db_val_t vals[2];
... ...
@@ -63,9 +63,11 @@ static inline int get_ha1(str* _user, str* _domain, str* _realm, char* _table, c
63 63
 	
64 64
 	VAL_STR(vals).s = _user->s;
65 65
 	VAL_STR(vals).len = _user->len;
66
-	
67
-	VAL_STR(vals + 1).s = _realm->s;
68
-	VAL_STR(vals + 1).len = _realm->len;
66
+
67
+	printf("bhoj: %.*s\n", _realm.len, _realm.s);	
68
+	VAL_STR(vals + 1).s = _realm.s;
69
+	VAL_STR(vals + 1).len = _realm.len;
70
+
69 71
 
70 72
 	     /* If there is domain in username, we must use
71 73
 	      * another column holding HA1 calculated with the
... ...
@@ -83,7 +85,7 @@ static inline int get_ha1(str* _user, str* _domain, str* _realm, char* _table, c
83 85
 
84 86
 	if (RES_ROW_N(res) == 0) {
85 87
 		DBG("get_ha1(): no result for user \'%.*s@%.*s\'\n", 
86
-		    _user->len, _user->s, _realm->len, _realm->s);
88
+		    _user->len, _user->s, _realm.len, _realm.s);
87 89
 		db_free_query(db_handle, res);
88 90
 		return -1;
89 91
 	}
... ...
@@ -94,7 +96,7 @@ static inline int get_ha1(str* _user, str* _domain, str* _realm, char* _table, c
94 96
 	if (calc_ha1) {
95 97
 		     /* Only plaintext passwords are stored in database,
96 98
 		      * we have to calculate HA1 */
97
-		calc_HA1(HA_MD5, _user, _realm, &result, 0, 0, _ha1);
99
+		calc_HA1(HA_MD5, _user, &_realm, &result, 0, 0, _ha1);
98 100
 		DBG("HA1 string calculated: %s\n", _ha1);
99 101
 	} else {
100 102
 		memcpy(_ha1, result.s, result.len);
... ...
@@ -170,7 +172,9 @@ static inline int authorize(struct sip_msg* _m, str* _realm, char* _table, int _
170 172
 
171 173
 	cred = (auth_body_t*)h->parsed;
172 174
 
173
-	res = get_ha1(&cred->digest.username.user, &cred->digest.username.domain, _realm, _table, ha1);
175
+	printf("ahoj: %.*s\n", _realm->len, _realm->s);
176
+
177
+	res = get_ha1(&cred->digest.username.user, &cred->digest.username.domain, *_realm, _table, ha1);
174 178
         if (res < 0) {
175 179
 		     /* Error while accessing the database */
176 180
 		if (sl_reply(_m, (char*)500, MESSAGE_500) == -1) {