1372cf2b83
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mds@1330 6952d904-891a-0410-993b-d76249ca496b
84 lines
2.1 KiB
Diff
84 lines
2.1 KiB
Diff
--- common/conflex.c.orig 2006-02-21 16:21:45.000000000 +0000
|
|
+++ common/conflex.c 2006-02-21 16:23:06.000000000 +0000
|
|
@@ -90,7 +90,7 @@
|
|
struct parse **cfile;
|
|
{
|
|
/* "Memory" config files have no file. */
|
|
- if ((*cfile)->file != -1)
|
|
+ if ((*cfile)->file != -1 && (*cfile)->file != fileno(stdin))
|
|
close((*cfile)->file);
|
|
|
|
if ((*cfile)->bufsiz)
|
|
--- client/clparse.c.orig 2006-02-22 09:37:12.000000000 +0000
|
|
+++ client/clparse.c 2006-02-22 09:38:26.000000000 +0000
|
|
@@ -97,6 +97,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
|
|
@@ -148,20 +153,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);
|
|
@@ -177,6 +179,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 :== <nil>
|