3267. [bug] Memory allocation failures could be mis-reported as

unexpected error.  New ISC_R_UNSET result code.
                        [RT #27336]
This commit is contained in:
Mark Andrews
2012-01-27 01:26:08 +00:00
parent ed1a2ef445
commit 713eea548b
4 changed files with 29 additions and 17 deletions
+4
View File
@@ -1,3 +1,7 @@
3267. [bug] Memory allocation failures could be mis-reported as
unexpected error. New ISC_R_UNSET result code.
[RT #27336]
3266. [bug] The maximum number of NSEC3 iterations for a
DNSKEY RRset was not being properly computed.
[RT #26543]
+3 -2
View File
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: result.h,v 1.73 2009/09/02 23:48:03 tbox Exp $ */
/* $Id: result.h,v 1.73.346.1 2012/01/27 01:26:07 marka Exp $ */
#ifndef ISC_RESULT_H
#define ISC_RESULT_H 1
@@ -87,9 +87,10 @@
#define ISC_R_MAXSIZE 58 /*%< max size */
#define ISC_R_BADADDRESSFORM 59 /*%< invalid address format */
#define ISC_R_BADBASE32 60 /*%< bad base32 encoding */
#define ISC_R_UNSET 61 /*%< unset */
/*% Not a result code: the number of results. */
#define ISC_R_NRESULTS 61
#define ISC_R_NRESULTS 62
ISC_LANG_BEGINDECLS
+2 -1
View File
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: result.c,v 1.71 2008/09/25 04:02:39 tbox Exp $ */
/* $Id: result.c,v 1.71.522.1 2012/01/27 01:26:07 marka Exp $ */
/*! \file */
@@ -102,6 +102,7 @@ static const char *text[ISC_R_NRESULTS] = {
"max size", /*%< 58 */
"invalid address format", /*%< 59 */
"bad base32 encoding", /*%< 60 */
"unset", /*%< 61 */
};
#define ISC_RESULT_RESULTSET 2
+20 -14
View File
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.333.14.11 2011/08/25 11:36:00 marka Exp $ */
/* $Id: socket.c,v 1.333.14.12 2012/01/27 01:26:08 marka Exp $ */
/*! \file */
@@ -1584,7 +1584,7 @@ allocate_socketevent(isc__socket_t *sock, isc_eventtype_t eventtype,
if (ev == NULL)
return (NULL);
ev->result = ISC_R_UNEXPECTED;
ev->result = ISC_R_UNSET;
ISC_LINK_INIT(ev, ev_link);
ISC_LIST_INIT(ev->bufferlist);
ev->region.base = NULL;
@@ -2037,8 +2037,6 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
if (sock == NULL)
return (ISC_R_NOMEMORY);
result = ISC_R_UNEXPECTED;
sock->common.magic = 0;
sock->common.impmagic = 0;
sock->references = 0;
@@ -2066,8 +2064,10 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
sock->recvcmsgbuflen = cmsgbuflen;
if (sock->recvcmsgbuflen != 0U) {
sock->recvcmsgbuf = isc_mem_get(manager->mctx, cmsgbuflen);
if (sock->recvcmsgbuf == NULL)
if (sock->recvcmsgbuf == NULL) {
result = ISC_R_NOMEMORY;
goto error;
}
}
cmsgbuflen = 0;
@@ -2084,8 +2084,10 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
sock->sendcmsgbuflen = cmsgbuflen;
if (sock->sendcmsgbuflen != 0U) {
sock->sendcmsgbuf = isc_mem_get(manager->mctx, cmsgbuflen);
if (sock->sendcmsgbuf == NULL)
if (sock->sendcmsgbuf == NULL) {
result = ISC_R_NOMEMORY;
goto error;
}
}
memset(sock->name, 0, sizeof(sock->name));
@@ -2223,6 +2225,7 @@ clear_bsdcompat(void) {
static isc_result_t
opensocket(isc__socketmgr_t *manager, isc__socket_t *sock) {
isc_result_t result;
char strbuf[ISC_STRERRORSIZE];
const char *err = "socket";
int tries = 0;
@@ -2327,9 +2330,10 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock) {
}
}
if (make_nonblock(sock->fd) != ISC_R_SUCCESS) {
result = make_nonblock(sock->fd);
if (result != ISC_R_SUCCESS) {
(void)close(sock->fd);
return (ISC_R_UNEXPECTED);
return (result);
}
#ifdef SO_BSDCOMPAT
@@ -3191,10 +3195,12 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
UNLOCK(&sock->lock);
if (fd != -1 && (make_nonblock(fd) != ISC_R_SUCCESS)) {
(void)close(fd);
fd = -1;
result = ISC_R_UNEXPECTED;
if (fd != -1) {
result = make_nonblock(fd);
if (result != ISC_R_SUCCESS) {
(void)close(fd);
fd = -1;
}
}
/*
@@ -4553,7 +4559,7 @@ isc__socket_recv2(isc_socket_t *sock0, isc_region_t *region,
isc__socket_t *sock = (isc__socket_t *)sock0;
event->ev_sender = sock;
event->result = ISC_R_UNEXPECTED;
event->result = ISC_R_UNSET;
ISC_LIST_INIT(event->bufferlist);
event->region = *region;
event->n = 0;
@@ -4767,7 +4773,7 @@ isc__socket_sendto2(isc_socket_t *sock0, isc_region_t *region,
if ((flags & ISC_SOCKFLAG_NORETRY) != 0)
REQUIRE(sock->type == isc_sockettype_udp);
event->ev_sender = sock;
event->result = ISC_R_UNEXPECTED;
event->result = ISC_R_UNSET;
ISC_LIST_INIT(event->bufferlist);
event->region = *region;
event->n = 0;