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
4d767fac
...
4d767fac3cec78beb790fa6336c9f1d69e3aa91c
authored
2001-05-28 03:45:58 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Patch from Sam Roberts.
1 parent
f2160616
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
48 deletions
ChangeLog
mailbox/address.c
mailbox/parse822.c
ChangeLog
View file @
4d767fa
2001-05-27 Sam Roberts
* mailbox/address.c: removed unfolding of lines at a NL before parsing.
* mailbox/parse822.c: consider LF and CRLF equivalent for purposes
of unfolding lines.
2001-05-23 Alain Magloire
* mailbox/mbx_default.c (mailbox_create_default): Check
...
...
mailbox/address.c
View file @
4d767fa
...
...
@@ -38,55 +38,12 @@ address_create (address_t *a, const char *s)
/* 'paddress' must exist, and can't already have been initialized
*/
int
status
;
const
char
*
e
;
const
char
*
save
;
char
*
fb
;
if
(
!
a
)
return
EINVAL
;
*
a
=
NULL
;
save
=
s
;
e
=
&
s
[
strlen
(
s
)];
fb
=
calloc
(
1
,
1
);
if
(
!
fb
)
return
ENOMEM
;
/* We need to unfold the string. Do the same thing as parse822_field_body()
but we have to be more flexible in allowing bare '\n' as CRLF for
unix-mbox. This is may not be the right approach still. */
for
(;;)
{
const
char
*
eol
=
s
;
size_t
len
=
strlen
(
fb
);
while
(
eol
!=
e
)
{
/* if (eol[0] == '\r' && (eol+1) != e && eol[1] == '\n') */
if
(
*
eol
==
'\n'
)
break
;
++
eol
;
}
fb
=
realloc
(
fb
,
len
+
(
eol
-
s
)
+
1
);
memcpy
(
fb
+
len
,
s
,
eol
-
s
);
fb
[
len
+
(
eol
-
s
)]
=
'\0'
;
s
=
eol
;
if
(
eol
==
e
)
break
;
/* no more, so we're done */
s
++
;
if
(
s
==
e
)
break
;
/* no more, so we're done */
/* check if next line is a continuation line */
if
(
*
s
!=
' '
&&
*
s
!=
'\t'
)
break
;
}
status
=
parse822_address_list
(
a
,
(
char
*
)
fb
);
free
(
fb
);
status
=
parse822_address_list
(
a
,
(
char
*
)
s
);
if
(
status
==
0
)
{
/* And address-list may contain 0 addresses but parse correctly.
...
...
@@ -94,7 +51,7 @@ address_create (address_t *a, const char *s)
if
(
!*
a
)
return
ENOENT
;
(
*
a
)
->
addr
=
strdup
(
s
ave
);
(
*
a
)
->
addr
=
strdup
(
s
);
if
(
!
(
*
a
)
->
addr
)
{
address_destroy
(
a
);
...
...
mailbox/parse822.c
View file @
4d767fa
...
...
@@ -211,9 +211,13 @@ int parse822_is_smtp_q(char c)
/***** From RFC 822, 3.3 Lexical Tokens *****/
int
parse822_skip_
crlf
(
const
char
**
p
,
const
char
*
e
)
int
parse822_skip_
nl
(
const
char
**
p
,
const
char
*
e
)
{
/* Here we consider a new-line (NL) to be either a bare LF, or
* a CRLF pair as required by the RFC.
*/
const
char
*
s
=
*
p
;
if
(
(
&
s
[
1
]
<
e
)
&&
s
[
0
]
==
'\r'
&&
...
...
@@ -224,6 +228,17 @@ int parse822_skip_crlf(const char** p, const char* e)
return
EOK
;
}
if
(
(
&
s
[
0
]
<
e
)
&&
s
[
0
]
==
'\n'
)
{
*
p
+=
1
;
return
EOK
;
}
return
EPARSE
;
}
int
parse822_skip_lwsp_char
(
const
char
**
p
,
const
char
*
e
)
...
...
@@ -237,7 +252,12 @@ int parse822_skip_lwsp_char(const char** p, const char* e)
int
parse822_skip_lwsp
(
const
char
**
p
,
const
char
*
e
)
{
/*
* linear-white-space = 1*([CRLF] LWSP-char)
* linear-white-space = 1*([[CR]LF] LWSP-char)
*
* We interpret a bare LF as identical to the canonical CRLF
* line ending, I don't know another way since on a Unix system
* all CRLF will be translated to the local convention, a bare
* LF, and thus we can not deal with bare NLs in the message.
*/
int
space
=
0
;
...
...
@@ -248,7 +268,7 @@ int parse822_skip_lwsp(const char** p, const char* e)
space
=
1
;
continue
;
}
if
(
parse822_skip_
crlf
(
p
,
e
)
==
EOK
)
{
if
(
parse822_skip_
nl
(
p
,
e
)
==
EOK
)
{
if
(
parse822_skip_lwsp_char
(
p
,
e
)
==
EOK
)
{
continue
;
}
...
...
Please
register
or
sign in
to post a comment