|
Lines 89-101
Link Here
|
| 89 |
packet -> packet_type < dhcp_type_name_max - 1) { |
80 |
packet -> packet_type < dhcp_type_name_max - 1) { |
| 90 |
s = dhcp_type_names [packet -> packet_type - 1]; |
81 |
s = dhcp_type_names [packet -> packet_type - 1]; |
| 91 |
} else { |
82 |
} else { |
| 92 |
#if defined (HAVE_SNPRINTF) |
|
|
| 93 |
snprintf (typebuf, sizeof typebuf, |
83 |
snprintf (typebuf, sizeof typebuf, |
| 94 |
"type %d", packet -> packet_type); |
84 |
"type %d", packet -> packet_type); |
| 95 |
#else |
|
|
| 96 |
sprintf (typebuf, |
| 97 |
"type %d", packet -> packet_type); |
| 98 |
#endif |
| 99 |
s = typebuf; |
85 |
s = typebuf; |
| 100 |
} |
86 |
} |
| 101 |
|
87 |
|
|
Lines 268-281
Link Here
|
| 268 |
find_lease (&lease, packet, packet -> shared_network, |
254 |
find_lease (&lease, packet, packet -> shared_network, |
| 269 |
0, &allocatedp, (struct lease *)0, MDL); |
255 |
0, &allocatedp, (struct lease *)0, MDL); |
| 270 |
|
256 |
|
| 271 |
if (lease && lease -> client_hostname && |
257 |
if (lease && lease -> client_hostname) { |
| 272 |
db_printable (lease -> client_hostname)) |
258 |
if ((strlen (lease -> client_hostname) <= 64) && |
| 273 |
s = lease -> client_hostname; |
259 |
db_printable (lease -> client_hostname)) |
| 274 |
else |
260 |
s = lease -> client_hostname; |
|
|
261 |
else |
| 262 |
s = "Hostname Unsuitable for Printing"; |
| 263 |
} else |
| 275 |
s = (char *)0; |
264 |
s = (char *)0; |
| 276 |
|
265 |
|
| 277 |
/* Say what we're doing... */ |
266 |
/* Say what we're doing... */ |
| 278 |
sprintf (msgbuf, "DHCPDISCOVER from %s %s%s%svia %s", |
267 |
snprintf (msgbuf, sizeof msgbuf, "DHCPDISCOVER from %s %s%s%svia %s", |
| 279 |
(packet -> raw -> htype |
268 |
(packet -> raw -> htype |
| 280 |
? print_hw_addr (packet -> raw -> htype, |
269 |
? print_hw_addr (packet -> raw -> htype, |
| 281 |
packet -> raw -> hlen, |
270 |
packet -> raw -> hlen, |
|
Lines 446-455
Link Here
|
| 446 |
/* XXX consider using allocatedp arg to find_lease to see |
435 |
/* XXX consider using allocatedp arg to find_lease to see |
| 447 |
XXX that this isn't a compliant DHCPREQUEST. */ |
436 |
XXX that this isn't a compliant DHCPREQUEST. */ |
| 448 |
|
437 |
|
| 449 |
if (lease && lease -> client_hostname && |
438 |
if (lease && lease -> client_hostname) { |
| 450 |
db_printable (lease -> client_hostname)) |
439 |
if ((strlen (lease -> client_hostname) <= 64) && |
| 451 |
s = lease -> client_hostname; |
440 |
db_printable (lease -> client_hostname)) |
| 452 |
else |
441 |
s = lease -> client_hostname; |
|
|
442 |
else |
| 443 |
s = "Hostname Unsuitable for Printing"; |
| 444 |
} else |
| 453 |
s = (char *)0; |
445 |
s = (char *)0; |
| 454 |
|
446 |
|
| 455 |
oc = lookup_option (&dhcp_universe, packet -> options, |
447 |
oc = lookup_option (&dhcp_universe, packet -> options, |
|
Lines 469-475
Link Here
|
| 469 |
smbuf [0] = 0; |
461 |
smbuf [0] = 0; |
| 470 |
|
462 |
|
| 471 |
/* Say what we're doing... */ |
463 |
/* Say what we're doing... */ |
| 472 |
sprintf (msgbuf, "DHCPREQUEST for %s%s from %s %s%s%svia %s", |
464 |
snprintf (msgbuf, sizeof msgbuf, |
|
|
465 |
"DHCPREQUEST for %s%s from %s %s%s%svia %s", |
| 473 |
piaddr (cip), smbuf, |
466 |
piaddr (cip), smbuf, |
| 474 |
(packet -> raw -> htype |
467 |
(packet -> raw -> htype |
| 475 |
? print_hw_addr (packet -> raw -> htype, |
468 |
? print_hw_addr (packet -> raw -> htype, |
|
Lines 742-758
Link Here
|
| 742 |
packet -> raw -> chaddr, packet -> raw -> hlen))) |
735 |
packet -> raw -> chaddr, packet -> raw -> hlen))) |
| 743 |
lease_dereference (&lease, MDL); |
736 |
lease_dereference (&lease, MDL); |
| 744 |
|
737 |
|
| 745 |
if (lease && lease -> client_hostname && |
738 |
if (lease && lease -> client_hostname) { |
| 746 |
db_printable (lease -> client_hostname)) |
739 |
if ((strlen (lease -> client_hostname) <= 64) && |
| 747 |
s = lease -> client_hostname; |
740 |
db_printable (lease -> client_hostname)) |
| 748 |
else |
741 |
s = lease -> client_hostname; |
|
|
742 |
else |
| 743 |
s = "Hostname Unsuitable for Printing"; |
| 744 |
} else |
| 749 |
s = (char *)0; |
745 |
s = (char *)0; |
| 750 |
|
746 |
|
| 751 |
strncpy(cstr, inet_ntoa (packet -> raw -> ciaddr), 15); |
747 |
strncpy(cstr, inet_ntoa (packet -> raw -> ciaddr), 15); |
| 752 |
cstr[15] = '\0'; |
748 |
cstr[15] = '\0'; |
| 753 |
|
749 |
|
| 754 |
/* Say what we're doing... */ |
750 |
/* Say what we're doing... */ |
| 755 |
sprintf (msgbuf, |
751 |
snprintf (msgbuf, sizeof msgbuf, |
| 756 |
"DHCPRELEASE of %s from %s %s%s%svia %s (%sfound)", |
752 |
"DHCPRELEASE of %s from %s %s%s%svia %s (%sfound)", |
| 757 |
cstr, |
753 |
cstr, |
| 758 |
(packet -> raw -> htype |
754 |
(packet -> raw -> htype |
|
Lines 830-842
Link Here
|
| 830 |
data_string_forget (&data, MDL); |
826 |
data_string_forget (&data, MDL); |
| 831 |
find_lease_by_ip_addr (&lease, cip, MDL); |
827 |
find_lease_by_ip_addr (&lease, cip, MDL); |
| 832 |
|
828 |
|
| 833 |
if (lease && lease -> client_hostname && |
829 |
if (lease && lease -> client_hostname) { |
| 834 |
db_printable (lease -> client_hostname)) |
830 |
if ((strlen (lease -> client_hostname) <= 64) && |
| 835 |
s = lease -> client_hostname; |
831 |
db_printable (lease -> client_hostname)) |
| 836 |
else |
832 |
s = lease -> client_hostname; |
|
|
833 |
else |
| 834 |
s = "Hostname Unsuitable for Printing"; |
| 835 |
} else |
| 837 |
s = (char *)0; |
836 |
s = (char *)0; |
| 838 |
|
837 |
|
| 839 |
sprintf (msgbuf, "DHCPDECLINE of %s from %s %s%s%svia %s", |
838 |
snprintf (msgbuf, sizeof msgbuf, |
|
|
839 |
"DHCPDECLINE of %s from %s %s%s%svia %s", |
| 840 |
piaddr (cip), |
840 |
piaddr (cip), |
| 841 |
(packet -> raw -> htype |
841 |
(packet -> raw -> htype |
| 842 |
? print_hw_addr (packet -> raw -> htype, |
842 |
? print_hw_addr (packet -> raw -> htype, |
|
Lines 947-953
Link Here
|
| 947 |
memcpy (cip.iabuf, &packet -> raw -> ciaddr, 4); |
947 |
memcpy (cip.iabuf, &packet -> raw -> ciaddr, 4); |
| 948 |
} |
948 |
} |
| 949 |
|
949 |
|
| 950 |
sprintf (msgbuf, "DHCPINFORM from %s via %s", |
950 |
snprintf (msgbuf, sizeof msgbuf, "DHCPINFORM from %s via %s", |
| 951 |
piaddr (cip), packet -> interface -> name); |
951 |
piaddr (cip), packet -> interface -> name); |
| 952 |
|
952 |
|
| 953 |
/* If the IP source address is zero, don't respond. */ |
953 |
/* If the IP source address is zero, don't respond. */ |
|
Lines 2748-2757
Link Here
|
| 2748 |
raw.hops = state -> hops; |
2748 |
raw.hops = state -> hops; |
| 2749 |
raw.op = BOOTREPLY; |
2749 |
raw.op = BOOTREPLY; |
| 2750 |
|
2750 |
|
| 2751 |
if (lease -> client_hostname && |
2751 |
if (lease -> client_hostname) { |
| 2752 |
db_printable (lease -> client_hostname)) |
2752 |
if ((strlen (lease -> client_hostname) <= 64) && |
| 2753 |
s = lease -> client_hostname; |
2753 |
db_printable (lease -> client_hostname)) |
| 2754 |
else |
2754 |
s = lease -> client_hostname; |
|
|
2755 |
else |
| 2756 |
s = "Hostname Unsuitable for Printing"; |
| 2757 |
} else |
| 2755 |
s = (char *)0; |
2758 |
s = (char *)0; |
| 2756 |
|
2759 |
|
| 2757 |
/* Say what we're doing... */ |
2760 |
/* Say what we're doing... */ |