home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume22 / bigb / part01 / bigb.h < prev    next >
C/C++ Source or Header  |  1991-09-13  |  4KB  |  131 lines

  1. #ifndef __BIGB_H_
  2. #define __BIGB_H_
  3.  
  4. /* Define qualifiers to restrict the scope of variables and functions */
  5. #ifndef PRIVATE
  6. # define PRIVATE    static
  7. # define PUBLIC     extern
  8. #endif
  9.  
  10. /* If QUICK is defined then look directly at the security database files.
  11.  * This reduces the cpu load by about a factor of 20 but it would
  12.  * cause problems if the location of the special files gets changed.
  13.  * This is unlikely to happen but anything is possible in version n+1
  14. */
  15. #define QUICK
  16.  
  17. /* Required by subsequent include files */
  18. #define SecureWare
  19.  
  20. #include <sys/types.h>
  21. #include <sys/security.h>
  22. #include <sys/audit.h>
  23. #include <prot.h>
  24. #include <errno.h>
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27.  
  28. /* Safer to define these myself */
  29. #ifndef TRUE
  30. # define TRUE  1
  31. # define FALSE 0
  32. #endif
  33.  
  34. /* A few variations on the theme of NULL to make things easier */
  35. #define FNULL ((FILE *) NULL)
  36. #define CNULL ((char *) NULL)
  37. #define MNULL ((struct member *) NULL)
  38.  
  39. /* Longer than any user or terminal name */
  40. #define MAX_LEN 15
  41.  
  42. /* Define a member of the linked lists used to hold terminals and users
  43.  * to check or not as the case may be.  Using linked lists allows any length
  44.  * of list and also allows the data to be easily replaced.
  45. */
  46. struct member {
  47.     struct member   *previous;      /* Points to previous member ( or MNULL) */
  48.     struct member   *next;          /* Points to next member ( or MNULL ) */
  49.     char            data[MAX_LEN];  /* The actual data */
  50.     };
  51.  
  52. /* The maximum length of a full file name */
  53. #define PATH_MAX 128
  54.  
  55. /* General scratch area */
  56. char    temp[PATH_MAX];
  57.  
  58. /* The filenames containing the terminals to check/not to check */
  59. char    terminal_check_file[PATH_MAX];
  60. char    terminal_nocheck_file[PATH_MAX];
  61.  
  62. /* The filenames containing the users to check/not to check */
  63. char    user_check_file[PATH_MAX];
  64. char    user_nocheck_file[PATH_MAX];
  65.  
  66. /* Just for neatness */
  67. typedef int flag_t;
  68.  
  69. /* Check specific entries, all but some, all or none */
  70. #define CHECK_SPECIFIC  ((flag_t) 1)
  71. #define CHECK_EXCLUDE   ((flag_t) 2)
  72. #define CHECK_ALL       ((flag_t) 4)
  73. #define CHECK_NONE      ((flag_t) 8)
  74.  
  75. /* The linked lists containing terminal data */
  76. struct member   *terminals_to_check;
  77. struct member   *terminals_to_exclude;
  78. flag_t          terminal_check;     /* E.G. CHECK_ALL */
  79.  
  80. /* The linked lists containing user data */
  81. struct member   *users_to_check;
  82. struct member   *users_to_exclude;
  83. flag_t          user_check;         /* E.G. CHECK_ALL */
  84.  
  85. /* When to start worrying */
  86. int             max_term_failures;
  87. int             max_login_failures;
  88.  
  89. /* Warn when root logs on ( 'yes' or 'no' ) */
  90. char            checkroot[4];
  91. int             check_root_selected;    /* As above but faster to check */
  92.  
  93. /* The time of the last round of checks */
  94. time_t          last_checked;
  95.  
  96. /* The time to pause between checks */
  97. int             sleeptime;
  98.  
  99. /* The requested nice value to run at */
  100. int             nicevalue;
  101.  
  102. /* Where to send the messages */
  103. char            error_display_name[PATH_MAX];   /* Usually /dev/console */
  104. char            error_file_name[PATH_MAX];      /* Usually /usr/adm/warnings */
  105. FILE            *error_display_chan;            /* For error_display_name[] */
  106. FILE            *error_file_chan;               /* For error_file_name [] */
  107.  
  108. #ifdef QUICK
  109. #define TERMINALFILE    "/etc/auth/system/ttys"
  110. #define USERFILES       "/tcb/files/auth/"
  111. #endif
  112.  
  113. /* The global function declarations */
  114. PUBLIC void check_terminals(void);
  115. PUBLIC void check_users(void);
  116. PUBLIC void check_root(void);
  117. PUBLIC char *find_relevant_terminal(int, int, time_t);
  118. PUBLIC int  read_from_list(const struct member *, struct member *, const char *);
  119. PUBLIC int  find_in_list(const struct member *, const char *);
  120. PUBLIC int  read_config(void);
  121. PUBLIC void get_params(void);
  122. PUBLIC void update_data(void);
  123. PUBLIC char *date(time_t);
  124. PUBLIC void neaten(char *);
  125. PUBLIC void print_warning(const char *);
  126. PUBLIC int  read_list(struct member **, FILE *);
  127. PUBLIC void print_list(const struct member *);
  128. PUBLIC void free_list(struct member **);
  129.  
  130. #endif /* __BIGB_H_ */
  131.