31 |
extern char *home; |
extern char *home; |
32 |
|
|
33 |
#ifdef ENCRYPTED_PASSWORDS |
#ifdef ENCRYPTED_PASSWORDS |
34 |
char *passphr; /* Master password to access the passwords |
char *passphr = NULL; /* Master password to access the passwords |
35 |
* file. */ |
* file. */ |
36 |
|
|
37 |
#endif |
#endif |
205 |
for (i = 0; i < 13; i++) |
for (i = 0; i < 13; i++) |
206 |
regfree(&creg[i]); |
regfree(&creg[i]); |
207 |
|
|
208 |
destroy_data(); |
destroy_unneeded(); |
209 |
|
|
210 |
return 0; |
return 0; |
211 |
} |
} |
212 |
|
|
213 |
|
|
214 |
/* |
/* |
215 |
|
* Signal SIGHUP received, destroy all data structures and reread the |
216 |
|
* configuration file. |
217 |
|
*/ |
218 |
|
void |
219 |
|
reread_config(char *cfg) |
220 |
|
{ |
221 |
|
destroy_all(); |
222 |
|
read_config(cfg); |
223 |
|
read_passwords(); |
224 |
|
|
225 |
|
flags &= ~(FLAG_SIGHUP_RECEIVED); |
226 |
|
} |
227 |
|
|
228 |
|
|
229 |
|
/* |
230 |
* Set other options found in config file. |
* Set other options found in config file. |
231 |
*/ |
*/ |
232 |
void |
void |
312 |
if (!(flags & FLAG_BLANK_PASSWORD)) |
if (!(flags & FLAG_BLANK_PASSWORD)) |
313 |
return ERROR_CONFIG_PARSE; |
return ERROR_CONFIG_PARSE; |
314 |
|
|
|
passphr = (char *)smalloc(PASSPHRASE_LEN); |
|
|
*passphr = '\0'; |
|
|
|
|
315 |
snprintf(pwfile, PATH_MAX, "%s/%s", home, ".imapfilter/passwords"); |
snprintf(pwfile, PATH_MAX, "%s/%s", home, ".imapfilter/passwords"); |
316 |
#ifdef DEBUG |
#ifdef DEBUG |
317 |
fprintf(stderr, "debug: passwords file: '%s'\n", pwfile); |
fprintf(stderr, "debug: passwords file: '%s'\n", pwfile); |
357 |
pe = NULL; |
pe = NULL; |
358 |
reg = "([[:alnum:].-]+) ([[:graph:]]+) ([[:graph:]]+)"; |
reg = "([[:alnum:].-]+) ([[:graph:]]+) ([[:graph:]]+)"; |
359 |
|
|
360 |
|
if (!passphr) { |
361 |
do { |
passphr = (char *)smalloc(PASSPHRASE_LEN); |
362 |
fseek(fd, 0L, SEEK_SET); |
*passphr = '\0'; |
363 |
printf("Enter master passphrase: "); |
|
364 |
get_password(passphr, PASSPHRASE_LEN); |
do { |
365 |
} while ((r = decrypt_passwords(&buf, fd)) && --t != 0); |
fseek(fd, 0L, SEEK_SET); |
366 |
|
printf("Enter master passphrase: "); |
367 |
if (!t) |
get_password(passphr, PASSPHRASE_LEN); |
368 |
return ERROR_PASSPHRASE; |
} while ((r = decrypt_passwords(&buf, fd)) && --t != 0); |
369 |
|
|
370 |
|
if (!t) |
371 |
|
return ERROR_PASSPHRASE; |
372 |
|
} else |
373 |
|
decrypt_passwords(&buf, fd); |
374 |
|
|
375 |
c = cp = sstrdup(buf); |
c = cp = sstrdup(buf); |
376 |
|
|