aboutsummaryrefslogtreecommitdiff
path: root/mtasim/mtasim.c
diff options
context:
space:
mode:
Diffstat (limited to 'mtasim/mtasim.c')
-rw-r--r--mtasim/mtasim.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/mtasim/mtasim.c b/mtasim/mtasim.c
index ac751d12..1c433a3b 100644
--- a/mtasim/mtasim.c
+++ b/mtasim/mtasim.c
@@ -1703,8 +1703,12 @@ process_header (struct obstack *stk, size_t header_size,
while (*hv && c_isspace (*hv))
hv++;
len = strlen (hv);
- if (len > 0 && hv[len-1] == '\n')
- hv[len - 1] = 0;
+ if (len > 0 && hv[len - 1] == '\n')
+ {
+ if (--len > 0 && hv[len - 1] == '\r')
+ len--;
+ hv[len] = 0;
+ }
rc = gacopyz_srv_header(gsrv, hn, hv);
status = process_data_reply ("cmd", "header", rc, state, reply);
}
@@ -2005,7 +2009,7 @@ smtp (void)
if (header_size)
{
rc = process_header (&stk, header_size, &state,
- &datareply);
+ &datareply);
header_size = 0;
if (rc)
continue;
@@ -2017,12 +2021,12 @@ smtp (void)
body_buf.level = 0;
state = STATE_DATA;
}
- else if (buf[0] == ' ' || buf[1] == '\t')
+ else if (buf[0] == ' ' || buf[0] == '\t')
{
if (gsrv)
{
- obstack_1grow (&stk, '\n');
- obstack_grow (&stk, buf, len);
+ obstack_grow (&stk, buf, len - 1);
+ obstack_grow (&stk, "\r\n", 2);
header_size += len + 1;
}
}
@@ -2056,8 +2060,9 @@ smtp (void)
if (rc)
continue;
}
- obstack_grow (&stk, buf, len);
- header_size += len;
+ obstack_grow (&stk, buf, len - 1);
+ obstack_grow (&stk, "\r\n", 2);
+ header_size += len + 1;
}
break;
@@ -2071,7 +2076,7 @@ smtp (void)
rc = gacopyz_srv_eom (gsrv, body_buf.bufptr, body_buf.level);
process_data_reply ("cmd", "eom", rc, &state, &datareply);
/* FIXME: Clear macro table, except for the entries from
- command line */
+ the command line */
gacopyz_srv_clear_macros (gsrv);
}
if (datareply)

Return to:

Send suggestions and report system problems to the System administrator.