Hi,

There seems to be a bug in couriertls (~every version of courier-imap) that 
causes it to segmentation fault if there are files with no dots in the 
certificate directory (peer_cert_dir). Openssl likes to put files like Makefile
there for some strange reason.

Problem is at libcourierctl.c:496:
495:   p=strrchr(de->d_name, '.');
496:   if (!p[0] || !p[1])
497:       continue;
498:   while (*++p)

If there's no dot in the filename, there will be no p[0] nor p[1] and
the program will segmentation fault.

I guess a solution might be to just change
  if (!p[0] || !p[1])
        continue;
to
  if (!p) continue;


Regards,

Tuomas Silen

P.S. I'm not subscribed so, please, keep me in Cc if replying.

Full debug output:
Program terminated with signal 11, Segmentation fault.
#0  0x0804d538 in tls_create ()

(gdb) bt full
#0  0x0804d538 in tls_create (isserver=1, info=0xbfbaa4e0) at 
libcouriertls.c:496
        p = 0x0                                                                 
                                                                                
                     q = 0x80bd0e8 "(¿\n\b"
        fp = (FILE *) 0x80c00e0                                                 
                                                                                
                     dirp = (DIR *) 0x80ba5c8
        de = (struct dirent *) 0x80baba4                                        
                                                                                
                     x = (X509 *) 0x0
        ctx = (SSL_CTX *) 0x80607d0                                             
                                                                                
                     protocol = 0xbfbaa890 "SSL3"
        ssl_cipher_list = 0x0
        session_timeout = 0
        dhcertfile = 0x0
        certfile = 0xbfbaa927 "/etc/ssl/certs/mail.imapd.pem"
        s = 0xbfbaafb1 "::ffff:1.2.3.4"
        stat_buf = {st_dev = 2051, __pad1 = 0, st_ino = 46658, st_mode = 16877, 
st_nlink = 2, st_uid = 0, st_gid = 0, st_rdev = 0, __pad2 = 0, st_size = 4096,
            st_blksize = 4096, st_blocks = 8, st_atim = {tv_sec = 1144808734, 
tv_nsec = 0}, st_mtim = {tv_sec = 1144808734, tv_nsec = 0}, 
            st_ctim = {tv_sec = 1144808734, tv_nsec = 0}, __unused4 = 0, 
__unused5 = 0}
        peer_cert_dir = 0xbfbaa83f "/etc/ssl/certs"
        peer_cert_file = 0x0
        n = 0
        info_copy = (struct tls_info *) 0x80606d8                               
                                                                                
             #1  0x0804b8c8 in dossl (fd=0, argn=3, argc=6, argv=0xbfbaa5f4) at 
starttls.c:591
        ctx = (SSL_CTX *) 0xbfbaa568
        ssl = (SSL *) 0x48c35ff4
        stdin_fd = -1208353984
        stdout_fd = -1078287000
        info = {peer_verify_domain = 0x0, connect_callback = 0x804b026 
<verify_connection>, tls_err_msg = 0x804a790 <ssl_errmsg>, 
             getconfigvar = 0x804e860 <getenv_wrapper>, app_data = 0x0, 
tlscache = 0x0, isserver = 0, connect_interrupted = 0, accept_interrupted = 0}
#2  0x0804c307 in main (argc=6, argv=0xbfbaa5f4) at starttls.c:858



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to