Package: xtradius
Version: 1.2.1-beta2-1
Severity: wishlist

For one of my projects, I need the ability to add  wildcard to the list
of accepted clients, so that any host can use the radius service. I
created a small patch that can achieve this by adding an entry like

*       secret

to the clients file. However, I am not a C programmer, so anyone familiar
with that language (and xtradius) should check that patch, although it is
working fine for me.

The patch has to be applied to the file src/files.c.

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.18-3-xen-vserver-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages xtradius depends on:
ii  libc6                 2.3.2.ds1-22sarge4 GNU C Library: Shared libraries an

-- no debconf information
1390,1391c1390,1402
< 
<               c->ipaddr = get_ipaddr(hostnm);
---
>               
>               // This introduces * as a fallback wildcard for clients
>               // Stefan Tomanek <[EMAIL PROTECTED]>
>               if ( strcmp(hostnm, "*") != 0 ) {
>                   c->ipaddr = get_ipaddr(hostnm);
>                   strNcpy(c->longname, ip_hostname(c->ipaddr), 
> sizeof(c->longname));
>               } else {
>                   log(L_INFO, "Creating a wildcard client entry");
>                   // wildcard: we do not know anything about the IP address 
> yet
>                   // An IP adress of 0 serves as a marker
>                   c->ipaddr = (UINT4)0;
>                   c->longname[0] = 0;
>               }
1394,1395d1404
<               strNcpy(c->longname, ip_hostname(c->ipaddr),
<                       sizeof(c->longname));
1405d1413
< 
1416a1425,1457
>       // So we did not find a matching entry, let's check again if we have
>       // a wildcard record
>       // Stefan Tomanek <[EMAIL PROTECTED]>
>         if (! cl) {
>             // client default (*)
>             RADCLIENT *cd;
>             // Let's see whether we can find a default entry in the list
>             for(cd = clients; cd; cd = cd->next) {
>               // An IP adress of 0 serves as a marker
>                 if(cd->ipaddr == 0) {
>                   // create a new client struct
>                   RADCLIENT       *cn;
>                   if ((cn = malloc(sizeof(RADCLIENT))) == NULL) {
>                           log(L_INFO, "Out of memory while processing 
> wildcard client");
>                           return NULL;
>                   } else {
>                       log(L_INFO, "Creating a new client entry due to 
> wildcard match");
>                       cn->ipaddr = ipaddr;
>                       // Now we copy all the important data over from the 
> default template
>                       strNcpy(cn->secret, cd->secret, sizeof(cn->secret));
>                       strNcpy(cn->shortname, cd->shortname, 
> sizeof(cn->shortname));
>                       strNcpy(cn->longname, ip_hostname(ipaddr), 
> sizeof(cn->longname));
>                       // Now we place the new RADCLIENT struct in the linked 
> list
>                       cn->next = cd->next;
>                       cd->next = cn;
>                       // This is the entry we want to return
>                       cl = cn;
>                   }
>                 }
>             }
>         }
> 
> 

Reply via email to