diff options
author | Gert Doering <gert@greenie.muc.de> | 2010-02-28 22:48:48 +0100 |
---|---|---|
committer | Gert Doering <gert@greenie.muc.de> | 2011-04-24 17:22:39 +0200 |
commit | 48ab6b419756c4be0974d447111f373d0cdb7dce (patch) | |
tree | 94616a3ad37c6bcac6f4309a418058f000fe77d6 /win32.c | |
parent | 49a945eafea2c64dbaa5cb2ecdfd4ca9a82aa26e (diff) | |
download | openvpn-48ab6b419756c4be0974d447111f373d0cdb7dce.tar.gz openvpn-48ab6b419756c4be0974d447111f373d0cdb7dce.tar.xz openvpn-48ab6b419756c4be0974d447111f373d0cdb7dce.zip |
env_block(): if PATH is not set, add standard PATH setting to env so that
"netsh.exe" can find "framedyn.dll" (needs work)
Diffstat (limited to 'win32.c')
-rw-r--r-- | win32.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -874,16 +874,21 @@ win_safe_filename (const char *fn) static char * env_block (const struct env_set *es) { + char * force_path = "PATH=C:\\Windows\\System32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem"; + if (es) { struct env_item *e; char *ret; char *p; size_t nchars = 1; + bool path_seen = false; for (e = es->list; e != NULL; e = e->next) nchars += strlen (e->string) + 1; + nchars += strlen(force_path)+1; + ret = (char *) malloc (nchars); check_malloc_return (ret); @@ -895,7 +900,18 @@ env_block (const struct env_set *es) strcpy (p, e->string); p += strlen (e->string) + 1; } + if ( strncmp(e->string, "PATH=", 5 ) == 0 ) + path_seen = true; + } + + /* make sure PATH is set */ + if ( !path_seen ) + { + msg( M_INFO, "env_block: add %s", force_path ); + strcpy( p, force_path ); + p += strlen(force_path) + 1; } + *p = '\0'; return ret; } |