ARPA2 Common Libraries  2.6.2
Functions
Collaboration diagram for Access Functions:

Functions

bool access_parse (char *userstr, access_rights *accumulator)
 Parse a string of Access Rights flags. More...
 
void access_format (const char *opt_fmtstr, access_rights rights, char *outstr)
 Format Access Rights flags to a string. More...
 
static void access_init (void)
 Initialise the ARPA2 Access system. More...
 
static void access_fini (void)
 Finalise the ARPA2 Access system. More...
 
const char * access_host2domain (const char *fqdn_hostname)
 Lookup the realm for a fully qualified host name. More...
 

Detailed Description

Access defines some general functions.

Function Documentation

◆ access_fini()

static void access_fini ( void  )
inlinestatic

Finalise the ARPA2 Access system.

This may do cleanup operations.

◆ access_format()

void access_format ( const char *  opt_fmtstr,
access_rights  rights,
char *  outstr 
)

Format Access Rights flags to a string.

This prints to outstr the characters of opt_fmtstr if provided, or otherwise up to 26 characters for a trailing NUL character. The buffer to hold outstr must be large enough.

This function does not fail.

Parameters
[in]opt_fmtstrholds uppercase letters and any other content that should appear in the outstr. Uppercase characters are skipped when the corresponding flag in rights is clear. Other characters are always added. When this parameter is NULL, all the flags are tried in alphabetic order, but no '' or other character is prefixed.
[in]rightsholds the access rights to filter which uppercase characters from the opt_fmtstr are added to the outstr.
[out]outstris a buffer for the formatted output, and it must be large enough to hold the resulting string and a trailing NUL. This means that it should be at least one character longer than the string length of opt_fmtstr or, if that is absent, a buffer size of 27.

◆ access_host2domain()

const char* access_host2domain ( const char *  fqdn_hostname)

Lookup the realm for a fully qualified host name.

The realm is often a trailer of the hostname, though local conventions may differ; a domain may be used as a hostname, and shared servers may not even show overlap with the domain. The mechanisms for determining this may involve DNS records (with DNSSEC security) or a configuration database, or merely a textual mapping.

This function is used by protocols that communicate host names instead of domain names. A typical example is HTTP. On such systems, aliases must not interfere with the specified host names; the best chance for that is to not lookup the client-sent host name, but the configured canonical host name (web servers tend to have a canonical ServerName and additionally allow ServerAlias names that are also recognised as Host: header).

This function returns NULL if no realm could be found for the supplied host name.

◆ access_init()

static void access_init ( void  )
inlinestatic

Initialise the ARPA2 Access system.

This has a mirror image for cleaup in access_fini().

◆ access_parse()

bool access_parse ( char *  userstr,
access_rights accumulator 
)

Parse a string of Access Rights flags.

Flags are uppercase letters, and assigned or set and cleared in the accumulator, depending on characters in the string. The parser can handle user input safely, returning an error and making no changes in case of syntax problems.

Parameters
[in]flagstris the string of flags. It consists of uppercase flag characters, prefixed with instructions to set flags after '+', to clear flags after '-' or to start from zero after '='. The character '' is not required but will be silently ignored. Instructions are processed in their order of appearance and the default mode is '+', so you "RW-CD" is a legal string.
[in,out]accumulatorcollects the flags, and must be initialised before starting, to be safe in situations where the flagstr contains no '=' instruction.
Returns
This function returns false with a com_err in errno in case of problems. In case of success, it returns true.