eimAddPolicyAssociation()--Add EIM Policy Association


  Syntax
 #include <eim.h>

 int eimAddPolicyAssociation(EimHandle                 * eim,
                             EimPolicyAssociationInfo  * policyAssoc,
                             EimRC                     * eimrc)
  Service Program Name: QSYS/QSYEIM

  Default Public Authority: *USE

  Threadsafe: Yes

The eimAddPolicyAssociation() function adds the specified policy association to the domain. A policy association is used to specify the target association for a mapping lookup operation without having to define specific source associations for all users. A policy association will be used in a mapping lookup operation (eimGetTargetFromSource or eimGetTargetFromIdentifier) if a specific source association does not exist.

Start of change EIM version 2 must be supported by the local EIM APIs to use this API (see eimGetVersion()--Get EIM Version). End of change

There are 3 types of policy associations that are supported:

  1. Certificate filter policy associations
  2. Default registry policy associations
  3. Default domain policy associations

A certificate filter policy association is used to map user (or client) certificates with similar attributes to the same target identity in the target registry. For example, a certificate filter policy association can be added so that all certificates issued by the same Certificate Authority (CA) are mapped to the same target identity in the target registry. Or, all certificates from the same organization are mapped to the same target identity in the target registry.

A default registry policy association is used to map any user in the specified source registry to the same target identity in the target registry.

A default domain association policy is used to map all users to the same target identity in the target registry.

The use of policy associations is controlled by the version of the API interface, not the domain. If policy associations are added to a domain, they will only be used in a mapping lookup operation if the version of the mapping lookup API that is used to access the domain supports policy associations. Start of change See EIM Mapping Lookup Algorithm for the affect that policy associations have on the mapping lookup operation.

In the mapping lookup algorithm, there is a check to see if there is a certificate policy filter value that matches the source identity. End of change To locate a certificate policy filter value, a search will be done using a series of full and partial distinguished names (DNs) until the most specific matching certificate policy filter value is found. The following values are used in sequence to search for a matching certificate policy filter value:

  1. <SDN>subject's-full-DN</SDN><IDN>issuer's-full-DN</IDN>
  2. <SDN>subject's-partial-DN</SDN><IDN>issuer's-full-DN</IDN>
  3. <SDN>subject's-full-DN</SDN>
  4. <SDN>subject's-partial-DN</SDN>
  5. <IDN>issuer's-full-DN</IDN>
  6. <IDN>issuer's-partial-DN</IDN>

Note that searching is not done for the following values:

Each step of the search using a partial DN may actually involve a series of searches for partial name values based on the full DN. Each partial DN value in the series is determined by removing the next most specific node in the DN. The nodes are removed from the most specific to the least specific, in the order that they appear in the DN.


Authorities and Locks

EIM Data
Access to EIM data is controlled by EIM access groups. LDAP administrators also have access to EIM data. The access groups whose members have authority to the EIM data for this API follow:

Parameters

eim  (Input)
The EIM handle returned by a previous call to eimCreateHandle(). A valid connection is required for this function.

policyAssoc  (Input)
The information about the policy association to be added.

The EimPolicyAssociationInfo structure contains information about the policy association to add.

For EIM_CERT_FILTER_POLICY (6) association type, the policyAssociation field must contain an EimCertificateFilterPolicyAssociation structure. The sourceRegistry field must contain the name of a registry that has a type of X.509. The certificate filter policy value specified in the filterValue field must have already been added using the Add EIM Policy Filter (eimAddPolicyFilter) API.

For EIM_DEFAULT_REG_POLICY (7) association type, the policyAssociation field must contain an EimDefaultRegistryPolicyAssociation structure.

For EIM_DEFAULT_DOMAIN_POLICY (8) association type. the policyAssociation field must contain an EimDefaultDomainPolicyAssociation structure.

