Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,182 +0,0 @@
1
-/*
2
- * Copyright (c) 2007 iptelorg GmbH
3
- *
4
- * This file is part of Kamailio, a free SIP server.
5
- *
6
- * Kamailio is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version
10
- *
11
- * Kamailio is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
- */
20
-
21
-/*! \file
22
- * \brief Parser :: Parse Identity header field
23
- *
24
- * \ingroup parser
25
- */
26
-
27
-
28
-#include <string.h>
29
-#include "parse_identity.h"
30
-#include "parse_def.h"
31
-#include "parser_f.h"  /* eat_space_end and so on */
32
-#include "../mem/mem.h"
33
-#include "../ut.h"
34
-
35
-/*
36
- * Parse Identity header field
37
- */
38
-
39
-#define SP(_c) ((_c)=='\t' || (_c)==' ')
40
-inline static int isendofhash (char* p, char* end)
41
-{
42
-	/* new header line */
43
-	if ((p<end && *p=='"')
44
-		/* end of message */
45
-		|| ((*p=='\n' || *p=='\r') && p+1==end))
46
-		return 1;
47
-	else
48
-		return 0;
49
-}
50
-
51
-
52
-/*! \brief
53
- * If the value of Identity header contains any LWS then we've to create
54
- * a new buffer and move there the LWSless part
55
- */
56
-int movetomybuffer (char *pstart,
57
-					char *pend,
58
-					char *pcur,
59
-					struct identity_body *ib)
60
-{
61
-	char *phashend;
62
-
63
-	for (phashend = pcur; !isendofhash(phashend, pend); phashend++);
64
-
65
-	if (!(ib->hash.s=pkg_malloc(phashend-pstart))) {
66
-		LOG(L_ERR, "parse_identity: out of memory\n");
67
-		return -2;
68
-	}
69
-	ib->ballocated=1;
70
-
71
-	memcpy(ib->hash.s, pstart, ib->hash.len);
72
-
73
-	return 0;
74
-}
75
-
76
-
77
-void parse_identity(char *buffer, char* end, struct identity_body* ib)
78
-{
79
-	char *p=NULL, *pstart=NULL;
80
-
81
-	if (!buffer || !end || !ib)
82
-		goto error;
83
-
84
-	ib->error=PARSE_ERROR;
85
-
86
-	/* if there is a '"' sign then we'll step over it */
87
-	*buffer == '"' ? (pstart = buffer + 1) : (pstart = buffer);
88
-
89
-	ib->hash.s=pstart;
90
-	ib->hash.len=0;
91
-
92
-	for (p = pstart; p < end; p++) {
93
-		/* check the BASE64 alphabet */
94
-		if (((*p >= 'a' && *p <='z')
95
-			|| (*p >= 'A' && *p <='Z')
96
-			|| (*p >= '0' && *p <='9')
97
-			|| (*p == '+' || *p == '/' || *p == '='))) {
98
-			if (ib->ballocated)
99
-				ib->hash.s[ib->hash.len]=*p;
100
-			ib->hash.len++;
101
-			continue;
102
-		}
103
-
104
-		/* LWS */
105
-		if (*p=='\n' && p+1<end && SP(*(p+1))) {
106
-			/* p - 1 because we don't want to pass '\n' */
107
-			if (!ib->ballocated && (movetomybuffer(pstart, end, p-1, ib)))
108
-				goto error;
109
-			/* p + 1 < end because 'continue' increases p so we'd skip \n
110
-			   we need after this for loop */
111
-			for (p+=1; p + 1 < end && SP(*(p + 1)); p++);
112
-			continue;
113
-		}
114
-		if (*p=='\r' && p+2<end && *(p+1)=='\n' && SP(*(p+2))) {
115
-			if (!ib->ballocated && (movetomybuffer(pstart, end, p-1, ib)))
116
-				goto error;
117
-			for (p+=2; p + 1 < end && SP(*(p + 1)); p++);
118
-			continue;
119
-		}
120
-
121
-		if (isendofhash(p, end))
122
-			break;
123
-
124
-		/* parse error */
125
-		goto parseerror;
126
-	}
127
-
128
-	/* this is the final quotation mark so we step over */
129
-	ib->error=PARSE_OK;
130
-	return ;
131
-
132
-parseerror:
133
-	LOG( L_ERR , "ERROR: parse_identity: "
134
-		"unexpected char [0x%X]: <<%.*s>> .\n",
135
-		*p,(int)(p-buffer), ZSW(buffer));
136
-error:
137
-	return ;
138
-}
139
-
140
-int parse_identity_header(struct sip_msg *msg)
141
-{
142
-	struct identity_body* identity_b;
143
-
144
-
145
-	if ( !msg->identity
146
-		 && (parse_headers(msg,HDR_IDENTITY_F,0)==-1
147
-		 || !msg->identity) ) {
148
-		LOG(L_ERR,"ERROR:parse_identity_header: bad msg or missing IDENTITY header\n");
149
-		goto error;
150
-	}
151
-
152
-	/* maybe the header is already parsed! */
153
-	if (msg->identity->parsed)
154
-		return 0;
155
-
156
-	identity_b=pkg_malloc(sizeof(*identity_b));
157
-	if (identity_b==0){
158
-		LOG(L_ERR, "ERROR:parse_identity_header: out of memory\n");
159
-		goto error;
160
-	}
161
-	memset(identity_b, 0, sizeof(*identity_b));
162
-
163
-	parse_identity(msg->identity->body.s,
164
-				   msg->identity->body.s + msg->identity->body.len+1,
165
-				   identity_b);
166
-	if (identity_b->error==PARSE_ERROR){
167
-		free_identity(identity_b);
168
-		goto error;
169
-	}
170
-	msg->identity->parsed=(void*)identity_b;
171
-
172
-	return 0;
173
-error:
174
-	return -1;
175
-}
176
-
177
-void free_identity(struct identity_body *ib)
178
-{
179
-	if (ib->ballocated)
180
-		pkg_free(ib->hash.s);
181
-	pkg_free(ib);
182
-}
Browse code

