diff options
author | Roland Dreier <roland@topspin.com> | 2005-06-24 16:06:01 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 11:35:56 -0800 |
commit | 5091b3e8360a0cd552e69eae76dba4868e3f113f (patch) | |
tree | c5cbe4f5579f60c512059cf1319852f983adc4f5 | |
parent | bc8f5e2c9dfc80dd310d12013ed970aa15da566b (diff) | |
download | libibverbs-5091b3e8360a0cd552e69eae76dba4868e3f113f.tar.gz |
Don't follow driver path in user's environment if we're running SUID
Signed-off-by: Roland Dreier <roland@topspin.com>
-rw-r--r-- | src/init.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -41,6 +41,8 @@ #include <glob.h> #include <stdio.h> #include <dlfcn.h> +#include <unistd.h> +#include <sys/types.h> #include "ibverbs.h" @@ -207,11 +209,17 @@ static void INIT ibverbs_init(void) */ load_driver(NULL); - user_path = getenv(OPENIB_DRIVER_PATH_ENV); - if (user_path) { - wr_path = strdupa(user_path); - while ((dir = strsep(&wr_path, ";:"))) - find_drivers(dir); + /* + * Only follow the path passed in through the calling user's + * environment if we're not running SUID. + */ + if (getuid() == geteuid()) { + user_path = getenv(OPENIB_DRIVER_PATH_ENV); + if (user_path) { + wr_path = strdupa(user_path); + while ((dir = strsep(&wr_path, ";:"))) + find_drivers(dir); + } } find_drivers(default_path); |