passphrase_read: Wrie the prompt to the controlling tty
authorShea Levy <shea@shealevy.com>
Sat, 24 Sep 2011 04:45:49 +0000 (00:45 -0400)
committerShea Levy <shea@shealevy.com>
Sat, 24 Sep 2011 04:45:49 +0000 (00:45 -0400)
libfreerdp-utils/passphrase.c

index 15066a5..90c92c0 100644 (file)
  * limitations under the License.
  */
 
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include <freerdp/utils/passphrase.h>
 
 char* freerdp_passphrase_read(const char* prompt, char* buf, size_t bufsiz)
 {
+       char term_name[L_ctermid];
+       int term_id;
+
+       ctermid(term_name);
+       term_id = open(term_name, O_RDWR);
+       write(term_id, prompt, strlen(prompt) + sizeof '\0');
+       close(term_id);
        return NULL;
 }