Linux/UNIX Driver Can Not Sync Chinese Characters to the /etc/password Gecos Field

  • 7004952
  • 01-Dec-2009
  • 26-Apr-2012

Environment

Novell Identity Manager 3.6.1
Novell Identity Manager Driver - Linux and UNIX - Bi-directional (formally NIS)
Novell Identity Manager Driver - Linux and UNIX - Fan Out

Situation

The requirement is to use the attribute FullName as the source data to synchronize the /etc/password gecos field. If the Full Name contains only ASCII characters, there is no problem. If the Full Name contains a Chinese Character, the gecos field will display an incorrect result.

Another problem may happen after the first sync problem. The error java.lang.ArrayIndexOutOfBoundsException will show up after a driver synchronization if the Full Name attribute is involved in the sync.

Resolution

To fix this, you must first have the correct Chinese locals installed. Here is a sample list of some Chinese locales:
chinese (zh_CN.UTF8@euro, zh_CN.UTF8)
chinese_hongkong (zh_HK.UTF8@euro, zh_HK.UTF8, zh_CN.UTF8)
chinese_macau (zh_MO.UTF8@euro, zh_MO.UTF8, zh_CN.UTF8)
chinese_singapore (zh_SG.UTF8@euro, zh_SG.UTF8, zh_CN.UTF8)
chinese_taiwan (zh_TW.UTF8@euro, zh_TW.UTF8, zh_CN.UTF8)

Then inside the nxdrvd startup script, near the top, simply add, for example:
LC_CTYPE=zh_CN.UTF8
export LC_CTYPE

And in your PAM configuration, modify the line for pam_nxdrv:
password required pam_nxdrv.so mechanism=api LC_CTYPE=zh_CN.UTF8

The above instructions could be tested on a system that does have Chinese locales installed. To verify this do the following:
locale -a | grep "zh"

This will print a list of installed locales and filter out "Chinese" pages.