]> granicus.if.org Git - apache/blobdiff - support/passwd_common.h
print Server Temp Key information.
[apache] / support / passwd_common.h
index 79341dda6f8b60f6b2fb43c153f095fd5fa45619..660081e9084935ef3c79ca565db7ff021ec72053 100644 (file)
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+#ifndef _PASSWD_COMMON_H
+#define _PASSWD_COMMON_H
+
 #include "apr.h"
 #include "apr_lib.h"
 #include "apr_strings.h"
@@ -21,6 +24,9 @@
 #include "apr_file_io.h"
 #include "apr_general.h"
 #include "apr_version.h"
+#if !APR_VERSION_AT_LEAST(2,0,0)
+#include "apu_version.h"
+#endif
 
 #define MAX_STRING_LEN 256
 
@@ -28,6 +34,9 @@
 #define ALG_CRYPT 1
 #define ALG_APMD5 2
 #define ALG_APSHA 3
+#define ALG_BCRYPT 4
+
+#define BCRYPT_DEFAULT_COST 5
 
 #define ERR_FILEPERM 1
 #define ERR_SYNTAX 2
 #define PLAIN_ALGO_SUPPORTED 0
 #endif
 
+#if APR_VERSION_AT_LEAST(2,0,0) || \
+    (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 5)
+#define BCRYPT_ALGO_SUPPORTED 1
+#else
+#define BCRYPT_ALGO_SUPPORTED 0
+#endif
+
+#if APR_CHARSET_EBCDIC
+#undef BCRYPT_ALGO_SUPPORTED
+#define BCRYPT_ALGO_SUPPORTED 0
+#endif
+
 /*
  * Must be initialized with apr_file_open_stderr() before using any of the
  * below functions.
@@ -63,12 +84,21 @@ struct passwd_ctx {
     apr_size_t      out_len;
     char            *passwd;
     int             alg;
+    int             cost;
     enum {
         PW_PROMPT = 0,
-        PW_ARG
+        PW_ARG,
+        PW_STDIN,
+        PW_PROMPT_VERIFY,
     } passwd_src;
 };
 
+
+/*
+ * To be used as apr_pool_abort_fn
+ */
+int abort_on_oom(int rc);
+
 /*
  * Write a line to the file. On error, print a message and exit
  */
@@ -93,3 +123,6 @@ int get_password(struct passwd_ctx *ctx);
  * Make a password record from the given information.
  */
 int mkhash(struct passwd_ctx *ctx);
+
+#endif /* _PASSWD_COMMON_H */
+