Latest leases patchset - getting there !
Jeremy Allison
jra at samba.org
Fri Dec 5 09:41:39 MST 2014
On Fri, Dec 05, 2014 at 02:54:39PM +0100, Stefan (metze) Metzmacher wrote:
> Hi Jeremy,
>
> > I'm unsure what happens in the dynamic share case
> > when one file is renamed. Opening the other file
> > would be rejected by NT_STATUS_INVALID_PARAMTER
> > because the file name doesn't match anymore.
>
> I think we need to change the data model for the
> leases_db.
>
> Maybe something like this:
>
> diff --git a/source3/librpc/idl/leases_db.idl
> b/source3/librpc/idl/leases_db.idl
> index 2ab1591..f6a979d 100644
> --- a/source3/librpc/idl/leases_db.idl
> +++ b/source3/librpc/idl/leases_db.idl
> @@ -15,9 +15,14 @@ interface leases_db
> } leases_db_key;
>
> typedef [public] struct {
> - uint32 num_file_ids;
> - [size_is(num_file_ids)] file_id ids[];
> - [string,charset(UTF8)] char *filename;
> + file_id id;
> + [string,charset(UTF8)] char *servicepath;
> + [string,charset(UTF8)] char *base_name;
> [string,charset(UTF8)] char *stream_name;
> + } leases_db_file;
> +
> + typedef [public] struct {
> + uint32 num_files;
> + [size_is(num_filess)] leases_db_file files[];
> } leases_db_value;
> }
>
> I'm not sure about the servicepath, I took the same values
> as we have in share_mode_data. But we need to maintain the names
> per file_id in order to support dynamic shares.
>
> That way we can check if an open with the same file_id uses
> the correct file name.
Doesn't this code in smbd/open.c:
static void lease_fname_match_parser(
uint32_t num_file_ids,
struct file_id *ids, const char *filename, const char *stream_name,
void *private_data)
{
struct lease_fname_match_state *state =
(struct lease_fname_match_state *)private_data;
if (!strequal(filename, state->fname->base_name) ||
!strequal(stream_name, state->fname->stream_name))
{
/* Names don't match lease key. */
state->match_status = NT_STATUS_INVALID_PARAMETER;
return;
}
do the trick already ?
> BTW: How did you test the dynamic share stuff from a windows client?
> Do you have a Win32 programm we can add to testprogs/win32/ ?
> If so we could add some rename code to it.
Hand testing I'm afraid as it requires some account
setup.
More information about the samba-technical
mailing list