16 |
#define ERROR_FILE_OPEN 3 |
#define ERROR_FILE_OPEN 3 |
17 |
#define ERROR_CONFIG_PARSE 4 |
#define ERROR_CONFIG_PARSE 4 |
18 |
#define ERROR_MEMORY_ALLOCATION 5 |
#define ERROR_MEMORY_ALLOCATION 5 |
19 |
#define ERROR_TERMIO 6 |
#define ERROR_SETUID 6 |
20 |
#define ERROR_NETWORK 7 |
#define ERROR_TERMIO 7 |
21 |
#define ERROR_SSL 8 |
#define ERROR_NETWORK 8 |
22 |
#define ERROR_PASSPHRASE 9 |
#define ERROR_SSL 9 |
23 |
#define ERROR_ENCRYPT 10 |
#define ERROR_PASSPHRASE 10 |
24 |
#define ERROR_DECRYPT 11 |
#define ERROR_ENCRYPT 11 |
25 |
#define ERROR_UNDEFINED 12 |
#define ERROR_DECRYPT 12 |
26 |
|
#define ERROR_UNDEFINED 13 |
27 |
|
|
28 |
/* Flags that control the program's options. */ |
/* Flags that control the program's options. */ |
29 |
#define OPTION_DETAILS_QUIET 0x01 |
#define OPTION_DETAILS_QUIET 0x01 |
75 |
#define ENCRYPTION_BUF 1024 |
#define ENCRYPTION_BUF 1024 |
76 |
#define DECRYPTION_BUF 4096 |
#define DECRYPTION_BUF 4096 |
77 |
|
|
78 |
|
/* Maximum passwords the password editor can handle. */ |
79 |
|
#define EDITOR_PASSWORDS_MAX 64 |
80 |
|
|
81 |
|
|
82 |
#define min(A, B) ((A) < (B) ? (A) : (B)) |
#define min(A, B) ((A) < (B) ? (A) : (B)) |
83 |
#define plural(A) ((A) == 1 ? "" : "s") |
#define plural(A) ((A) == 1 ? "" : "s") |
84 |
|
|
85 |
|
|
86 |
|
/* Secure memory information. */ |
87 |
|
typedef struct secmem { |
88 |
|
void *buf; /* Allocated memory buffer. */ |
89 |
|
size_t size; /* Size of the buffer. */ |
90 |
|
struct secmem *prev, *next; /* Previous/next node of doubly linked list. */ |
91 |
|
} secmem_t; |
92 |
|
|
93 |
|
|
94 |
/* file.c */ |
/* file.c */ |
95 |
|
int read_config(char *cfg); |
96 |
|
int parse_config(FILE * fd); |
97 |
|
void set_options(char *line, regmatch_t * match); |
98 |
|
|
99 |
|
int read_passwords(void); |
100 |
|
int parse_passwords(FILE * fd); |
101 |
|
int store_passwords(account_t * accts[]); |
102 |
|
|
103 |
int create_homedir(void); |
int create_homedir(void); |
104 |
int exists_file(char *fname); |
int exists_file(char *fname); |
105 |
int exists_dir(char *fname); |
int exists_dir(char *fname); |
109 |
int check_file_perms(char *fname, mode_t mode); |
int check_file_perms(char *fname, mode_t mode); |
110 |
int check_dir_perms(char *dname, mode_t mode); |
int check_dir_perms(char *dname, mode_t mode); |
111 |
#endif |
#endif |
|
int read_config(char *cfg); |
|
|
int parse_config(FILE * fd); |
|
|
void set_options(char *line, regmatch_t * match); |
|
|
int read_passwords(void); |
|
|
int parse_passwords(FILE * fd); |
|
|
int store_passwords(account_t * accts[]); |
|
112 |
|
|
113 |
/* imapfilter.c */ |
/* imapfilter.c */ |
114 |
void usage(void); |
void usage(void); |
152 |
void xfree(void *ptr); |
void xfree(void *ptr); |
153 |
char *xstrdup(const char *s); |
char *xstrdup(const char *s); |
154 |
|
|
155 |
|
void *smalloc(size_t size); |
156 |
|
void *srealloc(void *ptr, size_t size); |
157 |
|
void sfree(void *ptr); |
158 |
|
char *sstrdup(const char *s); |
159 |
|
void secmem_append(secmem_t *node); |
160 |
|
secmem_t *secmem_find(void *ptr); |
161 |
|
void secmem_remove(secmem_t *node); |
162 |
|
void secmem_clear(void); |
163 |
|
|
164 |
|
void corefile_disable(void); |
165 |
|
void corefile_restore(void); |
166 |
|
|
167 |
/* misc.c */ |
/* misc.c */ |
168 |
char *strcasestr(const char *haystack, const char *needle); |
char *strcasestr(const char *haystack, const char *needle); |
169 |
char *ultostr(unsigned long int num, int base); |
char *ultostr(unsigned long int num, int base); |
173 |
void get_password(char *passwd, size_t pwlen); |
void get_password(char *passwd, size_t pwlen); |
174 |
#ifdef ENCRYPTED_PASSWORDS |
#ifdef ENCRYPTED_PASSWORDS |
175 |
int encrypt_passwords(FILE *fd, account_t *accts[]); |
int encrypt_passwords(FILE *fd, account_t *accts[]); |
176 |
int decrypt_passwords(unsigned char *buf, FILE *fd); |
int decrypt_passwords(unsigned char **buf, FILE *fd); |
177 |
void password_editor(void); |
void password_editor(void); |
178 |
#endif |
#endif |
179 |
|
|