Honour RADIUS session timeout
authorLuke Howard <lukeh@padl.com>
Wed, 22 Sep 2010 13:37:32 +0000 (15:37 +0200)
committerLuke Howard <lukeh@padl.com>
Wed, 22 Sep 2010 13:37:32 +0000 (15:37 +0200)
mech_eap/util_radius.cpp
mech_eap/util_radius.h

index 081b9cb..ac568a0 100644 (file)
@@ -664,3 +664,15 @@ gss_eap_radius_attr_provider::exportToBuffer(gss_buffer_t buffer) const
 
     assert(remain == 0);
 }
+
+time_t
+gss_eap_radius_attr_provider::getExpiryTime(void) const
+{
+    VALUE_PAIR *vp;
+
+    vp = rc_avpair_get(m_avps, PW_SESSION_TIMEOUT, 0);
+    if (vp == NULL || vp->lvalue == 0)
+        return 0;
+
+    return time(NULL) + vp->lvalue;
+}
index 23a0595..30ac07e 100644 (file)
@@ -86,10 +86,12 @@ public:
                                 int *complete,
                                 gss_buffer_t value) const;
 
-    bool authenticated() const { return m_authenticated; }
+    bool authenticated(void) const { return m_authenticated; }
 
-    static bool init();
-    static void finalize();
+    time_t getExpiryTime(void) const;
+
+    static bool init(void);
+    static void finalize(void);
 
     static gss_eap_attr_provider *createAttrContext(void);