hesiod.c revision 1.1.4.2 1 1.1.4.2 lukem /* $NetBSD: hesiod.c,v 1.1.4.2 1997/05/24 15:53:50 lukem Exp $ */
2 1.1.4.1 lukem
3 1.1.4.1 lukem /* This file is part of the Hesiod library.
4 1.1.4.1 lukem *
5 1.1.4.1 lukem * Copyright (C) 1988, 1989 by the Massachusetts Institute of Technology
6 1.1.4.1 lukem *
7 1.1.4.1 lukem * Export of software employing encryption from the United States of
8 1.1.4.1 lukem * America is assumed to require a specific license from the United
9 1.1.4.1 lukem * States Government. It is the responsibility of any person or
10 1.1.4.1 lukem * organization contemplating export to obtain such a license before
11 1.1.4.1 lukem * exporting.
12 1.1.4.1 lukem *
13 1.1.4.1 lukem * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
14 1.1.4.1 lukem * distribute this software and its documentation for any purpose and
15 1.1.4.1 lukem * without fee is hereby granted, provided that the above copyright
16 1.1.4.1 lukem * notice appear in all copies and that both that copyright notice and
17 1.1.4.1 lukem * this permission notice appear in supporting documentation, and that
18 1.1.4.1 lukem * the name of M.I.T. not be used in advertising or publicity pertaining
19 1.1.4.1 lukem * to distribution of the software without specific, written prior
20 1.1.4.1 lukem * permission. M.I.T. makes no representations about the suitability of
21 1.1.4.1 lukem * this software for any purpose. It is provided "as is" without express
22 1.1.4.1 lukem * or implied warranty.
23 1.1.4.1 lukem */
24 1.1.4.1 lukem
25 1.1.4.1 lukem #ifndef lint
26 1.1.4.1 lukem static char rcsid_hesiod_c[] = "#Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/athena.lib/hesiod/RCS/hesiod.c,v 1.11 93/06/15 10:26:37 mar Exp #";
27 1.1.4.1 lukem static char rcsid_resolv_c[] = "#Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/athena.lib/hesiod/RCS/resolve.c,v 1.7 93/06/15 10:25:45 mar Exp #";
28 1.1.4.1 lukem #endif
29 1.1.4.1 lukem
30 1.1.4.1 lukem #include <sys/types.h>
31 1.1.4.1 lukem #include <sys/param.h>
32 1.1.4.1 lukem #include <netinet/in.h>
33 1.1.4.1 lukem #include <arpa/nameser.h>
34 1.1.4.1 lukem
35 1.1.4.1 lukem #include <errno.h>
36 1.1.4.1 lukem #include <hesiod.h>
37 1.1.4.1 lukem #include <resolv.h>
38 1.1.4.1 lukem #include <stdio.h>
39 1.1.4.1 lukem #include <stdlib.h>
40 1.1.4.1 lukem #include <string.h>
41 1.1.4.1 lukem #include <stringlist.h>
42 1.1.4.1 lukem #include <unistd.h>
43 1.1.4.1 lukem
44 1.1.4.1 lukem typedef struct rr {
45 1.1.4.1 lukem u_int16_t type; /* RR type */
46 1.1.4.1 lukem u_int16_t class; /* RR class */
47 1.1.4.1 lukem int dlen; /* len of data section */
48 1.1.4.1 lukem u_char *data; /* pointer to data */
49 1.1.4.1 lukem } rr_t, *rr_p;
50 1.1.4.1 lukem
51 1.1.4.1 lukem typedef struct nsmsg {
52 1.1.4.1 lukem int len; /* sizeof(msg) */
53 1.1.4.1 lukem int ns_off; /* offset to name server RRs */
54 1.1.4.1 lukem int ar_off; /* offset to additional RRs */
55 1.1.4.1 lukem int count; /* total number of RRs */
56 1.1.4.1 lukem HEADER *hd; /* message header */
57 1.1.4.1 lukem rr_t rr; /* vector of (stripped-down) RR descriptors */
58 1.1.4.1 lukem } nsmsg_t, *nsmsg_p;
59 1.1.4.1 lukem
60 1.1.4.1 lukem static int Hes_Errno = HES_ER_UNINIT;
61 1.1.4.1 lukem char *HesConfigFile = _PATH_HESIOD_CONF;
62 1.1.4.1 lukem static char Hes_LHS[MAXDNAME + 1];
63 1.1.4.1 lukem static char Hes_RHS[MAXDNAME + 1];
64 1.1.4.1 lukem static u_char *Hes_eoM;
65 1.1.4.1 lukem
66 1.1.4.1 lukem #define DEF_RETRANS 4
67 1.1.4.1 lukem #define DEF_RETRY 3
68 1.1.4.1 lukem
69 1.1.4.1 lukem static caddr_t
70 1.1.4.1 lukem _hes_rr_scan(cp, rr)
71 1.1.4.1 lukem u_char *cp;
72 1.1.4.1 lukem rr_t *rr;
73 1.1.4.1 lukem {
74 1.1.4.1 lukem int n;
75 1.1.4.1 lukem
76 1.1.4.1 lukem if ((n = dn_skipname(cp, Hes_eoM)) < 0) {
77 1.1.4.1 lukem errno = EINVAL;
78 1.1.4.1 lukem return((u_char *)NULL);
79 1.1.4.1 lukem }
80 1.1.4.1 lukem
81 1.1.4.1 lukem cp += n;
82 1.1.4.1 lukem rr->type = _getshort(cp);
83 1.1.4.1 lukem cp += sizeof(u_int16_t /*type*/);
84 1.1.4.1 lukem
85 1.1.4.1 lukem rr->class = _getshort(cp);
86 1.1.4.1 lukem cp += sizeof(u_int16_t /*class*/) + sizeof(u_int32_t /*ttl*/);
87 1.1.4.1 lukem
88 1.1.4.1 lukem rr->dlen = (int)_getshort(cp);
89 1.1.4.1 lukem rr->data = cp + sizeof(u_int16_t /*dlen*/);
90 1.1.4.1 lukem
91 1.1.4.1 lukem return(rr->data + rr->dlen);
92 1.1.4.1 lukem }
93 1.1.4.1 lukem
94 1.1.4.1 lukem
95 1.1.4.1 lukem static nsmsg_p
96 1.1.4.1 lukem _hes_res_scan(msg)
97 1.1.4.1 lukem u_char *msg;
98 1.1.4.1 lukem {
99 1.1.4.1 lukem static u_char bigmess[sizeof(nsmsg_t) + sizeof(rr_t) *
100 1.1.4.1 lukem ((PACKETSZ-sizeof(HEADER))/RRFIXEDSZ)];
101 1.1.4.1 lukem static u_char datmess[PACKETSZ-sizeof(HEADER)];
102 1.1.4.1 lukem u_char *cp;
103 1.1.4.1 lukem rr_t *rp;
104 1.1.4.1 lukem HEADER *hp;
105 1.1.4.1 lukem u_char *data = datmess;
106 1.1.4.1 lukem int n, n_an, n_ns, n_ar, nrec;
107 1.1.4.1 lukem nsmsg_t *mess = (nsmsg_t *)bigmess;
108 1.1.4.1 lukem
109 1.1.4.1 lukem hp = (HEADER *)msg;
110 1.1.4.1 lukem cp = msg + sizeof(HEADER);
111 1.1.4.1 lukem n_an = ntohs(hp->ancount);
112 1.1.4.1 lukem n_ns = ntohs(hp->nscount);
113 1.1.4.1 lukem n_ar = ntohs(hp->arcount);
114 1.1.4.1 lukem nrec = n_an + n_ns + n_ar;
115 1.1.4.1 lukem
116 1.1.4.1 lukem mess->len = 0;
117 1.1.4.1 lukem mess->hd = hp;
118 1.1.4.1 lukem mess->ns_off = n_an;
119 1.1.4.1 lukem mess->ar_off = n_an + n_ns;
120 1.1.4.1 lukem mess->count = nrec;
121 1.1.4.1 lukem rp = &mess->rr;
122 1.1.4.1 lukem
123 1.1.4.1 lukem /* skip over questions */
124 1.1.4.1 lukem if ((n = ntohs(hp->qdcount) != 0)) {
125 1.1.4.1 lukem while (--n >= 0) {
126 1.1.4.1 lukem int i;
127 1.1.4.1 lukem if ((i = dn_skipname(cp, Hes_eoM)) < 0)
128 1.1.4.1 lukem return((nsmsg_t *)NULL);
129 1.1.4.1 lukem cp += i + (sizeof(u_int16_t /*type*/)
130 1.1.4.1 lukem + sizeof(u_int16_t /*class*/));
131 1.1.4.1 lukem }
132 1.1.4.1 lukem }
133 1.1.4.1 lukem
134 1.1.4.1 lukem /* scan answers */
135 1.1.4.1 lukem if ((n = n_an) != 0) {
136 1.1.4.1 lukem while (--n >= 0) {
137 1.1.4.1 lukem if ((cp = _hes_rr_scan(cp, rp)) == NULL)
138 1.1.4.1 lukem return((nsmsg_t *)NULL);
139 1.1.4.1 lukem (void) strncpy(data, rp->data, rp->dlen);
140 1.1.4.1 lukem rp->data = data;
141 1.1.4.1 lukem data += rp->dlen;
142 1.1.4.1 lukem *data++ = '\0';
143 1.1.4.1 lukem rp++;
144 1.1.4.1 lukem }
145 1.1.4.1 lukem }
146 1.1.4.1 lukem
147 1.1.4.1 lukem /* scan name servers */
148 1.1.4.1 lukem if ((n = n_ns) != 0) {
149 1.1.4.1 lukem while (--n >= 0) {
150 1.1.4.1 lukem if ((cp = _hes_rr_scan(cp, rp)) == NULL)
151 1.1.4.1 lukem return((nsmsg_t *)NULL);
152 1.1.4.1 lukem (void) strncpy(data, rp->data, rp->dlen);
153 1.1.4.1 lukem rp->data = data;
154 1.1.4.1 lukem data += rp->dlen;
155 1.1.4.1 lukem *data++ = '\0';
156 1.1.4.1 lukem rp++;
157 1.1.4.1 lukem }
158 1.1.4.1 lukem }
159 1.1.4.1 lukem
160 1.1.4.1 lukem /* scan additional records */
161 1.1.4.1 lukem if ((n = n_ar) != 0) {
162 1.1.4.1 lukem while (--n >= 0) {
163 1.1.4.1 lukem if ((cp = _hes_rr_scan(cp, rp)) == NULL)
164 1.1.4.1 lukem return((nsmsg_t *)NULL);
165 1.1.4.1 lukem (void) strncpy(data, rp->data, rp->dlen);
166 1.1.4.1 lukem rp->data = data;
167 1.1.4.1 lukem data += rp->dlen;
168 1.1.4.1 lukem *data++ = '\0';
169 1.1.4.1 lukem rp++;
170 1.1.4.1 lukem }
171 1.1.4.1 lukem }
172 1.1.4.1 lukem
173 1.1.4.1 lukem mess->len = (int)cp - (int)msg;
174 1.1.4.1 lukem
175 1.1.4.1 lukem return(mess);
176 1.1.4.1 lukem }
177 1.1.4.1 lukem
178 1.1.4.1 lukem /*
179 1.1.4.1 lukem * Resolve name into data records
180 1.1.4.1 lukem */
181 1.1.4.1 lukem
182 1.1.4.1 lukem static nsmsg_p
183 1.1.4.1 lukem _hes_res(name, class, type)
184 1.1.4.1 lukem u_char *name;
185 1.1.4.1 lukem int class, type;
186 1.1.4.1 lukem {
187 1.1.4.1 lukem static u_char qbuf[PACKETSZ], abuf[PACKETSZ];
188 1.1.4.1 lukem int n;
189 1.1.4.1 lukem u_int32_t res_options = _res.options;
190 1.1.4.1 lukem int res_retrans = _res.retrans;
191 1.1.4.1 lukem int res_retry = _res.retry;
192 1.1.4.1 lukem
193 1.1.4.1 lukem #ifdef DEBUG
194 1.1.4.1 lukem if (_res.options & RES_DEBUG)
195 1.1.4.1 lukem printf("_hes_res: class = %d, type = %d\n", class, type);
196 1.1.4.1 lukem #endif
197 1.1.4.1 lukem
198 1.1.4.1 lukem if (class < 0 || type < 0) {
199 1.1.4.1 lukem errno = EINVAL;
200 1.1.4.1 lukem return((nsmsg_t *)NULL);
201 1.1.4.1 lukem }
202 1.1.4.1 lukem
203 1.1.4.1 lukem _res.options |= RES_IGNTC;
204 1.1.4.1 lukem
205 1.1.4.1 lukem n = res_mkquery(QUERY, name, class, type, (u_char *)NULL, 0,
206 1.1.4.1 lukem NULL, qbuf, PACKETSZ);
207 1.1.4.1 lukem if (n < 0) {
208 1.1.4.1 lukem errno = EMSGSIZE;
209 1.1.4.1 lukem return((nsmsg_t *)NULL);
210 1.1.4.1 lukem }
211 1.1.4.1 lukem
212 1.1.4.1 lukem _res.retrans = DEF_RETRANS;
213 1.1.4.1 lukem _res.retry = DEF_RETRY;
214 1.1.4.1 lukem
215 1.1.4.1 lukem n = res_send(qbuf, n, abuf, PACKETSZ);
216 1.1.4.1 lukem
217 1.1.4.1 lukem _res.options = res_options;
218 1.1.4.1 lukem _res.retrans = res_retrans;
219 1.1.4.1 lukem _res.retry = res_retry;
220 1.1.4.1 lukem
221 1.1.4.1 lukem if (n < 0) {
222 1.1.4.1 lukem errno = ECONNREFUSED;
223 1.1.4.1 lukem return((nsmsg_t *)NULL);
224 1.1.4.1 lukem }
225 1.1.4.1 lukem Hes_eoM = abuf+n;
226 1.1.4.1 lukem
227 1.1.4.1 lukem return(_hes_res_scan(abuf));
228 1.1.4.1 lukem }
229 1.1.4.1 lukem
230 1.1.4.1 lukem int
231 1.1.4.1 lukem hes_init()
232 1.1.4.1 lukem {
233 1.1.4.1 lukem FILE *fp;
234 1.1.4.1 lukem char *key, *cp, *cpp;
235 1.1.4.1 lukem char buf[MAXDNAME+7];
236 1.1.4.1 lukem
237 1.1.4.1 lukem Hes_Errno = HES_ER_UNINIT;
238 1.1.4.1 lukem Hes_LHS[0] = '\0';
239 1.1.4.1 lukem Hes_RHS[0] = '\0';
240 1.1.4.1 lukem if ((fp = fopen(HesConfigFile, "r")) == NULL) {
241 1.1.4.1 lukem /* use defaults compiled in */
242 1.1.4.1 lukem /* no file or no access uses defaults */
243 1.1.4.1 lukem /* but poorly formed file returns error */
244 1.1.4.1 lukem if (DEF_LHS) strncpy(Hes_LHS, DEF_LHS, MAXDNAME);
245 1.1.4.1 lukem if (DEF_RHS) strncpy(Hes_RHS, DEF_RHS, MAXDNAME);
246 1.1.4.1 lukem
247 1.1.4.1 lukem /* if DEF_RHS == "", use getdomainname() */
248 1.1.4.1 lukem if (Hes_RHS[0] == '\0')
249 1.1.4.1 lukem (void)getdomainname(Hes_RHS, MAXDNAME);
250 1.1.4.1 lukem } else {
251 1.1.4.1 lukem while(fgets(buf, MAXDNAME+7, fp) != NULL) {
252 1.1.4.1 lukem cp = buf;
253 1.1.4.1 lukem if (*cp == '#' || *cp == '\n')
254 1.1.4.1 lukem continue;
255 1.1.4.1 lukem while(*cp == ' ' || *cp == '\t')
256 1.1.4.1 lukem cp++;
257 1.1.4.1 lukem key = cp;
258 1.1.4.1 lukem while(*cp != ' ' && *cp != '\t' && *cp != '=')
259 1.1.4.1 lukem cp++;
260 1.1.4.1 lukem *cp++ = '\0';
261 1.1.4.1 lukem if (strcmp(key, "lhs") == 0)
262 1.1.4.1 lukem cpp = Hes_LHS;
263 1.1.4.1 lukem else if (strcmp(key, "rhs") == 0)
264 1.1.4.1 lukem cpp = Hes_RHS;
265 1.1.4.1 lukem else
266 1.1.4.1 lukem continue;
267 1.1.4.1 lukem while(*cp == ' ' || *cp == '\t' || *cp == '=')
268 1.1.4.1 lukem cp++;
269 1.1.4.1 lukem if (*cp != '.' && *cp != '\n') {
270 1.1.4.1 lukem Hes_Errno = HES_ER_CONFIG;
271 1.1.4.1 lukem fclose(fp);
272 1.1.4.1 lukem return(Hes_Errno);
273 1.1.4.1 lukem }
274 1.1.4.1 lukem (void) strncpy(cpp, cp, strlen(cp)-1);
275 1.1.4.1 lukem }
276 1.1.4.1 lukem fclose(fp);
277 1.1.4.1 lukem }
278 1.1.4.1 lukem /* see if the RHS is overridden by environment variable */
279 1.1.4.1 lukem if ((cp = getenv("HES_DOMAIN")) != NULL)
280 1.1.4.1 lukem strncpy(Hes_RHS, cp, MAXDNAME);
281 1.1.4.1 lukem /* the LHS may be null, the RHS must not be null */
282 1.1.4.1 lukem if (Hes_RHS[0] == '\0')
283 1.1.4.1 lukem Hes_Errno = HES_ER_CONFIG;
284 1.1.4.1 lukem else
285 1.1.4.1 lukem Hes_Errno = HES_ER_OK;
286 1.1.4.1 lukem return(Hes_Errno);
287 1.1.4.1 lukem }
288 1.1.4.1 lukem
289 1.1.4.1 lukem char *
290 1.1.4.1 lukem hes_to_bind(HesiodName, HesiodNameType)
291 1.1.4.1 lukem char *HesiodName, *HesiodNameType;
292 1.1.4.1 lukem {
293 1.1.4.1 lukem static char bindname[MAXDNAME];
294 1.1.4.1 lukem char *cp, **cpp, *x;
295 1.1.4.1 lukem char *RHS;
296 1.1.4.1 lukem int bni = 0;
297 1.1.4.1 lukem
298 1.1.4.1 lukem #define STRADDBIND(y) for (x = y; *x; x++, bni++) { \
299 1.1.4.1 lukem if (bni >= MAXDNAME) \
300 1.1.4.1 lukem return NULL; \
301 1.1.4.1 lukem bindname[bni] = *x; \
302 1.1.4.1 lukem }
303 1.1.4.1 lukem
304 1.1.4.1 lukem if (Hes_Errno == HES_ER_UNINIT || Hes_Errno == HES_ER_CONFIG)
305 1.1.4.1 lukem (void) hes_init();
306 1.1.4.1 lukem if (Hes_Errno == HES_ER_CONFIG)
307 1.1.4.1 lukem return(NULL);
308 1.1.4.1 lukem if ((cp = strchr(HesiodName,'@')) != NULL) {
309 1.1.4.1 lukem if (strchr(++cp,'.'))
310 1.1.4.1 lukem RHS = cp;
311 1.1.4.1 lukem else
312 1.1.4.1 lukem if ((cpp = hes_resolve(cp, "rhs-extension")) != NULL)
313 1.1.4.1 lukem RHS = *cpp;
314 1.1.4.1 lukem else {
315 1.1.4.1 lukem Hes_Errno = HES_ER_NOTFOUND;
316 1.1.4.1 lukem return(NULL);
317 1.1.4.1 lukem }
318 1.1.4.1 lukem STRADDBIND(HesiodName);
319 1.1.4.1 lukem *strchr(bindname,'@') = '\0';
320 1.1.4.1 lukem } else {
321 1.1.4.1 lukem RHS = Hes_RHS;
322 1.1.4.1 lukem STRADDBIND(HesiodName);
323 1.1.4.1 lukem }
324 1.1.4.1 lukem STRADDBIND(".");
325 1.1.4.1 lukem STRADDBIND(HesiodNameType);
326 1.1.4.1 lukem if (Hes_LHS && Hes_LHS[0]) {
327 1.1.4.1 lukem if (Hes_LHS[0] != '.')
328 1.1.4.1 lukem STRADDBIND(".");
329 1.1.4.1 lukem STRADDBIND(Hes_LHS);
330 1.1.4.1 lukem }
331 1.1.4.1 lukem if (RHS[0] != '.')
332 1.1.4.1 lukem STRADDBIND(".");
333 1.1.4.1 lukem STRADDBIND(RHS);
334 1.1.4.1 lukem if (bni == MAXDNAME)
335 1.1.4.1 lukem bni--;
336 1.1.4.1 lukem bindname[bni] = '\0';
337 1.1.4.1 lukem return(bindname);
338 1.1.4.1 lukem }
339 1.1.4.1 lukem
340 1.1.4.1 lukem /* XXX: convert to resolv directly */
341 1.1.4.1 lukem char **
342 1.1.4.1 lukem hes_resolve(HesiodName, HesiodNameType)
343 1.1.4.1 lukem char *HesiodName, *HesiodNameType;
344 1.1.4.1 lukem {
345 1.1.4.2 lukem char **retvec;
346 1.1.4.2 lukem int vecsiz = 5;
347 1.1.4.2 lukem char *cp, *ocp, *dst;
348 1.1.4.2 lukem int i, n;
349 1.1.4.2 lukem struct nsmsg *ns;
350 1.1.4.2 lukem rr_t *rp;
351 1.1.4.2 lukem StringList *sl;
352 1.1.4.1 lukem
353 1.1.4.1 lukem sl = sl_init();
354 1.1.4.1 lukem
355 1.1.4.1 lukem cp = hes_to_bind(HesiodName, HesiodNameType);
356 1.1.4.1 lukem if (cp == NULL)
357 1.1.4.1 lukem return(NULL);
358 1.1.4.1 lukem errno = 0;
359 1.1.4.1 lukem ns = _hes_res(cp, C_HS, T_TXT);
360 1.1.4.1 lukem if (errno == ETIMEDOUT || errno == ECONNREFUSED) {
361 1.1.4.1 lukem Hes_Errno = HES_ER_NET;
362 1.1.4.1 lukem return(NULL);
363 1.1.4.1 lukem }
364 1.1.4.1 lukem if (ns == NULL || ns->ns_off <= 0) {
365 1.1.4.1 lukem Hes_Errno = HES_ER_NOTFOUND;
366 1.1.4.1 lukem return(NULL);
367 1.1.4.1 lukem }
368 1.1.4.1 lukem for(i = 0, rp = &ns->rr; i < ns->ns_off; rp++, i++) {
369 1.1.4.1 lukem if (rp->class == C_HS && rp->type == T_TXT) {
370 1.1.4.1 lukem dst = calloc(rp->dlen + 1, sizeof(char));
371 1.1.4.1 lukem if (dst == NULL) {
372 1.1.4.1 lukem sl_free(sl, 1);
373 1.1.4.1 lukem return NULL;
374 1.1.4.1 lukem }
375 1.1.4.1 lukem sl_add(sl, dst);
376 1.1.4.1 lukem ocp = cp = rp->data;
377 1.1.4.1 lukem while (cp < ocp + rp->dlen) {
378 1.1.4.1 lukem n = (unsigned char) *cp++;
379 1.1.4.1 lukem (void) memmove(dst, cp, n);
380 1.1.4.1 lukem cp += n;
381 1.1.4.1 lukem dst += n;
382 1.1.4.1 lukem }
383 1.1.4.1 lukem *dst = 0;
384 1.1.4.1 lukem }
385 1.1.4.1 lukem }
386 1.1.4.1 lukem sl_add(sl, NULL);
387 1.1.4.1 lukem retvec = sl->sl_str; /* XXX: nasty, knows stringlist internals */
388 1.1.4.1 lukem free(sl);
389 1.1.4.1 lukem return(retvec);
390 1.1.4.1 lukem }
391 1.1.4.1 lukem
392 1.1.4.1 lukem int
393 1.1.4.1 lukem hes_error()
394 1.1.4.1 lukem {
395 1.1.4.1 lukem return(Hes_Errno);
396 1.1.4.1 lukem }
397 1.1.4.1 lukem
398 1.1.4.1 lukem void
399 1.1.4.1 lukem hes_free(hp)
400 1.1.4.1 lukem char **hp;
401 1.1.4.1 lukem {
402 1.1.4.1 lukem int i;
403 1.1.4.1 lukem if (!hp)
404 1.1.4.1 lukem return;
405 1.1.4.1 lukem for (i = 0; hp[i]; i++)
406 1.1.4.1 lukem free(hp[i]);
407 1.1.4.1 lukem free(hp);
408 1.1.4.1 lukem }
409