2022-09-29 3:42 GMT+09:00, Atte Heikkilä <atteh.mailbox@xxxxxxxxx>: > Preserve the case of share names by doing casefolding at hash table > lookup-time. This is preferrable for a few reasons. > > First, ksmbd can be built such that it is not capable of casefolding > UTF-8 share names. Such share names are then case-sensitive if they > have non-ASCII characters, and connections to them should succeed only > when matching the name in ksmbd.conf, ignoring ASCII case. As such, the > case-preserved share name will be sent to ksmbd in the share config > response so that ksmbd can casefold it and validate against the share > name it knows. This is necessitated by the way share config caching is > done. > > Second, addshare should ideally preserve formatting when modifying > ksmbd.conf. Then, preserving the case for user readability reasons is > desirable. Also, since ksmbd.conf is just as often edited with a text > editor, it is important that share names can be searched using it, > which is often not possible when they are written casefolded. > > Third, case-preserved share names are now used in SRVSVC GET_SHARE_INFO > response, with __share_entry_data_ctr0() and __share_entry_data_ctr1(), > and so they are seen as written in ksmbd.conf. > > Also, in shm_casefold_share_name(), note that g_utf8_casefold() aborts > on fail, and if g_utf8_normalize() fails, g_ascii_strdown() aborts on > fail. `share_name' was leaked in srvsvc_share_get_info_invoke() as the > string returned by shm_casefold_share_name() should be freed. Before > that, `share_name' was the string returned by g_ascii_strdown() and > leaked then as well. > > Signed-off-by: Atte Heikkilä <atteh.mailbox@xxxxxxxxx> Applied, Thanks for your work!