[Date Prev][Date Next] [Chronological] [Thread] [Top]

back-sql: custom attribute list: segmentation fault



Hi all,

I'm using OpenLDAP (2.2.6) with back-sql and postgresql (7.3.4).
My LDAP tree structure is very similar to the back-sql example. There is one root dcObject (dn: dc=panline,dc=net). Trying JXplorer (a Java LDAP GUI browser) and performing a simple search I have caused the slapd server to segfault. I have found that


ldapsearch -b "dc=panline,dc=net" "(&(objectClass=*)(gecos=test))"

works fine, but

ldapsearch -b "dc=panline,dc=net" "(&(objectClass=*)(gecos=test))" gecos

causes slapd to segfault. I started slapd in debug mode and perform the second ldapsearch. I have noticed that
it tries to obtain the custom attribute list for object with dn=dc=panlne,dc=net and segfaults.
Is there any limit in constructing ldapsearch with back-sql or I have inserted some bad data within ldap meta data?
Any help would be very appreciated! Thanks in advance


Nikola Ivancevic

slapd debug output (slapd -d 4095)

...
backsql_get_db_conn(): first call -- reading schema map
==>load_schema_map()
load_schema_map(): at_query 'SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?'
load_schema_map(): objectClass 'dcObject': keytbl='dc_object' keycol='id'
expect_return: add=0, del=0; attributes:
load_schema_map(): autoadding 'objectClass' and 'ref' mappings
********'dc'
name='dc',sel_expr='dc_object.dc' from='dc_object'join_where='',add_proc=''delete_proc=''
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT dc_object.dc AS dc FROM dc_object WHERE dc_object.id=?'
load_schema_map(): objectClass 'organizationalUnit': keytbl='organizational_unit' keycol='id'
expect_return: add=0, del=0; attributes:
load_schema_map(): autoadding 'objectClass' and 'ref' mappings
********'ou'
name='ou',sel_expr='organizational_unit.ou' from='organizational_unit'join_where='',add_proc=''delete_proc=''
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT organizational_unit.ou AS ou FROM organizational_unit WHERE organizational_unit.id=?'
load_schema_map(): objectClass 'myposixAccount': keytbl='users' keycol='id'
create_proc='select create_posixAccount()'
delete_proc='select delete_posixAccount(?)'
expect_return: add=0, del=0; attributes:
load_schema_map(): autoadding 'objectClass' and 'ref' mappings
********'userPassword'
name='userPassword',sel_expr='users.userpassword' from='users'join_where='',add_proc='{ call
set_posixAccount_userpassword(?,?) }'delete_proc='{ call
del_posixAccount_userpassword(?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.userpassword AS userPassword FROM users WHERE users.id=?'
********'loginShell'
name='loginShell',sel_expr='users.loginshell' from='users'join_where='',add_proc='{
call set_posixAccount_loginshell(?,?) }'delete_proc='{ call
del_posixAccount_loginshell(?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.loginshell AS loginShell FROM users WHERE users.id=?'
********'uidNumber'
name='uidNumber',sel_expr='users.uidnumber' from='users'join_where='',add_proc='{
call set_posixAccount_uidnumber(?,?) }'delete_proc='{ call
del_posixAccount_uidnumber(?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.uidnumber AS uidNumber FROM users WHERE users.id=?'
********'gidNumber'
name='gidNumber',sel_expr='users.gidnumber' from='users'join_where='',add_proc='{
call set_posixAccount_gidnumber(?,?) }'delete_proc='{ call
del_posixAccount_gidnumber(?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.gidnumber AS gidNumber FROM users WHERE users.id=?'
********'uid'
name='uid',sel_expr='users.username' from='users'join_where='',add_proc='{ call
set_posixAccount_uid(?,?) }'delete_proc='{ call
del_posixAccount_gidnumber(?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.username AS uid FROM users WHERE users.id=?'
********'cn'
name='cn',sel_expr='users.username' from='users'join_where='',add_proc='{ call
set_posixAccount_cn(?,?) }'delete_proc='{ call del_posixAccount_cn(?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.username AS cn FROM users WHERE users.id=?'
********'homeDirectory'
name='homeDirectory',sel_expr='users.homedirectory' from='users'join_where='',add_proc='{
call set_posixAccount_homedirectory(?,?) }'delete_proc='{ call
del_posixAccount_homedirectory(?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.homedirectory AS homeDirectory FROM users WHERE users.id=?'
********'description'
name='description',sel_expr='users.description' from='users'join_where='',add_proc='{ call set_posixAccount_description (?,?) }'delete_proc='{ call del_posixAccount_description (?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.description AS description FROM users WHERE users.id=?'
********'gecos'
name='gecos',sel_expr='users.gecos' from='users'join_where='',add_proc='{ call set_posixAccount_gecos (?,?) }'delete_proc='{
call del_posixAccount (?,?) }'
sel_expr_u=''
load_schema_map(): preconstructed query 'SELECT users.gecos AS gecos FROM users WHERE users.id=?'
<==load_schema_map()
<==backsql_get_db_conn()
==>backsql_free_db_conn()
backsql_free_db_conn(): closing db connection
==>backsql_close_db_conn()
<==backsql_close_db_conn()
<==backsql_free_db_conn()
<==backsql_db_open(): test succeeded, schema map loaded
slapd starting
daemon: added 6r
daemon: select: listen=6 active_threads=0 tvp=NULL
daemon: activity on 1 descriptors
daemon: new connection on 9
conn=0 fd=9 ACCEPT from IP=10.193.0.9:8824 (IP=0.0.0.0:389)
daemon: added 9r
daemon: activity on:
daemon: select: listen=6 active_threads=0 tvp=NULL
daemon: activity on 1 descriptors
daemon: activity on: 9r
daemon: read activity on 9
connection_get(9)
connection_get(9): got connid=0
connection_read(9): checking for input on id=0
ber_get_next
ldap_read: want=8, got=8
0000: 30 0c 02 01 01 60 07 02 0....`..
ldap_read: want=6, got=6
0000: 01 03 04 00 80 00 ......
ber_get_next: tag 0x30 len 12 contents:
ber_dump: buf=0x0815c010 ptr=0x0815c010 end=0x0815c01c len=12
0000: 02 01 01 60 07 02 01 03 04 00 80 00 ...`........
ber_get_next
ldap_read: want=8 error=Resource temporarily unavailable
ber_get_next on fd 9 failed errno=11 (Resource temporarily unavailable)
do_bind
daemon: select: listen=6 active_threads=0 tvp=NULL
ber_scanf fmt ({imt) ber:
ber_dump: buf=0x0815c010 ptr=0x0815c013 end=0x0815c01c len=9
0000: 60 07 02 01 03 04 00 80 00 `........
ber_scanf fmt (m}) ber:
ber_dump: buf=0x0815c010 ptr=0x0815c01a end=0x0815c01c len=2
0000: 00 00 ..
>>> dnPrettyNormal: <>
<<< dnPrettyNormal: <>, <>
do_bind: version=3 dn="" method=128
conn=0 op=0 BIND dn="" method=128
send_ldap_result: conn=0 op=0 p=3
send_ldap_result: err=0 matched="" text=""
send_ldap_response: msgid=1 tag=97 err=0
ber_flush: 14 bytes to sd 9
0000: 30 0c 02 01 01 61 07 0a 01 00 04 00 04 00 0....a........
ldap_write: want=14, written=14
0000: 30 0c 02 01 01 61 07 0a 01 00 04 00 04 00 0....a........
conn=0 op=0 RESULT tag=97 err=0 text=
do_bind: v3 anonymous bind
daemon: activity on 1 descriptors
daemon: activity on: 9r
daemon: read activity on 9
connection_get(9)
connection_get(9): got connid=0
connection_read(9): checking for input on id=0
ber_get_next
ldap_read: want=8, got=8
0000: 30 52 02 01 02 63 4d 04 0R...cM.
ldap_read: want=76, got=76
0000: 11 64 63 3d 70 61 6e 6c 69 6e 65 2c 64 63 3d 6e .dc=panline,dc=n
0010: 65 74 0a 01 02 0a 01 00 02 01 00 02 01 00 01 01 et..............
0020: 00 a0 20 87 0b 6f 62 6a 65 63 74 43 6c 61 73 73 .. ..objectClass
0030: a4 11 04 05 67 65 63 6f 73 30 08 80 06 6e 69 6b ....gecos0...nik
0040: 6f 6c 61 30 07 04 05 67 65 63 6f 73 ola0...gecos
ber_get_next: tag 0x30 len 82 contents:
ber_dump: buf=0x0815bfd8 ptr=0x0815bfd8 end=0x0815c02a len=82
0000: 02 01 02 63 4d 04 11 64 63 3d 70 61 6e 6c 69 6e ...cM..dc=panlin
0010: 65 2c 64 63 3d 6e 65 74 0a 01 02 0a 01 00 02 01 e,dc=net........
0020: 00 02 01 00 01 01 00 a0 20 87 0b 6f 62 6a 65 63 ........ ..objec
0030: 74 43 6c 61 73 73 a4 11 04 05 67 65 63 6f 73 30 tClass....gecos0
0040: 08 80 06 6e 69 6b 6f 6c 61 30 07 04 05 67 65 63 ...nikola0...gec
0050: 6f 73 os
ber_get_next
ldap_read: want=8 error=Resource temporarily unavailable
ber_get_next on fd 9 failed errno=11 (Resource temporarily unavailable)
do_search
ber_scanf fmt ({miiiib) ber:
ber_dump: buf=0x0815bfd8 ptr=0x0815bfdb end=0x0815c02a len=79
0000: 63 4d 04 11 64 63 3d 70 61 6e 6c 69 6e 65 2c 64 cM..dc=panline,d
0010: 63 3d 6e 65 74 0a 01 02 0a 01 00 02 01 00 02 01 c=net...........
0020: 00 01 01 00 a0 20 87 0b 6f 62 6a 65 63 74 43 6c ..... ..objectCl
0030: 61 73 73 a4 11 04 05 67 65 63 6f 73 30 08 80 06 ass....gecos0...
0040: 6e 69 6b 6f 6c 61 30 07 04 05 67 65 63 6f 73 nikola0...gecos
>>> dnPrettyNormal: <dc=panline,dc=net>
=> ldap_bv2dn(dc=panline,dc=net,0)
<= ldap_bv2dn(dc=panline,dc=net,0)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=panline,dc=net,272)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=panline,dc=net,272)=0
<<< dnPrettyNormal: <dc=panline,dc=net>, <dc=panline,dc=net>
SRCH "dc=panline,dc=net" 2 0 0 0 0
daemon: select: listen=6 active_threads=0 tvp=NULL
begin get_filter
AND
begin get_filter_list
begin get_filter
PRESENT
ber_scanf fmt (m) ber:
ber_dump: buf=0x0815bfd8 ptr=0x0815c001 end=0x0815c02a len=41
0000: 87 0b 6f 62 6a 65 63 74 43 6c 61 73 73 a4 11 04 ..objectClass...
0010: 05 67 65 63 6f 73 30 08 80 06 6e 69 6b 6f 6c 61 .gecos0...nikola
0020: 30 07 04 05 67 65 63 6f 73 0...gecos
end get_filter 0
begin get_filter
SUBSTRINGS
begin get_ssa
ber_scanf fmt ({m) ber:
ber_dump: buf=0x0815bfd8 ptr=0x0815c00e end=0x0815c02a len=28
0000: 00 11 04 05 67 65 63 6f 73 30 08 80 06 6e 69 6b ....gecos0...nik
0010: 6f 6c 61 30 07 04 05 67 65 63 6f 73 ola0...gecos
ber_scanf fmt (m) ber:
ber_dump: buf=0x0815bfd8 ptr=0x0815c019 end=0x0815c02a len=17
0000: 80 06 6e 69 6b 6f 6c 61 30 07 04 05 67 65 63 6f ..nikola0...geco
0010: 73 s
INITIAL
end get_ssa
end get_filter 0
end get_filter_list
end get_filter 0
filter: (&(objectClass=*)(gecos=nikola*))
ber_scanf fmt ({M}}) ber:
ber_dump: buf=0x0815bfd8 ptr=0x0815c021 end=0x0815c02a len=9
0000: 00 07 04 05 67 65 63 6f 73 ....gecos
attrs: gecos
conn=0 op=1 SRCH base="dc=panline,dc=net" scope=2 deref=0 filter="(&(objectClass=*)(gecos=nikola*))"
conn=0 op=1 SRCH attr=gecos
==>backsql_search(): base='dc=panline,dc=net', filter='(&(objectClass=*)(gecos=nikola*))', scope=2, deref=0, attrsonly=0, attributes to load: custom list
==>backsql_get_db_conn()
==>backsql_open_db_conn()
backsql_open_db_conn(): connected, adding to tree
<==backsql_open_db_conn()
<==backsql_get_db_conn()
==>backsql_attrlist_add(): adding 'gecos' to list
==>backsql_oc_get_candidates(): oc='organizationalUnit'
==>backsql_srch_query()
==>backsql_process_filter()
==>backsql_process_filter()
<==backsql_process_filter() succeeded
==>backsql_process_filter()
<==backsql_process_filter() succeeded
<==backsql_process_filter() succeeded
<==backsql_srch_query() returns SELECT DISTINCT ldap_entries.id,organizational_unit.id,text('organizationalUnit') AS objectClass,ldap_entries.dn AS dn FROM ldap_entries,organizational_unit WHERE organizational_unit.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND upper(ldap_entries.dn) LIKE upper(?) AND (1=1 AND 1=1)
Constructed query: SELECT DISTINCT ldap_entries.id,organizational_unit.id,text('organizationalUnit') AS objectClass,ldap_entries.dn AS dn FROM ldap_entries,organizational_unit WHERE organizational_unit.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND upper(ldap_entries.dn) LIKE upper(?) AND (1=1 AND 1=1)
id: '2'
(sub)dn: '%DC=PANLINE,DC=NET'
backsql_oc_get_candidates(): added entry id=2, keyval=1 dn='ou=users,dc=panline,dc=net'
<==backsql_oc_get_candidates(): 1
==>backsql_oc_get_candidates(): oc='dcObject'
==>backsql_srch_query()
==>backsql_process_filter()
==>backsql_process_filter()
<==backsql_process_filter() succeeded
==>backsql_process_filter()
<==backsql_process_filter() succeeded
<==backsql_process_filter() succeeded
<==backsql_srch_query() returns SELECT DISTINCT ldap_entries.id,dc_object.id,text('dcObject') AS objectClass,ldap_entries.dn
AS dn FROM ldap_entries,dc_object WHERE dc_object.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND upper(ldap_entries.dn) LIKE upper(?) AND (1=1 AND 1=1)
Constructed query: SELECT DISTINCT ldap_entries.id,dc_object.id,text('dcObject') AS objectClass,ldap_entries.dn AS dn FROM ldap_entries,dc_object WHERE dc_object.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND upper(ldap_entries.dn) LIKE upper(?) AND (1=1 AND 1=1)
id: '1'
(sub)dn: '%DC=PANLINE,DC=NET'
backsql_oc_get_candidates(): added entry id=1, keyval=1 dn='dc=panline,dc=net'
<==backsql_oc_get_candidates(): 1
==>backsql_oc_get_candidates(): oc='myposixAccount'
==>backsql_srch_query()
==>backsql_process_filter()
==>backsql_process_filter()
<==backsql_process_filter() succeeded
==>backsql_process_filter()
==>backsql_process_filter_attr(gecos)
==>backsql_attrlist_add(): attribute 'gecos' is in list
expr: 'users.gecos' 'upper(users.gecos)'
<==backsql_process_filter_attr(gecos)
<==backsql_process_filter() succeeded
<==backsql_process_filter() succeeded
<==backsql_srch_query() returns SELECT DISTINCT ldap_entries.id,users.id,text('myposixAccount') AS objectClass,ldap_entries.dn AS dn FROM ldap_entries,users WHERE users.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND upper(ldap_entries.dn) LIKE upper(?) AND (1=1 AND (upper(users.gecos) LIKE 'NIKOLA%'))
Constructed query: SELECT DISTINCT ldap_entries.id,users.id,text('myposixAccount') AS objectClass,ldap_entries.dn AS dn FROM
ldap_entries,users WHERE users.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND upper(ldap_entries.dn) LIKE upper(?) AND (1=1 AND (upper(users.gecos) LIKE 'NIKOLA%'))
id: '4'
(sub)dn: '%DC=PANLINE,DC=NET'
backsql_oc_get_candidates(): added entry id=8, keyval=5 dn='cn=nikola,ou=users,dc=panline,dc=net'
<==backsql_oc_get_candidates(): 1
backsql_search(): loading data for entry id=8, oc_id=4, keyval=5
==>backsql_id2entry()
>>> dnPrettyNormal: <cn=nikola,ou=users,dc=panline,dc=net>
=> ldap_bv2dn(cn=nikola,ou=users,dc=panline,dc=net,0)
<= ldap_bv2dn(cn=nikola,ou=users,dc=panline,dc=net,0)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=nikola,ou=users,dc=panline,dc=net,272)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=nikola,ou=users,dc=panline,dc=net,272)=0
<<< dnPrettyNormal: <cn=nikola,ou=users,dc=panline,dc=net>, <cn=nikola,ou=users,dc=panline,dc=net>
backsql_id2entry(): custom attribute list
==>backsql_get_attr_vals(): oc='myposixAccount' attr='gecos' keyval=5
<==backsql_get_attr_vals()
<==backsql_id2entry()
=> test_filter
AND
=> test_filter_and
=> test_filter
PRESENT
=> access_allowed: search access to "cn=nikola,ou=users,dc=panline,dc=net" "objectClass" requested
=> acl_get: [1] check attr objectClass
<= acl_get: [1] acl cn=nikola,ou=users,dc=panline,dc=net attr: objectClass
=> acl_mask: access to entry "cn=nikola,ou=users,dc=panline,dc=net", attr "objectClass" requested
=> acl_mask: to all values by "", (=n)
<= check a_dn_pat: self
<= check a_dn_pat: *
<= acl_mask: [2] applying read(=rscx) (stop)
<= acl_mask: [2] mask: read(=rscx)
=> access_allowed: search access granted by read(=rscx)
<= test_filter 6
=> test_filter
SUBSTRINGS
begin test_substrings_filter
=> access_allowed: search access to "cn=nikola,ou=users,dc=panline,dc=net" "gecos" requested
=> acl_get: [1] check attr gecos
<= acl_get: [1] acl cn=nikola,ou=users,dc=panline,dc=net attr: gecos
=> acl_mask: access to entry "cn=nikola,ou=users,dc=panline,dc=net", attr "gecos" requested
=> acl_mask: to all values by "", (=n)
<= check a_dn_pat: self
<= check a_dn_pat: *
<= acl_mask: [2] applying read(=rscx) (stop)
<= acl_mask: [2] mask: read(=rscx)
=> access_allowed: search access granted by read(=rscx)
<= test_filter 6
<= test_filter_and 6
<= test_filter 6
=> send_search_entry: dn="cn=nikola,ou=users,dc=panline,dc=net"
=> access_allowed: read access to "cn=nikola,ou=users,dc=panline,dc=net" "entry" requested
=> acl_get: [1] check attr entry
<= acl_get: [1] acl cn=nikola,ou=users,dc=panline,dc=net attr: entry
=> acl_mask: access to entry "cn=nikola,ou=users,dc=panline,dc=net", attr "entry" requested
=> acl_mask: to all values by "", (=n)
<= check a_dn_pat: self
<= check a_dn_pat: *
<= acl_mask: [2] applying read(=rscx) (stop)
<= acl_mask: [2] mask: read(=rscx)
=> access_allowed: read access granted by read(=rscx)
=> access_allowed: read access to "cn=nikola,ou=users,dc=panline,dc=net" "gecos" requested
=> acl_get: [1] check attr gecos
<= acl_get: [1] acl cn=nikola,ou=users,dc=panline,dc=net attr: gecos
access_allowed: no res from state (gecos)
=> acl_mask: access to entry "cn=nikola,ou=users,dc=panline,dc=net", attr "gecos" requested
=> acl_mask: to all values by "", (=n)
<= check a_dn_pat: self
<= check a_dn_pat: *
<= acl_mask: [2] applying read(=rscx) (stop)
<= acl_mask: [2] mask: read(=rscx)
=> access_allowed: read access granted by read(=rscx)
==>backsql_operational(): entry 'cn=nikola,ou=users,dc=panline,dc=net'
<==backsql_operational()
ber_flush: 76 bytes to sd 9
0000: 30 4a 02 01 02 64 45 04 24 63 6e 3d 6e 69 6b 6f 0J...dE.$cn=niko
0010: 6c 61 2c 6f 75 3d 75 73 65 72 73 2c 64 63 3d 70 la,ou=users,dc=p
0020: 61 6e 6c 69 6e 65 2c 64 63 3d 6e 65 74 30 1d 30 anline,dc=net0.0
0030: 1b 04 05 67 65 63 6f 73 31 12 04 10 4e 69 6b 6f ...gecos1...Niko
0040: 6c 61 20 49 76 61 6e 63 65 76 69 63 la Ivancevic
ldap_write: want=76, written=76
0000: 30 4a 02 01 02 64 45 04 24 63 6e 3d 6e 69 6b 6f 0J...dE.$cn=niko
0010: 6c 61 2c 6f 75 3d 75 73 65 72 73 2c 64 63 3d 70 la,ou=users,dc=p
0020: 61 6e 6c 69 6e 65 2c 64 63 3d 6e 65 74 30 1d 30 anline,dc=net0.0
0030: 1b 04 05 67 65 63 6f 73 31 12 04 10 4e 69 6b 6f ...gecos1...Niko
0040: 6c 61 20 49 76 61 6e 63 65 76 69 63 la Ivancevic
conn=0 op=1 ENTRY dn="cn=nikola,ou=users,dc=panline,dc=net"
<= send_search_entry
backsql_search(): loading data for entry id=1, oc_id=1, keyval=1
==>backsql_id2entry()
>>> dnPrettyNormal: <dc=panline,dc=net>
=> ldap_bv2dn(dc=panline,dc=net,0)
<= ldap_bv2dn(dc=panline,dc=net,0)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=panline,dc=net,272)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=panline,dc=net,272)=0
<<< dnPrettyNormal: <dc=panline,dc=net>, <dc=panline,dc=net>
backsql_id2entry(): custom attribute list
Segmentation fault