|
@@ -6,7 +6,7 @@
|
|
|
|
|
|
#include "digest.h"
|
|
|
#include "../../mem/mem.h" /* pkg_malloc */
|
|
|
-#include "../../dprint.h"
|
|
|
+#include "../../dprint.h" /* Guess what */
|
|
|
#include <stdio.h> /* printf */
|
|
|
|
|
|
|
|
@@ -14,15 +14,8 @@ static inline int new_credentials(struct hdr_field* _h)
|
|
|
{
|
|
|
auth_body_t* b;
|
|
|
|
|
|
- b = (auth_body_t*)(_h->parsed);
|
|
|
-
|
|
|
- if (b) {
|
|
|
- DBG("parse_credentials(): Credentials already parsed\n");
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
b = (auth_body_t*)pkg_malloc(sizeof(auth_body_t));
|
|
|
- if (!b) {
|
|
|
+ if (b == 0) {
|
|
|
LOG(L_ERR, "parse_credentials(): No memory left\n");
|
|
|
return -2;
|
|
|
}
|
|
@@ -42,6 +35,10 @@ int parse_credentials(struct hdr_field* _h)
|
|
|
{
|
|
|
int res;
|
|
|
|
|
|
+ if (_h->parsed) {
|
|
|
+ return 0; /* Already parsed */
|
|
|
+ }
|
|
|
+
|
|
|
if (new_credentials(_h) < 0) {
|
|
|
LOG(L_ERR, "parse_credentials(): Can't create new credentials\n");
|
|
|
return -1;
|