ptloader segfaulting while looking up LDAP groups

Igor Brezac igor at ipass.net
Wed Aug 9 14:49:23 EDT 2006



On Wed, 9 Aug 2006, Ben Poliakoff wrote:

> * Igor Brezac <igor at ipass.net> [20060809 07:39]:
>>
>>
>> On Tue, 8 Aug 2006, Ben Poliakoff wrote:
>>
>>> ptloader is segfaulting on multiple servers in my test environment when
>>> the user that is connecting for IMAP service is found in more than one
>>> group.
>>>
>>> I have a core file, but it doesn't seem that useful since a number of
>>> the libraries that ptloader links to don't currently have debugging
>>> symbols...
>>
>> Can you provide backtrace?
>>
>
> Yes, here's a backtrace...
>
> Core was generated by `ptloader'.
> Program terminated with signal 11, Segmentation fault.
> ...
> #0  0x00002b180d157c00 in strlen () from /lib/libc.so.6
> (gdb) bt
> #0  0x00002b180d157c00 in strlen () from /lib/libc.so.6
> #1  0x00000000004079f7 in ptsmodule_make_authstate_filter (canon_id=0x0,
>    size=0, reply=0x6e, dsize=0x1, newstate=0x7fff9e958860) at
> ldap.c:1070
> #2  0x0000000000407de6 in myauthstate (identifier=0x0, size=4,
>    reply=0x7fff9e9588d8, dsize=0x7fff9e9588e4) at ldap.c:1217
> #3  0x000000000040590a in ptsmodule_make_authstate (
>    identifier=0x7fff9e9588f0 "benp", size=4, reply=0x7fff9e9588d8,
>    dsize=0x7fff9e9588e4) at ptloader.c:120
> #4  0x0000000000405b60 in service_main_fd (c=7, argc=4, argv=0x5db69c,
>    envp=0x0) at ptloader.c:235
> #5  0x000000000040821a in main (argc=6099056, argv=0x7fff9e959258,
>    envp=0x7fff9e959268) at service-thread.c:304
>
> Ben
>

The last commit has an issue.

Please try this patch and report back:

--- ldap.c.orig	2006-08-09 14:42:05.023665000 -0400
+++ ldap.c	2006-08-09 14:42:41.274455000 -0400
@@ -1065,11 +1065,11 @@
                  continue;

              strcpy((*newstate)->groups[i].id, "group:");
+
  	    int j;
-	    strcpy((*newstate)->groups[i].id, "group:");
-	    for(j =0; j < strlen(vals[i]); j++) {
-	      if(isupper(vals[i][j]))
-		vals[i][j]=tolower(vals[i][j]);
+	    for(j =0; j < strlen(vals[0]); j++) {
+	      if(isupper(vals[0][j]))
+		vals[0][j]=tolower(vals[0][j]);
  	    }

              strlcat((*newstate)->groups[i].id, vals[0],

-- 
Igor


More information about the Info-cyrus mailing list