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

Are hyphens in attribute names supported when using sql backend?



Hi,

I use OpenLDAP + PostgreSQL as a sql backend. 
Just for tests if hyphens are supported I defined object class and attribute having hyphen in the names:

Schema:
attributetype ( 1.3.6.1.4.1.3814.4.4 NAME ( 'person-type' ) SUP name)
objectClass ( 1.3.6.1.4.1.3814.3.5 NAME 'person-oc'
	DESC 'Test Person'
	SUP ( inetOrgPerson )
	MAY ( person-type) )

insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return)
values (4,'person-oc','persons','id',NULL,NULL,0);
insert into ldap_attr_mappings
(id,oc_map_id,name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return)
values (10,4,'person-type','persons.name','persons',NULL,NULL,NULL,3,0);

When I search for object having this object class and attribute I get the following in debug from slapd:

<= ldap_dn2bv(cn=kori hutton,o=sql,c=ru)=0 Success
<<< dnPrettyNormal: <cn=Kori Hutton,o=sql,c=RU>, <cn=kori hutton,o=sql,c=ru>
backsql_id2entry(): retrieving all attributes
==>backsql_get_attr_vals(): oc="person-oc" attr="ref" keyval=12478
<==backsql_get_attr_vals()
==>backsql_get_attr_vals(): oc="person-oc" attr="objectClass" keyval=12478
<==backsql_get_attr_vals()
==>backsql_get_attr_vals(): oc="person-oc" attr="person-type" keyval=12478
backsql_get_attr_values(): error executing attribute query "SELECT persons.name
AS person-type FROM persons WHERE persons.id=? ORDER BY persons.name"
Return code: -1
   Native error code: 7
   SQL engine state:  42601
   Message:           ERROR: syntax error at or near "-";
Error while executing the query


Looks that hyphen is not allowed in attribute name. Is it any workaround for this to support "-" in attribute names?

Thank you,
greg