Don't use a global 'acctfd'
authoraland <aland>
Thu, 21 Feb 2002 22:46:40 +0000 (22:46 +0000)
committeraland <aland>
Thu, 21 Feb 2002 22:46:40 +0000 (22:46 +0000)
As a result, update 'session_zap' to take an fd as an argument.

Update radutmp to use 'request->packet->fd', instead of the global
acctfd

src/include/radiusd.h
src/main/session.c
src/modules/rlm_radutmp/rlm_radutmp.c

index 710c16f..bf6581c 100644 (file)
@@ -186,7 +186,6 @@ extern uint32_t             myip;
 extern int             log_auth_detail;
 extern int             auth_port;
 extern int             acct_port;
-extern int             acctfd;
 extern int             proxy_port;
 extern int             proxyfd;
 extern int             proxy_retry_count;
@@ -208,7 +207,7 @@ int         rad_accounting(REQUEST *);
 /* session.c */
 int            rad_check_ts(uint32_t nasaddr, int port, const char *user,
                             const char *sessionid);
-int            session_zap(uint32_t nasaddr, int port, const char *user,
+int            session_zap(int fd, uint32_t nasaddr, int port, const char *user,
                            const char *sessionid, uint32_t cliaddr,
                            char proto, time_t t);
 
index 39ab7a1..67ebb57 100644 (file)
@@ -35,7 +35,7 @@
 #include       "modules.h"
 
 /* End a session by faking a Stop packet to all accounting modules */
-int session_zap(uint32_t nasaddr, int port, const char *user,
+int session_zap(int sockfd, uint32_t nasaddr, int port, const char *user,
                const char *sessionid, uint32_t cliaddr, char proto, time_t t)
 {
        static unsigned char id = 0;
@@ -48,7 +48,7 @@ int session_zap(uint32_t nasaddr, int port, const char *user,
        stoppkt = rad_malloc(sizeof *stoppkt);
        memset(stoppkt, 0, sizeof stoppkt);
        stoppkt->data = NULL;
-       stoppkt->sockfd = acctfd;
+       stoppkt->sockfd = sockfd;
        stoppkt->code = PW_ACCOUNTING_REQUEST;
        stoppkt->id = id++;
        stoppkt->timestamp = t?t:time(0);
index 95792ed..53bbf64 100644 (file)
@@ -606,8 +606,8 @@ static int radutmp_checksimul(void *instance, REQUEST *request)
                                /*
                                 *      False record - zap it.
                                 */
-
-                               session_zap(u.nas_address, u.nas_port, login,
+                               session_zap(request->packet->sockfd,
+                                           u.nas_address, u.nas_port, login,
                                            session_id, u.framed_address,
                                            u.proto, 0);
                        }