[PATCH] Custom resolv.conf

Dmitry V. Levin ldv@altlinux.org
Wed Sep 15 12:11:00 GMT 2004


Hi,

On Wed, Sep 15, 2004 at 01:29:56PM +0200, Michal Svec wrote:
> The attached patch adds a possibility to define a custom resolv.conf with 
> a shell variable (RESOLV_CONF, pretty similar to RESOLV_HOST_CONF).
> 
> Regards
> Michal
> --
> Michal Svec
> msvec@suse.cz

> --- glibc-2.3/resolv/res_init.c.orig	2004-08-18 13:33:37.000000000 +0200
> +++ glibc-2.3/resolv/res_init.c	2004-09-10 13:21:46.000000000 +0200
> @@ -88,6 +88,8 @@
>  
>  #include <not-cancel.h>
>  
> +#define ENV_RESOLVCONF	"RESOLV_CONF"
> +
>  /* Options.  Should all be left alone. */
>  #define RESOLVSORT
>  #define RFC1535
> @@ -149,6 +151,7 @@
>  int
>  __res_vinit(res_state statp, int preinit) {
>  	register FILE *fp;
> +	const char *rconf_name;
>  	register char *cp, **pp;
>  	register int n;
>  	char buf[BUFSIZ];
> @@ -240,7 +243,11 @@
>  	(line[sizeof(name) - 1] == ' ' || \
>  	 line[sizeof(name) - 1] == '\t'))
>  
> -	if ((fp = fopen(_PATH_RESCONF, "rc")) != NULL) {
> +	rconf_name = getenv (ENV_RESOLVCONF);

How about using __secure_getenv() instead of getenv() and adding
"RESOLV_CONF\0" to the UNSECURE_ENVVARS list?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20040915/b8a09801/attachment.sig>


More information about the Libc-alpha mailing list