... | ... |
@@ -6,7 +6,7 @@ |
6 | 6 |
|
7 | 7 |
#include "digest.h" |
8 | 8 |
#include "../../mem/mem.h" /* pkg_malloc */ |
9 |
-#include "../../dprint.h" |
|
9 |
+#include "../../dprint.h" /* Guess what */ |
|
10 | 10 |
#include <stdio.h> /* printf */ |
11 | 11 |
|
12 | 12 |
|
... | ... |
@@ -14,15 +14,8 @@ static inline int new_credentials(struct hdr_field* _h) |
14 | 14 |
{ |
15 | 15 |
auth_body_t* b; |
16 | 16 |
|
17 |
- b = (auth_body_t*)(_h->parsed); |
|
18 |
- |
|
19 |
- if (b) { |
|
20 |
- DBG("parse_credentials(): Credentials already parsed\n"); |
|
21 |
- return -1; |
|
22 |
- } |
|
23 |
- |
|
24 | 17 |
b = (auth_body_t*)pkg_malloc(sizeof(auth_body_t)); |
25 |
- if (!b) { |
|
18 |
+ if (b == 0) { |
|
26 | 19 |
LOG(L_ERR, "parse_credentials(): No memory left\n"); |
27 | 20 |
return -2; |
28 | 21 |
} |
... | ... |
@@ -42,6 +35,10 @@ int parse_credentials(struct hdr_field* _h) |
42 | 35 |
{ |
43 | 36 |
int res; |
44 | 37 |
|
38 |
+ if (_h->parsed) { |
|
39 |
+ return 0; /* Already parsed */ |
|
40 |
+ } |
|
41 |
+ |
|
45 | 42 |
if (new_credentials(_h) < 0) { |
46 | 43 |
LOG(L_ERR, "parse_credentials(): Can't create new credentials\n"); |
47 | 44 |
return -1; |
... | ... |
@@ -16,9 +16,7 @@ typedef struct auth_body { |
16 | 16 |
/* This is pointer to header field containing |
17 | 17 |
* parsed authorized digest credentials. This |
18 | 18 |
* pointer is set in sip_msg->{authorization,proxy_auth} |
19 |
- * hooks if the authorized credentials are in another |
|
20 |
- * header field (a SIP message may contain many digest |
|
21 |
- * credentials with different realms). |
|
19 |
+ * hooks. |
|
22 | 20 |
* |
23 | 21 |
* This is necessary for functions called after |
24 | 22 |
* {www,proxy}_authorize, these functions need to know |
... | ... |
@@ -2,8 +2,8 @@ |
2 | 2 |
* $Id$ |
3 | 3 |
*/ |
4 | 4 |
|
5 |
-#ifndef PARSE_VIA |
|
6 |
-#define PARSE_VIA |
|
5 |
+#ifndef PARSE_VIA_H |
|
6 |
+#define PARSE_VIA_H |
|
7 | 7 |
|
8 | 8 |
#include "../str.h" |
9 | 9 |
|
... | ... |
@@ -62,4 +62,4 @@ char* parse_via(char* buffer, char* end, struct via_body *vb); |
62 | 62 |
void free_via_list(struct via_body *vb); |
63 | 63 |
|
64 | 64 |
|
65 |
-#endif |
|
65 |
+#endif /* PARSE_VIA_H */ |