From 5f971b8d4fa52c95ba2c8266217f69a2a7e01072 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Mon, 1 Mar 2021 10:46:52 +0000 Subject: [PATCH] Add askpass.c source code --- askpass.c | 24 ++++++++++++++++++++++++ askpass.exe | Bin 383164 -> 383164 bytes 2 files changed, 24 insertions(+) create mode 100644 askpass.c diff --git a/askpass.c b/askpass.c new file mode 100644 index 0000000..aa8d7e0 --- /dev/null +++ b/askpass.c @@ -0,0 +1,24 @@ +/* + ssh-add on Windows (probably part of the source at https://github.com/PowerShell/openssh-portable) + does not/can not read the passphrase from stdin. + + However, when the DISPLAY env var is set and ssh-add is not run from a terminal (however it tests + that), it will run the executable pointed to by SSH_ASKPASS in a subprocess and read the passphrase + from that subprocess' stdout. + + This program can be used as the SSH_ASKPASS implementation. It will return the passphrase set + in the SSH_PASS env variable. + + To cross-compile from Ubuntu, I installed the `mingw-w64` package and ran + $ x86_64-w64-mingw32-gcc askpass.c -static -o askpass.exe +*/ + +#include +#include + +int main(int argc, char** argv) +{ + printf("%s\n", getenv("SSH_PASS")); + + return 0; +} diff --git a/askpass.exe b/askpass.exe index 631d3db3e4fa4b442c938c0a268119ed0ecc453e..c06bfda56248066d8b70410e88ae60d651f7084b 100755 GIT binary patch delta 7096 zcmZ8l3tW^{+CS%=_sB&N6b1%n1_tCVD598_#o#5U!WAvN`w4kjNf8k6vfl8vIT1Pb zVh^Sjlov{KA=JUrlCrR`TCKHJ)7@zMws6;4DiyPGzWZ6II4r%v|YVzLG^RdbCrN`b)W{xLbg>Uf*SI0Z1r zdD3Id2XMaYF&0Z*O>TU$^F5Doh1M1{)PJD~BB!xT`#ETAOdt677!|JvYd4s2Lryqq z^3OY*7d*xvinKX>v(~jvl^w=P|3{1DP~v$Q4td|<%(4Qsi}G2F1*q&qyC?>d^*~CN z0>ZS~Tl;ZcfG!`r;W7R}x~T~YPLhMyfbkf+7c%y`bb|7Dj75-jHujeu#)X*REgb_n zYQ`a7;%#j}@clegdn`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