Added support for %{check:Attribute-Name}
authorphampson <phampson>
Tue, 23 Sep 2003 02:46:18 +0000 (02:46 +0000)
committerphampson <phampson>
Tue, 23 Sep 2003 02:46:18 +0000 (02:46 +0000)
doc/ChangeLog
doc/variables.txt
src/main/xlat.c

index e3d750a..b0de091 100644 (file)
@@ -4,6 +4,8 @@ FreeRADIUS 1.0.0 ; Date: $Date$, urgency=low
        * Fix segfault due to poorly initialised value in rlm_mschap
        * Added support for rejected packets to run an Post-Auth-Type REJECT
          stanza instead of skipping post-auth entirely.
+       * Added support for %{check:Attribute-Name} to go with
+         %{request:Attribute-Name} and the like.
 
 FreeRADIUS 0.9.1 ; Date: 2003/09/04 14:56:34, urgency=low
 
index 39969e6..974e9e8 100644 (file)
@@ -6,8 +6,11 @@ The variables defined by the server are:
                                      in request
      %{reply:Attribute-Name}         Corresponding value for Attribute-Name
                                      in reply
+     %{check:Attribute-Name}         Corresponding value for Attribute-Name
+                                     in check items for request
      %{proxy-reply:Attribute-Name}   Corresponding value for Attribute-Name
                                      in the proxy reply (if it exists)
+       
 
      %{config:section.subsection.item} Corresponding value in 'radiusd.conf'
                                        for the string value of that item.
index d9138f1..00e2821 100644 (file)
@@ -194,6 +194,33 @@ static int decode_attr_packet(const char *from, char **to, int freespace,
        return 0;
 }
 
+/*
+ * Decode an attribute name from a particular VALUE_PAIR*
+ * into a string.
+ */
+static int decode_attr_vps(const char *from, char **to, int freespace,
+                             VALUE_PAIR *vps,
+                             RADIUS_ESCAPE_STRING func)
+
+{
+       DICT_ATTR *tmpda;
+       VALUE_PAIR *vp;
+       
+       tmpda = dict_attrbyname(from);
+       if (!tmpda) return 0;
+
+       /*
+        *      See if the VP is defined.
+        */
+       vp = pairfind(vps, tmpda->attr);
+       if (vp) {
+               *to += valuepair2str(*to, freespace, vp,
+                                    tmpda->type, func);
+               return 1;
+       }
+
+       return 0;
+}
 
 /*
  *  Decode an attribute name into a string.
@@ -288,6 +315,13 @@ static void decode_attribute(const char **from, char **to, int freespace,
                                           request->packet, func);
 
                /*
+                *      Find an attribute from the config items.
+                */
+       } else if (strncasecmp(attrname,"check:",6) == 0) {
+               found = decode_attr_vps(&attrname[6], &q, freespace,
+                                          request->config_items, func);
+
+               /*
                 *      Find an attribute from the proxy request.
                 */
        } else if ((strncasecmp(attrname,"proxy-request:",14) == 0) &&