1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

some small improvements. ok gilles

This commit is contained in:
tedu 2008-11-11 02:14:58 +00:00
parent 9aaca6d3f2
commit cd5fb898fd
2 changed files with 9 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mta.c,v 1.4 2008/11/10 22:35:23 gilles Exp $ */
/* $OpenBSD: mta.c,v 1.5 2008/11/11 02:14:58 tedu Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@ -449,7 +449,7 @@ mta_reply_handler(struct bufferevent *bev, void *arg)
#define F_ISINFO 0x1
#define F_ISPROTOERROR 0x2
char codebuf[4];
char *errstr;
const char *errstr;
int flags = 0;
line = evbuffer_readline(bev->input);
@ -465,7 +465,7 @@ mta_reply_handler(struct bufferevent *bev, void *arg)
log_debug("remote server sent: [%s]", line);
strlcpy(codebuf, line, sizeof codebuf);
code = strtonum(codebuf, 0, UINT16_MAX, (const char **)&errstr);
code = strtonum(codebuf, 0, UINT16_MAX, &errstr);
if (errstr || code < 100) {
/* Server sent invalid line, protocol error */
batchp->status |= S_BATCH_PERMFAILURE;
@ -731,6 +731,7 @@ mta_write_handler(struct bufferevent *bev, void *arg)
}
evbuffer_add_printf(batchp->bev->output, "%s\r\n", buf);
free(lbuf);
lbuf = NULL;
}
else {
evbuffer_add_printf(batchp->bev->output, ".\r\n");

View File

@ -1,4 +1,4 @@
/* $OpenBSD: smtp.c,v 1.3 2008/11/11 01:08:08 gilles Exp $ */
/* $OpenBSD: smtp.c,v 1.4 2008/11/11 02:14:58 tedu Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@ -114,18 +114,13 @@ smtp_dispatch_parent(int sig, short event, void *p)
(void)strlcpy(s->ssl_name, x_ssl->ssl_name,
sizeof(s->ssl_name));
s->ssl_cert_len = x_ssl->ssl_cert_len;
if ((s->ssl_cert = malloc(s->ssl_cert_len + 1)) == NULL)
if ((s->ssl_cert =
strdup((char *)imsg.data + sizeof(*s))) == NULL)
fatal(NULL);
(void)strlcpy(s->ssl_cert,
(char *)imsg.data + sizeof(*s),
s->ssl_cert_len);
s->ssl_key_len = x_ssl->ssl_key_len;
if ((s->ssl_key = malloc(s->ssl_key_len + 1)) == NULL)
if ((s->ssl_key = strdup((char *)imsg.data +
(sizeof(*s) + s->ssl_cert_len))) == NULL)
fatal(NULL);
(void)strlcpy(s->ssl_key,
(char *)imsg.data + (sizeof(*s) + s->ssl_cert_len),
s->ssl_key_len);
SPLAY_INSERT(ssltree, &env->sc_ssl, s);
break;