Fixes by WaxDragon:
- Implement get* integer reading.
- Properly implement ipv4addrs (validates a set of IPv4 addresses)
- Limit returned DNS servers to 1 until we fix iphlpapi.
Modified: trunk/reactos/subsys/system/dhcp/dhclient.c
Modified: trunk/reactos/subsys/system/dhcp/util.c

Modified: trunk/reactos/subsys/system/dhcp/dhclient.c
--- trunk/reactos/subsys/system/dhcp/dhclient.c	2005-04-26 05:13:49 UTC (rev 14811)
+++ trunk/reactos/subsys/system/dhcp/dhclient.c	2005-04-26 07:11:02 UTC (rev 14812)
@@ -448,6 +448,8 @@
         int i, addrs = 
             new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG);
 
+               /* XXX I'm setting addrs to 1 until we are ready up the chain */
+               addrs = 1;
         nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) );
         nsbuf[0] = 0;
         
@@ -1896,7 +1898,7 @@
 	case DHO_FONT_SERVERS:
 	case DHO_DHCP_SERVER_IDENTIFIER:
 		if (!ipv4addrs(opbuf)) {
-			warning("Invalid IP address in option: %s", opbuf);
+                        warning("Invalid IP address in option(%d): %s", option, opbuf);
 			return (0);
 		}
 		return (1)  ;
@@ -1991,19 +1993,20 @@
 int
 ipv4addrs(char * buf)
 {
-	struct in_addr jnk;
-	int count = 0;
+    char *tmp;
+    struct in_addr jnk;
+    int i = 0;
+    
+    note("Input: %s\n", buf);
 
-	while (inet_aton(buf, &jnk) == 1){
-		count++;
-		while (periodchar(*buf) || digitchar(*buf))
-			buf++;
-		if (*buf == '\0')
-			return (count);
-		while (*buf ==  ' ')
-			buf++;
-	}
-	return (0);
+    do {
+        tmp = strtok(buf, " ");
+        note("got %s\n", tmp);
+        if( tmp && inet_aton(tmp, &jnk) ) i++;
+        buf = NULL;
+    } while( tmp );
+
+    return (i);
 }
 
 

Modified: trunk/reactos/subsys/system/dhcp/util.c
--- trunk/reactos/subsys/system/dhcp/util.c	2005-04-26 05:13:49 UTC (rev 14811)
+++ trunk/reactos/subsys/system/dhcp/util.c	2005-04-26 07:11:02 UTC (rev 14812)
@@ -70,19 +70,19 @@
 }    
 
 int16_t getShort( unsigned char *data ) {
-    return 0;
+    return (int16_t) ntohs(*(int16_t*) data);
 }
 
 u_int16_t getUShort( unsigned char *data ) {
-    return 0;
+    return (u_int16_t) ntohs(*(u_int16_t*) data);
 }
 
 int32_t getLong( unsigned char *data ) {
-    return 0;
+       return (int32_t) ntohl(*(u_int32_t*) data);
 }
 
 u_int32_t getULong( unsigned char *data ) {
-    return 0;
+       return ntohl(*(u_int32_t*)data);
 }
 
 int addr_eq( struct iaddr a, struct iaddr b ) {
@@ -93,6 +93,7 @@
 void dfree( void *v, char *name ) { free( v ); }
 
 int read_client_conf(void) {
+       error("util.c read_client_conf not implemented!");
     return 0;
 }