CD_IDMAP Domain/OS CD_IDMAP
NAME
cd_idmap - set and get mappings of User/Group IDs
SYNTAX
#include <sys/cdrom.h>
int cd_idmap(path, cmd, idmap, nmaps)
char *path;
int cmd;
struct cd_idmap idmap[];
int *nmaps;
DESCRIPTION
This function sets or gets (based upon cmd) the mapping of User or Group
IDs for the mounted CD-ROM. The argument path points to a mount-point of
a CD-ROM file system.
If cmd is either CD_SETUMAP or CD_SETGMAP, it uses the idmap array of
mappings to map User or Group IDs. The argument nmaps indicates the
number of mappings in the array. Any mapping or value set with a previous
invocation of cd_idmap is overridden. When nmaps is zero, none of the
previously set mappings will stay in effect.
If cmd is either CD_GETUMAP or CD_GETGMAP, it fills the array of mappings
of User or Group IDs with the current mappings. On call, nmaps must
contain the maximum number of mappings that may be returned. On return,
nmaps will contain the number of mappings that are returned.
The declaration for truct cd_idmap and the definitions for
CD_SETUMAP/CD_SETGMAP and CD_GETUMAP/CD_GETGMAP are contained in
<sys/cdrom.h>.
RETURN VALUE
Upon successful completion, cd_idmap returns a value of zero. In case of
an error, -1 is returned and errno is set to indicate the error.
ERRORS
The cd_idmap function will fail if one or more of the following is true:
[EACCESS]
Search permission is denied for a component of the path
prefix. Read permission is denied on the mount-point.
[ENAMETOOLONG]
The length of the path string exceeds {PATH_MAX} or a
pathname component is longer than {NAME_MAX} while
{_POSIX_NO_TRUNC} is in effect.
[ENOENT]
A component of path does not exist or the path
argument points to an empty string.
[EINVAL]
The value of cmd or nmaps is invalid.
A member of the cd_idmap structure is invalid: either from_id
is 0 or larger than 65535 or a value in to_uid or to_gid
is not supported by the system. Note that this error will not
be given when from_id doesn't exist on the CD-ROM, or
when to_uid is not defined in the User Database or
to_gid is not defined in the Group Database.
The argument path points to a file/directory not within
a CD-ROM file hierarchy.
[ENOTDIR]
A component of the path prefix is not a directory.
[EFAULT]
The address of cd_idmap or path is invalid.
[EPERM]
User does not have appropriate privileges in case of
setting values.
[EINTR]
A signal was caught during the cd_idmap() function.
[EMFILE]
{OPEN_MAX} file descriptors are currently open in the
calling process.
[ENFILE]
The system file table is full.
APPLICATION USAGE
The setting of values is restricted to a user with appropriate
privileges. Files and directories with default IDs (no final XAR or a
restricted final XAR) are not subject to this mapping. Since an owner and
group identification of zero (in case of a restricted final XAR)
indicates that there is no owner and group specified, the default IDs are
applied and therefore a mapping of the ID zero is not possible. Use
cd_defs() to change the default values. In case of set mappings this
function is intended to be used only directly after the CD-ROM has been
mounted, and before any access to the CD-ROM is done. If the function is
applied for setting mappings when files or directories have already been
opened the effect of this function on these files and directories is
undefined.
NOTES
The Domain implementation of the CD file system currently ignores
protections and Group and User IDs.