apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fua...@apache.org
Subject svn commit: r663941 - in /apr/apr/trunk: include/arch/netware/apr_private.h passwd/apr_getpass.c
Date Fri, 06 Jun 2008 13:49:42 GMT
Author: fuankg
Date: Fri Jun  6 06:49:41 2008
New Revision: 663941

URL: http://svn.apache.org/viewvc?rev=663941&view=rev
Log:
added usage of threadsafe getpass_r();
enabled HAVE_GETPASS_R for NetWare platform.

Modified:
    apr/apr/trunk/include/arch/netware/apr_private.h
    apr/apr/trunk/passwd/apr_getpass.c

Modified: apr/apr/trunk/include/arch/netware/apr_private.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/netware/apr_private.h?rev=663941&r1=663940&r2=663941&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/netware/apr_private.h (original)
+++ apr/apr/trunk/include/arch/netware/apr_private.h Fri Jun  6 06:49:41 2008
@@ -70,6 +70,15 @@
 
 #define HAVE_WRITEV     1
 
+#define HAVE_GETPASS_R  1
+/*
+ * check for older NDKs which have only the getpassword() function.
+ */
+#include <ndkvers.h>
+#if (CURRENT_NDK_THRESHOLD < 709060000)
+#define getpass_r getpassword
+#endif
+
 /* 64-bit integer conversion function */
 #define APR_INT64_STRFN	      strtoll
 

Modified: apr/apr/trunk/passwd/apr_getpass.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/passwd/apr_getpass.c?rev=663941&r1=663940&r2=663941&view=diff
==============================================================================
--- apr/apr/trunk/passwd/apr_getpass.c (original)
+++ apr/apr/trunk/passwd/apr_getpass.c Fri Jun  6 06:49:41 2008
@@ -70,7 +70,7 @@
 
 #define ERR_OVERFLOW 5
 
-#if !defined(HAVE_GETPASS) && !defined(HAVE_GETPASSPHRASE)
+#if !defined(HAVE_GETPASS) && !defined(HAVE_GETPASSPHRASE) && !defined(HAVE_GETPASS_R)
 
 /* MPE, Win32, NetWare and BeOS all lack a native getpass() */
 
@@ -202,7 +202,7 @@
 
 #endif /* no getchar or _getch */
 
-#endif /* no getpass */
+#endif /* no getpass or getpassphrase or getpass_r */
 
 /*
  * Use the OS getpass() routine (or our own) to obtain a password from
@@ -221,6 +221,11 @@
 
 APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf, apr_size_t *bufsiz)
 {
+    apr_status_t rv = APR_SUCCESS;
+#if defined(HAVE_GETPASS_R)
+    if (getpass_r(prompt, pwbuf, *bufsiz) == NULL)
+        return APR_EINVAL;
+#else
 #if defined(HAVE_GETPASSPHRASE)
     char *pw_got = getpassphrase(prompt);
 #elif defined(HAVE_GETPASS)
@@ -228,7 +233,6 @@
 #else /* use the replacement implementation above */
     char *pw_got = get_password(prompt);
 #endif
-    apr_status_t rv = APR_SUCCESS;
 
     if (!pw_got)
         return APR_EINVAL;
@@ -237,5 +241,6 @@
     }
     apr_cpystrn(pwbuf, pw_got, *bufsiz);
     memset(pw_got, 0, strlen(pw_got));
+#endif /* HAVE_GETPASS_R */
     return rv;
 }



Mime
View raw message