[PATCH] Have ntvfs_connect() accept union smb_tcon *tcon instead of char* sharename

Sam Liddicott sam at liddicott.com
Thu May 14 07:58:50 GMT 2009


This change brings ntvfs_connect into compliance with other ntvfs functions
which take an ntvfs module, an ntvfs request and an smb io union.

It now becomes the responsibility of ntvfs modules to examine
tcon->generic.level themselves and derive the share name and any other
options
directly; e.g.

	const char *sharename;

	switch (tcon->generic.level) {
	case RAW_TCON_TCON:
		sharename = tcon->tcon.in.service;
		break;
	case RAW_TCON_TCONX:
		sharename = tcon->tconx.in.path;
		break;
	case RAW_TCON_SMB2:
	default:
		return NT_STATUS_INVALID_LEVEL;
	}

	if (strncmp(sharename, "\\\\", 2) == 0) {
		char *p = strchr(sharename+2, '\\');
		if (p) {
			sharename = p + 1;
		}
	}

service.c smbsrv_tcon_backend() is called before ntvfs_connect and fills in
some of the tcon->..out values.
For the case of RAW_TCON_TCONX, it filles out tcon->tconx.out.tid and
tcon->tconx.out.options

For the case of RAW_TCON_TCON it fills out tcon->tcon.out.tid and
tcon->tcon.out.max_xmit

Thus the ntvfs_connect function for vfs modules may override these values
if desired, but are not required to.

ntvfs_connect functions are required to fill in the tcon->tconx.out.*_type
fields, for RAW_TCON_TCONX, perhaps something like:

	if (tcon->generic.level == RAW_TCON_TCONX) {
		tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
		tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
	}

Signed-off-by: Sam Liddicott <sam at liddicott.com>
---
 source4/ntvfs/cifs/vfs_cifs.c                 |   28
+++++++++++++++++++++++-
 source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c |   28
+++++++++++++++++++++++-
 source4/ntvfs/ipc/vfs_ipc.c                   |   28
+++++++++++++++++++++++-
 source4/ntvfs/nbench/vfs_nbench.c             |    5 ++-
 source4/ntvfs/ntvfs.h                         |    2 +-
 source4/ntvfs/ntvfs_interface.c               |    9 ++++---
 source4/ntvfs/posix/vfs_posix.c               |   28
+++++++++++++++++++++++-
 source4/ntvfs/print/vfs_print.c               |    7 +++++-
 source4/ntvfs/simple/vfs_simple.c             |   29
++++++++++++++++++++++++-
 source4/ntvfs/smb2/vfs_smb2.c                 |   29
+++++++++++++++++++++++-
 source4/ntvfs/unixuid/vfs_unixuid.c           |    4 +-
 source4/smb_server/smb/reply.c                |   24 +-------------------
 source4/smb_server/smb/service.c              |    3 +-
 13 files changed, 184 insertions(+), 40 deletions(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ed2458cc62d0ce03ff3e322e9b26d8a96344a46e.diff
Type: text/x-patch
Size: 17522 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090514/d7981935/ed2458cc62d0ce03ff3e322e9b26d8a96344a46e.bin


More information about the samba-technical mailing list