* limitations under the License.
*/
+#ifndef _PASSWD_COMMON_H
+#define _PASSWD_COMMON_H
+
#include "apr.h"
#include "apr_lib.h"
#include "apr_strings.h"
#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
#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.
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
*/
* Make a password record from the given information.
*/
int mkhash(struct passwd_ctx *ctx);
+
+#endif /* _PASSWD_COMMON_H */
+