Hello,

When qmailadmin could not open/find the language file (lang/en etc) it
gives the segmentation fault in the command line and nothing is displayed on 
the web
brower.
# ./qmailadmin
Segmentation fault: 11 (core dumped)
[EMAIL PROTECTED] /tmp/qmailadmin-1.2.11]# gdb qmailadmin
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...r
(gdb) r
Starting program: /tmp/qmailadmin-1.2.11/qmailadmin 

Program received signal SIGSEGV, Segmentation fault.
0x2818edc7 in _fseeko () from /lib/libc.so.6
(gdb) bt
#0  0x2818edc7 in _fseeko () from /lib/libc.so.6
#1  0x2818f4d9 in fseek () from /lib/libc.so.6
#2  0x0804a19a in load_lang (lang=0x806c940 "en") at qmailadmin.c:318
#3  0x0804a5b8 in init_globals () at qmailadmin.c:454
#4  0x0804a6f5 in main (argc=1, argv=0xbfbfecd8) at qmailadmin.c:132
(gdb) 

When I checked the qmailadmin.c, the return value of the open_lang at
load_lang() was not handled.I added some lines in qmailadmin.c to
give a html output
when an error returned by the function.


--- qmailadmin.c.orig   Wed Feb  6 14:02:14 2008
+++ qmailadmin.c        Wed Feb  6 14:04:14 2008
@@ -305,8 +305,19 @@
   char *lang_entries;
   char *id;
   char *p;
+  int lang_err;
+
+  lang_err = open_lang (lang);
+  if (lang_err == -1 ) {
+        printf("Content-Type: text/html\r\n\r\n");
+        printf("<html> <head>\r\n");
+        printf("<title>Failed to open lang file:%s</title>\r\n",lang);
+        printf("</head>\r\n<body>\r\n");
+        printf("<h1>qmailadmin error</h1>\r\n");
+        printf("<p>Failed to open lang file: %s. Please check your lang 
directory.\r\n", lang);
+        printf("</body></html>\r\n");
+        exit(-1);
 
-  open_lang (lang);
   fseek (lang_fs, 0, SEEK_END);
   lang_size = ftell (lang_fs);
   lang_entries = malloc (lang_size);


-- 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ http://www.enderunix.org/ismail  http://www.endersys.com.tr       +
+ EnderUNIX SDT @ Tr               Endersys Consultancy Ltd.        +
+ ismail ~ enderunix.org           ismail.yenigul ~ endersys.com.tr +
+ Volunteer, Core Team Member      Project Manager                  +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TCP/IP ve Ağ güvenliği kitabının 2. baskısı çıktı!
http://dukkan.acikakademi.com

!DSPAM:47a9c3ba310541058011895!

Attachment: qmailadmin_open_lang.patch
Description: Binary data

Reply via email to