core parser - remove svn ID, remove history, change "ser" => "Kamailio"

Olle E. Johansson authored on 18/01/2015 19:36:18
Showing 1 changed files
... ...
@@ -1,19 +1,14 @@
1 1
 /*
2 2
  * Copyright (c) 2007 iptelorg GmbH
3 3
  *
4
- * This file is part of ser, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
5 5
  *
6
- * ser is free software; you can redistribute it and/or modify
6
+ * Kamailio is free software; you can redistribute it and/or modify
7 7
  * it under the terms of the GNU General Public License as published by
8 8
  * the Free Software Foundation; either version 2 of the License, or
9 9
  * (at your option) any later version
10 10
  *
11
- * For a license to use the ser software under conditions
12
- * other than those described here, or to purchase support for this
13
- * software, please contact iptel.org by e-mail at the following addresses:
14
- *    info@iptel.org
15
- *
16
- * ser is distributed in the hope that it will be useful,
11
+ * Kamailio is distributed in the hope that it will be useful,
17 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 14
  * GNU General Public License for more details.
Browse code

all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
... ...
@@ -20,7 +20,7 @@
20 20
  *
21 21
  * You should have received a copy of the GNU General Public License
22 22
  * along with this program; if not, write to the Free Software
23
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 24
  */
25 25
 
26 26
 /*! \file
Browse code

parser: remove old $Id$ docs header from subversion times, not usable anymore

Henning Westerholt authored on 05/07/2012 21:39:51
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (c) 2007 iptelorg GmbH
5 3
  *
6 4
  * This file is part of ser, a free SIP server.
Browse code

Doxygen changes

oej authored on 25/10/2009 18:30:31
Showing 1 changed files
... ...
@@ -25,6 +25,12 @@
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 26
  */
27 27
 
28
+/*! \file
29
+ * \brief Parser :: Parse Identity header field
30
+ *
31
+ * \ingroup parser
32
+ */
33
+
28 34
 
29 35
 #include <string.h>
30 36
 #include "parse_identity.h"
... ...
@@ -50,7 +56,7 @@ inline static int isendofhash (char* p, char* end)
50 56
 }
