help-gnu-radius
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gnu-radius] Simultaneous-Use


From: fondy
Subject: [Help-gnu-radius] Simultaneous-Use
Date: Thu, 01 Aug 2002 13:10:40 +0800

Hi,

I am using gnu-radius-0.96. 

radutmp only record one,once new user accted, then update to new user record, 
but always only one record .then, rad_check_multi() useless, and when 
logout,always warning :
radlog(L_ERR,_("logout: entry for NAS %s port %d has wrong ID (expected %s 
found %s)")

I think this function has some problem!?
        
int
radutmp_putent(filename, ut, status)
        char *filename;
        struct radutmp *ut;
        int status;
{
        radut_file_t file;
        struct radutmp *ent;
        int rc = PUTENT_SUCCESS;

        if ((file = rut_setent(filename, 0)) == NULL)
                return PUTENT_NOENT;

        /* find matching entry */
        while ((ent = rut_getent(file)) != NULL &&
               (ent->nas_address != ut->nas_address ||
                ent->nas_port    != ut->nas_port))
                /* nothing */;

/*****************************************************
I always use the same nas_address, and the same nas_port,
how can find matching entry through nas_address ,nas_port?
******************************************************/


        if (!ent) {
                rc = PUTENT_NOENT;
        } else if (strncmp(ent->session_id, ut->session_id,
                           sizeof(ent->session_id)) == 0) {
                /* Exact match. */

                switch (status) {
                case DV_ACCT_STATUS_TYPE_ALIVE:
                        if (ent->type == P_LOGIN) {
                                ut->time = ent->time;
                                if (ent->login[0] != 0)
                                        rc = PUTENT_UPDATE;
                        }
                        break;
                        
                case DV_ACCT_STATUS_TYPE_START:
                        if (ent->time < ut->time)
                                break;
                        if (ent->type == P_LOGIN) {
                                radlog(L_INFO,
                _("login: entry for NAS %s port %d duplicate"),
                                       format_ipaddr(ntohl(ent->nas_address)),
                                       ent->nas_port);
                        } else {
                                radlog(L_INFO,
                _("login: entry for NAS %s port %d wrong order"),
                                       format_ipaddr(ntohl(ent->nas_address)),
                                       ent->nas_port);
                        }
                }

        } else { /* session IDs differ */
                        
                if (status == DV_ACCT_STATUS_TYPE_STOP) {
                        if (ent->type == P_LOGIN) {
                                radlog(L_ERR,
   _("logout: entry for NAS %s port %d has wrong ID (expected %s found %s)"),
                                       format_ipaddr(ntohl(ut->nas_address)),
                                       ent->nas_port,
                                       ut->session_id,
                                       ent->session_id);
                        }
                }

                
        }

        if (ent) 
                ut->duration = ut->time - ent->time;
        
        switch (status) {
        case DV_ACCT_STATUS_TYPE_START:
        case DV_ACCT_STATUS_TYPE_ALIVE:
                ut->type = P_LOGIN;
                break;

        case DV_ACCT_STATUS_TYPE_STOP:
                ut->type = P_IDLE;
                if (!ent) {
                        radlog(L_ERR,
                         _("logout: login entry for NAS %s port %d not found"),
                               format_ipaddr(ntohl(ut->nas_address)), 
ut->nas_port);
                }
                break;
        }
        rut_putent(file, ut);

/*****************************************************
rut_setent(filename, 0)   // append = 0, file->eof = 0
rut_putent()  
// if not eof(),then always update but not append except the first record,so 
always only one record in radutmp
******************************************************/

        rut_endent(file);
        return rc;
}
/*****************************************************
Never seen delete the record in radutmp but update P_LOGIN to 
P_IDLE? Seens not very good?
******************************************************/


Sorry if this is a fool question.
Thanks for help!

fondy





===================================================================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]