saf-esm.c File Reference


Detailed Description

ES ESF Manager ESM Module Loader and Interface and ESM Module API.

The ESF Manager employs plug-ins called ESM Modules to make the actual security decisions. ESM Modules (presumably) communicate with External Security Managers, which might be directories or other repositories of security rules (LDAP, SQL, etc), or OS security facilities, or third-party security managers.

This module is responsible for loading and configuring the ESM Modules. It also provides the interface between ESF Manager and the ESM Modules, which consists of a series of callbacks supplied by each module at load time; and the API that ESF Manager provides to ESM Modules for various useful functions.

Definition in file saf-esm.c.

Go to the source code of this file.

Defines

#define SafINTERNAL   static
#define SafESM_PATHMAX   1024

Functions

SafINTERNAL mf_uns32 EsmLog (mf_uns32 Number, mf_uns32 Level, const char *Text, mf_uns32 Length, void *Reserved)
 Log a message to the calling environment's log facility.
SafINTERNAL mf_uns32 EsmGetAcee (const char *Name, const char *Group, struct SafACEE **AceePtr, mf_uns32 *Info, void *Reserved)
 Locate an ACEE, or create it if it does not exist.
SafINTERNAL mf_uns32 EsmGetSharedMem (const char *Name, mf_uns32 *SizePtr, void **MemPtr, void *Reserved)
 Locate or allocate named shared memory.
SafINTERNAL mf_uns32 EsmLockEnq (const char *QName, const char *RName, mf_uns32 RNameLen, void *Reserved)
 Allocate a named lock (enqueue).
SafINTERNAL mf_uns32 EsmLockDeq (const char *QName, const char *RName, mf_uns32 RNameLen, void *Reserved)
 Release a named lock (dequeue).
SafINTERNAL mf_uns32 EsmGetSafInit (struct SafInit **InitPtr, void *Reserved)
 Retrieve the ESF Manager initialization block.
SafINTERNAL mf_uns32 EsmExtractVerifyStrings (struct safpb_parameter_block *Request, char *UserBuf, mf_uns32 UserMax, char *PassBuf, mf_uns32 PassMax, char *NPassBuf, mf_uns32 NPassMax, char *GroupBuf, mf_uns32 GroupMax, void *Reserved)
 Extract the variable-length string data from a Verify request.
SafINTERNAL mf_uns32 EsmExtractAuthStrings (struct safpb_parameter_block *Request, char *ClassBuf, mf_uns32 ClassMax, char *EntityBuf, mf_uns32 EntityMax, char *FacilityBuf, mf_uns32 FacilityMax, char *TransBuf, mf_uns32 TransMax, void *Reserved)
 Extract the variable-length string data from an Auth request.
SafINTERNAL mf_uns32 EsmExtractXAuthStrings (struct safpb_parameter_block *Request, char *ClassBuf, mf_uns32 ClassMax, char *EntityBuf, mf_uns32 EntityMax, char *String1Buf, mf_uns32 String1Max, char *String2Buf, mf_uns32 String2Max, void *Reserved)
 Extract the variable-length string data from an XAuth request.
SafINTERNAL mf_uns32 EsmSafQuery (mf_uns32 Type, void *Result, mf_uns32 ResSize, void *Reserved)
 Query ESF Manager for various settings and state information.
SafINTERNAL mf_uns32 EsmParseConfig (const char *Text, struct SafStore **Result, void *Reserved)
 Parse structured ESM Module configuration text.
SafINTERNAL mf_uns32 EsmQueryConfig (struct SafStore *Config, const char *Class, const char *Name, char **Value, void *Reserved)
 Query a parsed configuration.
SafINTERNAL mf_uns32 EsmFreeConfig (struct SafStore *Config, void *Reserved)
 Free a parsed configuration.
SafINTERNAL mf_uns32 EsmAceeIterate (void *Data, int(*Callback)(struct SafACEE *, void *), void *Reserved)
 Iterate over ACEEs.
mf_uns32 SafEsmInit (struct SafInit *Init)
 ESF ESM Module Loading and Initialization.
mf_uns32 SafEsmExit (void)
 Inform ESM Modules of Process Exit.
mf_uns32 SafEsmUnload (void)
 Unload ESM Modules.
const char * SafEsmName (mf_uns32 Index)
 Provide the Name of an ESM Module (For Logging).
