Debian Codegraph @

src/pwqprivate.h

raw
1 /*
2 * libpwquality internal header
3 *
4 * Copyright (c) Red Hat, Inc, 2011,2015
5 * Copyright (c) Tomas Mraz <[email protected]>, 2011, 2015
6 *
7 * See the end of the file for the License Information
8 */
9
10 #ifndef PWQPRIVATE_H
11 #define PWQPRIVATE_H
12
13 #include "pwquality.h"
14
15 struct pwquality_settings {
16 int diff_ok;
17 int min_length;
18 int dig_credit;
19 int up_credit;
20 int low_credit;
21 int oth_credit;
22 int min_class;
23 int max_repeat;
24 int max_class_repeat;
25 int max_sequence;
26 int gecos_check;
27 int dict_check;
28 int user_check;
29 int user_substr;
30 int enforcing;
31 int retry_times;
32 int enforce_for_root;
33 int local_users_only;
34 char *bad_words;
35 char *dict_path;
36 };
37
38 struct setting_mapping {
39 const char *name;
40 int id;
41 int type;
42 };
43
44 #define PWQ_DEFAULT_DIFF_OK 1
45 #define PWQ_DEFAULT_MIN_LENGTH 8
46 #define PWQ_DEFAULT_DIG_CREDIT 0
47 #define PWQ_DEFAULT_UP_CREDIT 0
48 #define PWQ_DEFAULT_LOW_CREDIT 0
49 #define PWQ_DEFAULT_OTH_CREDIT 0
50
51 #ifdef HAVE_CRACK_H
52 #define PWQ_DEFAULT_DICT_CHECK 1
53 #else
54 #define PWQ_DEFAULT_DICT_CHECK 0
55 #endif
56
57 #define PWQ_DEFAULT_USER_CHECK 1
58 #define PWQ_DEFAULT_USER_SUBSTR 0
59 #define PWQ_DEFAULT_ENFORCING 1
60 #define PWQ_DEFAULT_RETRY_TIMES 1
61 #define PWQ_DEFAULT_ENFORCE_ROOT 0
62 #define PWQ_DEFAULT_LOCAL_USERS 0
63
64 #define PWQ_TYPE_INT 1
65 #define PWQ_TYPE_STR 2
66 #define PWQ_TYPE_SET 3
67
68 #define PWQ_BASE_MIN_LENGTH 6 /* used when lower than this value of min len is set */
69 #define PWQ_NUM_CLASSES 4
70 #define PWQ_NUM_GENERATION_TRIES 3 /* how many times to try to generate the random password if it fails the check */
71 #define PWQ_MIN_WORD_LENGTH 4
72 #define PWQ_MAX_PASSWD_BUF_LEN 16300
73
74 #ifndef PWQUALITY_DEFAULT_CFGFILE
75 #define PWQUALITY_DEFAULT_CFGFILE "/etc/security/pwquality.conf"
76 #endif
77
78 #endif /* PWQPRIVATE_H */
79
80 /*
81 * Redistribution and use in source and binary forms, with or without
82 * modification, are permitted provided that the following conditions
83 * are met:
84 * 1. Redistributions of source code must retain the above copyright
85 * notice, and the entire permission notice in its entirety,
86 * including the disclaimer of warranties.
87 * 2. Redistributions in binary form must reproduce the above copyright
88 * notice, this list of conditions and the following disclaimer in the
89 * documentation and/or other materials provided with the distribution.
90 * 3. The name of the author may not be used to endorse or promote
91 * products derived from this software without specific prior
92 * written permission.
93 *
94 * ALTERNATIVELY, this product may be distributed under the terms of
95 * the GNU General Public License version 2 or later, in which case the
96 * provisions of the GPL are required INSTEAD OF the above restrictions.
97 *
98 * THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESS OR IMPLIED
99 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
100 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
101 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
102 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
103 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
104 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
105 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
106 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
107 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
108 * OF THE POSSIBILITY OF SUCH DAMAGE.
109 */