From 4ef23ce6957fc75fc005885496d605fed48213e1 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 30 Nov 1999 02:43:11 +0000 Subject: 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) --- contrib/bind/lib/irs/lcl_pw.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'contrib/bind/lib/irs/lcl_pw.c') 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 +#include +#include +#include +#include #include #include @@ -73,6 +77,7 @@ static int __bind_irs_pw_unneeded; #include #include +#include #include #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; -- cgit v1.1