libsmbclient and special characters not in us-ascii

Jostein Tveit Jostein.Tveit at idi.ntnu.no
Fri Nov 2 06:13:06 GMT 2001


I use libsmbclient (from samba-2.2.2) to access samba shares, but when I
try to access directories and files with special norwegian characters like
«æ» (ae ligature), «ø» (o slash) and «å» (a ring) i get en error. Other
characters outside the US-ASCII seems to give error too.

This problem is not present in smbclient from the command line.

Here are the relevant parts of my program:
---
set_fn("SINGSING", "test", " ");
smbc_init(auth_fn, 0);

dir = "smb://snoop/rap/test";
dh = smbc_opendir(dir);
fprintf(stderr, "Open %s : %s\n", dir, strerror(errno));

while (a = smbc_readdir(dh))
  printf("%s\n",a->name);

smbc_closedir(dh);
---

And the output:
---
[josteitv at snoop samba]$ ./a.out 
Open smb://snoop/rap/test : Success
.
..
h ppsann
p ss
---

The spaces are actually control characters if i cut and paste them into
emacs:
\206
\201

Here is the output from smbclient, which displays the characters right:
---
[josteitv at snoop josteitv]$ smbclient //snoop/rap -N -D/test -c ls
added interface ip=129.241.30.135 bcast=129.241.30.255 nmask=255.255.255.0
Got a positive name query response from 129.241.18.16 ( 129.241.30.135 )
Domain=[SINGSING] OS=[Unix] Server=[Samba 2.0.10]
  .                                   D        0  Thu Nov  1 00:31:22 2001
  ..                                  D        0  Thu Nov  1 00:31:10 2001
  håppsann                            D        0  Thu Nov  1 00:31:10 2001
  püss                                D        0  Thu Nov  1 00:31:22 2001

                63467 blocks of size 262144. 2162 blocks available
---

If i try to access the directories from libsmbclient with 
dir="smb://snoop/rap/test/håppsann" I get an error:
Open smb://snoop/rap/test/håppsann : No such file or directory

Anyone who knows if this is a problem with libsmbclient, or something I'm
doing wrong?

Regards,
-- 
Jostein Tveit (Jostein.Tveit at idi.ntnu.no)




More information about the samba-technical mailing list