Changeset View
Changeset View
Standalone View
Standalone View
pam_kwallet.c
Show All 15 Lines | |||||
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * | 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * | ||
17 | *************************************************************************************/ | 17 | *************************************************************************************/ | ||
18 | 18 | | |||
19 | #include <gcrypt.h> | 19 | #include <gcrypt.h> | ||
20 | #include <stdio.h> | 20 | #include <stdio.h> | ||
21 | #include <signal.h> | 21 | #include <signal.h> | ||
22 | #include <unistd.h> | 22 | #include <unistd.h> | ||
23 | #include <stdlib.h> | 23 | #include <stdlib.h> | ||
24 | #include <string.h> | ||||
24 | #include <errno.h> | 25 | #include <errno.h> | ||
25 | #include <grp.h> | 26 | #include <grp.h> | ||
26 | 27 | | |||
27 | #define PAM_SM_PASSWORD | 28 | #define PAM_SM_PASSWORD | ||
28 | #define PAM_SM_SESSION | 29 | #define PAM_SM_SESSION | ||
29 | #define PAM_SM_AUTH | 30 | #define PAM_SM_AUTH | ||
30 | #include <pwd.h> | 31 | #include <pwd.h> | ||
31 | #include <sys/stat.h> | 32 | #include <sys/stat.h> | ||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | |||||
172 | * Code copied from gkr-pam-module.c, GPL2+ | 173 | * Code copied from gkr-pam-module.c, GPL2+ | ||
173 | */ | 174 | */ | ||
174 | static void wipeString(char *str) | 175 | static void wipeString(char *str) | ||
175 | { | 176 | { | ||
176 | if (!str) { | 177 | if (!str) { | ||
177 | return; | 178 | return; | ||
178 | } | 179 | } | ||
179 | 180 | | |||
180 | size_t len; | 181 | const size_t len = strlen (str); | ||
aacid: make it const? | |||||
182 | #if HAVE_EXPLICIT_BZERO | ||||
183 | explicit_bzero(str, len); | ||||
184 | #else | ||||
181 | volatile char *vp; | 185 | volatile char *vp; | ||
182 | 186 | | |||
183 | /* Defeats some optimizations */ | 187 | /* Defeats some optimizations */ | ||
184 | len = strlen (str); | | |||
185 | memset (str, 0xAA, len); | 188 | memset (str, 0xAA, len); | ||
186 | memset (str, 0xBB, len); | 189 | memset (str, 0xBB, len); | ||
187 | 190 | | |||
188 | /* Defeats others */ | 191 | /* Defeats others */ | ||
189 | vp = (volatile char*)str; | 192 | vp = (volatile char*)str; | ||
190 | while (*vp) { | 193 | while (*vp) { | ||
191 | *(vp++) = 0xAA; | 194 | *(vp++) = 0xAA; | ||
192 | } | 195 | } | ||
196 | #endif | ||||
193 | 197 | | |||
194 | free (str); | 198 | free (str); | ||
195 | } | 199 | } | ||
196 | 200 | | |||
197 | static int prompt_for_password(pam_handle_t *pamh) | 201 | static int prompt_for_password(pam_handle_t *pamh) | ||
198 | { | 202 | { | ||
199 | int result; | 203 | int result; | ||
200 | 204 | | |||
▲ Show 20 Lines • Show All 579 Lines • Show Last 20 Lines |
make it const?