000022030 - ct_map_find doesn't return user property

Document created by RSA Customer Support Employee on Jun 16, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000022030
Applies ToRSA ClearTrust 5.5 Runtime C API
IssueHow to retrieve user map, map of user's properties, and specific named property from properties map in RSA ClearTrust 5.5 Runtime C API
ct_map_find doesn't return user property
The functions ct_map_find and ct_map_get_str return NULL rather than the named property, but printing out the property map using ct_map_string shows the property to be present in the map
CauseUser properties in the ct_map structure returned by ct_get_user_properties_pool are stored individually with char * keys, but with ct_item arrays for the map value, with the value of the property as a ct_str in the first slot of the array. Multi-valued properties are handled as a matter of course by returning an array with all the values for the property.
ResolutionThe following code will retrieve a single valued property:

ct_item * item = ct_map_get( user_properties_map, "[property name]", -1, CT_ITEM_ARRAY ) ;
if( item != NULL ) // item will be NULL if the property was not found in the map
{
    printf( "[property name] = %s\n", item->cti_array->cti_str ) ;
}

Where [property name] is the name of the property you're trying to retrieve. For more details, see the documentation in the ct_item.h file.

NOTE: For any standard attribute to be exported as a user property, it must be listed in the argument to the parameter:

    cleartrust.data.source.standard_attribute_export_list

in the aserver.conf file.
Legacy Article IDa28638

Attachments

    Outcomes