Angus,

You should try
gdb> f 1
given the output from bt. The f 5 was just an example. Here clearly frame #1 deserves a closer look.


Aaron, is it possible that getopt on freebsd doesn't allocate memory for the optarg values? Perhaps a my_strdup(optarg) is sufficient here. I'll test it myself.


Angus,

Could you please try the attached patch. It's against the dbmail_2_0_branch cvs, so I'm not sure it'l apply to 2.0.1 though. Aaron, what's your take ?


Angus Jordan wrote:
Hi Paul,

Thanks for the quick tut on gdb.  Useful information.  Not sure if
this is enough information, but here is the output I got:

su-2.05b# gdb /usr/local/sbin/dbmail-users
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"...
(gdb) run -c realuser -s [EMAIL PROTECTED]
Starting program: /usr/local/sbin/dbmail-users -c realuser -s [EMAIL PROTECTED]
Opening connection to database...
Opening connection to authentication...
Ok. Connected

Program received signal SIGSEGV, Segmentation fault.
0x2807feaf in makemd5 (buf=0x8054240 "\001") at dbmd5.c:51
51              gdm_md5_update(&mycontext, buf, strlen(buf));
(gdb) bt
#0  0x2807feaf in makemd5 (buf=0x8054240 "\001") at dbmd5.c:51
#1  0x0804a80d in mkpassword (
    user=0x6 <Error reading address 0x6: Bad address>,
    passwd=0x31 <Error reading address 0x31: Bad address>,
    passwdtype=0x28099de0 "md5sum", passwdfile=0x28099de0 "md5sum",
    password=0x240, enctype=0x0) at user.c:705
#2  0x0804b180 in main (argc=5, argv=0xbfbfeccc) at user.c:473
(gdb) f 5
#0  0x00000000 in ?? ()
(gdb) f 6
#0  0x00000000 in ?? ()
(gdb)


Looks like an issue in dbmd5.c?  Interesting.

Perhaps it *is* something to do with MySQL 4.1.

Thanks,

Angus


On Mon, 20 Dec 2004 18:30:56 +0100, Paul J Stevens <[EMAIL PROTECTED]> wrote:

Angus,

Only one solution: gdb

#> gdb /usr/sbin/dbmail-smtp

gdb> run -c user -s [EMAIL PROTECTED]

... segfault ...

gdb> bt

this will list a number of call that led up to the segfault. Copy-and-paste to 
your email client. Look for the
first one related to dbmail or mysql, skipping the libc stuff. This line has a 
number in front of it. That's
the stack-frame number and very likely the one that triggered the signal 11. In 
gdb select this number, i.e.

gdb> f 5

This will list more calls. Copy and paste them all.

gdb> f 6

jump back a frame, and copy the output.

etc...

The output should give us a pretty good idea about what's going on.

You could also provide me with shell access, and I'll do it myself.

O yeah, and make sure your dbmail binaries are installed with symbols: CFLAGS 
+= -g

This could be a mysql problem. mysql-4.1 is not that well tested around here. I 
don't use it, and I don't
think Aaron and Ilja use it.

But it could be all kind of other issues as well. No way to tell without a 
backtrace.

Really though, supporting these kind of issues would become much simpler if we 
could integrate this stuff in
dbmail itself, like python's execinfo. I'll look into that some more, soon.


Angus Jordan wrote:

Ok.

Does anyone else have any ideas, please?

Thank you,
Angus


On Sun, 19 Dec 2004 14:03:51 +0100, tonton1664 <[EMAIL PROTECTED]> wrote:


Angus Jordan wrote:


Hmm...

I'm not even sure if I have libgmime installed at all.  Is this
required to run dbmail 2.0.1?

I definitely haven't installed it on purpose, and I don't see it in my
packages database.  Any idea if it's installed by default in FreeBSD
5.1, 5.2.1, or 5.3?


sorry, this was for the experimental version 2.1.x. 2.0.1 doesn't need
libgmime

_______________________________________________
Dbmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail


_______________________________________________
Dbmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail



--
  ________________________________________________________________
  Paul Stevens                                  mailto:[EMAIL PROTECTED]
  NET FACILITIES GROUP                     PGP: finger [EMAIL PROTECTED]
  The Netherlands________________________________http://www.nfg.nl


_______________________________________________
Dbmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail


--
  ________________________________________________________________
  Paul Stevens                                         [EMAIL PROTECTED]
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands_______________________________________www.nfg.nl
diff -urNad dbmail-2.0.2/user.c /tmp/dpep.osI8ri/dbmail-2.0.2/user.c
--- dbmail-2.0.2/user.c	2004-12-21 11:06:01.000000000 +0100
+++ /tmp/dpep.osI8ri/dbmail-2.0.2/user.c	2004-12-21 11:06:22.000000000 +0100
@@ -223,7 +223,7 @@
 				mode_toomany = 1;
 			mode = opt;
 			if (optarg && strlen(optarg))
-				user = optarg;
+				user = my_strdup(optarg);
 			break;
 
 		case 'x':
@@ -231,7 +231,7 @@
 				mode_toomany = 1;
 			mode = opt;
 			if (optarg && strlen(optarg))
-				alias = optarg;
+				alias = my_strdup(optarg);
 			break;
 
 		case 'l':
@@ -241,7 +241,7 @@
 				mode_toomany = 1;
 			mode = opt;
 			if (optarg && strlen(optarg))
-				userspec = optarg;
+				userspec = my_strdup(optarg);
 			break;
 
 		case 'i':
@@ -252,13 +252,13 @@
 		/* Minor options */
 		case 'w':
 			change_flags.newpasswd = 1;
-			passwd = optarg;
+			passwd = my_strdup(optarg);
 			break;
 
 		case 'W':
 			change_flags.newpasswd = 1;
 			if (optarg && strlen(optarg)) {
-				passwdfile = optarg;
+				passwdfile = my_strdup(optarg);
 				change_flags.newpasswdfile = 1;
 			} else {
 				change_flags.newpasswdstdin = 1;
@@ -267,12 +267,12 @@
 
 		case 'u':
 			change_flags.newuser = 1;
-			newuser = optarg;
+			newuser = my_strdup(optarg);
 			break;
 
 		case 'p':
 			if (!passwdtype)
-				passwdtype = optarg;
+				passwdtype = my_strdup(optarg);
 			// else
 				// Complain about only one type allowed.
 			break;
@@ -280,7 +280,7 @@
 		case 'P':
 			change_flags.newpasswdshadow = 1;
 			if (optarg && strlen(optarg))
-				passwdfile = optarg;
+				passwdfile = my_strdup(optarg);
 			else
 				passwdfile = SHADOWFILE;
 			passwdtype = "shadow";
@@ -522,6 +522,19 @@
 	 * Be sure that all of these are NULL safe! */
 freeall:
 
+	if (user)
+		my_free(user);
+	if (passwd)
+		my_free(passwd);
+	if (alias)
+		my_free(alias);
+	if (userspec)
+		my_free(userspec);
+	if (passwdfile)
+		my_free(passwdfile);
+	if (newuser)
+		my_free(newuser);
+
 	/* Free the lists. */
 	if (alias_del.start)
 		list_freelist(&alias_del.start);

Reply via email to