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

Diff of /imapfilter/file.c

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

revision 1.51 by lefcha, Sat Mar 22 15:26:53 2003 UTC revision 1.52 by lefcha, Mon May 19 22:38:15 2003 UTC
# Line 31  extern long timeout; Line 31  extern long timeout;
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
# Line 205  parse_config(FILE * fd) Line 205  parse_config(FILE * fd)
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
# Line 297  read_passwords(void) Line 312  read_passwords(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);
# Line 345  parse_passwords(FILE * fd) Line 357  parse_passwords(FILE * fd)
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    

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26