From 80a08532b700fd0229e65d507a5c7f4c7c9716d3 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Sat, 9 Mar 2002 21:59:46 +0000 Subject: comply better to ClientID stuff --- mdk-stage1/dhcp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mdk-stage1') diff --git a/mdk-stage1/dhcp.c b/mdk-stage1/dhcp.c index 65b7df56e..d375608f8 100644 --- a/mdk-stage1/dhcp.c +++ b/mdk-stage1/dhcp.c @@ -552,9 +552,9 @@ enum return_type perform_dhcp(struct interface_info * intf) if (*dhcp_hostname && *dhcp_domain) { /* if we have both, then create client id from them */ - client_id_str = memdup(dhcp_hostname, strlen(dhcp_domain) + 2); - strcat(client_id_str, "."); - strcat(client_id_str, dhcp_domain); + client_id_str = malloc(1 + strlen(dhcp_hostname) + 1 + strlen(dhcp_domain) + 1); + client_id_str[0] = '\0'; + sprintf(client_id_str+1, "%s.%s", dhcp_hostname, dhcp_domain); } } } @@ -575,7 +575,7 @@ enum return_type perform_dhcp(struct interface_info * intf) /* add pieces needed to have DDNS/DHCP IP selection based on requested name */ if (dhcp_hostname && *dhcp_hostname) { /* pick client id form based on absence or presence of domain name */ if (*dhcp_domain) /* alternate style . */ - add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, strlen(client_id_str), client_id_str); + add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, strlen(client_id_str+1)+1, client_id_str); else { /* usual style (aka windows / dhcpcd) */ /* but put MAC in form required for client identifier first */ client_id_hwaddr = malloc(IFHWADDRLEN+2); @@ -630,7 +630,7 @@ enum return_type perform_dhcp(struct interface_info * intf) /* if used the first time, then have to use it again */ if (dhcp_hostname && *dhcp_hostname) { /* add pieces needed to have DDNS/DHCP IP selection based on requested name */ if (dhcp_domain && *dhcp_domain) /* alternate style */ - add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, strlen(client_id_str), client_id_str); + add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, strlen(client_id_str+1)+1, client_id_str); else /* usual style (aka windows / dhcpcd) */ add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, IFHWADDRLEN+1, client_id_hwaddr); /* this is the one that the dhcp server really wants for DDNS updates */ -- cgit v1.2.1