|
|
|
|
|
by jimsmart
2114 days ago
|
|
> Very costly, but the only way to give case-insensitivity. That is very costly — but it's certainly not the only way to provide case-insensitivity, nor is it the recommended way, and I'd be surprised if any implementation of case-insensitivity actually did what you say. Normally one would lowercase (or uppercase) both strings, and then do the comparison. The complexity here usually comes when case-folding various tricky locales. |
|
Windows slient sends a name "foo" over SMB2+. Samba does a stat("foo", &st) call, gets ENOENT.
Now, does that name really not exist ? Or is it there in the requested directory under any of the names "FOO"/"FOo"/"Foo"/"fOo"/"fOO"/"FoO" etc. ?
The only way for an application to tell is to do:
opendir() fname = readdir().... check strlower(client_provided_name, fname); closedir().
If the file really doesn't exist you have ended up scanning the whole directory.
Because Linux doesn't provide directory leasing you have to do this for every missed lookup (another process might have created it in the meantime).
There is no POSIX API for "does this file exist under another cased name" ? If there were Samba would use it.