PreviousNext

sec_login_get_pwent(3sec)

Returns a passwd-style entry for a login context

Synopsis

#include <dce/sec_login.h>

void sec_login_get_pwent(
sec_login_handle_t login_context,
sec_login_passwd_t *
pwent,
error_status_t *
status);

Parameters

Input

login_context
An opaque handle to login context data. The login context contains, among other data, the account principal name and UUID, account restrictions, records of group membership, and the process home directory. (See sec_intro(3sec) for more details about the login context.)

Output

pwent
A pointer to a pointer to the returned passwd-style structure. The particular structure depends on the underlying system. For example, on a system with a passwd structure like that supported by 4.4BSD and OSF/1, the structure (found in /usr/include/pwd.h) is:

struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* encrypted password */
int pw_uid; /* user uid */
int pw_gid; /* user gid */
time_t pw_change; /* password change time */
char *pw_class; /* user access class */
char *pw_gecos; /* miscellaneous account info */
char *pw_dir; /* home directory */
char *pw_shell; /* default shell */
time_t pw_expire; /* account expiration */ };

status
A pointer to the completion status. On successful completion, the routine returns one of the following status codes:

error_status_ok indicates that the login context has been validated and certified.

sec_login_s_not_certified indicates that the login context has been validated, but not certified. Although this code indicates successful completion, it warns you that the context is not validated.

If the call does not complete successfully, it returns an error.

Description
The sec_login_get_pwent( ) routine creates a passwd-style structure for the current network login context. This is generally useful for establishing the local operating system context. Applications that require all of the data normally extracted via getpwnam( ) should extract that data from the login context with this call.

This routine works only on explicitly created (not inherited or imported) contexts.

Cautions
The returned sec_login_passwd_t structure points to data stored in the structure indicated by the login_context pointer and must be treated as read-only data. Writing to these data objects may cause unexpected failures.

Files

/usr/include/dce/sec_login.idl
The idl file from which dce/sec_login.h was derived.

Examples
The following example illustrates use of the sec_login_get_pwent( ) routine:

#include <pwd.h>
...
struct passwd *pwd;
...
sec_login_get_pwent(login_context,(sec_login_passwd_t*)&pwd, &status);
...
printf ("%s",pwd->pw_name);

Errors

The following describes a partial list of errors that might be returned. Refer to the OSF DCE Problem Determination Guide for complete descriptions of all error messages.

sec_login_s_context_invalid
The login context itself is invalid.

sec_login_s_not_certified
The login context has not been certified.

sec_login_s_default_use
Illegal use of the default login handle occurred.

sec_login_s_info_not_avail
The login context has no UNIX information.

sec_rgy_object_not_found
The registry server could not find the specified login context data.

sec_rgy_server_unavailable
The DCE Registry Server is unavailable.

error_status_ok
The call was successful.

Related Information
Functions: sec_intro(3sec)