Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
81373837
...
813738374a351f5d69e40a0867b068faeccbe707
authored
2003-11-04 13:15:43 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Be more liberal in parsing local parts.
1 parent
c07d97cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
6 deletions
mailbox/parse822.c
mailbox/parse822.c
View file @
8137383
...
...
@@ -144,6 +144,7 @@ str_append_n (char **to, const char *from, size_t n)
return
EOK
;
}
static
int
str_append
(
char
**
to
,
const
char
*
from
)
{
...
...
@@ -151,16 +152,19 @@ str_append (char **to, const char *from)
return
0
;
return
str_append_n
(
to
,
from
,
strlen
(
from
));
}
static
int
str_append_char
(
char
**
to
,
char
c
)
{
return
str_append_n
(
to
,
&
c
,
1
);
}
static
int
str_append_range
(
char
**
to
,
const
char
*
b
,
const
char
*
e
)
{
return
str_append_n
(
to
,
b
,
e
-
b
);
}
static
void
str_free
(
char
**
s
)
{
...
...
@@ -226,14 +230,19 @@ parse822_is_special (char c)
{
return
strchr
(
"()<>@,;:
\\\"
.[]"
,
c
)
?
1
:
0
;
}
int
parse822_is_atom_char_ex
(
char
c
)
{
return
!
parse822_is_special
(
c
)
&&
!
parse822_is_space
(
c
)
&&
!
parse822_is_ctl
(
c
);
}
int
parse822_is_atom_char
(
char
c
)
{
return
parse822_is_char
(
c
)
&&
!
parse822_is_special
(
c
)
&&
!
parse822_is_space
(
c
)
&&
!
parse822_is_ctl
(
c
);
return
parse822_is_char
(
c
)
&&
parse822_is_atom_char_ex
(
c
);
}
int
...
...
@@ -294,6 +303,7 @@ parse822_skip_nl (const char **p, const char *e)
return
EPARSE
;
}
int
parse822_skip_lwsp_char
(
const
char
**
p
,
const
char
*
e
)
{
...
...
@@ -304,6 +314,7 @@ parse822_skip_lwsp_char (const char **p, const char *e)
}
return
EPARSE
;
}
int
parse822_skip_lwsp
(
const
char
**
p
,
const
char
*
e
)
{
...
...
@@ -482,6 +493,31 @@ parse822_atom (const char **p, const char *e, char **atom)
}
int
parse822_atom_ex
(
const
char
**
p
,
const
char
*
e
,
char
**
atom
)
{
/* atom = 1*<an atom char> */
const
char
*
save
=
*
p
;
int
rc
=
EPARSE
;
parse822_skip_comments
(
p
,
e
);
save
=
*
p
;
while
((
*
p
!=
e
)
&&
parse822_is_atom_char_ex
(
**
p
))
{
rc
=
str_append_char
(
atom
,
**
p
);
*
p
+=
1
;
if
(
rc
!=
EOK
)
{
*
p
=
save
;
break
;
}
}
return
rc
;
}
int
parse822_quoted_pair
(
const
char
**
p
,
const
char
*
e
,
char
**
qpair
)
{
/* quoted-pair = "\" char */
...
...
@@ -597,11 +633,14 @@ parse822_word (const char **p, const char *e, char **word)
/* Necessary because the quoted string could have found
* a partial string (invalid syntax). Thus reset, the atom
* will fail to if the syntax is invalid.
* We use parse822_atom_ex to allow for non-rfc-compliant atoms:
*
* "Be liberal in what you accept, and conservative in what you send."
*/
{
char
*
atom
=
0
;
if
(
parse822_atom
(
p
,
e
,
&
atom
)
==
EOK
)
if
(
parse822_atom
_ex
(
p
,
e
,
&
atom
)
==
EOK
)
{
rc
=
str_append
(
word
,
atom
);
...
...
Please
register
or
sign in
to post a comment