The structure layouts follow:

   enum EimAssociationType {
       EIM_ALL_ASSOC,                  /* Not supported on this interface*/
       EIM_TARGET,                     /* Not supported on this interface*/
       EIM_SOURCE,                     /* Not supported on this interface*/
       EIM_SOURCE_AND_TARGET,          /* Not supported on this interface*/
       EIM_ADMIN,                      /* Not supported on this interface*/
       EIM_ALL_POLICY_ASSOC,           /* Not supported on this interface*/
       EIM_CERT_FILTER_POLICY,         /* Association is a certificate
                                          filter policy association.     */
       EIM_DEFAULT_REG_POLICY,         /* Association is a default
                                          registry policy association    */
       EIM_DEFAULT_DOMAIN_POLICY       /* Policy is a default policy for
                                          the domain.                    */
   };

   typedef struct EimCertificateFilterPolicyAssociation
   {
       char  * sourceRegistry;         /* The source registry to add the
                                          policy association to.         */
       char  * filterValue;            /* The filter value of the policy.*/
       char  * targetRegistry;         /* The name of the target registry
                                          that the filter value should
                                          map to.                        */
       char  * targetRegistryUserName; /* The name of the target registry
                                          user name that the filter value
                                          should map to.                 */
   } EimCertificateFilterPolicyAssociation;

   typedef struct EimDefaultRegistryPolicyAssociation
   {
       char  * sourceRegistry;         /* The source registry to add the
                                          policy association to.         */
       char  * targetRegistry;         /* The name of the target registry
                                          that the policy should map to. */
       char  * targetRegistryUserName; /* The name of the target registry
                                          user name that the policy 
                                          should map to.                 */
   } EimDefaultRegistryPolicyAssociation;

   typedef struct EimDefaultDomainPolicyAssociation
   {
       char  * targetRegistry;         /* The name of the target registry
                                          that the policy should map to. */
       char  * targetRegistryUserName; /* The name of the target registry
                                          user name that the policy 
                                          should map to.                 */
   } EimDefaultDomainPolicyAssociation;

   typedef struct EimPolicyAssociationInfo
   {
       enum EimAssociationType type;
       union {
           EimCertificateFilterPolicyAssociation   certFilter;
           EimDefaultRegistryPolicyAssociation     defaultRegistry;
           EimDefaultDomainPolicyAssociation       defaultDomain;
       } policyAssociation;
   } EimPolicyAssociationInfo;
eimrc  (Input/Output)
The structure in which to return error code information. If the return value is not 0, eimrc is set with additional information. This parameter may be NULL. For the format of the structure, see EimRC--EIM Return Code Parameter.


Return Value

The return value from the API. Following each return value is the list of possible values for the messageCatalogMessageID field in the eimrc parameter for that value.

0
Request was successful.

EACCES
Access denied. Not enough permissions to access data.

EIMERR_ACCESS (1) Insufficient access to EIM data.

EBADDATA
eimrc is not valid.

EBADNAME
Registry name is not valid or insufficient access to EIM data, or policy filter value is not found.

EIMERR_NOREG (28) EIM Registry not found or insufficient access to EIM data.
EIMERR_NOPOLICYFILTER (61) Policy filter value not found for the specified EIM Registry.

EBUSY
Unable to allocate internal system object.

EIMERR_NOLOCK (26) Unable to allocate internal system object.

ECONVERT
Data conversion error.

EIMERR_DATA_CONVERSION (13) Error occurred when converting data between code pages.

EINVAL
Input parameter was not valid.

EIMERR_ASSOC_TYPE_INVAL (4) Association type is not valid.
EIMERR_HANDLE_INVAL (17) EimHandle is not valid.
EIMERR_PARM_REQ (34) Missing required parameter. Please check API documentation.
EIMERR_PTR_INVAL (35) Pointer parameter is not valid.
EIMERR_FUNCTION_NOT_SUPPORTED (70) The specified function is not supported by the EIM version.

ENOMEM
Unable to allocate required space.

EIMERR_NOMEM (27) No memory available. Unable to allocate required space.

ENOTCONN
LDAP connection has not been made.

EIMERR_NOT_CONN (31) Not connected to LDAP. Use eimConnect() API and try the request again.

EROFS
LDAP connection is for read only. Need to connect to master.

EIMERR_READ_ONLY (36) LDAP connection is for read only. Use eimConnectToMaster() to get a write connection.

EUNKNOWN
Unexpected exception.

EIMERR_LDAP_ERR (23) Unexpected LDAP error. %s
EIMERR_UNKNOWN (44) Unknown error or unknown system state.
EIMERR_UNEXP_OBJ_ VIOLATION (56) Unexpected object violation.

Related Information


Example

See Code disclaimer information for information pertaining to code examples.

The following example adds a default registry policy association.

#include <eim.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
    int           rc;
    char          eimerr[100];
    EimRC       * err;
    EimHandle   * handle;
    EimPolicyAssociationInfo assocInfo;

    /* Set up error structure.                  */
    memset(eimerr,0x00,100);
    err = (EimRC *)eimerr;
    err->memoryProvidedByCaller = 100;

    /* Get eim handle from input arg.           */
    /* This handle is already connected to EIM. */
    handle = (EimHandle *)argv[1];

    /* Set up policy association information    */
    assocInfo.type = EIM_DEFAULT_REG_POLICY;
    assocInfo.policyAssociation.defaultRegistry.sourceRegistry = "MySourceRegistry";
    assocInfo.policyAssociation.defaultRegistry.targetRegistry = "localRegistry";
    assocInfo.policyAssociation.defaultRegistry.targetRegistryUserName = "mjjones";
    
    /* Add the policy association               */
    if (0 != (rc = eimAddPolicyAssociation(handle,
                                           &assocInfo,
                                           err)))
    {
        printf("Add EIM Policy Association error = %d", rc);
        return -1;
    }
              
    return 0;
        
}



API introduced: V5R3
Top | Security APIs | APIs by category