summaryrefslogtreecommitdiffstats
path: root/common/file.c
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-03-16 15:38:13 -0700
committerJay Sorg <jay.sorg@gmail.com>2012-03-16 15:38:13 -0700
commit9da524814597ae38b5bfd7c2bc8e84a4b88df5b0 (patch)
tree30a62e06a7bceda73484370b6a88de3ff87e6002 /common/file.c
parente9c58226ba20efb6389d976acb9eb8e339b02df7 (diff)
downloadxrdp-proprietary-9da524814597ae38b5bfd7c2bc8e84a4b88df5b0.tar.gz
xrdp-proprietary-9da524814597ae38b5bfd7c2bc8e84a4b88df5b0.zip
common: allow env vars to override .ini settings when value start with $
Diffstat (limited to 'common/file.c')
-rw-r--r--common/file.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/common/file.c b/common/file.c
index 9a269309..808d94dc 100644
--- a/common/file.c
+++ b/common/file.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010 Jay Sorg
+ Copyright (c) 2004-2012 Jay Sorg
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@@ -204,6 +204,7 @@ l_file_read_section(int fd, int max_file_size, const char* section,
char text[512];
char name[512];
char value[512];
+ char* lvalue;
char c;
int in_it;
int in_it_index;
@@ -242,7 +243,22 @@ l_file_read_section(int fd, int max_file_size, const char* section,
{
file_split_name_value(text, name, value);
list_add_item(names, (tbus)g_strdup(name));
- list_add_item(values, (tbus)g_strdup(value));
+ if (value[0] == '$')
+ {
+ lvalue = g_getenv(value + 1);
+ if (lvalue != 0)
+ {
+ list_add_item(values, (tbus)g_strdup(lvalue));
+ }
+ else
+ {
+ list_add_item(values, (tbus)g_strdup(""));
+ }
+ }
+ else
+ {
+ list_add_item(values, (tbus)g_strdup(value));
+ }
}
}
free_stream(s);