Sm_PolicyApi_LookupDirectoryEntry()
Contents
casso127
Contents
Looks up the user specification in a user directory.
pszSearchPattern
holds the search pattern for the lookup. User directory searches vary for each type of user directory namespaces.Type
User directory function, global scope.
Syntax
int SM_EXTERN Sm_PolicyApi_LookupDirectoryEntry (void*pSessionHandle,const char*pszUserDirOid,const char*pszSearchPattern,Sm_PolicyApi_User_t**ppStructUserSpec);
Parameter | I/O | Description |
pSessionHandle
| I | A pointer to an internal Policy Management API data structure. The structure holds information about the administrator session and the client session. |
pszUserDirOid
| I | A null-terminated string containing the object identifier of the user directory where lookup is to be performed. |
pszSearchPattern
| I | A null-terminated string containing the search pattern for the lookup. Information about the search expression grammar for different namespace types appears in the section below. |
ppStructUserSpec
| O | The address of a pointer to a user structure. |
Search Expression Grammar for an LDAP Namespace
The search in an LDAP user directory can be based on an attribute-value pair or on an LDAP search expression.
- For an attribute-value pair, the format ofpszSearchPatternis:<attribute-name>=<value>For example if <attribute-name> is disabled and <value> is 0, the LDAP search filter is:Base:'o=airius.com',Filter:'(&(|(objectclass=organizationalPerson)(objectclass=inetOrgPerson)(objectclass=organization)(objectclass=organizationalUnit)(objectclass=groupOfNames)(objectclass=groupOfUniqueNames)(objectclass=group))(disabled=0))'
- If the search uses an LDAP search expression,pszSearchPatternwill hold the LDAP search expression. For example, if the search expression is 'uid=user1111', the LDAP search filter is:Base:'o=airius.com',Filter:'(&(|(objectclass=organizationalPerson)(objectclass=inetOrgPerson)(objectclass=organization)(objectclass=organizationalUnit)(objectclass=groupOfNames)(objectclass=groupOfUniqueNames)(objectclass=group))(uid=user1111))'
Search Expression Grammar for ODBC, WinNT and Custom Namespaces
You can search in an ODBC user directory for users, groups, or both. The search is based on attribute-value pairs.
The format of
pszSearchPattern
is:[ <class>= ] <value>
In the format example:
- <class> is an empty-string or user or group. An empty-string implies user and group.
- <value> is a wildcard string.
Returns
- Sm_PolicyApi_Success. The lookup was successful.
- Sm_PolicyApi_Failure. The user specification lookup failed or memory could not be allocated to Sm_PolicyApi_User_t.
- Sm_PolicyApi_NoSession. There is no valid administrator session.
- Sm_PolicyApi_InvalidHandle. There was no valid initialization prior to this call.
- Sm_PolicyApi_InvalidOid. The user directory OID was not found.
- Sm_PolicyApi_UserDirNotValid. There is no connection to the user directory or the user directory provider has not been loaded.