summaryrefslogtreecommitdiffstats
path: root/maildrop
diff options
context:
space:
mode:
authorSam Varshavchik2014-07-21 19:06:03 -0400
committerSam Varshavchik2014-07-21 19:06:03 -0400
commit86eac1206be963bcd3108774ccac1afc7a61a930 (patch)
treec539620e68d82424ab844a866d78f912ed79e8d2 /maildrop
parent53b5c8d40506939facab770fe5ec1c26aa1e1e76 (diff)
downloadcourier-libs-86eac1206be963bcd3108774ccac1afc7a61a930.tar.bz2
maildrop: fix parsing of headers added by the -A option.
Headers added by the option must be parsed in order, via rfc2045_parse().
Diffstat (limited to 'maildrop')
-rw-r--r--maildrop/main.C3
-rw-r--r--maildrop/message.C6
-rw-r--r--maildrop/message.h3
3 files changed, 8 insertions, 4 deletions
diff --git a/maildrop/main.C b/maildrop/main.C
index 1ee3954..8da29ba 100644
--- a/maildrop/main.C
+++ b/maildrop/main.C
@@ -752,9 +752,8 @@ Buffer value;
Buffer msg;
maildrop.global_timer.Set(GLOBAL_TIMEOUT);
- maildrop.msgptr->Init(0); // Read message from standard input.
+ maildrop.msgptr->Init(0, extra_headers); // Read message from standard input.
maildrop.msginfo.info( *maildrop.msgptr );
- maildrop.msgptr->ExtraHeaders(extra_headers);
maildrop.msgptr->setmsgsize();
diff --git a/maildrop/message.C b/maildrop/message.C
index 7d156c5..a32ae6e 100644
--- a/maildrop/message.C
+++ b/maildrop/message.C
@@ -73,9 +73,11 @@ void Message::Init()
rfc2045p=rfc2045_alloc();
}
-void Message::Init(int fd)
+void Message::Init(int fd, const Buffer &extra_headers)
{
Init();
+ ExtraHeaders(extra_headers);
+
// If the file descriptor is seekable, and the message is big
// keep message in the file.
if ( mseek(fd, 0, SEEK_END) >= 0 &&
@@ -192,6 +194,8 @@ void Message::Init(const void *data, unsigned cnt)
void Message::ExtraHeaders(const Buffer &buf)
{
+ rfc2045_parse(rfc2045p, (const char *)buf, buf.Length());
+
if ( extra_headers )
{
delete[] extra_headers;
diff --git a/maildrop/message.h b/maildrop/message.h
index a539929..f149f7f 100644
--- a/maildrop/message.h
+++ b/maildrop/message.h
@@ -61,7 +61,8 @@ class Message {
public:
Message();
~Message();
- void Init(int); // Initialize from file descriptor
+ void Init(int, const Buffer &extra_headers);
+ // Initialize from file descriptor
void Init(); // Begin initializing externally
void Init(const void *, unsigned); // From existing contents.