mf_uns32 SafEsmCVerify (mf_uns32 EsmIdx, struct safpb_parameter_block *PBlock)
 Call an ESM Module's Verify Procedure.
mf_uns32 SafEsmCAuth (mf_uns32 EsmIdx, struct safpb_parameter_block *PBlock)
 Call an ESM Module's Auth Procedure.
mf_uns32 SafEsmCXAuth (mf_uns32 EsmIdx, struct safpb_parameter_block *PBlock)
 Call an ESM Module's XAuth Procedure.
mf_uns32 SafEsmCAdmin (mf_uns32 EsmIdx, struct safpb_parameter_block *PBlock)
 Call an ESM Module's Admin Procedure.
mf_uns32 SafEsmCUpdate (mf_s32 Type, mf_uns32 EsmIdx, struct safpb_parameter_block *PBlock)
 Call an ESM Module's Update Procedure.


Function Documentation

SafINTERNAL mf_uns32 EsmLog ( mf_uns32  Number,
mf_uns32  Level,
const char *  Text,
mf_uns32  Length,
void *  Reserved 
)

Log a message to the calling environment's log facility.

An ESM Module can use this function to write an arbitrary message to the calling environment's log facility. (In the CAS environment, the log facility is the CAS console log; in the MFDS environment, it's the MFDS journal.)

Note that ESF Manager will not do any formatting or translation of the message text proper. It prefixes it with the environment-specific message prefix, the number, and the severity-level character, then passes it otherwise unchanged to the environment-specific logging function.

The Number parameter is passed to the logging function and must be in the allowed range of 0-9999. Typically ESM Modules should choose numbers in the user-defined message range of 9000-9999. See ESF Manager Messages and Logging for more information on ESF message numbers.

The Level parameter indicates the message severity level:
0 Informational
4 Warning
8 Error

Parameters:
[in] Number Message number; see ESF Manager Messages and Logging
[in] Level Message severity; see above
[in] Text Message text
[in] Length Message length
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 880 of file saf-esm.c.

References SafLogLit(), SafMsgERR, SafMsgINFO, and SafMsgWARN.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmGetAcee ( const char *  Name,
const char *  Group,
struct SafACEE **  AceePtr,
mf_uns32 *  Info,
void *  Reserved 
)

Locate an ACEE, or create it if it does not exist.

ESM Modules that need to modify the ACEE entry for a user or attach their own data to it should call this routine after they successfully verify the user's credentials in their Verify procedure.

The ACEE is a pointer to a SafACEE structure.

If an ESM Module verifies a user but does not call this routine to create an ACEE, ESF Manager will create the ACEE and initialize it to default values.

Parameters:
[in] Name The username. This must point to a buffer containing a name of no more than 8 ASCII characters, terminated with a nul or space character.
[in] Group Optional group name. If no group name is specified, the ACEE is created using the default group. If supplied, this must point to a buffer containing a name of no more than 8 ASCII characters, terminated with a nul or space character.
[out] AceePtr The returned pointer to the ACEE
[out] Info Optional additional information. Currently this will be set to 0 if the ACEE was created by this request, and 4 if an already-created ACEE was retrieved.
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 951 of file saf-esm.c.

References SafAceeAlloc().

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmGetSharedMem ( const char *  Name,
mf_uns32 *  SizePtr,
void **  MemPtr,
void *  Reserved 
)

Locate or allocate named shared memory.

Attach to an existing named memory area, or create it if it does not already exist. The area will be available to all ESF Manager and ESM Module instances in the current environment. Note that it may not actually be in OS shared memory. The memory is initialized to low-values if it is acquired new.

Parameters:
[in] Name Name of the area being opened. The name is terminated by the first space or nul character, and may be up to 255 bytes long.
[in,out] SizePtr Size of the area to create, if it does not already exist; actual size on return, if it does already exist.
[out] MemPtr Returns a pointer to the area.
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 1072 of file saf-esm.c.

References SafShmOpen().

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmLockEnq ( const char *  QName,
const char *  RName,
mf_uns32  RNameLen,
void *  Reserved 
)

Allocate a named lock (enqueue).

Allocate (aka enqueue, reserve, lock) a named lock object (aka mutex). This API is provided for ESM Modules that need to synchronize access to a shared resource, such as named shared memory. It currently only supports blocking lock requests with exclusive locking.

