Apache HTTPD
lua_passwd.h
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _LUA_PASSWD_H
18#define _LUA_PASSWD_H
19
20#include "apr.h"
21#include "apr_lib.h"
22#include "apr_strings.h"
23#include "apr_errno.h"
24#include "apr_file_io.h"
25#include "apr_general.h"
26#include "apr_version.h"
27#if !APR_VERSION_AT_LEAST(2,0,0)
28#include "apu_version.h"
29#endif
30
31#define MAX_PASSWD_LEN 256
32
33#define ALG_APMD5 0
34#define ALG_APSHA 1
35#define ALG_BCRYPT 2
36#define ALG_CRYPT 3
37
38#define BCRYPT_DEFAULT_COST 5
39
40#define ERR_FILEPERM 1
41#define ERR_SYNTAX 2
42#define ERR_PWMISMATCH 3
43#define ERR_INTERRUPTED 4
44#define ERR_OVERFLOW 5
45#define ERR_BADUSER 6
46#define ERR_INVALID 7
47#define ERR_RANDOM 8
48#define ERR_GENERAL 9
49#define ERR_ALG_NOT_SUPP 10
50
51#if defined(WIN32) || defined(NETWARE)
52#define CRYPT_ALGO_SUPPORTED 0
53#define PLAIN_ALGO_SUPPORTED 1
54#else
55#define CRYPT_ALGO_SUPPORTED 1
56#define PLAIN_ALGO_SUPPORTED 0
57#endif
58
59#if APR_VERSION_AT_LEAST(2,0,0) || \
60 (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 5)
61#define BCRYPT_ALGO_SUPPORTED 1
62#else
63#define BCRYPT_ALGO_SUPPORTED 0
64#endif
65
66typedef struct passwd_ctx passwd_ctx;
67
68struct passwd_ctx {
70 const char *errstr;
71 char *out;
73 char *passwd;
74 int alg;
75 int cost;
76};
77
78
79/*
80 * The following functions return zero on success; otherwise, one of
81 * the ERR_* codes is returned and an error message is stored in ctx->errstr.
82 */
83
84/*
85 * Make a password record from the given information.
86 */
88
89#endif /* _LUA_PASSWD_H */
90
APR Error Codes.
APR File I/O Handling.
APR Miscellaneous library routines.
APR general purpose library routines.
APR Strings library.
APR Versioning Interface.
APR-util Versioning Interface.
apr_brigade_flush void * ctx
apr_size_t size
int mk_password_hash(passwd_ctx *ctx)
Definition lua_passwd.c:87
apr_size_t out_len
Definition lua_passwd.h:72
apr_pool_t * pool
Definition lua_passwd.h:69
const char * errstr
Definition lua_passwd.h:70
char * out
Definition lua_passwd.h:71
char * passwd
Definition lua_passwd.h:73