home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / npasswd / part01 / checkpasswd / checkpasswd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-19  |  3.2 KB  |  103 lines

  1.  
  2. /* --------------------------------------------------------------------  */
  3. /*                                                                       */
  4. /*                         Author: Clyde Hoover                          */
  5. /*                          Computation Center                           */
  6. /*                   The University of Texas at Austin                   */
  7. /*                          Austin, Texas 78712                          */
  8. /*                         clyde@emx.utexas.edu                          */
  9. /*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  10. /*                                                                       */
  11. /*This code may be distributed freely, provided this notice is retained. */
  12. /*                                                                       */
  13. /* --------------------------------------------------------------------  */
  14. /*
  15.  *    checkpasswd.h - Master include for checkpasswd
  16.  * 
  17.  *    @(#)checkpasswd.h    1.4 11/26/90 (cc.utexas.edu) /tmp_mnt/usr/share/src/private/ut/share/bin/passwd/checkpasswd/SCCS/s.checkpasswd.h
  18.  */
  19.  
  20. #include <stdio.h>
  21. #include <ctype.h>
  22. #ifdef    SYSV
  23. #include <string.h>
  24. #define index strchr
  25. #else
  26. #include <strings.h>
  27. #endif
  28.  
  29. /*
  30.  *    Return codes from checkpasswd() and pwck_*
  31.  *    Also used as exit codes from main()
  32.  */
  33. #define    PWCK_FAIL    -1    /* Failure during check process */
  34. #define    PWCK_OK        0    /* Password is ok to use */
  35. #define    PWCK_NULL    1     /* Password is the null string */
  36. #define    PWCK_OBVIOUS    2    /* Password is 'too obvious' */
  37. #define    PWCK_FINGER    3    /* Password is part of users finger info */
  38. #define    PWCK_INDICT    4    /* Password found in a dictionary */
  39. #define    PWCK_ILLCHAR    5    /* Illegal character in password */
  40. #define    PWCK_SHORT    6    /* Password too short */
  41.  
  42. /*
  43.  *    Dictionary info
  44.  */
  45. typedef struct _dict {
  46.     char    *dict_path,        /* Path to dictionary */
  47.         *dict_desc;        /* Descriptive phrase */
  48.     struct _dict  *dict_next;    /* Link to next dict */
  49. } dictionary;
  50. extern dictionary    *dictionaries; /* List of dictionaries to check */
  51.  
  52. /*
  53.  *    This is the default dicitonary to look in
  54.  *    If you have some DBM dictionaries, either repoint this
  55.  *    define or comment it out and place dictionaries in
  56.  *    the configuration file.
  57.  */
  58. #define    DEFAULT_DICT    "/usr/dict/words"    /* Default dictionary */
  59.  
  60. #ifndef    CONFIG_FILE
  61.             /* Set configuration file name */
  62. # ifdef    DEBUG
  63. #    define    CONFIG_FILE    "checkpasswd.cf" 
  64. # else
  65. #    define    CONFIG_FILE    "/usr/adm/checkpasswd.cf"
  66. # endif    /* DEBUG */
  67. #endif    /* CONFIG_FILE */
  68.  
  69. /*
  70.  *    Password preferences
  71.  */
  72. int    single_case,        /* Single-case passwords ok or not */
  73.     print_only,        /* Printable characters only */
  74.     run_length,        /* Maximum length of character runs */
  75.     min_length,        /* Minimum password length */
  76.     max_length;        /* Maximum effective length */
  77.  
  78. #define    sizeof_illegalcc    128
  79. extern char    illegalcc[];        /* Control characters not allowed */
  80.  
  81. /*
  82.  *    Misc inline subroutine macros
  83.  */
  84.  
  85. /*    Single string comparasion */
  86. #define try(P,C,V) { \
  87.     if (_cistrcmp((P),(C)) == 0) \
  88.         return(V); \
  89.     }
  90.  
  91. /*    Multiple string comparasion */
  92. #define mtry(P,C,V) { \
  93.     int i; \
  94.     if ((i = _instring((P),(C),(V))) != PWCK_OK) \
  95.         return(i); \
  96. }
  97.  
  98. /* Compact string compare */
  99. #define    streq(X,S)    (_cistrncmp((X),(S), strlen(X)) == 0)
  100.  
  101.  
  102. /*    End checkpasswd.h    */
  103.