Lock objects have two-part names: a "queue name" (qname) of up to 8 characters, and a "resource name" (rname) of up to 255 characters. ASCII letters, numbers, and punctuation marks may be used in names; the resource name may include spaces.

Some names are used internally by ES. In particular, ESM Modules should not use any names beginning with SYS or # except as specifically recommended by Micro Focus.

Parameters:
[in] QName Queue name of the lock object. The name is terminated by the first space or nul character, and may be up to 8 bytes long.
[in] RName Resource name of the lock object
[in] RNameLen Resource name length
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. See SafLockRet.

Definition at line 1128 of file saf-esm.c.

References SafESM_LCK_EXCL, SafESM_LCK_NONE, SafESM_LCK_UOW, SafLockEnq(), and SafLockPARAM.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmLockDeq ( const char *  QName,
const char *  RName,
mf_uns32  RNameLen,
void *  Reserved 
)

Release a named lock (dequeue).

Release (aka dequeue, unlock) a named lock object (aka mutex). This API is provided for ESM Modules that need to synchronize access to a shared resource, such as named shared memory. It supports shared (read) locks and exclusive (write) locks, testing to see if a lock is held, and attempting to lock without waiting.

Lock objects have two-part names: a "queue name" (qname) of up to 8 characters, and a "resource name" (rname) of up to 255 characters. ASCII letters, numbers, and punctuation marks may be used in names; the resource name may include spaces.

Some names are used internally by ES. In particular, ESM Modules should not use any names beginning with SYS or # except as specifically recommended by Micro Focus.

Parameters:
[in] QName Queue name of the lock object. The name is terminated by the first space or nul character, and may be up to 8 bytes long.
[in] RName Resource name of the lock object
[in] RNameLen Resource name length
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. See SafLockRet.

Definition at line 1201 of file saf-esm.c.

References SafLockDeq(), and SafLockPARAM.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmGetSafInit ( struct SafInit **  InitPtr,
void *  Reserved 
)

Retrieve the ESF Manager initialization block.

This function returns a pointer to the ESF Manager initialization block, which some ESM Modules may wish to inspect for their own purposes.

Parameters:
[out] InitPtr Pointer to the ESF Manager initialization area
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 1251 of file saf-esm.c.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmExtractVerifyStrings ( struct safpb_parameter_block Request,
char *  UserBuf,
mf_uns32  UserMax,
char *  PassBuf,
mf_uns32  PassMax,
char *  NPassBuf,
mf_uns32  NPassMax,
char *  GroupBuf,
mf_uns32  GroupMax,
void *  Reserved 
)

Extract the variable-length string data from a Verify request.

The ESF API Parameter Block contains or references a number of pieces of variable-length string data. This function extracts that data as C-style nul-terminated strings, into buffers provided by the caller.

Note that the caller can determine the required buffer size for each character field from its associated length field in the parameter block, except for the Group field, which is never more than nine bytes including the nul terminator.

If any of the size parameters are zero, the function will skip the relevant area in the parameter block; in this case the assocated buffer can be null. If any of the buffers are too small to hold the assocaited string, the function will copy as many bytes as will fit, less one for the terminating nul, which is always added. If any string is truncated in this fashion, the return code will reflect that (see below).

Parameters:
[in] Request ESF API parameter block
[out] UserBuf Buffer to receive the UserID string
[in] UserMax Maximum number of bytes (including nul) to write to UserBuf
[out] PassBuf Buffer to receive the Password
[in] PassMax Maximum number of bytes to write to PassBuf
[out] NPassBuf Buffer to receive the (optional) New Password
[in] NPassMax Maximum number of bytes to write to NPassBuf
[out] GroupBuf Buffer to receive the (optional) Group
[in] GroupMax Maximum number of bytes to write to GroupBuf
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Error codes currently defined:
1
One or more strings was truncated
2
Invalid request (eg this request is not a Verify)
3
Parameter error (null Request, or null buffer with nonzero length)
Other error codes may also be returned.

Definition at line 1551 of file saf-esm.c.

