diff -uNr dhcp-4.0.0.ORIG/client/clparse.c dhcp-4.0.0/client/clparse.c --- dhcp-4.0.0.ORIG/client/clparse.c 2008-09-01 13:50:55.000000000 +0100 +++ dhcp-4.0.0/client/clparse.c 2008-09-01 13:51:31.000000000 +0100 @@ -149,6 +149,11 @@ status = read_client_conf_file (path_dhclient_conf, (struct interface_info *)0, &top_level_config); + + /* Read any extra configuration from stdin */ + read_client_conf_stdin ((struct interface_info *)0, + &top_level_config); + if (status != ISC_R_SUCCESS) { ; #ifdef LATER @@ -201,20 +206,17 @@ return status; } -int read_client_conf_file (const char *name, struct interface_info *ip, - struct client_config *client) +int read_client_conf_actual (int file, const char *name, + struct interface_info *ip, + struct client_config *client) { - int file; struct parse *cfile; const char *val; int token; isc_result_t status; - if ((file = open (name, O_RDONLY)) < 0) - return uerr2isc (errno); - cfile = (struct parse *)0; - new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0); + new_parse (&cfile, file, (char *)0, 0, name , 0); do { token = peek_token (&val, (unsigned *)0, cfile); @@ -230,6 +232,32 @@ return status; } +int read_client_conf_file (const char *name, struct interface_info *ip, + struct client_config *client) +{ + int file; + isc_result_t status; + + if ((file = open (name, O_RDONLY)) < 0) + return uerr2isc (errno); + + status = read_client_conf_actual(file, name, ip, client); + + return status; +} + + +int read_client_conf_stdin (struct interface_info *ip, + struct client_config *client) +{ + int file = fileno(stdin); + isc_result_t status; + + if (isatty(file)) return ISC_R_NOTFOUND; + status = read_client_conf_actual(file, "stdin", ip, client); + + return status; +} /* lease-file :== client-lease-statements END_OF_FILE client-lease-statements :== diff -uNr dhcp-4.0.0.ORIG/common/conflex.c dhcp-4.0.0/common/conflex.c --- dhcp-4.0.0.ORIG/common/conflex.c 2008-09-01 13:50:55.000000000 +0100 +++ dhcp-4.0.0/common/conflex.c 2008-09-01 13:52:55.000000000 +0100 @@ -103,7 +103,7 @@ struct parse **cfile; { /* "Memory" config files have no file. */ - if ((*cfile)->file != -1) { + if ((*cfile)->file != -1 && (*cfile)->file != fileno(stdin)) { munmap((*cfile)->inbuf, (*cfile)->bufsiz); close((*cfile)->file); }