home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / COMMS / PSIONMAI / PMFULLSO / SUNMAIL / SCCS / S9.C < prev   
Encoding:
Text File  |  1995-07-06  |  3.0 KB  |  92 lines

  1. h60457
  2. s 00001/00000/00052
  3. d D 1.3 95/07/06 20:14:13 tim 3 2
  4. c user the getpass command to get the users password as it is secure. modified getstr so is the field is secure and there is an existing string a - will remove the data
  5. e
  6. s 00000/00013/00052
  7. d D 1.2 95/07/06 14:12:39 tim 2 1
  8. c getuname moved from talktopopconfig to talktopopconf so it is available to
  9. c talktopop
  10. e
  11. s 00065/00000/00000
  12. d D 1.1 95/07/06 14:00:30 tim 1 0
  13. c 
  14. e
  15. u
  16. U
  17. f e 0
  18. t
  19. T
  20. I 1
  21. /* this program builds up a talktopop config file.
  22.    If the file exists it uses the information if there as a default, 
  23.    otherwise it tries to give some sensible information */
  24. #include "talktopop.h"
  25. #include <stdio.h>
  26. #include <string.h>
  27. #include <pwd.h>
  28. char popserver[100] ;
  29. char popname [100] ;
  30. char protname [100] ;
  31. char uname[100] ;
  32. char passwd[100] ;
  33. int filestartno = 0 ;
  34. int dodel = FALSE ;
  35. int direction = FALSE ;
  36. int verbose = FALSE ;
  37. int maxsize = MAXSIZE ;
  38. int maxemail = MAXCOUNT ;
  39. int hnset, pwset, unset ;
  40.  
  41. main ()
  42. {
  43.     confinit() ;
  44.     readconf() ;
  45.     newconf() ;
  46.     writeconf() ;
  47. }
  48.  
  49. newconf()
  50. {
  51.     char tmp[1024] ;
  52.     /* say hi etc. */
  53.     printf("This program builds or modifies you %s configuration file\n", POPCONF) ;
  54.     printf("If the %s file exists it uses the data in that file for defaults\n") ;
  55.     printf("Otherwise it provides its own.\n") ;
  56.     printf("Where a value is given in brackets (e.g. [tim]) you just have to\n") ;
  57.     printf("hit return to accept this of enter a new value if you want to change it\n") ;
  58. I 3
  59.     printf("In the password field if there is an existing value you want to remove just enter -\n") ;
  60. E 3
  61.     /* get the users name */
  62.     getuname(uname) ;
  63.     getstr(uname, "your username", FALSE) ;
  64.     printf("WARNING. If you enter a password it will be stored in clear\ntext format in a configuration file. This is a potential security\nhole. If you chose not to enter a password you will be prompted\nfor it each time you run talktopop\n") ;
  65.     getstr(passwd, "your password", TRUE) ;
  66.     getstr(popserver, "the name of the machine running the POP-3 server", FALSE) ;
  67.     getno(&filestartno, "the number you want to use as the starting point for retrieved file names") ;
  68.     getyn("true if you want talktopop to delete emails from the mailbox once they are downloaded, false if you want them to be kept", &dodel) ;
  69.     getyn("true if you want talktopop to retrieve emails from the start of your mailbox, false if you want it to retrieve them from the end", &direction) ;
  70.     getyn("true if you want talktopop to be verbose, false otherwise", &verbose) ;
  71.     getno(&maxsize, "the maximum email size (in bytes) to be downloaded") ;
  72.     getno(&maxemail, "the maximum number of emails to be downloaded to the psion") ;
  73.     getstr(popname, "the name of the pop-3 server in the services file / map", FALSE) ;
  74.     getstr(protname, "the name of the transport mechanism used to talk to pop (Leave as tcp unless you REALY know better)", FALSE) ;
  75. }
  76. D 2
  77.  
  78.  
  79. getuname(str)
  80. char * str ;
  81. {
  82.     uid_t uid ;
  83.     struct passwd *pwent ;
  84.     uid = getuid() ;
  85.     pwent = getpwuid(uid) ;
  86.     if (pwent == NULL)
  87.         return ;
  88.     strcpy(str, pwent->pw_name) ;
  89. }
  90. E 2
  91. E 1
  92.