version 1.1.1.2, 2013/07/22 10:46:13
|
version 1.1.1.3, 2014/06/15 16:12:55
|
Line 37
|
Line 37
|
# include <malloc.h> |
# include <malloc.h> |
#endif /* HAVE_MALLOC_H && !STDC_HEADERS */ |
#endif /* HAVE_MALLOC_H && !STDC_HEADERS */ |
#include <errno.h> |
#include <errno.h> |
#ifdef HAVE_DLOPEN |
|
# include <dlfcn.h> |
|
#else |
|
# include "compat/dlfcn.h" |
|
#endif |
|
|
|
#include "sudo.h" |
#include "sudo.h" |
#include "sudo_plugin.h" |
#include "sudo_plugin.h" |
|
#include "sudo_dso.h" |
|
|
extern char **environ; /* global environment pointer */ |
extern char **environ; /* global environment pointer */ |
static char **priv_environ; /* private environment pointer */ |
static char **priv_environ; /* private environment pointer */ |
Line 72 typedef char * (*sudo_fn_getenv_t)(const char *);
|
Line 68 typedef char * (*sudo_fn_getenv_t)(const char *);
|
char * |
char * |
getenv_unhooked(const char *name) |
getenv_unhooked(const char *name) |
{ |
{ |
#if defined(HAVE_DLOPEN) && defined(RTLD_NEXT) |
|
sudo_fn_getenv_t fn; |
sudo_fn_getenv_t fn; |
|
|
fn = (sudo_fn_getenv_t)dlsym(RTLD_NEXT, "getenv"); | fn = (sudo_fn_getenv_t)sudo_dso_findsym(SUDO_DSO_NEXT, "getenv"); |
if (fn != NULL) |
if (fn != NULL) |
return fn(name); |
return fn(name); |
#endif /* HAVE_DLOPEN && RTLD_NEXT */ |
|
return rpl_getenv(name); |
return rpl_getenv(name); |
} |
} |
|
|
|
__dso_public char *getenv(const char *); |
|
|
char * |
char * |
getenv(const char *name) |
getenv(const char *name) |
{ |
{ |
Line 144 typedef int (*sudo_fn_putenv_t)(PUTENV_CONST char *);
|
Line 140 typedef int (*sudo_fn_putenv_t)(PUTENV_CONST char *);
|
static int |
static int |
putenv_unhooked(PUTENV_CONST char *string) |
putenv_unhooked(PUTENV_CONST char *string) |
{ |
{ |
#if defined(HAVE_DLOPEN) && defined(RTLD_NEXT) |
|
sudo_fn_putenv_t fn; |
sudo_fn_putenv_t fn; |
|
|
fn = (sudo_fn_putenv_t)dlsym(RTLD_NEXT, "putenv"); | fn = (sudo_fn_putenv_t)sudo_dso_findsym(SUDO_DSO_NEXT, "putenv"); |
if (fn != NULL) |
if (fn != NULL) |
return fn(string); |
return fn(string); |
#endif /* HAVE_DLOPEN && RTLD_NEXT */ |
|
return rpl_putenv(string); |
return rpl_putenv(string); |
} |
} |
|
|
Line 214 typedef int (*sudo_fn_setenv_t)(const char *, const ch
|
Line 208 typedef int (*sudo_fn_setenv_t)(const char *, const ch
|
static int |
static int |
setenv_unhooked(const char *var, const char *val, int overwrite) |
setenv_unhooked(const char *var, const char *val, int overwrite) |
{ |
{ |
#if defined(HAVE_SETENV) && defined(HAVE_DLOPEN) && defined(RTLD_NEXT) |
|
sudo_fn_setenv_t fn; |
sudo_fn_setenv_t fn; |
|
|
fn = (sudo_fn_setenv_t)dlsym(RTLD_NEXT, "setenv"); | fn = (sudo_fn_setenv_t)sudo_dso_findsym(SUDO_DSO_NEXT, "setenv"); |
if (fn != NULL) |
if (fn != NULL) |
return fn(var, val, overwrite); |
return fn(var, val, overwrite); |
#endif /* HAVE_SETENV && HAVE_DLOPEN && RTLD_NEXT */ |
|
return rpl_setenv(var, val, overwrite); |
return rpl_setenv(var, val, overwrite); |
} |
} |
|
|
Line 273 static int
|
Line 265 static int
|
unsetenv_unhooked(const char *var) |
unsetenv_unhooked(const char *var) |
{ |
{ |
int rval = 0; |
int rval = 0; |
#if defined(HAVE_UNSETENV) && defined(HAVE_DLOPEN) && defined(RTLD_NEXT) |
|
sudo_fn_unsetenv_t fn; |
sudo_fn_unsetenv_t fn; |
|
|
fn = (sudo_fn_unsetenv_t)dlsym(RTLD_NEXT, "unsetenv"); | fn = (sudo_fn_unsetenv_t)sudo_dso_findsym(SUDO_DSO_NEXT, "unsetenv"); |
if (fn != NULL) { |
if (fn != NULL) { |
# ifdef UNSETENV_VOID |
# ifdef UNSETENV_VOID |
fn(var); |
fn(var); |
# else |
# else |
rval = fn(var); |
rval = fn(var); |
# endif |
# endif |
} else | } else { |
#endif /* HAVE_UNSETENV && HAVE_DLOPEN && RTLD_NEXT */ | |
{ | |
rval = rpl_unsetenv(var); |
rval = rpl_unsetenv(var); |
} |
} |
return rval; |
return rval; |