ldifde.exe and carriage returns

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

Hello all.
I am trying to update the address field for my users using
ldifde.exe. The problem I am running into is that I need
to have a carriage return in the address field to properly
format the address. I have tried <CR>, \0D, etc, but
these all seem to apply when you need a CR in the DN, not
an individual text field.

Below is an example of what I am feeding ldifde.exe I am
putting in commas in the streetAddress where I want
carriage returns for this exampe. Any help is appreciated!

dn: CN=User\, Test,OU=Users,OU=Europe,DC=test,DC=local
changetype: modify
replace: streetAddress
streetAddress: Poligono Industrial, "Valle del Cinca",
Apartado 18
 
Taking a look at the ldif gramar in (http://www.faqs.org/rfcs/rfc2849.html)
it is not obvious that there is an easy escape character for an attribute
value. One method that might work is to use the < url option that would
allow the attribute value to be read in from file. If that doesn't work I'm
confident you could base64 encode the value.

This line from note 4 from the "Formal Syntax Definition of LDIF" suggests
it may need to be base64 encoded:

" Any value that contains characters other than those defined as
"SAFE-CHAR", or begins with a character other than those
defined as "SAFE-INIT-CHAR", above, MUST be base-64 encoded.
Other values MAY be base-64 encoded."

Looking closer at the spec we find CR is explicitly mentioned as not being
part of either of the safe sets.

I'd still try using the URL input format to read a file containing a CR
before going through the work of doing base64 encoding.

Jason
 
You could try this *.vbs script...

Const ADS_PROPERTY_UPDATE = 2

Set objUser =
GetObject("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")

objUser.Put "streetAddress", "Building 43" & vbCrLf & "One Microsoft Way"

objUser.Put "l", "Redmond"

objUser.Put "st", "Washington"

objUser.Put "postalCode", "98053"

objUser.Put "c", "US"

objUser.PutEx ADS_PROPERTY_UPDATE, "postOfficeBox", Array("2222", "2223",
"2224")

objUser.SetInfo

Notice the vbCrLf (HRt) in the StreetAddress...

Hope this helps.

(delete the xxxxx in the emailaddress...)
 
Back
Top