+2556. [cleanup] PCI compliance:
+ * new libisc log module file
+ * isc_dir_chroot() now also changes the working
+ directory to "/".
+ * additional INSISTs
+ * additional logging when files can't be removed.
+
2553. [bug] Reference leak on DNSSEC validation errors. [RT #19291]
2552. [bug] zero-no-soa-ttl-cache was not being honoured.
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named-checkconf.c,v 1.28.18.16 2007/11/26 23:46:18 tbox Exp $ */
+/* $Id: named-checkconf.c,v 1.28.18.17 2009/02/16 02:12:58 marka Exp $ */
/*! \file */
isc_result_totext(result));
exit(1);
}
- result = isc_dir_chdir("/");
- if (result != ISC_R_SUCCESS) {
- fprintf(stderr, "isc_dir_chdir: %s\n",
- isc_result_totext(result));
- exit(1);
- }
break;
case 'v':
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named-checkzone.c,v 1.29.18.21 2008/10/24 01:43:17 tbox Exp $ */
+/* $Id: named-checkzone.c,v 1.29.18.22 2009/02/16 02:12:58 marka Exp $ */
/*! \file */
isc_result_totext(result));
exit(1);
}
- result = isc_dir_chdir("/");
- if (result != ISC_R_SUCCESS) {
- fprintf(stderr, "isc_dir_chdir: %s\n",
- isc_result_totext(result));
- exit(1);
- }
break;
case 's':
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.66.18.18 2008/12/01 04:02:15 marka Exp $ */
+/* $Id: os.c,v 1.66.18.19 2009/02/16 02:12:58 marka Exp $ */
/*! \file */
fd = open(filename, O_WRONLY|O_CREAT|O_APPEND,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
else {
- (void)unlink(filename);
+ if (unlink(filename) < 0 && errno != ENOENT)
+ return (-1);
fd = open(filename, O_WRONLY|O_CREAT|O_EXCL,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
}
static void
cleanup_pidfile(void) {
+ int n;
if (pidfile != NULL) {
- (void)unlink(pidfile);
+ n = unlink(pidfile);
+ if (n == -1 && errno != ENOENT)
+ ns_main_earlywarning("unlink '%s': failed", pidfile);
free(pidfile);
}
pidfile = NULL;
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: loc_29.c,v 1.41.18.4 2009/01/19 23:46:16 tbox Exp $ */
+/* $Id: loc_29.c,v 1.41.18.5 2009/02/16 02:12:58 marka Exp $ */
/* Reviewed: Wed Mar 15 18:13:09 PST 2000 by explorer */
/* version = sr.base[0]; */
size = sr.base[1];
+ INSIST((size&0x0f) < 10 && (size>>4) < 10);
if ((size&0x0f)> 1)
sprintf(sbuf, "%lum", (size>>4) * poweroften[(size&0x0f)-2]);
else
sprintf(sbuf, "0.%02lum", (size>>4) * poweroften[(size&0x0f)]);
hp = sr.base[2];
+ INSIST((hp&0x0f) < 10 && (hp>>4) < 10);
if ((hp&0x0f)> 1)
sprintf(hbuf, "%lum", (hp>>4) * poweroften[(hp&0x0f)-2]);
else
sprintf(hbuf, "0.%02lum", (hp>>4) * poweroften[(hp&0x0f)]);
vp = sr.base[3];
+ INSIST((vp&0x0f) < 10 && (vp>>4) < 10);
if ((vp&0x0f)> 1)
sprintf(vbuf, "%lum", (vp>>4) * poweroften[(vp&0x0f)-2]);
else
m1 = (int)(latitude % 60);
latitude /= 60;
d1 = (int)latitude;
+ INSIST(latitude <= 90);
longitude = uint32_fromregion(&sr);
isc_region_consume(&sr, 4);
m2 = (int)(longitude % 60);
longitude /= 60;
d2 = (int)longitude;
+ INSIST(longitude <= 180);
altitude = uint32_fromregion(&sr);
isc_region_consume(&sr, 4);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: soa_6.c,v 1.59 2004/03/05 05:10:18 marka Exp $ */
+/* $Id: soa_6.c,v 1.59.18.1 2009/02/16 02:12:58 marka Exp $ */
/* Reviewed: Thu Mar 16 15:18:32 PST 2000 by explorer */
REQUIRE(rdata->length != 0);
multiline = ISC_TF((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0);
- comment = ISC_TF((tctx->flags & DNS_STYLEFLAG_COMMENT) != 0);
+ if (multiline)
+ comment = ISC_TF((tctx->flags & DNS_STYLEFLAG_COMMENT) != 0);
+ else
+ comment = ISC_FALSE;
+
dns_name_init(&mname, NULL);
dns_name_init(&rname, NULL);
RETERR(str_totext(tctx->linebreak, target));
for (i = 0; i < 5; i++) {
- char buf[sizeof("2147483647")];
+ char buf[sizeof("0123456789 ; ")];
unsigned long num;
- unsigned int numlen;
num = uint32_fromregion(&dregion);
isc_region_consume(&dregion, 4);
- numlen = sprintf(buf, "%lu", num);
- INSIST(numlen > 0 && numlen < sizeof("2147483647"));
+ sprintf(buf, comment ? "%-10lu ; " : "%lu", num);
RETERR(str_totext(buf, target));
- if (multiline && comment) {
- RETERR(str_totext(" ; " + numlen, target));
+ if (comment) {
RETERR(str_totext(soa_fieldnames[i], target));
/* Print times in week/day/hour/minute/second form */
if (i >= 1) {
}
RETERR(str_totext(tctx->linebreak, target));
} else if (i < 4) {
- RETERR(str_totext(tctx->linebreak, target));
+ RETERR(str_totext(tctx->linebreak, target));
}
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: wks_11.c,v 1.51.18.1 2004/09/16 01:02:19 marka Exp $ */
+/* $Id: wks_11.c,v 1.51.18.2 2009/02/16 02:12:58 marka Exp $ */
/* Reviewed: Fri Mar 17 15:01:49 PST 2000 by explorer */
RETERR(str_totext(buf, target));
isc_region_consume(&sr, 1);
+ INSIST(sr.length <= 8*1024);
for (i = 0; i < sr.length; i++) {
if (sr.base[i] != 0)
for (j = 0; j < 8; j++)
REQUIRE(source != NULL);
REQUIRE(wks->common.rdtype == type);
REQUIRE(wks->common.rdclass == rdclass);
- REQUIRE(wks->map != NULL || wks->map_len == 0);
+ REQUIRE((wks->map != NULL && wks->map_len <= 8*1024) ||
+ wks->map_len == 0);
UNUSED(type);
UNUSED(rdclass);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.410.18.57 2009/01/19 23:46:15 tbox Exp $ */
+/* $Id: zone.c,v 1.410.18.58 2009/02/16 02:12:58 marka Exp $ */
/*! \file */
#include <config.h>
+#include <errno.h>
#include <isc/file.h>
#include <isc/mutex.h>
#include <isc/refcount.h>
#include <isc/rwlock.h>
#include <isc/serial.h>
+#include <isc/strerror.h>
#include <isc/string.h>
#include <isc/taskpool.h>
#include <isc/timer.h>
isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_ZONE, ISC_LOG_DEBUG(3),
"removing journal file");
- (void)remove(zone->journal);
+ if (remove(zone->journal) < 0) {
+ char strbuf[ISC_STRERRORSIZE];
+ isc__strerror(errno, strbuf, sizeof(strbuf));
+ isc_log_write(dns_lctx,
+ DNS_LOGCATEGORY_GENERAL,
+ DNS_LOGMODULE_ZONE,
+ ISC_LOG_WARNING,
+ "unable to remove journal "
+ "'%s': '%s'",
+ zone->journal, strbuf);
+ }
}
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.h,v 1.47.18.7 2009/01/19 00:36:28 marka Exp $ */
+/* $Id: log.h,v 1.47.18.8 2009/02/16 02:12:58 marka Exp $ */
#ifndef ISC_LOG_H
#define ISC_LOG_H 1
#define ISC_LOGMODULE_TIME (&isc_modules[1])
#define ISC_LOGMODULE_INTERFACE (&isc_modules[2])
#define ISC_LOGMODULE_TIMER (&isc_modules[3])
+#define ISC_LOGMODULE_FILE (&isc_modules[4])
ISC_LANG_BEGINDECLS
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.84.18.12 2009/01/19 00:36:28 marka Exp $ */
+/* $Id: log.c,v 1.84.18.13 2009/02/16 02:12:58 marka Exp $ */
/*! \file
* \author Principal Authors: DCL */
{ "time", 0 },
{ "interface", 0 },
{ "timer", 0 },
+ { "file", 0 },
{ NULL, 0 }
};
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dir.c,v 1.20.18.5 2008/12/01 23:45:57 tbox Exp $ */
+/* $Id: dir.c,v 1.20.18.6 2009/02/16 02:12:58 marka Exp $ */
/*! \file
* \author Principal Authors: DCL */
REQUIRE(dirname != NULL);
#ifdef HAVE_CHROOT
- if (chroot(dirname) < 0)
+ if (chroot(dirname) < 0 || chdir("/") < 0)
return (isc__errno2result(errno));
return (ISC_R_SUCCESS);
* SUCH DAMAGE.
*/
-/* $Id: file.c,v 1.47.18.2 2005/04/29 00:17:07 marka Exp $ */
+/* $Id: file.c,v 1.47.18.3 2009/02/16 02:12:58 marka Exp $ */
/*! \file */
#include <isc/dir.h>
#include <isc/file.h>
+#include <isc/log.h>
#include <isc/random.h>
#include <isc/string.h>
#include <isc/time.h>
}
}
}
- (void)unlink(file);
+ if (unlink(file) < 0)
+ if (errno != ENOENT)
+ return (isc__errno2result(errno));
return (ISC_R_SUCCESS);
}
f = fdopen(fd, "w+");
if (f == NULL) {
result = isc__errno2result(errno);
- (void)remove(templet);
+ if (remove(templet) < 0) {
+ isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_FILE, ISC_LOG_ERROR,
+ "remove '%s': failed", templet);
+ }
(void)close(fd);
} else
*fp = f;
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: strerror.c,v 1.4.18.2 2005/04/29 00:17:08 marka Exp $ */
+/* $Id: strerror.c,v 1.4.18.3 2009/02/16 02:12:58 marka Exp $ */
/*! \file */
isc__strerror(int num, char *buf, size_t size) {
#ifdef HAVE_STRERROR
char *msg;
- unsigned int unum = num;
+ unsigned int unum = (unsigned int)num;
static isc_once_t once = ISC_ONCE_INIT;
REQUIRE(buf != NULL);
snprintf(buf, size, "Unknown error: %u", unum);
UNLOCK(&isc_strerror_lock);
#else
- unsigned int unum = num;
+ unsigned int unum = (unsigned int)num;
REQUIRE(buf != NULL);