Index: src/modules/rlm_detail/rlm_detail.c
===================================================================
RCS file: /source/radiusd/src/modules/rlm_detail/rlm_detail.c,v
retrieving revision 1.37.2.1.2.1
diff -u -r1.37.2.1.2.1 rlm_detail.c
--- src/modules/rlm_detail/rlm_detail.c	19 Apr 2006 18:35:41 -0000	1.37.2.1.2.1
+++ src/modules/rlm_detail/rlm_detail.c	24 Apr 2006 16:25:09 -0000
@@ -70,6 +70,10 @@
 	int locking;
 
 	lrad_hash_table_t *ht;
+
+	/* users file */
+	char *usersfile;
+	PAIR_LIST *users;
 };
 
 static CONF_PARSER module_config[] = {
@@ -81,6 +85,8 @@
 	  offsetof(struct detail_instance,dirperm),    NULL, "0755" },
 	{ "locking",       PW_TYPE_BOOLEAN,
 	  offsetof(struct detail_instance,locking),    NULL, "no" },
+	{ "usersfile",	   PW_TYPE_STRING_PTR,
+	  offsetof(struct detail_instance,usersfile), NULL, NULL },
 	{ NULL, -1, 0, NULL, NULL }
 };
 
@@ -96,6 +102,8 @@
 	free((char*) inst->last_made_directory);
 
 	if (inst->ht) lrad_hash_table_free(inst->ht);
+	if (inst->users) pairlist_free(&inst->users);
+	if (inst->usersfile) free(inst->usersfile);
 
         free(inst);
 	return 0;
@@ -109,6 +117,7 @@
 {
 	struct detail_instance *inst;
 	CONF_SECTION	*cs;
+	int rcode;
 
 	inst = rad_malloc(sizeof(*inst));
 	if (!inst) {
@@ -163,6 +172,18 @@
 		}
 	}
 
+	/*
+	 *      Log only some users
+	 */
+	if (inst->usersfile) {
+		rcode = pairlist_read(inst->usersfile, &inst->users, 1);
+		if (rcode != 0) {
+			radlog(L_ERR, "rlm_detail: Errors reading %s - ignoring", inst->usersfile);
+			free(inst->usersfile);
+			inst->usersfile = NULL;
+		}
+	}
+
 
 	*instance = inst;
 	return 0;
@@ -185,6 +206,9 @@
 	REALM		*proxy_realm;
 	char		proxy_buffer[16];
 	VALUE_PAIR	*pair = packet->vps;
+	VALUE_PAIR	*namepair;
+	PAIR_LIST	*pl;
+	int		found = 0;
 
 	struct detail_instance *inst = instance;
 
@@ -196,6 +220,54 @@
 	}
 
 	/*
+	 *      Do we log only some users?
+	 */
+	if (inst->users) {
+		/*
+		 *	Grab the canonical user name.
+		 */
+		namepair = request->username;
+
+		/* 
+		 * ignore requests without a user name
+		 */
+		if (!namepair) {
+			return RLM_MODULE_NOOP;
+		}
+
+		/*
+		 *	Find the entry for the user.
+		 */
+		for(pl = inst->users; pl; pl = pl->next) {
+			/*
+			 *	If the current entry is NOT a default,
+			 *	AND the name does NOT match the current entry,
+			 *	then skip to the next entry.
+			 */
+			if ((strcmp(pl->name, "DEFAULT") != 0) &&
+			    (strcmp(namepair->strvalue, pl->name) != 0))  {
+				continue;
+			}
+
+			/*
+			 *	If the current request matches against the
+			 *	check pairs, then we log it
+			 */
+			if (paircmp(request, request->packet->vps, pl->check, &request->reply->vps) == 0) {
+				DEBUG2("    detail: Matched entry %s at line %d", pl->name, pl->lineno);
+				found = 1;
+				break;
+			}
+		}
+
+		/*
+		 *	If we didn't find the user, we don't do anything
+		 */
+		if (!found)
+			return RLM_MODULE_NOOP;
+	}
+
+	/*
 	 *	Create a directory for this nas.
 	 *
 	 *	Generate the path for the detail file.  Use the
