Merge branch 'master' of ssh://lhoward@moonshot.suchdamage.org:822/srv/git/moonshot
[mech_eap.git] / util_radius.h
index fff01b4..30ac07e 100644 (file)
 #ifndef _UTIL_RADIUS_H_
 #define _UTIL_RADIUS_H_ 1
 
+#ifdef __cplusplus
+
 struct gss_eap_radius_attr_provider : gss_eap_attr_provider {
 public:
-    gss_eap_radius_attr_provider(void) {}
+    gss_eap_radius_attr_provider(void);
     ~gss_eap_radius_attr_provider(void);
 
     bool initFromExistingContext(const gss_eap_attr_ctx *source,
@@ -64,25 +66,95 @@ public:
     bool initFromBuffer(const gss_eap_attr_ctx *ctx,
                         const gss_buffer_t buffer);
 
-    bool getAttribute(unsigned int attribute,
+    bool getAttribute(int attribute,
+                      int *authenticated,
+                      int *complete,
+                      gss_buffer_t value,
+                      gss_buffer_t display_value,
+                      int *more) const;
+    bool getAttribute(int attribute,
+                      int vendor,
                       int *authenticated,
                       int *complete,
                       gss_buffer_t value,
                       gss_buffer_t display_value,
                       int *more) const;
 
-    bool authenticated() const { return m_authenticated; }
+    bool getFragmentedAttribute(int attribute,
+                                int vendor,
+                                int *authenticated,
+                                int *complete,
+                                gss_buffer_t value) const;
 
-    static bool init();
-    static void finalize();
+    bool authenticated(void) const { return m_authenticated; }
+
+    time_t getExpiryTime(void) const;
+
+    static bool init(void);
+    static void finalize(void);
 
     static gss_eap_attr_provider *createAttrContext(void);
 
 private:
+    bool initFromGssCred(const gss_cred_id_t cred);
+    static VALUE_PAIR *copyAvps(const VALUE_PAIR *in);
+    const VALUE_PAIR *getAvps(void) const {
+        return m_avps;
+    }
+
+    rc_handle *m_rh;
+    VALUE_PAIR *m_avps;
     bool m_authenticated;
 };
 
 /* For now */
-#define PW_SAML_ASSERTION           1936
+extern "C" {
+#endif
+
+OM_uint32
+addAvpFromBuffer(OM_uint32 *minor,
+                 rc_handle *rh,
+                 VALUE_PAIR **vp,
+                 int type,
+                 int vendor,
+                 gss_buffer_t buffer);
+
+OM_uint32
+getBufferFromAvps(OM_uint32 *minor,
+                  VALUE_PAIR *vps,
+                  int type,
+                  int vendor,
+                  gss_buffer_t buffer,
+                  int concat);
+
+OM_uint32 gssEapRadiusAttrProviderInit(OM_uint32 *minor);
+OM_uint32 gssEapRadiusAttrProviderFinalize(OM_uint32 *minor);
+
+OM_uint32
+gssEapRadiusAllocHandle(OM_uint32 *minor,
+                        const gss_cred_id_t cred,
+                        rc_handle **pHandle);
+
+#define RC_CONFIG_FILE      SYSCONFDIR "/radiusclient/radiusclient.conf"
+
+/* RFC 2548 - Microsoft Vendor-specific RADIUS Attributes */
+#define VENDOR_ID_MICROSOFT 311
+
+enum { VENDOR_ATTR_MS_MPPE_SEND_KEY = 16,
+       VENDOR_ATTR_MS_MPPE_RECV_KEY = 17
+};
+
+#define VENDOR_ID_UKERNA    25622
+
+enum { VENDOR_ATTR_GSS_ACCEPTOR_SERVICE_NAME = 128,
+       VENDOR_ATTR_GSS_ACCEPTOR_HOST_NAME,
+       VENDOR_ATTR_GSS_ACCEPTOR_SERVICE_SPECIFIC,
+       VENDOR_ATTR_GSS_ACCEPTOR_REALM_NAME,
+       VENDOR_ATTR_SAML_AAA_ASSERTION
+};
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _UTIL_RADIUS_H_ */