diff options
Diffstat (limited to 'src/lib/libc/net/res_comp.c')
| -rw-r--r-- | src/lib/libc/net/res_comp.c | 74 |
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 @@ | |||
| 56 | static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; | 56 | static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; |
| 57 | static char rcsid[] = "$From: res_comp.c,v 8.11 1996/12/02 09:17:22 vixie Exp $"; | 57 | static char rcsid[] = "$From: res_comp.c,v 8.11 1996/12/02 09:17:22 vixie Exp $"; |
| 58 | #else | 58 | #else |
| 59 | static char rcsid[] = "$OpenBSD: res_comp.c,v 1.11 2003/06/02 20:18:36 millert Exp $"; | 59 | static 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 | */ |
| 84 | int | 84 | int |
| 85 | dn_expand(msg, eomorig, comp_dn, exp_dn, length) | 85 | dn_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 | */ |
| 168 | int | 166 | int |
| 169 | dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr) | 167 | dn_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 | */ |
| 248 | int | 244 | int |
| 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 | ||
| 277 | static int | 272 | static int |
| 278 | mklower(ch) | 273 | mklower(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 | */ |
| 292 | static int | 286 | static int |
| 293 | dn_find(exp_dn, msg, dnptrs, lastdnptr) | 287 | dn_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 | ||
| 362 | int | 354 | int |
| 363 | res_hnok(dn) | 355 | res_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 | */ |
| 392 | int | 383 | int |
| 393 | res_ownok(dn) | 384 | res_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 | */ |
| 409 | int | 399 | int |
| 410 | res_mailok(dn) | 400 | res_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 | */ |
| 439 | int | 428 | int |
| 440 | res_dnok(dn) | 429 | res_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 | ||
| 455 | u_int16_t | 443 | u_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 | */ |
| 469 | u_int16_t | 456 | u_int16_t |
| 470 | res_getshort(msgp) | 457 | res_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 | ||
| 477 | u_int32_t | 464 | u_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 | ||
| 487 | void | 473 | void |
| 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 | ||
| 493 | void | 479 | void |
| 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 | } |
