Hi list I have had some help from a colleague, so now my problem is solved :-) When a Dir do not hold any forwards, then num_names equals 0 in vpalias.c at line 372, realloc will call free in order to assign 0 bytes for names, and return NULL for success. When valias_select_names_end free names a double free error occurred, generates the behavior described below.
The following output from
"diff -Naur vpopmail-5.4.33/vpalias.c new/vpalias.c"
show the changes I've made in order to get it to work:

--- vpopmail-5.4.33/vpalias.c   2011-02-28 18:00:45.000000000 +0100
+++ new/vpalias.c       2013-06-13 16:10:49.269063043 +0200
@@ -315,6 +315,9 @@
    num_names = 0;

    names = malloc( max_names * sizeof(char *));
+    if (names == NULL) {
+      return(NULL);
+    }
    memset(names, 0, max_names * sizeof(char *));

    if ( (mydir = opendir(Dir)) == NULL ) return(NULL);
@@ -348,6 +351,10 @@
              for(i = 0; i < num_names; i++)
                free(names[i]);
              free(names);
+             names=NULL;
+             max_names=0;
+             num_names=0;
+             cur_name=0;
              return(NULL);
            }

@@ -369,11 +376,6 @@
        }
      }
    }
-    if (num_names < max_names) {
-      new_names = realloc( names, num_names * sizeof(char *) );
-      if (new_names != NULL)
-       names = new_names;
-    }

    if (mydir!=NULL) {
closedir(mydir);

If I have to contribute the patch in any other way, please let me know.
Best regards,
Allan Dukat

Allan Dukat writes:
Hi list I have a problem with qmailadmin-1.2.16, configured like this:
./configure \
--enable-vpopmaildir=/home/vpopmail \
--enable-htmldir=/usr/local/apache2/htdocs \
--enable-cgibindir=/usr/local/apache2/cgi-bin \
--enable-imageurl=/images/qmailadmin \
--enable-imagedir=/usr/local/apache2/htdocs/images/qmailadmin \
--enable-qmaildir=/var/qmail \
--enable-ezmlmdir=/usr/local/bin/ezmlm \
--enable-cgipath=/cgi-bin/qmailadmin \
--enable-autoresponder-path=/usr/local/bin \
--enable-vpopuser=vpopmail \
--enable-vpopgroup=vchkpw \
--disable-ezmlm-mysql \
--enable-modify-quota \
--enable-help
When adding the fist Forward I got an empty page as answer, an this in
Apache errorlog: *** glibc detected *** /usr/local/apache2/cgi-bin/qmailadmin: double free or corruption (top): 0x0000000001f326e0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f9ed7c8ab96]
/usr/local/apache2/cgi-bin/qmailadmin[0x421f04]
/usr/local/apache2/cgi-bin/qmailadmin[0x4219ad]
/usr/local/apache2/cgi-bin/qmailadmin[0x42202f]
/usr/local/apache2/cgi-bin/qmailadmin[0x40715d]
/usr/local/apache2/cgi-bin/qmailadmin[0x4070a3]
/usr/local/apache2/cgi-bin/qmailadmin[0x4054f5]
/usr/local/apache2/cgi-bin/qmailadmin[0x4130c3]
/usr/local/apache2/cgi-bin/qmailadmin[0x402db6]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f9ed7c2d76d]
/usr/local/apache2/cgi-bin/qmailadmin[0x402929]

The Forward is added, and I can add and list Forwards from now on. When
all Forward is deleted and I add a new Forward the error is repeated with
the same addresses.

Best regards,
Allan Dukat

!DSPAM:51b9dfc834132014110541!

Reply via email to