Attached is a patch to the latest 3.0 SVN tree which features the following bug fixes and additional capabilities. The changes are explained here in approximately the order in which they are found in the patch. - libsmb/libsmbclient.c * My previous contribution of extended attribute functions applied primarily to access control lists. These changes add the ability to set and get the DOS attributes. This change was needed because simulating the DOS attributes with mode bits in chmod() was unreliable; i.e. for directories, changes to these bits were ignored entirely (since directories need to have the execute bits set). It is now possible to set and get DOS attributes of any file or folder using the new extended attribute functions. * URL encoding and decoding was not done symmetrically. Although smbc_opendir() and smbc_open() expected a url-encoded path (e.g. spaces converted to "%20", etc.), smbc_readdir() would return non-url-encoded paths. There are many times when this is desired behavior, e.g. when the returned paths are to be presented directly to a user. However, there are also many times when it would be better to have the returned strings url- encoded, e.g. when they will be appended to the path opened with smbc_opendir() and passed back to an smbc_*() function. ~ smbc_urldecode() and smbc_urlencode() are now publicly accessible functions. ~ added an option in the context structure to specify whether or not to url-encode returned readdir entries. * In my earlier patch, currently in the 3.0 tree, I had provided a method of specifying which master browser to query when browsing for workgroups. This was to solve the problem that a master browser which has been running for only a short period of time does not yet know about all workgroups on the local network. I had implemented a method where one could pass "smb://" or "smb://?mb=.any" to use, as was traditional, the first discovered master browser; or "smb://?mb=.all" to request the browse list from all discovered master browsers and return a merged list. Unfortunately, my implementation violated the URI syntax. In this patch, I have removed the the previous implementation (following discussions a few months ago with crh and rsharpe) and replaced it with a choice in a set of options within the context structure. * Fixed a bug where memory was freed after having been previously freed. * Added the capability, again through an options selection in the context, to have only one connection per server. Previously, each share would get its own connection. For long-running applications, it is not necessarily desirable to maintain lots and lots of connections -- in fact, XP Home appears to stop replying if too many connections are established concurrently -- so instead, a single connection may be maintained with a tree connect being issued for each change of share use on that server. - libsmb/cliconnect.c * cli_tdis() was not setting the cnum field back to -1, so there was no way to determine whether an existing tree connection was active. - libsmb/libsmb_cache.c * more changes here pertaining to whether to reuse a connection to a server for multiple shares, or to establish a new connection for each share. - include/libsmb_internal.h * The space for directory entries was not adequate given the new option of urlencoding the returned directory entries - include/libsmbclient.h * mappings of DOS mode bits * new _smbc_options structure in context. The capabilities are explained in excruciating detail, therein. Note that all new features default to the original behavior, to prevent backwards compatibility issues, except for the number of local master browsers to query for the list of workgroups. This now defaults to 3 instead of 1, which is a reasonable compromise between getting an accurate browse list, and the extra (really, pretty insubstantial) amount of time required to query additional local master browsers. I've been running with these changes for the past few months with no problems, so I believe this to be a reasonably stable patch.
Created attachment 945 [details] patch to provide the specified bug fixes and enhancements
assigning to richard. I think he replied on samba-technical about this.
See also bug #2271 as a likely better method of fixing the XP Home bug in clilist.c than what is included in my patch.
richard, if you are pressed for time. Let me know and I'll work on incorporating this patch. I'd like to see some closure on this one for 3.0.12. It's been hanging around for a long time.
taking over since richard is pressed for time. Will get this in for the next 3.0.12{pre,rc} release.
the changes to clidesc.c have already been applied. Everything else applied with minimal fuzz to the current 3_0 svn tree. Building and reviewing the rest of the patch now.
when I build a new libsmbclient.so with these chanegs and install it konqueror dies accessing smb://server/share (process died unexpectedly). Any ideas? The changes look ok. I just want to make sure for myself that certain things don't break.
The context structure has new options fields and is a different size. It likely requires a simple recompilation of Konqueror with the new libsmbclient.h file to fix this problem.
i've applied the patch bug I moved the options struct from _SMBCCTX to the context->internal structure to maintain binary compatibility. Tested with Konqueror. WOrks ok. derrel, we should probably talk about this some more on the samba-technical ml. closing for now.
Created attachment 1027 [details] patch to move "options" back into context, and flags into options
re-open bug to handle movement of options back into context from internals, and flags into options
derrell, for now let's leave things as they are (in the current 3.0 tree). This is identical to your patch but leaves the flags. We have people using that one already. It was specifically for the gnomevfs people.
But the current version in the current 3.0 tree doesn't work since the options structure is not accessible to applications: options is still inside of internals which is not available to an application...??? This seems to defeat most of the purpose of the patch, doesn't it?
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.