51 57
 
52 58
 
53
-/*
59
+/*! \brief
54 60
  * If the value of Identity header contains any LWS then we've to create
55 61
  * a new buffer and move there the LWSless part
56 62
  */
Browse code

Identity-info and Identity header parser does not insist on BNF specified in RFC.

Memory allocator part of Identity-info, Identity and Date header moved out
from get_hdr_field()@parser/msg_parser.c

Gergely Kovacs authored on 15/10/2007 14:32:19
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- * $Id$ 
2
+ * $Id$
3 3
  *
4 4
  * Copyright (c) 2007 iptelorg GmbH
5 5
  *
... ...
@@ -37,136 +37,144 @@
37 37
  * Parse Identity header field
38 38
  */
39 39
 
40
+#define SP(_c) ((_c)=='\t' || (_c)==' ')
41
+inline static int isendofhash (char* p, char* end)
42
+{
43
+	/* new header line */
44
+	if ((p<end && *p=='"')
45
+		/* end of message */
46
+		|| ((*p=='\n' || *p=='\r') && p+1==end))
47
+		return 1;
48
+	else
49
+		return 0;
50
+}
51
+
52
+
40 53
 /*
41 54
  * If the value of Identity header contains any LWS then we've to create
42 55
  * a new buffer and move there the LWSless part
43 56
  */
