aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-28 22:50:06 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-28 22:50:06 +0000
commit5696c8402789c5f835bc4428c3bea8204cf01352 (patch)
treee02a13ebfaee0233cb41293d7da871d1af74e5d5 /main
parent1297a5987850c9af9eef4179d6c4ae7a467bd49a (diff)
Setup environment variables for the benefit of child processes and disallow changing them.
(closes issue #14899) Reported by: jmls Patches: 20090916__issue14899.diff.txt uploaded by tilghman (license 14) Tested by: jmls git-svn-id: http://svn.digium.com/svn/asterisk/trunk@266385 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 9ae67a9d8..d11fc8dce 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -3128,6 +3128,18 @@ static void run_startup_commands(void)
ast_config_destroy(cfg);
}
+static void env_init(void)
+{
+ setenv("AST_SYSTEMNAME", ast_config_AST_SYSTEM_NAME, 1);
+ setenv("AST_BUILD_HOST", ast_build_hostname, 1);
+ setenv("AST_BUILD_DATE", ast_build_date, 1);
+ setenv("AST_BUILD_KERNEL", ast_build_kernel, 1);
+ setenv("AST_BUILD_MACHINE", ast_build_machine, 1);
+ setenv("AST_BUILD_OS", ast_build_os, 1);
+ setenv("AST_BUILD_USER", ast_build_user, 1);
+ setenv("AST_VERSION", ast_get_version(), 1);
+}
+
int main(int argc, char *argv[])
{
int c;
@@ -3314,6 +3326,7 @@ int main(int argc, char *argv[])
}
ast_readconfig();
+ env_init();
if (ast_opt_remote && remotesock != NULL)
ast_copy_string((char *) cfg_paths.socket_path, remotesock, sizeof(cfg_paths.socket_path));