1 |
#include <stdio.h> |
#include <stdio.h> |
2 |
|
#include <stdlib.h> |
3 |
#include <string.h> |
#include <string.h> |
4 |
#include <limits.h> |
#include <limits.h> |
5 |
#include <errno.h> |
#include <errno.h> |
391 |
|
|
392 |
return 0; |
return 0; |
393 |
} |
} |
|
|
|
|
|
|
|
/* |
|
|
* Store encrypted passwords to file. |
|
|
*/ |
|
|
int |
|
|
store_passwords(account_t ** accts) |
|
|
{ |
|
|
char pwfile[PATH_MAX]; |
|
|
FILE *fd; |
|
|
|
|
|
snprintf(pwfile, PATH_MAX, "%s/%s", home, ".imapfilter/passwords"); |
|
|
|
|
|
create_file(pwfile, S_IRUSR | S_IWUSR); |
|
|
|
|
|
fd = fopen(pwfile, "w"); |
|
|
|
|
|
if (fd == NULL) |
|
|
fatal(ERROR_FILE_OPEN, "opening passwords file %s; %s\n", |
|
|
pwfile, strerror(errno)); |
|
|
|
|
|
encrypt_passwords(fd, accts); |
|
|
|
|
|
fclose(fd); |
|
|
|
|
|
return 0; |
|
|
} |
|
394 |
#endif /* ENCRYPTED_PASSWORDS */ |
#endif /* ENCRYPTED_PASSWORDS */ |