sys/vfs/hammer2: Fix multiple "radii" -> "radix"
[dragonfly.git] / contrib / pam_passwdqc / pam_macros.h
blob84a18a6d805d2f25b53ba0a5a18c7b59c8f316d2
1 /*
2 * These macros are partially based on Linux-PAM's <security/_pam_macros.h>,
3 * which were organized by Cristian Gafton and I believe are in the public
4 * domain.
6 * - Solar Designer
7 */
9 #ifndef PAM_PASSWDQC_MACROS_H__
10 #define PAM_PASSWDQC_MACROS_H__
12 #include <string.h>
13 #include <stdlib.h>
15 static __inline void
16 pwqc_overwrite_string(char *x)
18 if (x)
19 memset(x, 0, strlen(x));
22 static __inline void
23 pwqc_drop_mem(void *x)
25 if (x) {
26 free(x);
27 x = NULL;
31 static __inline void
32 pwqc_drop_pam_reply(struct pam_response *reply, int replies)
34 if (reply) {
35 int reply_i;
37 for (reply_i = 0; reply_i < replies; ++reply_i) {
38 pwqc_overwrite_string(reply[reply_i].resp);
39 pwqc_drop_mem(reply[reply_i].resp);
41 pwqc_drop_mem(reply);
45 #endif /* PAM_PASSWDQC_MACROS_H__ */