home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / comm / amitcp-3.0ß2.lha / AmiTCP / netinclude / libraries / usergroup.h
C/C++ Source or Header  |  1994-05-16  |  2KB  |  85 lines

  1. #ifndef LIBRARIES_USERGROUP_H
  2. #define LIBRARIES_USERGROUP_H
  3. /*
  4. **      $Filename: libraries/usergroup.h $
  5. **    $Release$
  6. **      $Revision: 4.1 $
  7. **      $Date: 1994/05/16 14:09:07 $
  8. **
  9. **    Definitions of AmiTCP/IP usergroup.library for 32 bit C compilers
  10. **
  11. **    Copyright © 1993 AmiTCP/IP Group, <AmiTCP-Group@hut.fi>
  12. **                  Helsinki University of Technology, Finland.
  13. **                  All rights reserved.
  14. */
  15.  
  16. #ifndef EXEC_TYPES_H
  17. #include <exec/types.h>
  18. #endif
  19.  
  20. #ifndef PWD_H
  21. #include <pwd.h>
  22. #endif 
  23. #ifndef GRP_H
  24. #include <grp.h>
  25. #endif
  26. #ifndef UTMP_H
  27. #include <utmp.h>
  28. #endif
  29.  
  30. #ifndef _PID_T
  31. #define _PID_T struct Task *
  32. typedef    _PID_T pid_t;            /* process id */
  33. #endif
  34. #ifndef _MODE_T
  35. #define _MODE_T unsigned short
  36. typedef _MODE_T mode_t;
  37. #endif
  38.  
  39. #define USERGROUPNAME "AmiTCP:libs/usergroup.library"
  40.  
  41. /* Extended password encryption begins with underscore */
  42. #define _PASSWORD_EFMT1 '_'
  43.  
  44. /* Maximum length for password */
  45. #define _PASSWORD_LEN   128
  46.  
  47. /* A user can belong to NGROUPS different groups */
  48. #define NGROUPS 32
  49.  
  50. /* Max length of a login name */
  51. #define MAXLOGNAME      32
  52.  
  53. /* Credentials of a process */
  54. struct UserGroupCredentials {
  55.   uid_t   cr_ruid;
  56.   gid_t   cr_rgid;
  57.   mode_t  cr_umask;        /* umask */
  58.   uid_t   cr_euid;
  59.   short   cr_ngroups;        /* number of groups */
  60.   gid_t   cr_groups[NGROUPS];
  61.   pid_t   cr_session;
  62.   char    cr_login[MAXLOGNAME]; /* setlogin() name */
  63. };
  64.  
  65. /*
  66.  * ID conversion macros
  67.  */
  68. #define UG2MU(id) ((id) == 0 ? 65535 : (id) == -2 ? 0 : (id))
  69. #define MU2UG(id) ((id) == 65535 ? 0L : (id) == 0L ? -2L : (id))
  70.  
  71. /*
  72.  * Context tags
  73.  */
  74. #define UGT_ERRNOBPTR 0x80000001
  75. #define UGT_ERRNOWPTR 0x80000002
  76. #define UGT_ERRNOLPTR 0x80000004
  77. #define UGT_ERRNOPTR(size)\
  78.   ((size == 4) ? UGT_ERRNOLPTR :\
  79.    (size == 2) ? UGT_ERRNOWPTR :\
  80.    (size == 1) ? UGT_ERRNOBPTR : 1L)
  81. #define UGT_OWNER     0x80000011
  82. #define UGT_INTRMASK  0x80000010
  83.  
  84. #endif /* LIBRARIES_USERGROUP_H */
  85.