References safpb_parameter_block::REQUESTS, saf78_REQUEST_VERIFY, saf78_VERSION_1, safpb_parameter_block::safpb_request, safpb_verify::safpb_verify_group, safpb_verify::safpb_verify_NEWPWRD_len, safpb_verify::safpb_verify_NEWPWRD_ptr, safpb_verify::safpb_verify_PWRD_len, safpb_verify::safpb_verify_PWRD_ptr, safpb_verify::safpb_verify_USERID_len, safpb_verify::safpb_verify_USERID_ptr, safpb_parameter_block::safpb_version, and safpb_parameter_block::VERIFY.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmExtractAuthStrings ( struct safpb_parameter_block Request,
char *  ClassBuf,
mf_uns32  ClassMax,
char *  EntityBuf,
mf_uns32  EntityMax,
char *  FacilityBuf,
mf_uns32  FacilityMax,
char *  TransBuf,
mf_uns32  TransMax,
void *  Reserved 
)

Extract the variable-length string data from an Auth request.

The ESF API Parameter Block contains or references a number of pieces of variable-length string data. This function extracts that data as C-style nul-terminated strings, into buffers provided by the caller.

Note that the caller can determine the required buffer size for each character field from its associated length field in the parameter block, except for the Group field, which is never more than nine bytes including the nul terminator.

If any of the size parameters are zero, the function will skip the relevant area in the parameter block; in this case the assocated buffer can be null. If any of the buffers are too small to hold the assocaited string, the function will copy as many bytes as will fit, less one for the terminating nul, which is always added. If any string is truncated in this fashion, the return code will reflect that (see below).

Parameters:
[in] Request ESF API parameter block
[out] ClassBuf Buffer to receive the Class string
[in] ClassMax Maximum number of bytes (including nul) to write to ClassBuf
[out] EntityBuf Buffer to receive the Entity
[in] EntityMax Maximum number of bytes to write to EntityBuf
[out] FacilityBuf Buffer to receive the (optional) Facility (terminal ID)
[in] FacilityMax Maximum number of bytes to write to FacilityBuf
[out] TransBuf Buffer to receive the (optional) Transaction
[in] TransMax Maximum number of bytes to write to TransBuf
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Error codes currently defined:
1
One or more strings was truncated
2
Invalid request (eg this request is not an Auth)
3
Parameter error (null Request, or null buffer with nonzero length)
Other error codes may also be returned.

Definition at line 1660 of file saf-esm.c.

References safpb_parameter_block::AUTH, safpb_parameter_block::REQUESTS, saf78_REQUEST_AUTH, saf78_VERSION_1, safpb_auth::safpb_auth_class, safpb_auth::safpb_auth_ENTITY_len, safpb_auth::safpb_auth_ENTITY_ptr, safpb_auth::safpb_auth_FACILITY_len, safpb_auth::safpb_auth_FACILITY_ptr, safpb_auth::safpb_auth_TRANSACTION_len, safpb_auth::safpb_auth_TRANSACTION_ptr, safpb_parameter_block::safpb_request, and safpb_parameter_block::safpb_version.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmExtractXAuthStrings ( struct safpb_parameter_block Request,
char *  ClassBuf,
mf_uns32  ClassMax,
char *  EntityBuf,
mf_uns32  EntityMax,
char *  String1Buf,
mf_uns32  String1Max,
char *  String2Buf,
mf_uns32  String2Max,
void *  Reserved 
)

Extract the variable-length string data from an XAuth request.

The ESF API Parameter Block contains or references a number of pieces of variable-length string data. This function extracts that data as C-style nul-terminated strings, into buffers provided by the caller.

Note that the caller can determine the required buffer size for each character field from its associated length field in the parameter block, except for the Group field, which is never more than nine bytes including the nul terminator.

If any of the size parameters are zero, the function will skip the relevant area in the parameter block; in this case the assocated buffer can be null. If any of the buffers are too small to hold the assocaited string, the function will copy as many bytes as will fit, less one for the terminating nul, which is always added. If any string is truncated in this fashion, the return code will reflect that (see below).

Parameters:
[in] Request ESF API parameter block
[out] ClassBuf Buffer to receive the Class string
[in] ClassMax Maximum number of bytes (including nul) to write to ClassBuf
[out] EntityBuf Buffer to receive the Entity
[in] EntityMax Maximum number of bytes to write to EntityBuf
[out] String1Buf Buffer to receive the (optional) String1
[in] String1Max Maximum number of bytes to write to String1Buf
[out] String2Buf Buffer to receive the (optional) String2
[in] String2Max Maximum number of bytes to write to String2Buf
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Error codes currently defined:
1
One or more strings was truncated
2
Invalid request (eg this request is not an XAuth)
3
Parameter error (null Request, or null buffer with nonzero length)
Other error codes may also be returned.

