AddTrustee

Adds a trustee to a directory’s or file’s trustee list

Local Servers:blocking
Remote Servers:blocking
Classification:3.x, 4.x, 5.x, 6.x
SMP Aware:No
Service:File System

Syntax

   #include <nwdir.h> 
    
    int AddTrustee  (  
      char   *pathName, 
       LONG   trusteeObjectID, 
       WORD   trusteeRightsMask);
   

Parameters

pathName

(IN) Specifies the string containing the path specification (maximum 255 characters, including the NULL terminator).

trusteeObjectID

(IN) Specifies the unique object ID of the trustee, in reverse order.

trusteeRightsMask

(IN) Specifies the trustee rights to assign to the directory or file.

Return Values

0x00

ESUCCESS

0x8C

ERR_NO_MODIFY_PRIVILEGES

0xFC

ERR_NO_SUCH_BINDERY_OBJECT

Remarks

This function adds a trustee to a directory’s or file’s trustee list by passing the trustee’s object ID and an associated trustee rights mask. (Trustees can be set for files in NetWare 3.x and 4.x, unlike NetWare 2.x.) The application can obtain an object’s ID and the user’s object ID number by using the Directory Services function NWDSMapNameToID .

This function specifies the directory or file by passing a pathname. The pathName parameter can identify an absolute or relative directory or file path. An absolute path includes a volume. Examples of absolute pathnames would be:

volume:directory\...\directory\filename

volume:filename

 

volume:

(equivalent to volume:\)

Applications can use a relative file path to specify a directory or file. The relative path, combined with the CWD specifies an absolute file path. For example, if the CWD points to SYS:\ and the specified pathname is PUBLIC\WORDP or PUBLIC\WORDP\ABC.TXT, then in the former case, the resulting directory is SYS:PUBLIC\WORDP and in the latter case, SYS:PUBLIC\WORDP\ABC.TXT.

AddTrustee expects the trustee ID in reverse order (0010000e = e0000100) to perform properly.

The trusteeRightsMask parameter specifies a user’s trustee rights. The bits in a trustee rights mask are defined as follows:

The following constants have been defined for each right which can be ORed (|) together for a complete specification: TA_READ, TA_WRITE, TA_CREATE, TA_DELETE, TA_ACCESSCONTROL, TA_SEEFILES, TA_MODIFY, TA_SUPERVISOR.

For versions of NetWare previous to 3.0, the trustee rights appear in a 1-byte format as follows:

Given the following path, where component1 through componentn-1 are directories, and componentn is either a file or directory:

   volume:component1\component2\...\componentn
   

An object’s effective rights to a file or in a directory can be determined, using the following algorithm:

  • Initialize an object’s effective rights to whatever rights are granted to the current connection in the root of the specified volume.

  • For each component (component1 through componentn), the effective rights are intersected (ANDed) with the component’s inherited rights mask.

  • If the current connection is granted any rights (is a trustee) in the component, then the effective ights are ORed (|) together with the rights granted to the current connection in the component.

To be added as a trustee, a user must exist as an object. The rights mask of a new trustee is made equal to trusteeRightsMask . If the user is already a trustee in the specified directory or file, the existing rights mask for the trustee is replaced by the trusteeRightsMask .

The current connection must have access control rights to the directory or file whose trustee list is being manipulated.

SetCurrentNameSpace sets the name space which is used for parsing the path input to this function.

NOTE:For NetWare versions before 4.x, this function only works with DOS name space for remote servers.

See Also

DeleteTrustee, NWDSMapNameToID (NDK: Novell eDirectory Core Services)