Added debugging statements, so that we can see just what the heck
authoraland <aland>
Tue, 26 Mar 2002 15:37:35 +0000 (15:37 +0000)
committeraland <aland>
Tue, 26 Mar 2002 15:37:35 +0000 (15:37 +0000)
the module is doing.

src/modules/rlm_realm/rlm_realm.c

index 4b43963..92c67ea 100644 (file)
@@ -78,6 +78,7 @@ static REALM *check_for_realm(void *instance, REQUEST *request)
         */
        if ((request->proxy != NULL) ||
            (request->username == NULL)) {
+               DEBUG2("    rlm_realm: Request was proxied, or no user name.  Ignoring.");
                return NULL;
        }
 
@@ -119,13 +120,20 @@ static REALM *check_for_realm(void *instance, REQUEST *request)
                break;
        }
 
+       DEBUG2("    rlm_realm: Looking up realm %s for User-Name = \"%s\"",
+              (realmname == NULL) ? "NULL" : realmname,
+              request->username->strvalue);
+
        /*
         *      Allow NULL realms.
         */
        realm = realm_find(realmname);
        if (!realm) {
+               DEBUG2("    rlm_realm: No such realm %s",
+                      (realmname == NULL) ? "NULL" : realmname);
                return NULL;
        }
+       DEBUG2("    rlm_realm: Found realm %s", realm->realm);
        
        /*
         *      If we've been told to strip the realm off, then do so.
@@ -143,8 +151,10 @@ static REALM *check_for_realm(void *instance, REQUEST *request)
                                exit(1);
                        }
                        pairadd(&request->packet->vps, vp);
+                       DEBUG2("    rlm_realm: Adding Stripped-User-Name = \"%s\"", username);
                } else {
                        vp = request->username;
+                       DEBUG2("    rlm_realm: Setting Stripped-User-Name = \"%s\"", username);
                }
 
                strcpy(vp->strvalue, username);
@@ -161,6 +171,8 @@ static REALM *check_for_realm(void *instance, REQUEST *request)
        if ((realm->notrealm) ||
            (strcmp(realm->server, "LOCAL") == 0)) {
                pairadd(&request->packet->vps, pairmake("Realm", realm->realm, T_OP_EQ));
+               DEBUG2("    rlm_realm: Adding Realm = \"%s\"",
+                      realm->realm);
                return NULL;
        }
 
@@ -187,7 +199,6 @@ static REALM *check_for_realm(void *instance, REQUEST *request)
                return NULL;
        }
 
-
        return realm;
 }
 
@@ -284,7 +295,7 @@ static int realm_authorize(void *instance, REQUEST *request)
         */
        realm = check_for_realm(instance, request);
        if (!realm) {
-               return RLM_MODULE_OK;
+               return RLM_MODULE_NOOP;
        }
 
        /*