Create credential helper trampoline, send stdin
Co-Authored-By: Sergio Padrino <1083228+sergiou87@users.noreply.github.com>
This commit is contained in:
18
binding.gyp
18
binding.gyp
@@ -55,6 +55,24 @@
|
||||
}]
|
||||
]
|
||||
},
|
||||
{
|
||||
'target_name': 'desktop-credential-helper-trampoline',
|
||||
'type': 'executable',
|
||||
'defines': [
|
||||
'CREDENTIAL_HELPER'
|
||||
],
|
||||
'sources': [
|
||||
'src/desktop-trampoline.c',
|
||||
'src/socket.c'
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'link_settings': {
|
||||
'libraries': [ 'Ws2_32.lib' ]
|
||||
}
|
||||
}]
|
||||
]
|
||||
},
|
||||
{
|
||||
'target_name': 'ssh-wrapper',
|
||||
'type': 'executable',
|
||||
|
||||
@@ -102,7 +102,15 @@ int runTrampolineClient(SOCKET *outSocket, int argc, char **argv, char **envp) {
|
||||
WRITE_STRING_OR_EXIT("environment variable", validEnvVars[idx]);
|
||||
}
|
||||
|
||||
// TODO: send stdin stuff?
|
||||
char stdinBuffer[BUFFER_LENGTH + 1];
|
||||
int stdinBytes = 0;
|
||||
|
||||
#ifdef CREDENTIAL_HELPER
|
||||
stdinBytes = fread(stdinBuffer, sizeof(char), BUFFER_LENGTH, stdin);
|
||||
#endif
|
||||
|
||||
stdinBuffer[stdinBytes] = '\0';
|
||||
WRITE_STRING_OR_EXIT("stdin", stdinBuffer);
|
||||
|
||||
char buffer[BUFFER_LENGTH + 1];
|
||||
size_t totalBytesRead = 0;
|
||||
@@ -129,6 +137,13 @@ int runTrampolineClient(SOCKET *outSocket, int argc, char **argv, char **envp) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
|
||||
#ifdef CREDENTIAL_HELPER
|
||||
setenv("DESKTOP_TRAMPOLINE_IDENTIFIER", "CREDENTIALHELPER");
|
||||
#elif
|
||||
setenv("DESKTOP_TRAMPOLINE_IDENTIFIER", "ASKPASS");
|
||||
#endif
|
||||
|
||||
if (initializeNetwork() != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user