Browse code

Minor beautifications.

Jan Janak authored on 09/03/2003 13:06:56
Showing 1 changed files
... ...
@@ -186,18 +186,18 @@ static inline int parse_digest_param(str* _s, dig_cred_t* _c)
186 186
 	      * body content will be stored
187 187
 	      */
188 188
 	switch(t) {
189
-	case PAR_USERNAME:  ptr = &(_c->username.whole);  break;
190
-	case PAR_REALM:     ptr = &(_c->realm);           break;
191
-	case PAR_NONCE:     ptr = &(_c->nonce);           break;
192
-	case PAR_URI:       ptr = &(_c->uri);             break;
193
-	case PAR_RESPONSE:  ptr = &(_c->response);        break;
194
-	case PAR_CNONCE:    ptr = &(_c->cnonce);          break;
195
-	case PAR_OPAQUE:    ptr = &(_c->opaque);          break;
196
-	case PAR_QOP:       ptr = &(_c->qop.qop_str);     break;
197
-	case PAR_NC:        ptr = &(_c->nc);              break;
198
-	case PAR_ALGORITHM: ptr = &(_c->alg.alg_str);     break;
199
-	case PAR_OTHER:     ptr = &dummy;                 break;
200
-	default:            ptr = &dummy;                 break;
189
+	case PAR_USERNAME:  ptr = &_c->username.whole;  break;
190
+	case PAR_REALM:     ptr = &_c->realm;           break;
191
+	case PAR_NONCE:     ptr = &_c->nonce;           break;
192
+	case PAR_URI:       ptr = &_c->uri;             break;
193
+	case PAR_RESPONSE:  ptr = &_c->response;        break;
194
+	case PAR_CNONCE:    ptr = &_c->cnonce;          break;
195
+	case PAR_OPAQUE:    ptr = &_c->opaque;          break;
196
+	case PAR_QOP:       ptr = &_c->qop.qop_str;     break;
197
+	case PAR_NC:        ptr = &_c->nc;              break;
198
+	case PAR_ALGORITHM: ptr = &_c->alg.alg_str;     break;
199
+	case PAR_OTHER:     ptr = &dummy;               break;
200
+	default:            ptr = &dummy;               break;
201 201
 	}
202 202
 
203 203
 	     /* If the first character is qoute, it is
... ...
@@ -278,7 +278,7 @@ static inline void parse_username(struct username* _u)
278 278
 	d = q_memchr(_u->whole.s, '@', _u->whole.len);
279 279
 
280 280
 	if (d) {
281
-		_u->domain.s = d;
281
+		_u->domain.s = d + 1;
282 282
 		_u->domain.len = _u->whole.len - (d - _u->whole.s) - 1;
283 283
 		_u->user.len = d - _u->user.s;
284 284
 	}
... ...
@@ -314,15 +314,17 @@ static inline int parse_digest_params(str* _s, dig_cred_t* _c)
314 314
 
315 315
 	     /* Parse QOP body if the parameter was present */
316 316
 	if (_c->qop.qop_str.s != 0) {
317
-		parse_qop(&(_c->qop));
317
+		parse_qop(&_c->qop);
318 318
 	}
319 319
 
320 320
 	     /* Parse algorithm body if the parameter was present */
321 321
 	if (_c->alg.alg_str.s != 0) {
322
-		parse_algorithm(&(_c->alg));
322
+		parse_algorithm(&_c->alg);
323 323
 	}
324 324
 
325
-	parse_username(&_c->username);
325
+	if (_c->username.whole.s != 0) {
326
+		parse_username(&_c->username);
327
+	}
326 328
 
327 329
 	return 0;
328 330
 }