Bug 6496 - libsmbclient: MS-DFS: cannot follow multibyte char link name
Summary: libsmbclient: MS-DFS: cannot follow multibyte char link name
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.4.0rc1
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-23 01:47 UTC by SATOH Fumiyasu
Modified: 2009-09-09 05:32 UTC (History)
0 users

See Also:


Attachments
[PATCH] libsmb: MS-DFS: cannot follow multibyte char link name (3.92 KB, patch)
2009-06-23 01:49 UTC, SATOH Fumiyasu
no flags Details
[PATCH] libsmbclient: MS-DFS: cannot follow multibyte char link name (3.47 KB, patch)
2009-06-23 02:03 UTC, SATOH Fumiyasu
no flags Details
Slightly modified patch. (3.88 KB, patch)
2009-06-29 18:59 UTC, Jeremy Allison
no flags Details
Revised patch for v3-2-test (3.78 KB, patch)
2009-06-30 02:32 UTC, SATOH Fumiyasu
no flags Details
git-am format patch for 3.4.1. (4.27 KB, patch)
2009-09-08 18:09 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description SATOH Fumiyasu 2009-06-23 01:47:34 UTC
If a MS-DFS link name has multibyte character, smbclient (libsmb) cannot follow it.
I'll post a patch later.
Comment 1 SATOH Fumiyasu 2009-06-23 01:49:57 UTC
Created attachment 4340 [details]
[PATCH] libsmb: MS-DFS: cannot follow multibyte char link name

Calculate the byte of consumed path in UNIX charset.
Comment 2 SATOH Fumiyasu 2009-06-23 02:03:46 UTC
Created attachment 4341 [details]
[PATCH] libsmbclient: MS-DFS: cannot follow multibyte char link name

Remake with `set noexpandtab` in vi.
Comment 3 Jeremy Allison 2009-06-24 12:53:20 UTC
Thanks for this. I'm sick at home at the moment. I'll get to this as soon as I'm able.
Jeremy.
Comment 4 Jeremy Allison 2009-06-29 17:23:42 UTC
Ok, I don't understand this patch. Can you explain more please.

The patch to cli_dfs_get_referral() stores the base pointer to the ucs2 conversion of the path string in path_ucs, then uses pull_string_talloc() to pull that ucs2 version of that string back to UNIX charset into the variable consumed_path. However, the call to pull_string_talloc() uses the flag STR_TERMINATE, which will cause pull_string_talloc() to ignore the passed in length value of consumed_ucs and just look for the two '\0' string terminator bytes of the ucs2 string.

This means the string in consumed_path will be equal to the string in path, meaning there was no point to that code at all.

I need to understand this change much better before I can apply this patch.

Thanks,

Jeremy.
Comment 5 Jeremy Allison 2009-06-29 18:59:15 UTC
Created attachment 4367 [details]
Slightly modified patch.

Can you test this patch please, as I think this might be more correct (correctly sets flags in the pull_string_talloc() call).
Jeremy.
Comment 6 SATOH Fumiyasu 2009-06-30 02:32:36 UTC
Created attachment 4371 [details]
Revised patch for v3-2-test

I confirmed your patch with the following changes fixed this bug
on Samba 3.2.8.

  * Remove the commnet '/* Number of bytes of "path" consumed. */'
    that confuses samba-3.X.Y/source/script/mkproto.awk (X <= 2).
  * Do not free param by 'SAFE_FREE(param)' after cli_send_trans()
    call because param contains path_ucs that is referred later.

Thank you!
Comment 7 Jeremy Allison 2009-06-30 11:23:40 UTC
Thanks for those fixes (and looking carefully at the changed patch). I'll push this to master. It will need review for 3.4.0, I'll ask for it but I'm not sure we can do this in time.
Jeremy.
Comment 8 Karolin Seeger 2009-07-02 03:10:20 UTC
Raise version as it's a 3.4 issue also.
Comment 9 Karolin Seeger 2009-07-02 03:12:35 UTC
Volker, shall I pick that one for 3.4.0?
Comment 10 Volker Lendecke 2009-07-02 03:14:55 UTC
Sorry, can't take time right now to review this in time for 3.4. At least by a quick glance I did not understand what's going on, so I'll have to spend more time on this patch to review it.

Volker
Comment 11 Jeremy Allison 2009-07-02 10:38:58 UTC
This is not a show stopper for 3.4.0 IMHO. We could pick it as part of the first 3.4.1 bugfix release.
Jeremy.
Comment 12 Guenther Deschner 2009-09-01 03:32:30 UTC
Comment on attachment 4371 [details]
Revised patch for v3-2-test

Jeremy, could you please review?
Comment 13 Jeremy Allison 2009-09-08 18:01:11 UTC
+1. Assigning to Karolin for inclusion in 3.4.1 (this one should have gotten pushed a while ago, sorry for the delay caused by my vacation).
Jeremy.
Comment 14 Jeremy Allison 2009-09-08 18:09:30 UTC
Created attachment 4663 [details]
git-am format patch for 3.4.1.
Comment 15 Karolin Seeger 2009-09-09 05:32:33 UTC
Pushed, will be included in 3.4.1.
Closing out bug report.

Thanks!