diff -Naur samba-3.0.3.orig/source/client/smbmount.c samba-3.0.3/source/client/smbmount.c --- samba-3.0.3.orig/source/client/smbmount.c 2004-04-20 22:42:58.000000000 +0200 +++ samba-3.0.3/source/client/smbmount.c 2004-08-31 22:40:09.140404175 +0200 @@ -700,6 +700,57 @@ /**************************************************************************** + Append character set definition to option string. + A light translation is made to ease matching a kernel character set name. + ****************************************************************************/ +static char * +append_charset(char * p, char * option, char * value, int maxchar) + +{ + char * setname; + + if (!*value) + return p; + + while (*option && maxchar > 0) { + *p++ = *option++; + maxchar--; + } + + if (maxchar > 0) { + *p++ = '='; + maxchar--; + } + + /* Translate charset name to lower case. */ + + setname = p; + + while (*value && maxchar > 0) { + *p++ = isupper(*value)? tolower(*value): *value; + value++; + maxchar--; + } + + /* Special case: translate "utf-8" into "utf8". */ + + *p = '\0'; /* Terminator byte may always be stored. */ + + if (!strcmp(setname, "utf-8")) { + p--; + p[-1] = '8'; + maxchar++; + } + + if (maxchar > 0) + *p++ = ','; + + *p = '\0'; /* Terminator byte may always be stored. */ + return p; +} + + +/**************************************************************************** Argument parsing for mount.smbfs interface mount will call us like this: mount.smbfs device mountpoint -o @@ -714,6 +765,8 @@ extern char *optarg; int val; char *p; + pstring dos_charset; + pstring unix_charset; /* FIXME: This function can silently fail if the arguments are * not in the expected order. @@ -745,6 +798,8 @@ return; } + pstrcpy(dos_charset, lp_dos_charset()); + pstrcpy(unix_charset, lp_unix_charset()); options[0] = 0; p = options; @@ -806,6 +861,10 @@ pstrcpy(user_socket_options,opteq+1); } else if(!strcmp(opts, "scope")) { set_global_scope(opteq+1); + } else if(!strcmp(opts, "codepage")) { + pstrcpy(dos_charset, opteq + 1); + } else if(!strcmp(opts, "iocharset")) { + pstrcpy(unix_charset, opteq + 1); } else { slprintf(p, sizeof(pstring) - (p - options) - 1, "%s=%s,", opts, opteq+1); p += strlen(p); @@ -850,6 +909,11 @@ exit(1); } + p = append_charset(p, "codepage", dos_charset, + sizeof(pstring) - (p - options) - 1); + p = append_charset(p, "iocharset", unix_charset, + sizeof(pstring) - (p - options) - 1); + if (p != options) { *(p-1) = 0; /* remove trailing , */ DEBUG(3,("passthrough options '%s'\n", options));