qsysetreuid()--Set Real and Effective User IDs


  Syntax
 int qsysetreuid(uid_t ruid, uid_t euid);    
  Service Program Name: QSYSETIDS

  Default Public Authority: *USE

  Threadsafe: Yes

The qsysetreuid() function sets the real and effective user IDs to the values specified by ruid and euid.

A thread with *ALLOBJ special authority can set either ID to any value.

A thread without *ALLOBJ special authority can only set the effective user ID if the euid argument is equal to the real, effective, or saved user ID.

Job scoped locks with a lock state of *SHRRD are held on the user profiles associated with the real user ID, effective user ID, saved user ID, real group ID, effective group ID, saved group ID, and all of the supplemental groups.


Parameters

real uid
(Input) User ID.

This field must contain one of the following values:

0 to 4294967294
The user ID value for the set operation.
4294967295
The real user ID does not change. This value is the same as X'FFFFFFFF' or -1 in languages that do not support unsigned integers.

effective uid
(Input) User ID.

This field must contain one of the following values:

0 to 4294967294
The user ID value for the set operation.
4294967295
The effective user ID does not change. This value is the same as X'FFFFFFFF' or -1 in languages that do not support unsigned integers.

Authorities and Locks

*ALLOBJ special authority
*ALLOBJ special authority is required to change the real user ID. *ALLOBJ special authorty is required to change the effective user ID if the euid is not equal to the real, effective, or saved user ID.
User profile associated with euid lock
*SHRRD
User profile associated with ruid lock
*SHRRD

Return Value

0
qsysetreuid() was successful.
-1
qsysetreuid() was not successful. The errno variable is set to indicate the error.

Error Conditions

If qsysetreuid() is not successful, errno indicates one of the following errors.

Error condition Additional information
[EAGAIN]

User profile associated with ruid or euid is locked. Try again.

[EDAMAGE]

The user profile associated with ruid or euid or an internal system object is damaged.

[EINVAL]

The value of the ruid or euid argument is not valid. Following are possible reasons:

  • Out of range.
  • Not associated with a user profile.
[ENOTSUP]

Operation not supported. The user profile associated with this uid specifies OWNER(*GRPPRF), but the user profile's first group is not the current effective group, nor is it in the list of supplemental groups.

[EPERM]

Operation not permitted. The current thread does not have *ALLOBJ special authority, and either an attempt was made to change the effective user ID to a value other than the real user ID or the saved set-user-ID or an an attempt was made to change the real user ID.

[EUNKNOWN]

An unknown error has occurred. Check the joblog for error messages.



API introduced: V4R5
Top | UNIX-Type APIs | APIs by category