summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2005-10-19 05:46:36 +0000
committerStef Walter <stef@memberwebs.com>2005-10-19 05:46:36 +0000
commit4ad6be7d1300ed518294a57c26a09d4218c49502 (patch)
treee3c344344d86186739bcd6a65ef555c34fee5059
parent15ebe8e5ad0730b9ac95e6210798aa9008f001d3 (diff)
Fixes from Loic Le Loarer
-rw-r--r--common/smtppass.c16
-rw-r--r--common/smtppass.h2
-rw-r--r--common/spio.c4
3 files changed, 10 insertions, 12 deletions
diff --git a/common/smtppass.c b/common/smtppass.c
index c9bc6d8..f8129ed 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -87,8 +87,8 @@ spthread_t;
#define CRLF "\r\n"
#define SMTP_TOOLONG "500 Line too long" CRLF
-#define SMTP_STARTBUSY "554 Server Busy" CRLF
-#define SMTP_STARTFAILED "554 Local Error" CRLF
+#define SMTP_STARTBUSY "421 Server busy, too many connections" CRLF
+#define SMTP_STARTFAILED "421 Local Error, cannot start thread" CRLF
#define SMTP_DATAINTERMED "354 Start mail input; end with <CRLF>.<CRLF>" CRLF
#define SMTP_FAILED "451 Local Error" CRLF
#define SMTP_NOTSUPP "502 Command not implemented" CRLF
@@ -1490,10 +1490,9 @@ static int make_header(spctx_t* ctx, const char* format_str, char* header)
int sp_done_data(spctx_t* ctx)
{
FILE* file = 0;
- int had_header = 0;
int ret = 0;
char *line;
- char header[MAX_HEADER_LENGTH];
+ char header[MAX_HEADER_LENGTH] = "";
size_t header_len, line_len;
ssize_t rc;
@@ -1539,12 +1538,12 @@ int sp_done_data(spctx_t* ctx)
header_len = make_header(ctx, g_state.header, header);
/* If we have to prepend the header, do it */
- if(header[0] && g_state.header_prepend)
+ if(header[0] != '\0' && g_state.header_prepend)
{
if(spio_write_data_raw(ctx, &(ctx->server), (unsigned char*)header, header_len) == -1 ||
spio_write_data_raw(ctx, &(ctx->server), (unsigned char*)CRLF, KL(CRLF)) == -1)
RETURN(-1);
- had_header = 1;
+ header[0] = '\0';
}
/* Transfer actual file data */
@@ -1559,7 +1558,7 @@ int sp_done_data(spctx_t* ctx)
if(strcmp(line, "." CRLF) == 0)
strncpy(line, ". " CRLF, SP_LINE_LENGTH);
- if(header[0] && !had_header)
+ if(header[0] != '\0')
{
/*
* The first blank line we see means the headers are done.
@@ -1570,8 +1569,7 @@ int sp_done_data(spctx_t* ctx)
if(spio_write_data_raw(ctx, &(ctx->server), (unsigned char*)header, header_len) == -1 ||
spio_write_data_raw(ctx, &(ctx->server), (unsigned char*)CRLF, KL(CRLF)) == -1)
RETURN(-1);
-
- had_header = 1;
+ header[0] = '\0';
}
}
diff --git a/common/smtppass.h b/common/smtppass.h
index d10bed1..701ecb9 100644
--- a/common/smtppass.h
+++ b/common/smtppass.h
@@ -101,7 +101,7 @@ int spio_read_line(struct spctx* ctx, spio_t* io, int opts);
* Guaranteed to accept all data or fail. */
int spio_write_data(struct spctx* ctx, spio_t* io, const char* data);
int spio_write_dataf(struct spctx* ctx, spio_t* io, const char* fmt, ...);
-int spio_write_data_raw(struct spctx* ctx, spio_t* io, unsigned char* buf, int len);
+int spio_write_data_raw(struct spctx* ctx, spio_t* io, const unsigned char* buf, int len);
/* Empty the given socket */
void spio_read_junk(struct spctx* sp, spio_t* io);
diff --git a/common/spio.c b/common/spio.c
index 5ee58ee..f2198c0 100644
--- a/common/spio.c
+++ b/common/spio.c
@@ -441,7 +441,7 @@ int read_raw(spctx_t* ctx, spio_t* io, int opts)
{
/*
* K, basically the logic is that we're discarding
- * data ond the data will be screwed up. So overwriting
+ * data and the data will be screwed up. So overwriting
* some valid data in order to flush the line and
* keep the buffering simple is a price we pay gladly :)
*/
@@ -544,7 +544,7 @@ int spio_write_dataf(struct spctx* ctx, spio_t* io, const char* fmt, ...)
return spio_write_data(ctx, io, buf);
}
-int spio_write_data_raw(spctx_t* ctx, spio_t* io, unsigned char* buf, int len)
+int spio_write_data_raw(spctx_t* ctx, spio_t* io, const unsigned char* buf, int len)
{
int r;