Use "update" instead of "map".
authorAlan T. DeKok <aland@freeradius.org>
Fri, 1 May 2015 14:57:06 +0000 (10:57 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 1 May 2015 14:57:06 +0000 (10:57 -0400)
For consistency with the rest of the server

raddb/mods-available/couchbase
src/modules/rlm_couchbase/mod.c

index 7746c2b..6eff33b 100644 (file)
@@ -25,39 +25,39 @@ couchbase {
        # Map attribute names to json element names for accounting.
        #
        # Configuration items are in the format:
-       #  <element name> = '<radius attribute>'
+       #  <radius attribute> = '<element name>'
        #
-       # Attribute names should be single quoted.
+       # Element names should be single quoted.
        #
        # Note: Atrributes not in this map will not be recorded.
        #
-       map {
-               sessionId           = 'Acct-Session-Id'
-               uniqueId            = 'Acct-Unique-Session-Id'
-               lastStatus          = 'Acct-Status-Type'
-               authentic           = 'Acct-Authentic'
-               userName            = 'User-Name'
-               strippedUserName    = 'Stripped-User-Name'
-               strippedUserDomain  = 'Stripped-User-Domain'
-               realm               = 'Realm'
-               nasIpAddress        = 'NAS-IP-Address'
-               nasIdentifier       = 'NAS-Identifier'
-               nasPort             = 'NAS-Port'
-               calledStationId     = 'Called-Station-Id'
-               calledStationSSID   = 'Called-Station-SSID'
-               callingStationId    = 'Calling-Station-Id'
-               framedProtocol      = 'Framed-Protocol'
-               framedIpAddress     = 'Framed-IP-Address'
-               nasPortType         = 'NAS-Port-Type'
-               connectInfo         = 'Connect-Info'
-               sessionTime         = 'Acct-Session-Time'
-               inputPackets        = 'Acct-Input-Packets'
-               outputPackets       = 'Acct-Output-Packets'
-               inputOctets         = 'Acct-Input-Octets'
-               outputOctets        = 'Acct-Output-Octets'
-               inputGigawords      = 'Acct-Input-Gigawords'
-               outputGigawords     = 'Acct-Output-Gigawords'
-               lastUpdated         = 'Event-Timestamp'
+       update {
+               Acct-Session-Id         = 'sessionId'
+               Acct-Unique-Session-Id  = 'uniqueId'
+               Acct-Status-Type        = 'lastStatus'
+               Acct-Authentic          = 'authentic'
+               User-Name               = 'userName'
+               Stripped-User-Name      = 'strippedUserName'
+               Stripped-User-Domain    = 'strippedUserDomain'
+               Realm                   = 'realm'
+               NAS-IP-Address          = 'nasIpAddress'
+               NAS-Identifier          = 'nasIdentifier'
+               NAS-Port                = 'nasPort'
+               Called-Station-Id       = 'calledStationId'
+               Called-Station-SSID     = 'calledStationSSID'
+               Calling-Station-Id      = 'callingStationId'
+               Framed-Protocol         = 'framedProtocol'
+               Framed-IP-Address       = 'framedIpAddress'
+               NAS-Port-Type           = 'nasPortType'
+               Connect-Info            = 'connectInfo'
+               Acct-Session-Time       = 'sessionTime'
+               Acct-Input-Packets      = 'inputPackets'
+               Acct-Output-Packets     = 'outputPackets'
+               Acct-Input-Octets       = 'inputOctets'
+               Acct-Output-Octets      = 'outputOctets'
+               Acct-Input-Gigawords    = 'inputGigawords'
+               Acct-Output-Gigawords   = 'outputGigawords'
+               Event-Timestamp         = 'lastUpdated'
        }
 
        # Couchbase document key for user documents (unlang supported)
index 785b431..a3eb5bd 100644 (file)
@@ -103,7 +103,7 @@ void *mod_conn_create(TALLOC_CTX *ctx, void *instance)
        return chandle;
 }
 
-/** Build a JSON object map from the configuration "map" section
+/** Build a JSON object map from the configuration "update" section
  *
  * Parse the "map" section from the module configuration file and store this
  * as a JSON object (key/value list) in the module instance.  This map will be
@@ -122,11 +122,11 @@ int mod_build_attribute_element_map(CONF_SECTION *conf, void *instance)
        const char *attribute, *element;    /* attribute and element names */
 
        /* find map section */
-       cs = cf_section_sub_find(conf, "map");
+       cs = cf_section_sub_find(conf, "update");
 
        /* check section */
        if (!cs) {
-               ERROR("rlm_couchbase: failed to find 'map' section in config");
+               ERROR("rlm_couchbase: failed to find 'update' section in config");
                /* fail */
                return -1;
        }
@@ -150,21 +150,21 @@ int mod_build_attribute_element_map(CONF_SECTION *conf, void *instance)
                /* get value pair from item */
                cp = cf_item_to_pair(ci);
 
-               /* get pair name (element name) */
-               element = cf_pair_attr(cp);
+               /* get pair name (attribute name) */
+               attribute = cf_pair_attr(cp);
 
-               /* get pair value (attribute name) */
-               attribute = cf_pair_value(cp);
+               /* get pair value (element name) */
+               element = cf_pair_value(cp);
 
                /* add pair name and value */
                json_object_object_add(inst->map, attribute, json_object_new_string(element));
 
                /* debugging */
-               DEBUG3("rlm_couchbase: added attribute '%s' to element '%s' map to object", attribute, element);
+               DEBUG3("rlm_couchbase: added attribute '%s' to element '%s' mapping", attribute, element);
        }
 
        /* debugging */
-       DEBUG3("rlm_couchbase: built attribute to element map %s", json_object_to_json_string(inst->map));
+       DEBUG3("rlm_couchbase: built attribute to element mapping %s", json_object_to_json_string(inst->map));
 
        /* return */
        return 0;