Definition at line 1770 of file saf-esm.c.

References safpb_parameter_block::REQUESTS, saf78_REQUEST_XAUTH, saf78_VERSION_1, safpb_parameter_block::safpb_request, safpb_parameter_block::safpb_version, safpb_xauth::safpb_xauth_CLASS_len, safpb_xauth::safpb_xauth_CLASS_ptr, safpb_xauth::safpb_xauth_ENTITY_len, safpb_xauth::safpb_xauth_ENTITY_ptr, safpb_xauth::safpb_xauth_STRING1_len, safpb_xauth::safpb_xauth_STRING1_ptr, safpb_xauth::safpb_xauth_STRING2_len, safpb_xauth::safpb_xauth_STRING2_ptr, and safpb_parameter_block::XAUTH.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmSafQuery ( mf_uns32  Type,
void *  Result,
mf_uns32  ResSize,
void *  Reserved 
)

Query ESF Manager for various settings and state information.

This function populates a caller-supplied buffer with information on a topic selected by the Type parameter.

Parameters:
[in] Type Query type; see ESF Query Types
[out] Result Area for result
[in] ResSize Length of Result buffer
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 1274 of file saf-esm.c.

References SafInit::Config, SafIsMT(), SafQUERY_ALLGRP, and SafQUERY_MT.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmParseConfig ( const char *  Text,
struct SafStore **  Result,
void *  Reserved 
)

Parse structured ESM Module configuration text.

Each ESM Module definition in MFDS has a "Configuration Information" area, sometimes referred to as the "custom configuration". This is a free- format text area. By convention, it usually contains additional configuration, specific to the ESM Module, in the "ini" format of name=value lines within sections that are labelled with [section name] lines.

This function parses that text and loads it into a "store", which is an associative array with a two-part key. Every entry has a "class", which is the name of the section in which the item appeared; a "name", which is the part before the equals sign; and a "value", which is everything after the equals sign, to the end of the line. (Leading and trailing whitespace are removed.)

After parsing, an ESM Module can use EsmQueryConfig() to retrieve the value associated with a given name within a given class.

See SafStoreLoad() for more information.

Parameters:
[in] Text Configuration text to be parsed, as a nul-terminated string
[out] Result (Opaque) handle to the store created from the data
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 1347 of file saf-esm.c.

References SafAllocStore(), SafFreeStore(), and SafStoreLoad().

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmQueryConfig ( struct SafStore *  Config,
const char *  Class,
const char *  Name,
char **  Value,
void *  Reserved 
)

Query a parsed configuration.

Retrieve the value, if any, associated with the given name and the given class in the parsed configuration.

See EsmParseConfig() for more information.

The returned value is a pointer into the data in the store. Generally the caller should not modify it, since it's shared data: any modifications will be seen by other callers in the same process. Also, overwriting the end of the value will cause undefined behavior.

Parameters:
[in] Config Parsed configuration
[in] Class Class name (nul-terminated string)
[in] Name Entry name (nul-terminated string)
[out] Value Returned value (pointer to nul-terminated string.)
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. A return value of 4 indicates that the specified Name does not appear in the specified Class. (In this case the Value parameter will also be set to NULL.)

Definition at line 1403 of file saf-esm.c.

References SafR_NOTFOUND, SafR_OK, and SafStoreFind().

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmFreeConfig ( struct SafStore *  Config,
void *  Reserved 
)

Free a parsed configuration.

Free a parsed configuration created by EsmParseConfig(). After this function has been called, the store and any values returned by queries against it are invalid and must not be used.

Parameters:
[in] Config Configuration to be freed
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 1445 of file saf-esm.c.

Referenced by SafEsmInit().

SafINTERNAL mf_uns32 EsmAceeIterate ( void *  Data,
int(*)(struct SafACEE *, void *)  Callback,
void *  Reserved 
)

Iterate over ACEEs.

ESM Modules sometimes need to find and process several, or all, ACEEs. For example, ESM Modules that handle Update requests often need to find all the ACEEs that refer to a given user or group. The EsmAceeIterate function is provided for this purpose.

