So far, the whole environment is copied over to child processes started from sshd when running under Cygwin. The attached patch restricts this to the basic environment created for all processes.
Created attachment 698 [details] The patch copies only the basic Windows environment over to child processes
Comment on attachment 698 [details] The patch copies only the basic Windows environment over to child processes Looks OK to me. A few minor comments: [...] >+ p[idx] = NULL; >+ for (e = environ; *e; ++e) { style guide says to explicitly test against NULL, ie "*e != NULL" >+ for (i = 0; i < WENV_SIZ; ++i) { >+ if (!strncmp(*e, wenv_arr[i].name, >+ wenv_arr[i].namelen)) { >+ p[idx] = *e; >+ p[++idx] = NULL; You could make that "p[idx++] = *e", move "p[idx] = NULL" from above the loop to below and delete "p[++idx] = NULL" from the loop. It would be nice if the array didn't need to be structs but that would mean a bit of run-time overhead and I don't think it would be any clearer anyway...
Created attachment 706 [details] Modified patch with Darren's suggestions
Patch #706 applied, thanks.