Bugzilla – Attachment 698 Details for
Bug 915
[PATCH] Only copy basic Windows environment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
The patch copies only the basic Windows environment over to child processes
copy-env.diff (text/plain), 3.31 KB, created by
Corinna Vinschen
on 2004-08-18 17:39:51 AEST
(
hide
)
Description:
The patch copies only the basic Windows environment over to child processes
Filename:
MIME Type:
Creator:
Corinna Vinschen
Created:
2004-08-18 17:39:51 AEST
Size:
3.31 KB
patch
obsolete
>Index: session.c >=================================================================== >RCS file: /cvs/openssh_cvs/session.c,v >retrieving revision 1.287 >diff -p -u -r1.287 session.c >--- session.c 12 Aug 2004 12:40:25 -0000 1.287 >+++ session.c 13 Aug 2004 12:41:28 -0000 >@@ -979,7 +979,13 @@ do_setup_env(Session *s, const char *she > * The Windows environment contains some setting which are > * important for a running system. They must not be dropped. > */ >- copy_environment(environ, &env, &envsize); >+ { >+ char **p; >+ >+ p = fetch_windows_environment(); >+ copy_environment(p, &env, &envsize); >+ free_windows_environment(p); >+ } > #endif > > #ifdef GSSAPI >Index: openbsd-compat/bsd-cygwin_util.c >=================================================================== >RCS file: /cvs/openssh_cvs/openbsd-compat/bsd-cygwin_util.c,v >retrieving revision 1.12 >diff -p -u -r1.12 bsd-cygwin_util.c >--- openbsd-compat/bsd-cygwin_util.c 18 Apr 2004 11:15:45 -0000 1.12 >+++ openbsd-compat/bsd-cygwin_util.c 13 Aug 2004 12:41:28 -0000 >@@ -38,6 +38,7 @@ RCSID("$Id: bsd-cygwin_util.c,v 1.12 200 > #include <sys/utsname.h> > #include <sys/vfs.h> > #include <windows.h> >+#include "xmalloc.h" > #define is_winnt (GetVersion() < 0x80000000) > > #define ntsec_on(c) ((c) && strstr((c),"ntsec") && !strstr((c),"nontsec")) >@@ -96,7 +97,6 @@ has_capability(int what) > */ > if (!inited) { > struct utsname uts; >- char *c; > > if (!uname(&uts)) { > int major_high = 0, major_low = 0, minor = 0; >@@ -234,6 +234,59 @@ register_9x_service(void) > GetProcAddress(kerneldll, "RegisterServiceProcess"))) > return; > RegisterServiceProcess(0, 1); >+} >+ >+#define NL(x) x, (sizeof (x) - 1) >+#define WENV_SIZ (sizeof (wenv_arr) / sizeof (wenv_arr[0])) >+ >+static struct wenv { >+ const char *name; >+ size_t namelen; >+} wenv_arr[] = { >+ { NL("ALLUSERSPROFILE=") }, >+ { NL("COMMONPROGRAMFILES=") }, >+ { NL("COMPUTERNAME=") }, >+ { NL("COMSPEC=") }, >+ { NL("NUMBER_OF_PROCESSORS=") }, >+ { NL("OS=") }, >+ { NL("PATH=") }, >+ { NL("PATHEXT=") }, >+ { NL("PROCESSOR_ARCHITECTURE=") }, >+ { NL("PROCESSOR_IDENTIFIER=") }, >+ { NL("PROCESSOR_LEVEL=") }, >+ { NL("PROCESSOR_REVISION=") }, >+ { NL("PROGRAMFILES=") }, >+ { NL("SYSTEMDRIVE=") }, >+ { NL("SYSTEMROOT=") }, >+ { NL("TMP=") }, >+ { NL("TEMP=") }, >+ { NL("WINDIR=") }, >+}; >+ >+char ** >+fetch_windows_environment(void) >+{ >+ char **e, **p; >+ int i, idx = 0; >+ >+ p = xmalloc(WENV_SIZ * sizeof(char *)); >+ p[idx] = NULL; >+ for (e = environ; *e; ++e) { >+ for (i = 0; i < WENV_SIZ; ++i) { >+ if (!strncmp(*e, wenv_arr[i].name, >+ wenv_arr[i].namelen)) { >+ p[idx] = *e; >+ p[++idx] = NULL; >+ } >+ } >+ } >+ return p; >+} >+ >+void >+free_windows_environment(char **p) >+{ >+ xfree(p); > } > > #endif /* HAVE_CYGWIN */ >Index: openbsd-compat/bsd-cygwin_util.h >=================================================================== >RCS file: /cvs/openssh_cvs/openbsd-compat/bsd-cygwin_util.h,v >retrieving revision 1.10 >diff -p -u -r1.10 bsd-cygwin_util.h >--- openbsd-compat/bsd-cygwin_util.h 7 Aug 2003 06:28:16 -0000 1.10 >+++ openbsd-compat/bsd-cygwin_util.h 13 Aug 2004 12:41:28 -0000 >@@ -46,6 +46,8 @@ int binary_pipe(int fd[2]); > int check_nt_auth(int, struct passwd *); > int check_ntsec(const char *); > void register_9x_service(void); >+char **fetch_windows_environment(void); >+void free_windows_environment(char **); > > #define open binary_open > #define pipe binary_pipe
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dtucker
:
ok+
Actions:
View
|
Diff
Attachments on
bug 915
:
698
|
706