Browse code

- warnings removed

Jan Janak authored on 12/03/2003 15:45:37
Showing 1 changed files
... ...
@@ -53,7 +53,6 @@ static inline int get_ha1(str* _user, str* _domain, str* _realm, char* _table, c
53 53
 	db_key_t col[1];
54 54
 	db_res_t* res;
55 55
 	str result;
56
-	char* at;
57 56
 
58 57
 	keys[0] = username_column;
59 58
 	keys[1] = domain_column;
... ...
@@ -68,26 +67,12 @@ static inline int get_ha1(str* _user, str* _domain, str* _realm, char* _table, c
68 67
 	VAL_STR(vals + 1).s = _realm->s;
69 68
 	VAL_STR(vals + 1).len = _realm->len;
70 69
 
71
-	     /* If username contains also domain U */
72
-	if (_domain->len) {
73
-		     /* Use that domain instead of realm */
74
-		VAL_STR(vals + 1).s = _domain->s;
75
-		VAL_STR(vals + 1).len = _domain->len;		
76
-		     /*
77
-		      * If we do not calculate HA1 strings on the fly,
78
-		      * we must use another column here, because the original
79
-		      * column contains HA1 hashed without the domain. So we
80
-		      * use another column which contains HA1 string including
81
-		      * also the domain
82
-		      *
83
-		      * This is not necessarry if we calculate HA1 strings on the
84
-		      * fly (i.e. plaintext passwords are stored in the database),
85
-		      * because in this case HA1 will be always calculated correctly
86
-		      * by the server.
87
-		      */
88
-		if (!calc_ha1) {
89
-			col[0] = pass_column_2;
90
-		}
70
+	     /* If there is domain in username, we must use
71
+	      * another column holding HA1 calculated with the
72
+	      * domain
73
+	      */
74
+	if ((_domain->len) && !calc_ha1) {
75
+		col[0] = pass_column_2;
91 76
 	}
92 77
 
93 78
 	db_use_table(db_handle, _table);
... ...
@@ -98,10 +83,7 @@ static inline int get_ha1(str* _user, str* _domain, str* _realm, char* _table, c
98 83
 
99 84
 	if (RES_ROW_N(res) == 0) {
100 85
 		DBG("get_ha1(): no result for user \'%.*s@%.*s\'\n", 
101
-		    _user->len, _user->s,
102
-		    (_domain->len) ? (_domain->len) : (_realm->len),
103
-		    (_domain->len) ? (_domain->s) : (_realm->s)
104
-		    );
86
+		    _user->len, _user->s, _realm->len, _realm->s);
105 87
 		db_free_query(db_handle, res);
106 88
 		return -1;
107 89
 	}
... ...
@@ -207,6 +189,7 @@ static inline int authorize(struct sip_msg* _m, str* _realm, char* _table, int _
207 189
 		case ERROR:          return 0;
208 190
 		case NOT_AUTHORIZED: return -1;
209 191
 		case AUTHORIZED:     return 1;
192
+		default:             return -1; 
210 193
 		}
211 194
 	}
212 195