summaryrefslogtreecommitdiffstats
path: root/contrib/bind/lib/irs/lcl_pw.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-11-30 02:43:11 +0000
committerpeter <peter@FreeBSD.org>1999-11-30 02:43:11 +0000
commit4ef23ce6957fc75fc005885496d605fed48213e1 (patch)
tree7828b08c74ef918938b1b853c98f0cb41edac52c /contrib/bind/lib/irs/lcl_pw.c
parent67e0f3ce71726dc4058c2f80a813341a59244dbd (diff)
downloadFreeBSD-src-4ef23ce6957fc75fc005885496d605fed48213e1.zip
FreeBSD-src-4ef23ce6957fc75fc005885496d605fed48213e1.tar.gz
Import bind v8.2.2.p5, minus the crypto for the time being. The bind
package does have BXA export approval, but the licensing strings on the dnssafe code are a bit unpleasant. The crypto is easy to restore and bind will run without it - just without full dnssec support. Obtained from: The Internet Software Consortium (www.isc.org)
Diffstat (limited to 'contrib/bind/lib/irs/lcl_pw.c')
-rw-r--r--contrib/bind/lib/irs/lcl_pw.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/contrib/bind/lib/irs/lcl_pw.c b/contrib/bind/lib/irs/lcl_pw.c
index 1f3e870..2655677 100644
--- a/contrib/bind/lib/irs/lcl_pw.c
+++ b/contrib/bind/lib/irs/lcl_pw.c
@@ -32,7 +32,7 @@
*/
/*
- * Portions Copyright (c) 1996 by Internet Software Consortium.
+ * Portions Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -49,7 +49,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: lcl_pw.c,v 1.16 1998/02/13 01:10:42 halley Exp $";
+static const char rcsid[] = "$Id: lcl_pw.c,v 1.19 1999/01/18 07:46:57 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
/* Extern */
@@ -61,6 +61,10 @@ static int __bind_irs_pw_unneeded;
#else
#include <sys/param.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
#include <db.h>
#include <errno.h>
@@ -73,6 +77,7 @@ static int __bind_irs_pw_unneeded;
#include <utmp.h>
#include <unistd.h>
+#include <isc/memcluster.h>
#include <irs.h>
#include "port_after.h"
@@ -115,12 +120,12 @@ irs_lcl_pw(struct irs_acc *this) {
struct irs_pw *pw;
struct pvt *pvt;
- if (!(pw = malloc(sizeof *pw))) {
+ if (!(pw = memget(sizeof *pw))) {
errno = ENOMEM;
return (NULL);
}
memset(pw, 0x5e, sizeof *pw);
- if (!(pvt = malloc(sizeof *pvt))) {
+ if (!(pvt = memget(sizeof *pvt))) {
free(pw);
errno = ENOMEM;
return (NULL);
@@ -133,6 +138,8 @@ irs_lcl_pw(struct irs_acc *this) {
pw->byuid = pw_byuid;
pw->rewind = pw_rewind;
pw->minimize = pw_minimize;
+ pw->res_get = NULL;
+ pw->res_set = NULL;
return (pw);
}
@@ -147,9 +154,9 @@ pw_close(struct irs_pw *this) {
pvt->pw_db = NULL;
}
if (pvt->line)
- free(pvt->line);
- free(pvt);
- free(this);
+ memput(pvt->line, pvt->max);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
}
static struct passwd *
@@ -262,9 +269,20 @@ hashpw(struct irs_pw *this, DBT *key) {
if ((pvt->pw_db->get)(pvt->pw_db, key, &data, 0))
return (0);
p = (char *)data.data;
- if (data.size > pvt->max &&
- (pvt->line = realloc(pvt->line, pvt->max += 1024)) == NULL)
- return (0);
+ if (data.size > pvt->max) {
+ size_t newlen = pvt->max + 1024;
+ char *p = memget(newlen);
+ if (p == NULL) {
+ return (0);
+ }
+ if (pvt->line != NULL) {
+ memcpy(p, pvt->line, pvt->max);
+ memput(pvt->line, pvt->max);
+ }
+ pvt->max = newlen;
+ pvt->line = p;
+ }
+
/* THIS CODE MUST MATCH THAT IN pwd_mkdb. */
t = pvt->line;
l = pvt->line + pvt->max;
OpenPOWER on IntegriCloud