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

Re: back-sql with binary values from mysql DBs (ITS#3113)



> Full_Name: Babak Nasri
> Version: 2.2.10
> OS: linux 2.4.22  on debian dist
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (213.61.157.73)
>
>
> Returning binary values from a mysql table bound to openldap back-sql
> through iODBC the type was lost somewhere and the value was treated
> hexdumped as string.
>
> Work around I deployed in my installation was some minor changes in
> entry_id.c ->  backsql_get_attr_vals and sql-wrap.c ->
> backsql_BindRowAsStrings.
>
> In BindRowAsString I just changed the colname before binding the col
> using SQLBindCol:
>    if ( col_type == SQL_LONGVARCHAR || col_type == SQL_LONGVARBINARY) {
>        ber_str2bv( strcat(colname,";binary"), 0, 1, &row->col_names[ i -
> 1 ] ); ....
>
>
> And In backsql_get_attr_vals I checked back for having that phrase in
> colname and converted the hexdump string to the corresponding binary
> value (hex_to_bytes) just before calling 	backsql_entry_addattr.
>
> This has shown up to be a work around for that issue but I am not sure
> if it applies to general thread to be considered in the head.

I note that the ";binary" option, which only addresses how a value is
transported, and not how it is stored, has been obsoleted
by draft-ietf-ldapbis-protocol.  I see your problem, it's a matter
of data representation between RDBMS and LDAP.  I think the general
solution would be to use binary syntax attributes on the LDAP side to hold
binary valued RDBMS data.  When a binary valued attribute type is
requested on the LDAP side, and the RDBMS side value is typed SQL_*BINARY,
the value should be entirely copied.  Currently, back-sql only deals with
string-typed values.  If the RDBMS side value is binary typed, and the
LDAP side attribute type syntax is not binary, I think the value should be
rejected as invalid per syntax.

Can you specify what value are you trying to store in what LDAP attribute
type?  I think this ITS might lead to a more syntax-aware back-sql.

p.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it