directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: [Attribute writing] Writing non-string attributes
Date Thu, 17 Jan 2013 16:43:54 GMT
Le 1/17/13 5:22 PM, Jonathan Russell a écrit :
> Hello,
>
> I'm trying to write an array of bytes as an attribute in LDAP. I'm trying to do 
> this without converting it into a string. So I have the following in my LDIF:
>
>
> dn: m-oid=1.3.6.1.4.1.18060.0.9.3.1.9, ou=attributeTypes, cn=other, ou=schema
> objectclass: metaAttributeType
> objectclass: metaTop
> objectclass: top
> m-oid: 1.3.6.1.4.1.18060.0.9.3.1.9
> m-name: ibm-imm
> m-description: the actual block data being stored
> m-equality: caseIgnoreIA5Match
> m-ordering: caseIgnoreOrderingMatch
> m-substr: caseIgnoreSubstringsMatch
> m-syntax: 1.3.6.1.4.1.1466.115.121.1.15

This is the DirectoryString syntax. Why don't you use the OctetString
syntax (1.3.6.1.4.1.1466.115.121.1.40) insted, as you want to store
bytes ? Same for the matching rule...
> m-length: 32700
> m-singleValue: TRUE
>
> dn: m-oid=1.3.6.1.4.1.18060.0.9.5.1.2, ou=objectClasses, cn=other, ou=schema
> objectclass: metaObjectClass
> objectclass: metaTop
> objectclass: top
> m-oid: 1.3.6.1.4.1.18060.0.9.5.1.2
> m-name: DeploymentBlock
> m-description: Deployment information
> m-must: cn
> m-must: ibm-imm
> m-may: name
> m-may: uid
> m-may: uniqueIdentifier
> m-may: fileName
> m-may: profileName
> m-may: status
> m-may: ou
>
>
> In my actual code, I have the following:
>              ServerEntry newEntry = service.newEntry (new LdapDN (dnString));
>              newEntry.add ("objectClass", "top", "DeploymentBlock");
>              newEntry.add ("ou", baseString);
>              newEntry.add ("name", "deployment");
>              newEntry.add ("cn", <something unique>);
>              newEntry.add ("ibm-imm", <the block data>);
>              service.getAdminSession ().add (newEntry);
>              OfmLogHandler.DEBUG ("Done adding block!");
>
> When I run my code, I find the entry in Apache Director Studio, but the 
> attribute associated with the block data ("ibm-imm") is not there. When I try to 
> read back the data:
>
>   serverEntry.get ("ibm-imm"), it says that it's null. So I'm obviously writing 
> the data incorrectly, but I'm not sure how. Is my syntax for ibm-imm not correct?

Depends on what you store in the attribute. DirectoryString can obly be
a valid UTF-8 String, so if you try to store any byte which is not a
valid UTF-8 char then it will be rejected.

But again, you should use and OctetString syntax.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Mime
View raw message