gcc ssh-askpass.c -o ssh-askpass.exe -Os -flto -s -ffunction-sections -fdata-sections -Wl,--gc-sections -nostartfiles -fno-ident -ffreestanding -nostdlib
Last active
March 19, 2025 17:14
-
-
Save jkroepke/cbf4c4bb5c649353fae72ce4ae6483a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
const char *filePath = getenv("SSH_ASKPASS_FILE"); | |
if (!filePath) return 1; | |
FILE *file = fopen(filePath, "rb"); | |
if (!file) return 1; | |
char buffer[256]; | |
if (!fgets(buffer, sizeof(buffer), file)) { | |
fclose(file); | |
return 1; | |
} | |
fclose(file); | |
// Trim newlines | |
for (char *p = buffer; *p; ++p) | |
if (*p == '\n' || *p == '\r') | |
*p = '\0'; | |
puts(buffer); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment