]> git.sur5r.net Git - bacula/bacula/commitdiff
add getpass for Win32
authorKern Sibbald <kern@sibbald.com>
Fri, 28 Apr 2006 15:20:23 +0000 (15:20 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 28 Apr 2006 15:20:23 +0000 (15:20 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2985 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/console/console.c

index 9f20f6de0a20d36b5a2c1f4cc5bd3ef90b32a14d..3d7072718533c33a1cd49f7bb5ad677e53fcb8e1 100644 (file)
@@ -288,17 +288,29 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
 
 /*
  * Call-back for reading a passphrase for an encrypted PEM file
- * This function uses getpass(), which uses a static buffer and is NOT thread-safe.
+ * This function uses getpass(), 
+ *  which uses a static buffer and is NOT thread-safe.
  */
 static int tls_pem_callback(char *buf, int size, const void *userdata)
 {
 #ifdef HAVE_TLS
-   const char *prompt = (const char *) userdata;
+# ifdef HAVE_MINGW
+   const char *prompt = (const char *)userdata;
+   sendit(prompt)
+   if (win32_cgets(buf, size) == NULL) {
+      buf[0] = 0;
+      return 0;
+   } else {
+      return strlen(buf);
+   }
+# else
+   const char *prompt = (const char *)userdata;
    char *passwd;
 
    passwd = getpass(prompt);
    bstrncpy(buf, passwd, size);
-   return (strlen(buf));
+   return strlen(buf);
+# endif
 #else
    buf[0] = 0;
    return 0;