Svein Hansen wrote:

> I suspected that there had to be a module in freeradius that makes
> glibc fault, so I tried to run freeradius in Valgrind:

Thanks, the output of Valgrind is very useful.

> I'm not a programmer, but can it be that radius tries a double-close
> or a double-free?

Indeed, it looks like a file stream is closed more than once.

Please try to apply these changes to src/modules/rlm_passwd/rlm_passwd.c
then recompile FreeRADIUS and test again.

Index: src/modules/rlm_passwd/rlm_passwd.c
===================================================================
RCS file: /source/radiusd/src/modules/rlm_passwd/rlm_passwd.c,v
retrieving revision 1.13.2.3
diff -u -r1.13.2.3 rlm_passwd.c
--- src/modules/rlm_passwd/rlm_passwd.c 19 Dec 2004 20:06:30 -0000      1.13.2.3
+++ src/modules/rlm_passwd/rlm_passwd.c 27 Oct 2005 10:23:00 -0000
@@ -136,8 +136,15 @@
        for (i=0; i<ht->tablesize; i++)
                if (ht->table[i])
                        destroy_password(ht->table[i]);
-       if (ht->table) free(ht->table);
-       if (ht->fp) fclose(ht->fp);
+       if (ht->table) {
+               free(ht->table);
+               ht->table = NULL:
+       }
+       if (ht->fp) {
+               fclose(ht->fp);
+               ht->fp = NULL;
+       }
+       ht->tablesize = 0;
 }
 
 static void release_ht(struct hashtable * ht){
@@ -194,7 +201,6 @@
                if(*buffer && *buffer!='\n' && (!ignorenis || (*buffer != '+' 
&& *buffer != '-')) ){
                        if(!(hashentry = mypasswd_malloc(buffer, nfields, 
&len))){
                                release_hash_table(ht);
-                               ht->tablesize = 0;
                                return ht;
                        }
                        len = string_to_entry(buffer, nfields, *ht->delimiter, 
hashentry, len);
@@ -219,7 +225,6 @@
                                        else nextlist = 0;
                                        if(!(hashentry1 = mypasswd_malloc("", 
nfields, &len))){
                                                release_hash_table(ht);
-                                               ht->tablesize = 0;
                                                return ht;
                                        }
                                        for (i=0; i<nfields; i++) 
hashentry1->field[i] = hashentry->field[i];


-- 
Nicolas Baradakis

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

Reply via email to