Good day. In general, there is a task to add users to LDAP. I bring from from a file (ldif). But all is good only Russian letters can be added. When adding Russian letters LDAP writes

ldap_add: Invalid syntax (21) additional info: cn: value # 0invalid per syntax

I read somewhere that I need to encode a file with ldif in UTF-8 and encode Russian letters in base64. I tried it but it did not work anyway. Perhaps there is some other way to bring Russian users. For example, give the text ldif.

dn: uid=shevchenko,ou=People,dc=tov,dc=ruobjectClass: topobjectClass: inetOrgPersonobjectClass: posixAccountobjectClass: shadowAccountobjectClass: qmailUserobjectClass: sambaSamAccountobjectClass: deepofixuserobjectClass: CourierMailAccountcn: Шевченко Татьянаuid: shevchenkouidNumber: 1008gidNumber: 1000userPassword: {SSHA}XvNqnPzwIB9g3xbPPoN+lYgOE0JNiUJMhomeDirectory: /home/shevchenkologinShell: /bin/falseshadowLastChange: 15118shadowMin: -1shadowMax: -1shadowWarning: -1shadowInactive: -1shadowExpire: -1shadowFlag: -1mail: shevchenko@domainmailMessageStore: /home/shevchenko/Maildir/qmailUID: 1008qmailGID: 1000mailHost: localhostdeliveryMode: noforwardaccountStatus: activemailQuotaSize: 0mailSizeMax: 0sambaLMPassword: 6E9A9CB752F2F855DB2294261F598B4CsambaNTPassword: 33D2D01D8A74F01D34E4A6CDCE0E088BsambaAcctFlags: [U ]sambaPwdLastSet: 1306264612sambaPwdCanChange: 1337800612sambaPwdMustChange: 1337800612sambaSID: S-1-5-21-3825789469-1479138690-1952092781-SIDsambaPrimaryGroupSID: S-1-5-21-3825789469-1479138690-1952092781-3001displayName: Шевченко Татьяна gecos: Шевченко Татьянаdescription: Шевченко Татьяна disableimap: 0disablepop3: 0disablewebmail: 0qmailDotMode: ldaponlygivenName: Шевченко Татьянаsn: . 

    1 answer 1

    From Wikipedia :

    The attribute value is written in 7-bit ASCII encoding and is separated from its name by the symbol ":". Values ​​that are not suitable for this encoding are written in base64 encoding and are separated from the attribute name with "::" characters.

    Like this:

     <имя_атрибута>:: <base64_значение_атрибута> 
    • Good day. So if I enter the value encoded in base64, it will be displayed in base64. Those. there will be just a set of characters and letters of the English alphabet but not Russian. I have another idea, I can change the type of this attribute in the schemas, but I don’t know how to change it. - Alexander Arkhipov
    • base64 is the encoding of other code tables into seven-bit ASCII, and moreover, the way of packing binary files for sending them by e-mail, and not only. Much to my regret, there is no other way of encoding non-ASCII characters in the LDIF. - areshin
    • I entered the values ​​in base64. But the Russian text, this value is gone. And I need Russian value. For example, give an example. Here I’m dropping a value into LDAP: cname :: 0J / QtdGC0YDQvtCyВ from LDAP it will be extracted as 0J / QtdGC0YDQvtCy. Then the question is where are the Russian characters? I washed out what I translated from in base64, then it is stored in English characters. - Alexander Arkhipov
    • Bring your ldif text after the change. I have no intention of lying to you. You can see for yourself RFC 2849: tools.ietf.org/html/rfc2849 There, by the way, there are examples. - areshin
    • For example, my ldif docs.google.com/document/d / ... for example, I’ll upload base64 there, but I need to write some decoder which this base64 decodes back to readable text on the fly. - Alexander Arkhipov