if we have a share whose name includes '\' (0x5c) in its name in 'unix charset' encoding. For example [global] unix charset = CP932 dos charset = CP932 [--] * -- means a 2byte string {0x83, 0x5c} Browsing works well but cannot access. This is a part of level 3 log when access \\server\-- (-- means 0x83, 0x5c) [2003/09/23 07:19:35, 3] smbd/error.c:error_packet(113) error packet at smbd/reply.c(274) cmd=117 (SMBtconX) NT_STATUS_BAD_NETWORK_NAME [2003/09/23 07:19:35, 3] smbd/process.c:process_smb(890) Transaction 52 of length 92 [2003/09/23 07:19:35, 3] smbd/process.c:switch_message(685) switch message SMBtconX (pid 10564) [2003/09/23 07:19:35, 3] smbd/sec_ctx.c:set_sec_ctx(288) setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0 [2003/09/23 07:19:35, 3] lib/charcnv.c:convert_string_allocate(444) convert_string_allocate: Conversion error: Illegal multibyte sequence(<83>/) (snip) convert_string_allocate: Conversion error: Illegal multibyte sequence(<83>/) [2003/09/23 07:19:35, 3] lib/charcnv.c:convert_string_allocate(444) convert_string_allocate: Conversion error: Illegal multibyte sequence(<83>/) [2003/09/23 07:19:35, 3] smbd/service.c:find_service(143) checking for home directory <83>/ gave (NULL) [2003/09/23 07:19:35, 3] smbd/service.c:find_service(157) checking whether <83>/ is a valid printer name... [2003/09/23 07:19:35, 3] lib/charcnv.c:convert_string_allocate(444) convert_string_allocate: Conversion error: Illegal multibyte sequence(<83>/) [2003/09/23 07:19:35, 3] lib/charcnv.c:convert_string_allocate(444) convert_string_allocate: Conversion error: Illegal multibyte sequence(<83>/) [2003/09/23 07:19:35, 3] smbd/service.c:find_service(169) <83>/ is not a valid printer name [2003/09/23 07:19:35, 3] smbd/service.c:find_service(211) find_service() failed to find service <83>/ [2003/09/23 07:19:35, 3] lib/charcnv.c:convert_string_allocate(444) convert_string_allocate: Conversion error: Illegal multibyte sequence(<83>/) [2003/09/23 07:19:35, 3] lib/charcnv.c:convert_string_allocate(444) convert_string_allocate: Conversion error: Illegal multibyte sequence(<83>/) [2003/09/23 07:19:35, 0] smbd/service.c:make_connection(848) monyo31 (192.168.230.1) couldn't find service <83>/ [2003/09/23 07:19:35, 3] smbd/error.c:error_packet(94) error string = Invalid or incomplete multibyte or wide character [2003/09/23 07:19:35, 3] smbd/error.c:error_packet(113) error packet at smbd/reply.c(274) cmd=117 (SMBtconX) NT_STATUS_BAD_NETWORK_NAME
If a share name is defined using a MB char with '0x5D' in its second byte, where '0x5D' is equivalent of '\' in ascii code, then although the share name is retrievable by SMB clients, they cannot access it, returning the error NT_STATUS_BAD_NETWORK_NAME. The source of this problem is that smbd replaces '\' with '/' by all_string_sub() in find_service() function. Because all_string_sub() handles strings in single byte, the second byte of MB char is wrongly identified as '\' and hence converted '/'. Since the second byte of MB char has changed, Samba fails to retrieve the share specified as the argument for searching the share is no longer valid. smbd/service.c --- int find_service(fstring service) { int iService; all_string_sub(service,"\\","/",0); iService = lp_servicenumber(service); ... } ---
Created attachment 363 [details] a patch which enables accessing a share with 0x5c code This patch enables accessing a share with '0x5c' code, by first converting its name from unix charset to UCS2, followed by replacing '\' with '/' under UCS2 format and then convert the end product back to unix charset. It is an expensive operation but probably the only solution for this bug under current implementation.
Jeremy, Is this still an issue? Can you take a look? Thanks.
Ok, I think I've just fixed this by changing occurrences of strstr() to a new implementation strstr_m(). Please check this out and let me know if it is now fixed in SAMBA_3_0 CVS (it should be). Jeremy.
jeremy says fixed. please let us know if this is not the case.
originally reported against one of the 3.0.0rc[1-4] releases. Cleaning up non-production versions.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.