EsmAceeIterate takes a function pointer (procedure-pointer in COBOL) and a data pointer. It calls the supplied function (the "callback") for every ACEE, passing in a pointer to the ACEE and the data pointer supplied by the caller.

The callback can examine the ACEE to see if it's one that it wants to process and take the appropriate action. It can use the data block supplied by the ESM Module for whatever additional parameters it needs, and/or to collect data to go back to the module.

Iteration ends when all ACEEs have been processed, or the callback returns a non-zero return code. The callback can use this to end processing if it knows it doesn't need to see any more ACEEs. By convention, callbacks return one of the SafRet return codes, usually SafR_OK (0) or SafR_END (11) if they want to stop iteration.

The ACEE is a pointer to a SafACEE structure.

Parameters:
[in] Data A pointer to any data area that the ESM Module wants to pass to its callback. Typically the module will define a structure that contains any data it needs to pass to the callback, or that it wants the callback to return to it. This parameter can be null, though, if the callback doesn't need any additional data.
[in] Callback A pointer to a function/procedure that takes a pointer to an ACEE and a pointer to arbitrary data (which will be the Data parameter described above), and returning an int.
Reserved Reserved for future use; must be null
Returns:
An integer value, zero for success, non-zero for error. By convention these are SafRet values. SafR_NOMORE (8) is returned if there are no ACEEs.

Definition at line 1039 of file saf-esm.c.

References SafAceeIterate(), and SafR_PARAM.

Referenced by SafEsmInit().

mf_uns32 SafEsmInit ( struct SafInit Init  ) 

ESF ESM Module Loading and Initialization.

For internal use only.

When ESF Manager is initialized, it calls this function to load and initialize all of the configured ESM Modules. Like the other init functions, this is not threadsafe.

Parameters:
[in,out] Init Pointer to the SafInit structure. Note that some fields (eg Reason and Detail) may be altered by this function.
Returns:
An integer value, zero for success and non-zero if initialization failed. See ESF Manager Initialization Return Codes and ESF Manager Initialization Internal Return Codes.

Definition at line 193 of file saf-esm.c.

References SafEsmApi::AceeIterate, SafInit::CasLockF, SafEsmApi::CasLockMgr, SafEsmApi::CasMessage, SafInit::CasMsgF, SafEsmApi::CasService, SafInit::CasTmpF, SafEsmApi::Count, EsmAceeIterate(), SafInit::ESMCfg, SafInit::ESMCnt, EsmExtractAuthStrings(), EsmExtractVerifyStrings(), EsmExtractXAuthStrings(), EsmFreeConfig(), EsmGetAcee(), EsmGetSafInit(), EsmGetSharedMem(), EsmLockDeq(), EsmLockEnq(), EsmLog(), EsmParseConfig(), EsmQueryConfig(), EsmSafQuery(), SafEsmApi::ExtractAuthStrings, SafEsmApi::ExtractVerifyStrings, SafEsmApi::ExtractXAuthStrings, SafEsmApi::FreeConfig, SafEsmApi::GetAcee, SafEsmApi::GetSafInit, SafEsmApi::GetSharedMem, SafEsmApi::LockDeq, SafEsmApi::LockEnq, SafEsmApi::Log, SafEsmApi::ParseConfig, SafEsmApi::QueryConfig, SafInit::Reason, SafESM_API_VER_MAJ, SafESM_API_VER_MIN, SafINIT_ESMCFG, SafINIT_MODNAME, SafINIT_NULL, SafINIT_OK, SafMGR_FAIL_ESMENTRY, SafEsmApi::SafQuery, and SafR_OK.

mf_uns32 SafEsmExit ( void   ) 

Inform ESM Modules of Process Exit.

Invoke the Exit procedure for all loaded ESM Modules that implement this procedure. This notifies the modules that the process is exiting.

Currently there are no parameters.

Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 529 of file saf-esm.c.

References SafLog(), and SafMsgWARN.

Referenced by safterm().

mf_uns32 SafEsmUnload ( void   ) 

Unload ESM Modules.

Unload any ESM Modules that were dynamically loaded. This is used when ESF is being shut down for possible restarting in the same process, and helps ensure that the modules will be reinitialized correctly.

Currently there are no parameters.

Returns:
An integer value, zero for success, non-zero for error. Currently no specific error codes are defined.

Definition at line 572 of file saf-esm.c.

