[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freeradius-devel
Subject:    rlm_files post-proxy
From:       Chris Brotsos <cbrotsos () starnetusa ! net>
Date:       2004-02-18 21:48:33
Message-ID: 32C20B22-625C-11D8-A76D-000A95EFE8AA () starnetusa ! net
[Download RAW message or body]

Devel:

Not sure if you want to include a post-proxy method in rlm_files come 
1.0, but if so, a patch is attached.

I'm mainly writing to say that I just downloaded the CVS head, which I 
haven't done in quite awhile...WOW!

Great job on finding a way around the strtok issues in filters.c. I've 
had a strtok_r patch in place for months now that works great, but I'm 
tired of porting it when I build off standard releases. Great job on 
the new RB tree dictionary too! As well, Solaris now has no issues when 
building the rlm_sql module (it was a nuisance to manually add the 
libraries to the Makefile).

I wish I could have been a little more active in the recent 
developments and contributed to the exciting/great changes that were 
made, but I can at least give my opinion (FWIW), and say that everybody 
has done an excellent job.

Thanks,
["rlm_files.patch" (rlm_files.patch)]

Index: rlm_files.c
===================================================================
RCS file: /source/radiusd/src/modules/rlm_files/rlm_files.c,v
retrieving revision 1.59
diff -r1.59 rlm_files.c
54a55,58
> 
> 	/* post-proxy */
> 	char *postproxy_usersfile;
> 	PAIR_LIST *postproxy_users;
74a79,80
> 	{ "postproxy_usersfile", PW_TYPE_STRING_PTR,
> 	  offsetof(struct file_instance,postproxy_usersfile), NULL, "${raddbdir}/postproxy_users" },
268a275,291
> 	/*
> 	 * Get the post-proxy stuff
> 	 */
> 	rcode = getusersfile(inst->postproxy_usersfile, &inst->postproxy_users, inst->compat_mode);
> 	if (rcode != 0) {
> 		radlog(L_ERR|L_CONS, "Errors reading %s", inst->postproxy_usersfile);
> 		pairlist_free(&inst->users);
> 		pairlist_free(&inst->acctusers);
> 		pairlist_free(&inst->preproxy_users);
> 		free(inst->usersfile);
> 		free(inst->acctusersfile);
> 		free(inst->preproxy_usersfile);
> 		free(inst->postproxy_usersfile);
> 		free(inst);
> 		return -1;
> 	}
> 
549a573,629
>  * This function is a copy of file_authorize, only now we work with
>  * proxy_reply->vps.
>  */
> static int file_postproxy(void *instance, REQUEST *request)
> {
> 	VALUE_PAIR	*namepair;
> 	const char	*name;
> 	VALUE_PAIR	*check_pairs;
> 	VALUE_PAIR	**config_pairs;
> 	VALUE_PAIR	**reply_pairs;
> 	VALUE_PAIR	*check_tmp;
> 	VALUE_PAIR	*reply_tmp;
> 	PAIR_LIST	*pl;
> 	int		found = 0;
> 	struct file_instance *inst = instance;
> 
> 	namepair = request->username;
> 	name = namepair ? (char *) namepair->strvalue : "NONE";
> 	check_pairs = request->proxy_reply->vps;
> 	config_pairs = &request->config_items;
> 	reply_pairs = &request->proxy_reply->vps;
> 
> 	/*
> 	 * Find the entry for the user.
> 	 */
> 	for (pl = inst->postproxy_users; pl; pl = pl->next) {
> 		if (strcmp(name, pl->name) && strcmp(pl->name, "DEFAULT"))
> 		    continue;
> 		if (paircmp(request, check_pairs, pl->check,
> 			    reply_pairs) == 0) {
> 		    DEBUG2("    postproxyusers: Matched %s at %d",
> 				pl->name, pl->lineno);
> 		    found = 1;
> 		    check_tmp = paircopy(pl->check);
> 		    reply_tmp = paircopy(pl->reply);
> 		    pairxlatmove(request, reply_pairs, &reply_tmp);
> 		    pairmove(config_pairs, &check_tmp);
> 		    pairfree(&reply_tmp);
> 		    pairfree(&check_tmp); /* Should be NULL */
> 		    /*
> 		     * Fallthrough ?
> 		     */
> 		    if (!fallthrough(pl->reply))
> 			break;
> 		}
> 	}
> 
> 	/*
> 	 * See if we succeeded.
> 	 */
> 	if (!found)
> 		return RLM_MODULE_NOOP; /* on to the next module */
> 
> 	return RLM_MODULE_OK;
> }
> 		
> /*
557a638
> 	pairlist_free(&inst->postproxy_users);
560a642
> 	free(inst->postproxy_usersfile);
580c662
< 		NULL,			/* post-proxy */
---
> 		file_postproxy,		/* post-proxy */


Chris

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic