authorize module handling doesn't work the way I thought.
authorfcusack <fcusack>
Wed, 13 Nov 2002 04:21:59 +0000 (04:21 +0000)
committerfcusack <fcusack>
Wed, 13 Nov 2002 04:21:59 +0000 (04:21 +0000)
Fix multiple instance support to accomodate the way it REALLY works.

src/modules/rlm_x99_token/x99.h
src/modules/rlm_x99_token/x99_rlm.c

index bb85734..0ebff7f 100644 (file)
@@ -84,6 +84,7 @@ typedef struct x99_token_t {
     int ewindow2_delay;        /* softfail override max time delay                */
 #if defined(FREERADIUS)
     /* freeradius-specific items */
+    char *name;                        /* instance name for x99_token_authorize() */
     int mschapv2_mppe_policy;  /* whether or not do to mppe for mschapv2  */
     int mschapv2_mppe_types;   /* key type/length for mschapv2/mppe       */
     int mschap_mppe_policy;    /* whether or not do to mppe for mschap    */
index 6d5a045..2097b09 100644 (file)
@@ -263,6 +263,16 @@ x99_token_instantiate(CONF_SECTION *conf, void **instance)
        return -1;
     }
 
+    /* Set the instance name (for use with authorize()) */
+    data->name = cf_section_name2(conf);
+    if (!data->name)
+       data->name = cf_section_name1(conf);
+    if (!data->name) {
+       x99_log(X99_LOG_ERR, "no instance name (this can't happen)");
+       free(data);
+       return -1;
+    }
+
     *instance = data;
     return 0;
 }
@@ -284,11 +294,11 @@ x99_token_authorize(void *instance, REQUEST *request)
     int32_t sflags = 0; /* flags for state */
     VALUE_PAIR *vp;
 
-    /* Early exit if Auth-Type !~ /^x99_token/ */
+    /* Early exit if Auth-Type != inst->name */
     auth_type_found = 0;
     if ((vp = pairfind(request->config_items, PW_AUTHTYPE)) != NULL) {
        auth_type_found = 1;
-       if (strncmp(vp->strvalue, "x99_token", 9)) {
+       if (strcmp(vp->strvalue, inst->name)) {
            return RLM_MODULE_NOOP;
        }
     }