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. 5 */ 6 7 #if !defined(_PAM_MACROS_H) && !defined(_pam_overwrite) 8 #define _PAM_MACROS_H 9 10 #include <string.h> 11 #include <stdlib.h> 12 13 #define _pam_overwrite(x) \ 14 memset((x), 0, strlen((x))) 15 16 #define _pam_drop_reply(/* struct pam_response * */ reply, /* int */ replies) \ 17 do { \ 18 int i; \ 19 \ 20 for (i = 0; i < (replies); i++) \ 21 if ((reply)[i].resp) { \ 22 _pam_overwrite((reply)[i].resp); \ 23 free((reply)[i].resp); \ 24 } \ 25 if ((reply)) free((reply)); \ 26 } while (0) 27 28 #endif 29