diff options
-rw-r--r-- | ChangeLog.txt | 3 | ||||
-rw-r--r-- | guts/symlinkat.c | 2 | ||||
-rw-r--r-- | pseudo_client.c | 1 | ||||
-rw-r--r-- | pseudo_client.h | 1 | ||||
-rw-r--r-- | pseudo_wrappers.c | 22 |
5 files changed, 28 insertions, 1 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt index 1fd596b..c0d9baf 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,6 @@ +2010-06-02: + * (seebs) add PSEUDO_NOSYMLINKEXP feature and documentation. + 2010-04-30: * (seebs) rework pdb_history * (seebs) small cleanups and bulletproofing. diff --git a/guts/symlinkat.c b/guts/symlinkat.c index eaf1523..b70d500 100644 --- a/guts/symlinkat.c +++ b/guts/symlinkat.c @@ -9,7 +9,7 @@ struct stat64 buf; char *roldname = 0; - if (oldname[0] == '/' && pseudo_chroot_len) { + if (oldname[0] == '/' && pseudo_chroot_len && !pseudo_nosymlinkexp) { size_t len = pseudo_chroot_len + strlen(oldname) + 1; roldname = malloc(len); snprintf(roldname, len, "%s%s", pseudo_chroot, oldname); diff --git a/pseudo_client.c b/pseudo_client.c index f1ec54d..f58d633 100644 --- a/pseudo_client.c +++ b/pseudo_client.c @@ -63,6 +63,7 @@ static int nfds = 0; static int messages = 0; static struct timeval message_time = { .tv_sec = 0 }; static int pseudo_inited = 0; +int pseudo_nosymlinkexp = 0; /* note: these are int, not uid_t/gid_t, so I can use 'em with scanf */ uid_t pseudo_ruid; diff --git a/pseudo_client.h b/pseudo_client.h index b1c730c..5b2a7f9 100644 --- a/pseudo_client.h +++ b/pseudo_client.h @@ -60,6 +60,7 @@ extern char *pseudo_cwd_rel; extern char *pseudo_chroot; extern char *pseudo_passwd; extern size_t pseudo_chroot_len; +extern int pseudo_nosymlinkexp; /* Root can read, write, and execute files which have no read, write, * or execute permissions. diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c index ae4e698..fd51e9a 100644 --- a/pseudo_wrappers.c +++ b/pseudo_wrappers.c @@ -121,6 +121,7 @@ pseudo_populate_wrappers(void) { char *debug; static int done = 0; char *pseudo_path = 0; + char *no_symlink_exp; if (done) return done; @@ -149,6 +150,27 @@ pseudo_populate_wrappers(void) { pseudo_debug_verbose(); } } + no_symlink_exp = getenv("PSEUDO_NOSYMLINKEXP"); + if (no_symlink_exp) { + char *endptr; + /* if the environment variable is not an empty string, + * parse it; "0" means turn NOSYMLINKEXP off, "1" means + * turn it on (disabling the feature). An empty string + * or something we can't parse means to set the flag; this + * is a safe default because if you didn't want the flag + * set, you normally wouldn't set the environment variable + * at all. + */ + if (*no_symlink_exp) { + pseudo_nosymlinkexp = strtol(no_symlink_exp, &endptr, 10); + if (*endptr) + pseudo_nosymlinkexp = 1; + } else { + pseudo_nosymlinkexp = 1; + } + } else { + pseudo_nosymlinkexp = 0; + } /* if PSEUDO_DEBUG_FILE is set up, redirect logging there. */ pseudo_logfile(NULL); |