summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/res_comp.c
diff options
context:
space:
mode:
authorotto <>2005-03-25 13:24:12 +0000
committerotto <>2005-03-25 13:24:12 +0000
commit2f490723a2e673b2457f65c4b06cacb7d700a3e8 (patch)
treec9dcd3a58da3f7404d9e626fe10abdd67c384fba /src/lib/libc/net/res_comp.c
parent9a03506f8308b6023a12f108a2072feb958607a6 (diff)
downloadopenbsd-2f490723a2e673b2457f65c4b06cacb7d700a3e8.tar.gz
openbsd-2f490723a2e673b2457f65c4b06cacb7d700a3e8.tar.bz2
openbsd-2f490723a2e673b2457f65c4b06cacb7d700a3e8.zip
ansify. ok deraadt@ moritz@
Diffstat (limited to 'src/lib/libc/net/res_comp.c')
-rw-r--r--src/lib/libc/net/res_comp.c74
1 files changed, 29 insertions, 45 deletions
diff --git a/src/lib/libc/net/res_comp.c b/src/lib/libc/net/res_comp.c
index c10eb52931..62c04d8518 100644
--- a/src/lib/libc/net/res_comp.c
+++ b/src/lib/libc/net/res_comp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_comp.c,v 1.11 2003/06/02 20:18:36 millert Exp $ */ 1/* $OpenBSD: res_comp.c,v 1.12 2005/03/25 13:24:12 otto Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1993 4 * ++Copyright++ 1985, 1993
@@ -56,7 +56,7 @@
56static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; 56static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
57static char rcsid[] = "$From: res_comp.c,v 8.11 1996/12/02 09:17:22 vixie Exp $"; 57static char rcsid[] = "$From: res_comp.c,v 8.11 1996/12/02 09:17:22 vixie Exp $";
58#else 58#else
59static char rcsid[] = "$OpenBSD: res_comp.c,v 1.11 2003/06/02 20:18:36 millert Exp $"; 59static char rcsid[] = "$OpenBSD: res_comp.c,v 1.12 2005/03/25 13:24:12 otto Exp $";
60#endif 60#endif
61#endif /* LIBC_SCCS and not lint */ 61#endif /* LIBC_SCCS and not lint */
62 62
@@ -82,14 +82,12 @@ static int dn_find(u_char *, u_char *, u_char **, u_char **);
82 * Return size of compressed name or -1 if there was an error. 82 * Return size of compressed name or -1 if there was an error.
83 */ 83 */
84int 84int
85dn_expand(msg, eomorig, comp_dn, exp_dn, length) 85dn_expand(const u_char *msg, const u_char *eomorig, const u_char *comp_dn,
86 const u_char *msg, *eomorig, *comp_dn; 86 char *exp_dn, int length)
87 char *exp_dn;
88 int length;
89{ 87{
90 register const u_char *cp; 88 const u_char *cp;
91 register char *dn; 89 char *dn;
92 register int n, c; 90 int n, c;
93 char *eom; 91 char *eom;
94 int len = -1, checked = 0; 92 int len = -1, checked = 0;
95 93
@@ -166,13 +164,11 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
166 * is NULL, we don't update the list. 164 * is NULL, we don't update the list.
167 */ 165 */
168int 166int
169dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr) 167dn_comp(const char *exp_dn, u_char *comp_dn, int length, u_char **dnptrs,
170 const char *exp_dn; 168 u_char **lastdnptr)
171 u_char *comp_dn, **dnptrs, **lastdnptr;
172 int length;
173{ 169{
174 register u_char *cp, *dn; 170 u_char *cp, *dn;
175 register int c, l; 171 int c, l;
176 u_char **cpp, **lpp, *sp, *eob; 172 u_char **cpp, **lpp, *sp, *eob;
177 u_char *msg; 173 u_char *msg;
178 174
@@ -246,11 +242,10 @@ dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
246 * Skip over a compressed domain name. Return the size or -1. 242 * Skip over a compressed domain name. Return the size or -1.
247 */ 243 */
248int 244int
249__dn_skipname(comp_dn, eom) 245__dn_skipname(const u_char *comp_dn, const u_char *eom)
250 const u_char *comp_dn, *eom;
251{ 246{
252 register const u_char *cp; 247 const u_char *cp;
253 register int n; 248 int n;
254 249
255 cp = comp_dn; 250 cp = comp_dn;
256 while (cp < eom && (n = *cp++)) { 251 while (cp < eom && (n = *cp++)) {
@@ -275,8 +270,7 @@ __dn_skipname(comp_dn, eom)
275} 270}
276 271
277static int 272static int
278mklower(ch) 273mklower(int ch)
279 register int ch;
280{ 274{
281 if (isascii(ch) && isupper(ch)) 275 if (isascii(ch) && isupper(ch))
282 return (tolower(ch)); 276 return (tolower(ch));
@@ -290,12 +284,10 @@ mklower(ch)
290 * not the pointer to the start of the message. 284 * not the pointer to the start of the message.
291 */ 285 */
292static int 286static int
293dn_find(exp_dn, msg, dnptrs, lastdnptr) 287dn_find(u_char *exp_dn, u_char *msg, u_char **dnptrs, u_char **lastdnptr)
294 u_char *exp_dn, *msg;
295 u_char **dnptrs, **lastdnptr;
296{ 288{
297 register u_char *dn, *cp, **cpp; 289 u_char *dn, *cp, **cpp;
298 register int n; 290 int n;
299 u_char *sp; 291 u_char *sp;
300 292
301 for (cpp = dnptrs; cpp < lastdnptr; cpp++) { 293 for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
@@ -360,8 +352,7 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
360#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) 352#define domainchar(c) ((c) > 0x20 && (c) < 0x7f)
361 353
362int 354int
363res_hnok(dn) 355res_hnok(const char *dn)
364 const char *dn;
365{ 356{
366 int pch = PERIOD, ch = *dn++; 357 int pch = PERIOD, ch = *dn++;
367 358
@@ -390,8 +381,7 @@ res_hnok(dn)
390 * but must otherwise be as a host name. 381 * but must otherwise be as a host name.
391 */ 382 */
392int 383int
393res_ownok(dn) 384res_ownok(const char *dn)
394 const char *dn;
395{ 385{
396 if (asterchar(dn[0])) { 386 if (asterchar(dn[0])) {
397 if (periodchar(dn[1])) 387 if (periodchar(dn[1]))
@@ -407,8 +397,7 @@ res_ownok(dn)
407 * label, but the rest of the name has to look like a host name. 397 * label, but the rest of the name has to look like a host name.
408 */ 398 */
409int 399int
410res_mailok(dn) 400res_mailok(const char *dn)
411 const char *dn;
412{ 401{
413 int ch, escaped = 0; 402 int ch, escaped = 0;
414 403
@@ -437,8 +426,7 @@ res_mailok(dn)
437 * recommendations. 426 * recommendations.
438 */ 427 */
439int 428int
440res_dnok(dn) 429res_dnok(const char *dn)
441 const char *dn;
442{ 430{
443 int ch; 431 int ch;
444 432
@@ -453,10 +441,9 @@ res_dnok(dn)
453 */ 441 */
454 442
455u_int16_t 443u_int16_t
456_getshort(msgp) 444_getshort(const u_char *msgp)
457 register const u_char *msgp;
458{ 445{
459 register u_int16_t u; 446 u_int16_t u;
460 447
461 GETSHORT(u, msgp); 448 GETSHORT(u, msgp);
462 return (u); 449 return (u);
@@ -468,32 +455,29 @@ _getshort(msgp)
468 */ 455 */
469u_int16_t 456u_int16_t
470res_getshort(msgp) 457res_getshort(msgp)
471 register const u_char *msgp; 458 const u_char *msgp;
472{ 459{
473 return (_getshort(msgp)); 460 return (_getshort(msgp));
474} 461}
475#endif 462#endif
476 463
477u_int32_t 464u_int32_t
478_getlong(msgp) 465_getlong(const u_char *msgp)
479 register const u_char *msgp;
480{ 466{
481 register u_int32_t u; 467 u_int32_t u;
482 468
483 GETLONG(u, msgp); 469 GETLONG(u, msgp);
484 return (u); 470 return (u);
485} 471}
486 472
487void 473void
488__putshort(register u_int16_t s, register u_char *msgp) 474__putshort(u_int16_t s, u_char *msgp)
489{ 475{
490 PUTSHORT(s, msgp); 476 PUTSHORT(s, msgp);
491} 477}
492 478
493void 479void
494__putlong(l, msgp) 480__putlong(u_int32_t l, u_char *msgp)
495 register u_int32_t l;
496 register u_char *msgp;
497{ 481{
498 PUTLONG(l, msgp); 482 PUTLONG(l, msgp);
499} 483}