home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / 3COMM.ZIP / H.ZIP / ACCESS.H next >
C/C++ Source or Header  |  1989-05-17  |  8KB  |  298 lines

  1. /********************************************************************/
  2. /**                   Microsoft OS/2 LAN Manager                   **/
  3. /**            Copyright(c) Microsoft Corp., 1987, 1988            **/
  4. /********************************************************************/
  5.  
  6. /********************************************************************
  7.  *                                    *
  8.  *  About this file ...  ACCESS.H                    *
  9.  *                                    *
  10.  *  This file contains information about the NetUser, NetGroup, and *
  11.  *  NetAccess APIs.  There is a section for each set of APIs.  Each *
  12.  *  section contains:                            *
  13.  *                                    *
  14.  *    Function prototypes.                        *
  15.  *                                    *
  16.  *    Data structure templates.                    *
  17.  *                                    *
  18.  *    Definition of special values.                    *
  19.  *                                    *
  20.  *                                    *
  21.  *  NOTE:  You must include NETCONS.H before this file, since this  *
  22.  *       file    depends on values defined in NETCONS.H.            *
  23.  *                                    *
  24.  ********************************************************************/
  25.  
  26.  
  27. /**************************************************************** 
  28.  *                                *
  29.  *          Function prototypes - USER            *
  30.  *                                *
  31.  ****************************************************************/
  32.  
  33.  
  34. extern API_FUNCTION 
  35.   NetUserEnum( const char far *, short, char far *, unsigned short,
  36.          unsigned short far *, unsigned short far *);
  37.  
  38. extern API_FUNCTION 
  39.   NetUserAdd(const char far *, short, char far *, unsigned short);
  40.  
  41. extern API_FUNCTION 
  42.   NetUserDel( const char far *, char far *);
  43.  
  44. extern API_FUNCTION 
  45.   NetUserGetInfo( const char far *, char far *, short, char far *, unsigned short,
  46.     unsigned short far *);
  47.  
  48. extern API_FUNCTION 
  49.   NetUserSetInfo( const char far *, char far *,short, char far *, unsigned short,
  50.           short);
  51.  
  52. extern API_FUNCTION 
  53.   NetUserPasswordSet( const char far *, char far *, char far *, char far *);
  54.  
  55. extern API_FUNCTION
  56.   NetUserValidate( char far *, char far *, char far *, unsigned short far *);
  57.  
  58. extern API_FUNCTION 
  59.   NetUserGetGroups( const char far *, const char far *, short, char far *, 
  60.          unsigned short , unsigned short far *, unsigned short far *);
  61.  
  62.  
  63. /**************************************************************** 
  64.  *                                *
  65.  *          Data structure templates - USER            *
  66.  *                                *
  67.  ****************************************************************/
  68.  
  69.  
  70. struct user_info_0 {
  71.     char usri0_name[UNLEN+1];
  72. };
  73.  
  74. struct user_info_1 {
  75.     char usri1_name[UNLEN+1];
  76.     char usri1_pad_1;
  77.     char usri1_password[ENCRYPTED_PWLEN];    /* See note below */
  78.     long usri1_password_age;
  79.     unsigned short usri1_priv;            /* See values below */
  80.     char far *usri1_home_dir;
  81.     char far *usri1_comment;
  82.     unsigned short usri1_flags;            /* See values below */
  83.     char far *usri1_script_path;
  84. };
  85.  
  86. /*
  87.  *    NOTE:  The maximum length of a user password is PWLEN.  The
  88.  *    field usri1_password contains extra room for transporting
  89.  *    the encrypted form of the password over the network.  When
  90.  *    setting the user's password, check length vs. PWLEN, not
  91.  *    the size of this field.  PWLEN is defined in NETCONS.H.
  92.  */
  93.  
  94.  
  95. /**************************************************************** 
  96.  *                                *
  97.  *          Special values and constants - USER        *
  98.  *                                *
  99.  ****************************************************************/
  100.  
  101.  
  102. /*  
  103.  *    Bit masks for field usri1_flags of user_info_1.
  104.  */
  105.  
  106. #define    UF_SCRIPT        1
  107. #define UF_ACCOUNTDISABLE    2
  108.  
  109. /*
  110.  *    Values for parmnum for NetUseSetInfo.
  111.  */
  112.  
  113. #define U1_ALL            0
  114. #define U1_NAME            1
  115. #define U1_PAD            2
  116. #define U1_PASSWD        3
  117. #define U1_PASSWDAGE        4
  118. #define U1_PRIV            5
  119. #define U1_DIR            6
  120. #define U1_COMMENT        7
  121. #define U1_USER_FLAGS        8
  122. #define U1_SCRIPT_PATH        9
  123.  
  124. /*
  125.  *    Privilege levels (user_info_1 field usri1_priv).
  126.  */
  127. #define USER_PRIV_GUEST        0
  128. #define USER_PRIV_USER        1
  129. #define USER_PRIV_ADMIN        2
  130.  
  131.  
  132. /**************************************************************** 
  133.  *                                *
  134.  *          Function prototypes - GROUP            *
  135.  *                                *
  136.  ****************************************************************/
  137.  
  138.  
  139. extern API_FUNCTION 
  140.   NetGroupEnum( const char far *, short, char far *, unsigned short,
  141.          unsigned short far *, unsigned short far *);
  142.  
  143. extern API_FUNCTION 
  144.   NetGroupAdd( const char far *, short,char far *, unsigned short);
  145.  
  146. extern API_FUNCTION 
  147.   NetGroupDel( const char far *, char far *);
  148.  
  149. extern API_FUNCTION 
  150.   NetGroupAddUser( const char far *, char far *, char far *);
  151.  
  152. extern API_FUNCTION 
  153.   NetGroupDelUser( const char far *, char far *, char far *);
  154.  
  155. extern API_FUNCTION 
  156.   NetGroupGetUsers( const char far *, const char far *, short, char far *, 
  157.          unsigned short, unsigned short far *, unsigned short far *);
  158.  
  159.  
  160.  
  161. /**************************************************************** 
  162.  *                                *
  163.  *          Data structure templates - GROUP        *
  164.  *                                *
  165.  ****************************************************************/
  166.  
  167.  
  168. struct group_info_0 {
  169.     char grpi0_name[GNLEN+1];
  170. };
  171.  
  172.  
  173. struct group_users_info_0 {
  174.     char grui0_name[UNLEN+1];
  175. };
  176.  
  177.  
  178. /**************************************************************** 
  179.  *                                *
  180.  *          Special values and constants - GROUP        *
  181.  *                                *
  182.  ****************************************************************/
  183.  
  184. /*
  185.  *     Predefined group for all normal users and administrators
  186.  *    (non-guests).
  187.  */
  188.  
  189. #define GROUP_SPECIALGRP_USERS    "USERS"
  190.  
  191.  
  192.  
  193. /**************************************************************** 
  194.  *                                *
  195.  *          Function prototypes - ACCESS            *
  196.  *                                *
  197.  ****************************************************************/
  198.  
  199.  
  200. extern API_FUNCTION
  201.   NetAccessEnum ( const char far *,char far *, short,short, char far *,
  202.     unsigned short, unsigned short far *, unsigned short far * );
  203.  
  204. extern API_FUNCTION
  205.   NetAccessGetInfo ( const char far *, char far *, short, char far *, unsigned short,
  206.              unsigned short far * );
  207.  
  208.  
  209. extern API_FUNCTION
  210.   NetAccessSetInfo ( const char far *, char far *,short,char far *,unsigned short,
  211.         short );
  212.  
  213. extern API_FUNCTION
  214.   NetAccessAdd ( const char far *, short, char far *, unsigned short);
  215.  
  216. extern API_FUNCTION
  217.   NetAccessDel ( const char far *, char far * );
  218.  
  219. extern API_FUNCTION
  220.   NetAccessCheck( char far *, char far *, char far *, unsigned short,
  221.         unsigned short far *);
  222.  
  223.  
  224. /**************************************************************** 
  225.  *                                *
  226.  *          Data structure templates - ACCESS        *
  227.  *                                *
  228.  ****************************************************************/
  229.  
  230. struct access_list {
  231.     char   acl_ugname[UNLEN+1];
  232.     char   acl_ugname_pad_1;
  233.     short  acl_access;
  234. };
  235.  
  236. struct access_info_0 {
  237.     char far * acc0_resource_name;
  238. };
  239.  
  240. struct access_info_1 {
  241.     char  far * acc1_resource_name;
  242.     short acc1_attr;               /* See values below */
  243.     short acc1_count;
  244. };
  245.  
  246. /**************************************************************** 
  247.  *                                *
  248.  *          Special values and constants - ACCESS        *
  249.  *                                *
  250.  ****************************************************************/
  251.  
  252. /*
  253.  *    Maximum number of permission entries for each resource.
  254.  */
  255.  
  256. #define MAXPERMENTRIES  64
  257.  
  258.  
  259. /*
  260.  *    Bit values for the access permissions.  ACCESS_ALL is a handy
  261.  *    way to specify maximum permissions.  These are used in
  262.  *    acl_access field of access_list structures.
  263.  */
  264.  
  265. #define ACCESS_ALL     (ACCESS_READ|ACCESS_WRITE|ACCESS_CREATE|ACCESS_EXEC|ACCESS_DELETE|ACCESS_ATRIB|ACCESS_PERM)
  266.  
  267. #define ACCESS_READ   0x1
  268. #define ACCESS_WRITE  0x2
  269. #define ACCESS_CREATE 0x4
  270. #define ACCESS_EXEC   0x8
  271. #define ACCESS_DELETE 0x10
  272. #define ACCESS_ATRIB  0x20
  273. #define ACCESS_PERM   0x40
  274.  
  275. #define ACCESS_GROUP  0x8000
  276.  
  277. /*
  278.  *    Bit values for access_info_1 acf1_attr field.  Only one
  279.  *    bit is currently defined.
  280.  */
  281.  
  282. #define ACCESS_AUDIT    0x1
  283.  
  284. /*
  285.  *    Parmnum value for NetAccessSetInfo.
  286.  */
  287.  
  288. #define ACCESS_ATTR_PARMNUM     2
  289.  
  290.  
  291. /*
  292.  *    ACCESS_LETTERS defines a letter for each bit position in
  293.  *    the acl_access field of struct access_list.  Note that some
  294.  *    bits have a corresponding letter of ' ' (space).
  295.  */
  296.  
  297. #define ACCESS_LETTERS "RWCXDAP         " 
  298.