summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2003-05-30 19:07:35 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2003-05-30 19:07:35 +0000
commita999be2e57085c8e407447290e34d7992576e19b (patch)
treef826428df5971b641246faaa639011d8ae754f78
parent12a0f955b6f514f264850c67cb8b8d5d6116cc1e (diff)
Move env setup to its own function, works around compiler problem on sparc
LD_NORANDOM is now disabled on issetugid().
-rw-r--r--libexec/ld.so/loader.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index 51975af53c1..05dee673f38 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.60 2003/05/30 16:00:43 deraadt Exp $ */
+/* $OpenBSD: loader.c,v 1.61 2003/05/30 19:07:34 drahn Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -123,25 +123,13 @@ _dl_dopreload(char *paths)
}
/*
- * This is the dynamic loader entrypoint. When entering here, depending
- * on architecture type, the stack and registers are set up according
- * to the architectures ABI specification. The first thing required
- * to do is to dig out all information we need to accomplish our task.
+ * grab interesting environment variables, zap bad env vars if
+ * issetugid
*/
-unsigned long
-_dl_boot(const char **argv, char **envp, const long loff, long *dl_data)
-{
- struct elf_object *exe_obj; /* Pointer to executable object */
- struct elf_object *dyn_obj; /* Pointer to executable object */
- struct r_debug **map_link; /* Where to put pointer for gdb */
- struct r_debug *debug_map;
- Elf_Dyn *dynp;
- elf_object_t *dynobj;
- Elf_Phdr *phdp;
- char *us = "";
- unsigned int i;
- int libcnt = 0;
+void
+_dl_setup_env(char **envp)
+{
/*
* Get paths to various things we are going to use.
*/
@@ -173,13 +161,34 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data)
_dl_debug = NULL;
_dl_unsetenv("LD_DEBUG", envp);
}
-#if 0
if (_dl_norandom) {
_dl_norandom = NULL;
_dl_unsetenv("LD_NORANDOM", envp);
}
-#endif
}
+}
+
+/*
+ * This is the dynamic loader entrypoint. When entering here, depending
+ * on architecture type, the stack and registers are set up according
+ * to the architectures ABI specification. The first thing required
+ * to do is to dig out all information we need to accomplish our task.
+ */
+unsigned long
+_dl_boot(const char **argv, char **envp, const long loff, long *dl_data)
+{
+ struct elf_object *exe_obj; /* Pointer to executable object */
+ struct elf_object *dyn_obj; /* Pointer to executable object */
+ struct r_debug **map_link; /* Where to put pointer for gdb */
+ struct r_debug *debug_map;
+ Elf_Dyn *dynp;
+ elf_object_t *dynobj;
+ Elf_Phdr *phdp;
+ char *us = "";
+ unsigned int i;
+ int libcnt = 0;
+
+ _dl_setup_env(envp);
_dl_progname = argv[0];
if (dl_data[AUX_pagesz] != 0)