The radzap program has support for specifying the server IP, but it does not check the 
correct secret for the IP.

Here is a patch to solve this :


--- radzap.c.ori        Fri Feb  7 18:07:17 2003
+++ radzap.c    Fri Feb  7 18:17:19 2003
@@ -245,13 +245,14 @@
        return ntohs(svp->s_port);
 }
 
-static const char *getlocalhostsecret(void)
+static const char *getsecret(uint32_t server)
 {
        RADCLIENT *cl;
+       char buf[32];
 
-       cl = client_find(htonl(INADDR_LOOPBACK));
+       cl = client_find(server);
        if (cl == NULL) {
-               radlog(L_ERR|L_CONS, "No clients entry for localhost");
+               radlog(L_ERR|L_CONS, "No clients entry for %s",ip_ntoa(buf,server));
                exit(1);
        }
        return (const char *)cl->secret;
@@ -287,7 +288,7 @@
        struct timeval tv;
        RADIUS_PACKET *req, *rep = NULL;
        VALUE_PAIR *vp;
-       const char *secret=getlocalhostsecret();
+       const char *secret;
 
        if ((req = rad_alloc(1)) == NULL) {
                librad_perror("radzap");
@@ -308,6 +309,7 @@
        }
        if(!req->dst_ipaddr) 
                req->dst_ipaddr = 0x7f000001;
+       secret = getsecret(req->dst_ipaddr);
        req->vps = NULL;
 
        if(allports != 0) {

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

Reply via email to