diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2008-11-11 02:14:59 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2008-11-11 02:14:59 +0000 |
commit | 7aeee9b92264906aeb2f618498d4670f01bd77b2 (patch) | |
tree | 4adfffe6a56f5ad5644f4e4c9cd73af8dca1e836 /usr.sbin | |
parent | 5f71cbc6b422c15be464aa61934d622323af56c7 (diff) |
some small improvements. ok gilles
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/mta.c | 7 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp.c | 15 |
2 files changed, 9 insertions, 13 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index 1f16d0be0b5..b77a367fc7c 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -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"); diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c index 46f52f9da3b..b49284439db 100644 --- a/usr.sbin/smtpd/smtp.c +++ b/usr.sbin/smtpd/smtp.c @@ -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; |