References SafModUnload().

Referenced by safterm().

const char* SafEsmName ( mf_uns32  Index  ) 

Provide the Name of an ESM Module (For Logging).

Return the name of an ESM module, indicated by zero-based index into the module array passed at initialization.

Parameters:
[in] Index The index of the ESM module.
Returns:
A constant string containing the module name, or a default if the name is unavailable.

Definition at line 604 of file saf-esm.c.

References SafInit::ESMCfg.

Referenced by SafAdmin(), SafAuth(), SafUpdate(), SafVerify(), and SafXauth().

mf_uns32 SafEsmCVerify ( mf_uns32  EsmIdx,
struct safpb_parameter_block PBlock 
)

Call an ESM Module's Verify Procedure.

Invoke the Verify procedure for the specified ESM Module, if it provides one. If the module does not implement Verify, return the "Unimplemented" return code SafESMRC_NOTIMPL (see Return Codes).

Parameters:
[in,out] PBlock The ESF API parameter block for the request
[in] EsmIdx The index of the ESM Module to call
Returns:
An integer, zero for success, nonzero for error; see ESM Module Procedure Return Codes

Definition at line 631 of file saf-esm.c.

References SafESMRC_NOTIMPL, and SafESMRC_PARAM.

Referenced by SafVerify().

mf_uns32 SafEsmCAuth ( mf_uns32  EsmIdx,
struct safpb_parameter_block PBlock 
)

Call an ESM Module's Auth Procedure.

Invoke the Auth procedure for the specified ESM Module, if it provides one. If the module does not implement Auth, return the "Unimplemented" return code SafESMRC_NOTIMPL (see Return Codes).

Parameters:
[in,out] PBlock The ESF API parameter block for the request
[in] EsmIdx The index of the ESM Module to call
Returns:
An integer, zero for success, nonzero for error; see ESM Module Procedure Return Codes

Definition at line 657 of file saf-esm.c.

References SafESMRC_NOTIMPL, and SafESMRC_PARAM.

Referenced by SafAuth().

mf_uns32 SafEsmCXAuth ( mf_uns32  EsmIdx,
struct safpb_parameter_block PBlock 
)

Call an ESM Module's XAuth Procedure.

Invoke the XAuth procedure for the specified ESM Module, if it provides one. If the module does not implement XAuth, return the "Unimplemented" return code SafESMRC_NOTIMPL (see Return Codes).

Parameters:
[in,out] PBlock The ESF API parameter block for the request
[in] EsmIdx The index of the ESM Module to call
Returns:
An integer, zero for success, nonzero for error; see ESM Module Procedure Return Codes

Definition at line 683 of file saf-esm.c.

References SafESMRC_NOTIMPL, and SafESMRC_PARAM.

Referenced by SafXauth().

mf_uns32 SafEsmCAdmin ( mf_uns32  EsmIdx,
struct safpb_parameter_block PBlock 
)

Call an ESM Module's Admin Procedure.

Invoke the Admin procedure for the specified ESM Module, if it provides one. If the module does not implement Admin, return the "Unimplemented" return code SafESMRC_NOTIMPL (see Return Codes).

Parameters:
[in,out] PBlock The ESF API parameter block for the request
[in] EsmIdx The index of the ESM Module to call
Returns:
An integer, zero for success, nonzero for error; see ESM Module Procedure Return Codes

Definition at line 709 of file saf-esm.c.

References SafESMRC_NOTIMPL, and SafESMRC_PARAM.

Referenced by SafAdmin().

mf_uns32 SafEsmCUpdate ( mf_s32  Type,
mf_uns32  EsmIdx,
struct safpb_parameter_block PBlock 
)

Call an ESM Module's Update Procedure.

Invoke the Update procedure for the specified ESM Module, if it provides one. If the module does not implement Admin, return the "Unimplemented" return code SafESMRC_NOTIMPL (see Return Codes).

Parameters:
[in] Type The type of update call; see ESF ESM Update Request Types
[in] EsmIdx The index of the ESM Module to call
[in,out] PBlock The ESF API parameter block for the request
Returns:
An integer, zero for success, nonzero for error; see ESM Module Procedure Return Codes

Definition at line 736 of file saf-esm.c.

References SafESMRC_NOTIMPL, and SafESMRC_PARAM.

Referenced by SafUpdate().