man pages section 3: Basic Library Functions

Exit Print View

Updated: July 2014
 
 

getaccess_times (3C)

Name

getaccess_times - return the time for a service used by the specified username.

Synopsis

#include <user_attr.h>
access_times_t *getaccess_times(
const char *username, const char *
service);

Description

The getaccess_times() function returns the times for which the specified service may be used by the specified username.

The internal representation of the time values is in a access_times_t structure defined in <user_attr.h> with the following members:


typedef struct access_times {
		struct {
			int     start;
			int     end;
		} range[7];
	} access_times_t;

The caller is responsible to free the returned access_times_t structure.

Return Values

The entries in the range array correspond to the seven days of the week, beginning with Sunday. The start and end times indicate minutes since midnight. If the end time is less than the start time, then the end time applies to the following day. For days that have no valid range, both the start and end times are set to -1.

If the username has no matching entry for the service then the function returns NULL.

Usage

The access time policies are specified using the access_times keyword in user_attr(4) and prof_attr (4). The administrative interfaces are usermod(1M) , rolemod(1M) , and profiles (1). The getaccess_times () function is intended to be used to validate the policy with respect to the current time, which is retrieved via localtime(3C) . By convention, if the getaccess_times() function returns NULL, then no time restrictions apply for the service.

Attributes

See attributes(5) for description of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
MT-Level
MT-Safe

See also

usermod(1M) , rolemod(1M) , profiles(1) , pam_unix_account(5), user_attr(4), prof_attr(4), attributes(5)