Recently, we decided to upgrade the samba server at our office from samba2 to samba3. If this were a modern Linux installation, we wouldn't have so many obstacles in our way. But since we are using Solaris9 on our server, we faced some ugly quirks.
So here's the story, and the solution. If anybody will ever need to do so as well.
The problem begins with the fact that Samba2 is not Unicode aware, thus, when you saved a file with an Hebrew name from a windows machine - the real file name on the storage was with the same character set as of the windows (CP862).
When upgraded to Samba3 - the engine of samba3 in the back end expects the file to be in Unicode. With a modern Linux the solution is simple:
add the statement
unix charset = cp862
to the [global] section of smb.confWhat happens now, is that samba3 uses glibc's i18n functions and dynamically loads the shared object: IBM862.so (on my kubuntu found as: /usr/lib/gconv/IBM862.so) and makes the conversion.
With Solaris, things are different. i18n is not part of libc, and you have to use an external library called libiconv (part of the GNU project).
At this stage I wasted some good hours on either downloading libiconv from sunfreeware.com (binary package) or compiling libiconv from sources alone and compiling & linking samba3 with this package. But surprisingly, it did not work.
And here comes the tricky part - the following section is copied as is from the README file in the sources directory of libiconv:
On systems other than GNU/Linux, the iconv program will be internationalized
only if GNU gettext has been built and installed before GNU libiconv. This
means that the first time GNU libiconv is installed, we have a circular
dependency between the GNU libiconv and GNU gettext packages, which can be
resolved by building and installing either
- first libiconv, then gettext, then libiconv again,
or (on systems supporting shared libraries, excluding AIX)
- first gettext, then libiconv, then gettext again.
Recall that before building a package for the second time, you need to erase
the traces of the first build by running "make distclean".
only if GNU gettext has been built and installed before GNU libiconv. This
means that the first time GNU libiconv is installed, we have a circular
dependency between the GNU libiconv and GNU gettext packages, which can be
resolved by building and installing either
- first libiconv, then gettext, then libiconv again,
or (on systems supporting shared libraries, excluding AIX)
- first gettext, then libiconv, then gettext again.
Recall that before building a package for the second time, you need to erase
the traces of the first build by running "make distclean".
So from the minute I found this, the road to success became shorter.
I compiled and installed libiconv.
I compiled and installed gettext linked with libiconv.
I compiled and installed libiconv linked with gettext (installed to the same location as in the first time).
And just for case - I compiled and installed gettext linked with the new libiconv. (to the same location as before).
I compiled and installed Samba3 (while telling the configure script where to look for the libiconv installation tree).
And now, adding the configuration statement as described above, worked.
I hope that someone will make a good use of this document.
Noam Meltzer