Detect pipe/stdio for parameter --from-stdin

When --from-stdin is given and parameters are passed via pipe/file
don't use passphrase function for the password.
This fixes #698.
(cherry picked from commit d846024e85)
This commit is contained in:
Bernhard Miklautz 2012-08-14 23:50:10 +02:00 committed by Bernhard Miklautz
parent 1851856eb3
commit db9651f48e

View File

@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <freerdp/settings.h>
#include <freerdp/utils/print.h>
#include <freerdp/utils/memory.h>
@ -728,7 +729,13 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
/* password */
if (NULL == settings->password) {
settings->password = xmalloc(512 * sizeof(char));
freerdp_passphrase_read("password: ", settings->password, 512, settings->from_stdin);
if (isatty(STDIN_FILENO))
freerdp_passphrase_read("password: ", settings->password, 512, settings->from_stdin);
else
{
printf("password: ");
scanf("%511s", settings->password);
}
}
/* domain */
if (NULL == settings->domain) {