Merge branch 'oldradius'
[mech_eap.orig] / util_radius.cpp
index 7c6552a..2c55bff 100644 (file)
@@ -133,6 +133,28 @@ alreadyAddedAttributeP(std::vector <std::string> &attrs, VALUE_PAIR *vp)
     return false;
 }
 
+static bool
+isSecretAttributeP(int attrid, int vendor)
+{
+    bool ret = false;
+
+    switch (vendor) {
+    case RADIUS_VENDOR_ID_MICROSOFT:
+        switch (attrid) {
+        case RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY:
+        case RADIUS_VENDOR_ATTR_MS_MPPE_RECV_KEY:
+            ret = true;
+            break;
+        default:
+            break;
+        }
+    default:
+        break;
+    }
+
+    return ret;
+}
+
 bool
 gss_eap_radius_attr_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addAttribute, void *data) const
 {
@@ -142,6 +164,9 @@ gss_eap_radius_attr_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addA
     for (vp = m_avps; vp != NULL; vp = vp->next) {
         gss_buffer_desc attribute;
 
+        if (isSecretAttributeP(ATTRID(vp->attribute), VENDOR(vp->attribute)))
+            continue;
+
         if (alreadyAddedAttributeP(seen, vp))
             continue;
 
@@ -238,6 +263,9 @@ gss_eap_radius_attr_provider::getAttribute(int attrid,
 
     *more = 0;
 
+    if (isSecretAttributeP(attrid, vendor))
+        return false;
+
     vp = rc_avpair_get(m_avps, attrid, vendor);
     if (vp == NULL)
         return false;
@@ -299,7 +327,9 @@ gss_eap_radius_attr_provider::getAttribute(int attrid,
                                            gss_buffer_t display_value,
                                            int *more) const
 {
-    return getAttribute(attrid, 0, authenticated, complete,
+
+    return getAttribute(ATTRID(attrid), VENDOR(attrid),
+                        authenticated, complete,
                         value, display_value, more);
 }