The countryCode can't have multiple values:

attributetype ( NAME ( 'c' 'countryName' )
        DESC 'RFC2256: ISO-3166 country 2-letter code'
        SUP name SINGLE-VALUE )

Can't you use the postalAddress attribute?
With your examples, it should be something like:
postalAddress: 123 1st av$Montreal$QC$GGG RT3$CA
postalAddress: 321 42nd st$Montreal$QC$GGG RT1$CA

Address elements are separated by a "$" character, and you can't have empty elements (which means that in your example, you would lose the 2 first empty elements).

Anyway, I don't think multiple values stored in an attribute are given back strictly in the same order.

2013/5/3 Nicolas Mora <>

I'm currently programming a connector between a CardDAV server and a LDAP server in php.

I'm using the schema inetOrgPerson which is good for most of the data but I have a problem with multiple equal data.
The VCard data is set like this :

ADR;TYPE=HOME:;;123 1st av;Montreal;QC;GGG RT3;CA

which is translated into :

street:: 123 1st av
l: Montreal
postalcode: GGG RT3

By default in the inetOrgPerson schema, the country code is not added, so I add a personalized schema with 2 fields :
- countryCode ('c')
- VCardUnassigned ('vcardunassigned')
The second one is when a vcard field has no correspondance in the ldap schema

Problem is, when you have multiple fields with the same value, you get an error 0x14 - LDAP_TYPE_OR_VALUE_EXISTS. Which is logical but kinda annoying if you want for example to add a second address in the same state or country, like :
ADR;TYPE=HOME:;;321 42nd st;Montreal;QC;GGG RT1;CA

Is there a way to save multiple equal values for an entry for some fields ?