Hi, My name is KOZUKA Masahiro.
I use freeradius-0.8 with PostgreSQL for authorize, for accounting.
But in accounting, I often come accross the following error....
 --
Sun Mar  2 00:39:16 2003 : Error: rlm_sql (sql): Couldn't update SQL accountingSTOP 
record - ERROR:  Bad numeric input format ''
Sun Mar  2 01:53:39 2003 : Error: rlm_sql: Couldn't insert SQL accounting STOP record 
- ERROR:  pg_atoi: zero-length string
 --
These errors occured because the SQL, including '' for an integer item, 
generated by "'%{Acct-Delay-Time}'".

So I use freeradius-0.8 with the folloing patch.
This patch, for xlat.c, which changes the usage of valuepair2str.
The function, valuepair2str, is written to return the propper value
if the packet doesn't have target section.
I think that  no checking wheter the argument isn't NULL, is better, isn't it?

 --
--- freeradius-0.8.1/src/main/xlat.c    Wed Nov 13 02:29:03 2002
+++ freeradius-0.8.1.new/src/main/xlat.c        Mon Mar  3 15:19:47 2003
@@ -225,8 +225,8 @@
         *      Find an attribute from the reply.
         */
        if (strncasecmp(attrname,"reply:",6) == 0) {
-               if((tmpda = dict_attrbyname(&attrname[6])) && 
-                               (tmppair = pairfind(request->reply->vps, 
tmpda->attr))) {
+               if ((tmpda = dict_attrbyname(&attrname[6]))) {
+                       tmppair = pairfind(request->reply->vps, tmpda->attr);
                        q += valuepair2str(q,freespace,tmppair,tmpda->type, func);
                        found = 1;
                }
@@ -235,8 +235,8 @@
                 *      Find an attribute from the request.
                 */
        } else if (strncasecmp(attrname,"request:",8) == 0) {
-               if((tmpda = dict_attrbyname(&attrname[8])) && 
-                               (tmppair = pairfind(request->packet->vps, 
tmpda->attr))) {
+               if ((tmpda = dict_attrbyname(&attrname[8]))) {
+                       tmppair = pairfind(request->packet->vps, tmpda->attr);
                        q += valuepair2str(q,freespace,tmppair,tmpda->type, func);
                        found = 1;
                }
@@ -246,8 +246,8 @@
                 */
        } else if ((strncasecmp(attrname,"proxy-reply:",12) == 0) &&
                   (request->proxy_reply != NULL)) {
-               if((tmpda = dict_attrbyname(&attrname[12])) && 
-                               (tmppair = pairfind(request->proxy_reply->vps, 
tmpda->attr))) {
+               if ((tmpda = dict_attrbyname(&attrname[12]))) {
+                       tmppair = pairfind(request->proxy_reply->vps, tmpda->attr);
                        q += valuepair2str(q,freespace,tmppair,tmpda->type, func);
                        found = 1;
                }
@@ -268,10 +268,9 @@
                tmpda = dict_attrbyname(attrname);
                
                if (tmpda) {
-                       if ((tmppair = pairfind(request->packet->vps,tmpda->attr)) != 
NULL) {
-                               q += valuepair2str(q,freespace,tmppair,tmpda->type, 
func);
-                               found = 1;
-                       } /* else silently fail */
+                       tmppair = pairfind(request->packet->vps,tmpda->attr);
+                       q += valuepair2str(q,freespace,tmppair,tmpda->type, func);
+                       found = 1;
                } else {
                        /*
                         *      No attribute by that name, return an error.
 --
-- 
{^-^}[EMAIL PROTECTED] / KOZUKA Masahiro

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

Reply via email to