44
-int movetomybuffer (char *buffer, char *end, char *p, struct identity_body *ib)
57
+int movetomybuffer (char *pstart,
58
+					char *pend,
59
+					char *pcur,
60
+					struct identity_body *ib)
45 61
 {
46
-	char *bufend;
62
+	char *phashend;
47 63
 
48
-	if (!(bufend=q_memchr(p, '"', end-p))) {
49
-		LOG(L_ERR, "parse_identity: quotation mark is missing\n");
50
-		return -1;
51
-	}
64
+	for (phashend = pcur; !isendofhash(phashend, pend); phashend++);
52 65
 
53
-	if (!(ib->hash.s=pkg_malloc(bufend-buffer))) {
66
+	if (!(ib->hash.s=pkg_malloc(phashend-pstart))) {
54 67
 		LOG(L_ERR, "parse_identity: out of memory\n");
55 68
 		return -2;
56 69
 	}
57 70
 	ib->ballocated=1;
58 71
 
59
-	memcpy(ib->hash.s, buffer, ib->hash.len);
72
+	memcpy(ib->hash.s, pstart, ib->hash.len);
60 73
 
61 74
 	return 0;
62 75
 }
63 76
 
64
-char* parse_identity(char *buffer, char* end, struct identity_body* ib)
77
+
78
+void parse_identity(char *buffer, char* end, struct identity_body* ib)
65 79
 {
66
-	char *p=NULL;
67
-	char bpadded=0;
80
+	char *p=NULL, *pstart=NULL;
68 81
 
69 82
 	if (!buffer || !end || !ib)
70 83
 		goto error;
71 84
 
72 85
 	ib->error=PARSE_ERROR;
73 86
 
74
-	/* there must be '"' sign because there might be '=' sign in the
75
-	 * value of Identity header
76
-	 */
77
-	if (*buffer != '"') {
78
-		LOG(L_ERR, "parse_identity: quotation mark is missing\n");
79
-		goto error;
80
-	}
87
+	/* if there is a '"' sign then we'll step over it */
88
+	*buffer == '"' ? (pstart = buffer + 1) : (pstart = buffer);
81 89
 
82
-	/* we step over the '"' mark */
83
-	ib->hash.s=buffer+1;
90
+	ib->hash.s=pstart;
84 91
 	ib->hash.len=0;
85 92
 
86
-	for (p=buffer+1; p < end && *p != '"'; p++) {
93
+	for (p = pstart; p < end; p++) {
87 94
 		/* check the BASE64 alphabet */
88
-		if (!bpadded
89
-		    && ((*p >= 'a' && *p <='z')
90
-			 	|| (*p >= 'A' && *p <='Z')
91
-				|| (*p >= '0' && *p <='9')
92
-				|| (*p == '+' || *p == '/'))) {
95
+		if (((*p >= 'a' && *p <='z')
96
+			|| (*p >= 'A' && *p <='Z')
97
+			|| (*p >= '0' && *p <='9')
98
+			|| (*p == '+' || *p == '/' || *p == '='))) {
93 99
 			if (ib->ballocated)
94 100
 				ib->hash.s[ib->hash.len]=*p;
95 101
 			ib->hash.len++;
96 102
 			continue;
97 103
 		}
98 104
 
99
-		/* check the BASE64 padding */
100
-		if ((p+1 < end && *p == '=' && *(p+1) != '=')
101
-		    || (p+2 < end && *p == '=' && *(p+1) == '=' && *(p+2) != '=')) {
102
-			bpadded=1;
103
-			if (ib->ballocated)
104
-				ib->hash.s[ib->hash.len]=*p;
105
-			ib->hash.len++;
106
-			continue;
107
-		}
108
-
109
-		/* LSW case */
110
-		if (*p == ' ' || *p == '\t') {
111
-			for (p++; p < end && (*p == ' ' || *p == '\t'); p++);
112
-			if (p == end)
113
-				goto parseerror;
114
-			/* we've to create another whitespaceless buffer */
115
-			if (!ib->ballocated && (movetomybuffer(buffer+1, end, p-1, ib)))
105
+		/* LWS */
106
+		if (*p=='\n' && p+1<end && SP(*(p+1))) {
107
+			/* p - 1 because we don't want to pass '\n' */
108
+			if (!ib->ballocated && (movetomybuffer(pstart, end, p-1, ib)))
116 109
 				goto error;
117
-		}
118
-		if (p+2 < end && *p == '\n' && *(p+1) == ' '
119
-		    && !(*(p+2) == ' ' || *(p+2) == '\t')) {
120
-			/* we've to create another whitespaceless buffer */
121
-			if (!ib->ballocated && (movetomybuffer(buffer+1, end, p-1, ib)))
122
-				goto error;
123
-			p+=1;
110
+			/* p + 1 < end because 'continue' increases p so we'd skip \n
111
+			   we need after this for loop */
112
+			for (p+=1; p + 1 < end && SP(*(p + 1)); p++);
124 113
 			continue;
125 114
 		}
126
-		if (p+3 < end && *p == '\r' && *(p+1) == '\n' && *(p+2) == ' '
127
-		  	&& !(*(p+3) == ' ' || *(p+3) == '\t')) {
128
-			/* we've to create another whitespaceless buffer */
129
-			if (!ib->ballocated && (movetomybuffer(buffer+1, end, p-1, ib)))
115
+		if (*p=='\r' && p+2<end && *(p+1)=='\n' && SP(*(p+2))) {
116
+			if (!ib->ballocated && (movetomybuffer(pstart, end, p-1, ib)))
130 117
 				goto error;
131
-			p+=2;
118
+			for (p+=2; p + 1 < end && SP(*(p + 1)); p++);
132 119
 			continue;
133 120
 		}
134 121
 
122
+		if (isendofhash(p, end))
123
+			break;
124
+
135 125
 		/* parse error */
136
-		break;
137
-	}
138
-	if (p == end || *p != '"')
139 126
 		goto parseerror;
127
+	}
140 128
 
141
-	/* we step over '"' */
142
-	p++;
129
+	/* this is the final quotation mark so we step over */
130
+	ib->error=PARSE_OK;
131
+	return ;
143 132
 
144
-	p=eat_lws_end(p, end);
145
-	/*check if the header ends here*/
146
-	if (p>=end) {
147
-		LOG(L_ERR, "ERROR: parse_identity: strange EoHF\n");
133
+parseerror:
134
+	LOG( L_ERR , "ERROR: parse_identity: "
135
+		"unexpected char [0x%X]: <<%.*s>> .\n",
136
+		*p,(int)(p-buffer), ZSW(buffer));
137
+error:
138
+	return ;
139
+}
140
+
141
+int parse_identity_header(struct sip_msg *msg)
142
+{
143
+	struct identity_body* identity_b;
144
+
145
+
146
+	if ( !msg->identity
147
+		 && (parse_headers(msg,HDR_IDENTITY_F,0)==-1
148
+		 || !msg->identity) ) {
149
+		LOG(L_ERR,"ERROR:parse_identity_header: bad msg or missing IDENTITY header\n");
148 150
 		goto error;
149 151
 	}
150
-	if (*p=='\r' && p+1<end && *(p+1)=='\n') {
151
-		ib->error=PARSE_OK;
152
-		return p+2;
152
+
153
+	/* maybe the header is already parsed! */
154
+	if (msg->identity->parsed)
155
+		return 0;
156
+
157
+	identity_b=pkg_malloc(sizeof(*identity_b));
158
+	if (identity_b==0){
159
+		LOG(L_ERR, "ERROR:parse_identity_header: out of memory\n");
160
+		goto error;
153 161
 	}
154
-	if (*p=='\n') {
155
-		ib->error=PARSE_OK;
156
-		return p+1;
162
+	memset(identity_b, 0, sizeof(*identity_b));
163
+
164
+	parse_identity(msg->identity->body.s,
165
+				   msg->identity->body.s + msg->identity->body.len+1,
166
+				   identity_b);
167
+	if (identity_b->error==PARSE_ERROR){
168
+		free_identity(identity_b);
169
+		goto error;
157 170
 	}
158
-	LOG(L_ERR, "ERROR: Identity EoL expected\n");
159
-	goto error;
171
+	msg->identity->parsed=(void*)identity_b;
160 172
 
161
-parseerror:
162
-	LOG( L_ERR , "ERROR: parse_identity: "
163
-		"unexpected char [%c]: <<%.*s>> .\n",
164
-		*p,(int)(p-buffer), ZSW(buffer));
173
+	return 0;
165 174
 error:
166
-	return p;
175
+	return -1;
167 176
 }
168 177
 
169
-
170 178
 void free_identity(struct identity_body *ib)
171 179
 {
172 180
 	if (ib->ballocated)
Browse code

Identity Header Field parsing functions and macros

First release

Gergely Kovacs authored on 08/03/2007 15:21:54
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,175 @@
1
+/*
2
+ * $Id$ 
3
+ *
4
+ * Copyright (c) 2007 iptelorg GmbH
5
+ *
6
+ * This file is part of ser, a free SIP server.
7
+ *
8
+ * ser is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * For a license to use the ser software under conditions
14
+ * other than those described here, or to purchase support for this
15
+ * software, please contact iptel.org by e-mail at the following addresses:
16
+ *    info@iptel.org
17
+ *
18
+ * ser is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program; if not, write to the Free Software
25
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ */
27
+
28
+
29
+#include <string.h>
30
+#include "parse_identity.h"
31
+#include "parse_def.h"
32
+#include "parser_f.h"  /* eat_space_end and so on */
33
+#include "../mem/mem.h"
34
+#include "../ut.h"
35
+
36
+/*
37
+ * Parse Identity header field
38
+ */
39
+
40
+/*
41
+ * If the value of Identity header contains any LWS then we've to create
42
+ * a new buffer and move there the LWSless part
43
+ */
44
+int movetomybuffer (char *buffer, char *end, char *p, struct identity_body *ib)
45
+{
46
+	char *bufend;
47
+
48
+	if (!(bufend=q_memchr(p, '"', end-p))) {
49
+		LOG(L_ERR, "parse_identity: quotation mark is missing\n");
50
+		return -1;
51
+	}
52
+
53
+	if (!(ib->hash.s=pkg_malloc(bufend-buffer))) {
54
+		LOG(L_ERR, "parse_identity: out of memory\n");
55
+		return -2;
56
+	}
57
+	ib->ballocated=1;
58
+
59
+	memcpy(ib->hash.s, buffer, ib->hash.len);
60
+
61
+	return 0;
62
+}
63
+
64
+char* parse_identity(char *buffer, char* end, struct identity_body* ib)
65
+{
66
+	char *p=NULL;
67
+	char bpadded=0;
68
+
69
+	if (!buffer || !end || !ib)
70
+		goto error;
71
+
72
+	ib->error=PARSE_ERROR;
73
+
74
+	/* there must be '"' sign because there might be '=' sign in the
75
+	 * value of Identity header
76
+	 */
77
+	if (*buffer != '"') {
78
+		LOG(L_ERR, "parse_identity: quotation mark is missing\n");
79
+		goto error;
80
+	}
81
+
82
+	/* we step over the '"' mark */
83
+	ib->hash.s=buffer+1;
84
+	ib->hash.len=0;
85
+
86
+	for (p=buffer+1; p < end && *p != '"'; p++) {
87
+		/* check the BASE64 alphabet */
88
+		if (!bpadded
89
+		    && ((*p >= 'a' && *p <='z')
90
+			 	|| (*p >= 'A' && *p <='Z')
91
+				|| (*p >= '0' && *p <='9')
92
+				|| (*p == '+' || *p == '/'))) {
93
+			if (ib->ballocated)
94
+				ib->hash.s[ib->hash.len]=*p;
95
+			ib->hash.len++;
96
+			continue;
97
+		}
98
+
99
+		/* check the BASE64 padding */
100
+		if ((p+1 < end && *p == '=' && *(p+1) != '=')
101
+		    || (p+2 < end && *p == '=' && *(p+1) == '=' && *(p+2) != '=')) {
102
+			bpadded=1;
103
+			if (ib->ballocated)
104
+				ib->hash.s[ib->hash.len]=*p;
105
+			ib->hash.len++;
106
+			continue;
107
+		}
108
+
109
+		/* LSW case */
110
+		if (*p == ' ' || *p == '\t') {
111
+			for (p++; p < end && (*p == ' ' || *p == '\t'); p++);
112
+			if (p == end)
113
+				goto parseerror;
114
+			/* we've to create another whitespaceless buffer */
115
+			if (!ib->ballocated && (movetomybuffer(buffer+1, end, p-1, ib)))
116
+				goto error;
117
+		}
118
+		if (p+2 < end && *p == '\n' && *(p+1) == ' '
119
+		    && !(*(p+2) == ' ' || *(p+2) == '\t')) {
120
+			/* we've to create another whitespaceless buffer */
121
+			if (!ib->ballocated && (movetomybuffer(buffer+1, end, p-1, ib)))
122
+				goto error;
123
+			p+=1;
124
+			continue;
125
+		}
126
+		if (p+3 < end && *p == '\r' && *(p+1) == '\n' && *(p+2) == ' '
127
+		  	&& !(*(p+3) == ' ' || *(p+3) == '\t')) {
128
+			/* we've to create another whitespaceless buffer */
129
+			if (!ib->ballocated && (movetomybuffer(buffer+1, end, p-1, ib)))
130
+				goto error;
131
+			p+=2;
132
+			continue;
133
+		}
134
+
135
+		/* parse error */
136
+		break;
137
+	}
138
+	if (p == end || *p != '"')
139
+		goto parseerror;
140
+
141
+	/* we step over '"' */
142
+	p++;
143
+
144
+	p=eat_lws_end(p, end);
145
+	/*check if the header ends here*/
146
+	if (p>=end) {
147
+		LOG(L_ERR, "ERROR: parse_identity: strange EoHF\n");
148
+		goto error;
149
+	}
150
+	if (*p=='\r' && p+1<end && *(p+1)=='\n') {
151
+		ib->error=PARSE_OK;
152
+		return p+2;
153
+	}
154
+	if (*p=='\n') {
155
+		ib->error=PARSE_OK;
156
+		return p+1;
157
+	}
158
+	LOG(L_ERR, "ERROR: Identity EoL expected\n");
159
+	goto error;
160
+
161
+parseerror:
162
+	LOG( L_ERR , "ERROR: parse_identity: "
163
+		"unexpected char [%c]: <<%.*s>> .\n",
164
+		*p,(int)(p-buffer), ZSW(buffer));
165
+error:
166
+	return p;
167
+}
168
+
169
+
170
+void free_identity(struct identity_body *ib)
171
+{
172
+	if (ib->ballocated)
173
+		pkg_free(ib->hash.s);
174
+	pkg_free(ib);
175
+}