5 #ifndef _PAM_UNIX_SUPPORT_H
6 #define _PAM_UNIX_SUPPORT_H
11 * here is the string to inform the user that the new passwords they
12 * typed were not the same.
15 #define MISTYPED_PASS "Sorry, passwords do not match"
17 /* type definition for the control options */
21 unsigned int mask; /* shall assume 32 bits of flags */
26 * macro to determine if a given flag is on
29 #define on(x,ctrl) (unix_args[x].flag & ctrl)
32 * macro to determine that a given flag is NOT on
35 #define off(x,ctrl) (!on(x,ctrl))
38 * macro to turn on/off a ctrl flag manually
41 #define set(x,ctrl) (ctrl = ((ctrl)&unix_args[x].mask)|unix_args[x].flag)
42 #define unset(x,ctrl) (ctrl &= ~(unix_args[x].flag))
44 /* the generic mask */
46 #define _ALL_ON_ (~0U)
48 /* end of macro definitions definitions for the control flags */
50 /* ****************************************************************** *
55 * here are the various options recognized by the unix module. They
56 * are enumerated here and then defined below. Internal arguments are
60 #define UNIX__OLD_PASSWD 0 /* internal */
61 #define UNIX__VERIFY_PASSWD 1 /* internal */
62 #define UNIX__IAMROOT 2 /* internal */
64 #define UNIX_AUDIT 3 /* print more things than debug..
65 some information may be sensitive */
66 #define UNIX_USE_FIRST_PASS 4
67 #define UNIX_TRY_FIRST_PASS 5
68 #define UNIX_NOT_SET_PASS 6 /* don't set the AUTHTOK items */
70 #define UNIX__PRELIM 7 /* internal */
71 #define UNIX__UPDATE 8 /* internal */
72 #define UNIX__NONULL 9 /* internal */
73 #define UNIX__QUIET 10 /* internal */
74 #define UNIX_USE_AUTHTOK 11 /* insist on reading PAM_AUTHTOK */
75 #define UNIX_SHADOW 12 /* signal shadow on */
76 #define UNIX_MD5_PASS 13 /* force the use of MD5 passwords */
77 #define UNIX__NULLOK 14 /* Null token ok */
78 #define UNIX_DEBUG 15 /* send more info to syslog(3) */
79 #define UNIX_NODELAY 16 /* admin does not want a fail-delay */
80 #define UNIX_NIS 17 /* wish to use NIS for pwd */
81 #define UNIX_BIGCRYPT 18 /* use DEC-C2 crypt()^x function */
82 #define UNIX_LIKE_AUTH 19 /* need to auth for setcred to work */
83 #define UNIX_REMEMBER_PASSWD 20 /* Remember N previous passwords */
84 #define UNIX_NOREAP 21 /* don't reap child process */
85 #define UNIX_BROKEN_SHADOW 22 /* ignore errors reading password aging
86 * information during acct management */
87 #define UNIX_SHA256_PASS 23 /* new password hashes will use SHA256 */
88 #define UNIX_SHA512_PASS 24 /* new password hashes will use SHA512 */
89 #define UNIX_ALGO_ROUNDS 25 /* optional number of rounds for new
90 password hash algorithms */
91 #define UNIX_BLOWFISH_PASS 26 /* new password hashes will use blowfish */
93 #define UNIX_CTRLS_ 27 /* number of ctrl arguments defined */
95 static const UNIX_Ctrls unix_args[UNIX_CTRLS_] =
97 /* symbol token name ctrl mask ctrl *
98 * ----------------------- ------------------- --------------------- -------- */
100 /* UNIX__OLD_PASSWD */ {NULL, _ALL_ON_, 01},
101 /* UNIX__VERIFY_PASSWD */ {NULL, _ALL_ON_, 02},
102 /* UNIX__IAMROOT */ {NULL, _ALL_ON_, 04},
103 /* UNIX_AUDIT */ {"audit", _ALL_ON_, 010},
104 /* UNIX_USE_FIRST_PASS */ {"use_first_pass", _ALL_ON_^(060), 020},
105 /* UNIX_TRY_FIRST_PASS */ {"try_first_pass", _ALL_ON_^(060), 040},
106 /* UNIX_NOT_SET_PASS */ {"not_set_pass", _ALL_ON_, 0100},
107 /* UNIX__PRELIM */ {NULL, _ALL_ON_^(0600), 0200},
108 /* UNIX__UPDATE */ {NULL, _ALL_ON_^(0600), 0400},
109 /* UNIX__NONULL */ {NULL, _ALL_ON_, 01000},
110 /* UNIX__QUIET */ {NULL, _ALL_ON_, 02000},
111 /* UNIX_USE_AUTHTOK */ {"use_authtok", _ALL_ON_, 04000},
112 /* UNIX_SHADOW */ {"shadow", _ALL_ON_, 010000},
113 /* UNIX_MD5_PASS */ {"md5", _ALL_ON_^(0260420000), 020000},
114 /* UNIX__NULLOK */ {"nullok", _ALL_ON_^(01000), 0},
115 /* UNIX_DEBUG */ {"debug", _ALL_ON_, 040000},
116 /* UNIX_NODELAY */ {"nodelay", _ALL_ON_, 0100000},
117 /* UNIX_NIS */ {"nis", _ALL_ON_, 0200000},
118 /* UNIX_BIGCRYPT */ {"bigcrypt", _ALL_ON_^(0260420000), 0400000},
119 /* UNIX_LIKE_AUTH */ {"likeauth", _ALL_ON_, 01000000},
120 /* UNIX_REMEMBER_PASSWD */ {"remember=", _ALL_ON_, 02000000},
121 /* UNIX_NOREAP */ {"noreap", _ALL_ON_, 04000000},
122 /* UNIX_BROKEN_SHADOW */ {"broken_shadow", _ALL_ON_, 010000000},
123 /* UNIX_SHA256_PASS */ {"sha256", _ALL_ON_^(0260420000), 020000000},
124 /* UNIX_SHA512_PASS */ {"sha512", _ALL_ON_^(0260420000), 040000000},
125 /* UNIX_ALGO_ROUNDS */ {"rounds=", _ALL_ON_, 0100000000},
126 /* UNIX_BLOWFISH_PASS */ {"blowfish", _ALL_ON_^(0260420000), 0200000000},
129 #define UNIX_DEFAULTS (unix_args[UNIX__NONULL].flag)
131 #define MAX_FD_NO 2000000
133 /* use this to free strings. ESPECIALLY password strings */
135 #define _pam_delete(xx) \
137 _pam_overwrite(xx); \
141 extern int _make_remark(pam_handle_t * pamh, unsigned int ctrl
142 ,int type, const char *text);
143 extern int _set_ctrl(pam_handle_t * pamh, int flags, int *remember, int *rounds,
144 int argc, const char **argv);
145 extern int _unix_getpwnam (pam_handle_t *pamh,
146 const char *name, int files, int nis,
147 struct passwd **ret);
148 extern int _unix_comesfromsource (pam_handle_t *pamh,
149 const char *name, int files, int nis);
150 extern int _unix_blankpasswd(pam_handle_t *pamh,unsigned int ctrl,
152 extern int _unix_verify_password(pam_handle_t * pamh, const char *name
153 ,const char *p, unsigned int ctrl);
154 extern int _unix_read_password(pam_handle_t * pamh
159 ,const char *data_name
162 extern int _unix_run_verify_binary(pam_handle_t *pamh,
163 unsigned int ctrl, const char *user, int *daysleft);
164 #endif /* _PAM_UNIX_SUPPORT_H */