/[imapfilter]/imapfilter/passwd.c
ViewVC logotype

Diff of /imapfilter/passwd.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by lefcha, Thu Jul 31 15:53:19 2003 UTC revision 1.15 by lefcha, Sun Aug 3 16:06:04 2003 UTC
# Line 1  Line 1 
1  #include <stdio.h>  #include <stdio.h>
2  #include <string.h>  #include <string.h>
3    #include <errno.h>
4  #include <stdlib.h>  #include <stdlib.h>
5  #include <limits.h>  #include <limits.h>
6    #include <sys/types.h>
7    #include <sys/stat.h>
8    #include <fcntl.h>
9    
10  #include "config.h"  #include "config.h"
11  #include "imapfilter.h"  #include "imapfilter.h"
12    #include "pathnames.h"
13    
14  #ifdef ENCRYPTED_PASSWORDS  #ifdef ENCRYPTED_PASSWORDS
15  #include <openssl/evp.h>  #include <openssl/evp.h>
# Line 13  Line 18 
18    
19  extern unsigned int flags;  extern unsigned int flags;
20  extern account_t *accounts;  extern account_t *accounts;
21    extern char *home;
22    
23  #ifdef ENCRYPTED_PASSWORDS  #ifdef ENCRYPTED_PASSWORDS
24  extern char *passphr;  extern char *passphr;
25  #endif  #endif
26    
27    
28    int store_passwords(account_t ** accts);
29    
30    
31  /*  /*
32   * Get password from user interactively.   * Get password from user interactively.
33   */   */
# Line 208  fail: Line 218  fail:
218  }  }
219    
220    
221    /*
222     * Store encrypted passwords to file.
223     */
224    int
225    store_passwords(account_t ** accts)
226    {
227            char pwfile[PATH_MAX];
228            FILE *fd;
229    
230            snprintf(pwfile, PATH_MAX, "%s/%s", home, PATHNAME_PASSWORD_FILE);
231    
232            create_file(pwfile, S_IRUSR | S_IWUSR);
233    
234            fd = fopen(pwfile, "w");
235    
236            if (fd == NULL)
237                    fatal(ERROR_FILE_OPEN, "opening passwords file %s; %s\n",
238                        pwfile, strerror(errno));
239    
240            encrypt_passwords(fd, accts);
241    
242            fclose(fd);
243    
244            return 0;
245    }
246    
247    
248  /*  /*
249   * Interactive encrypted passwords editor.   * Interactive encrypted passwords editor.
250   */   */

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26