summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-06-27 17:14:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:58:03 -0500
commitafc7af3fdf3ec8214dff8924734008eb41c81979 (patch)
treef5bc82b48131f8ecd5e727b8ab01105a185c1a66 /source3/smbd
parente28cfbfac88255a0cb002b7841d30b89325ee973 (diff)
downloadsamba-afc7af3fdf3ec8214dff8924734008eb41c81979.tar.gz
samba-afc7af3fdf3ec8214dff8924734008eb41c81979.tar.bz2
samba-afc7af3fdf3ec8214dff8924734008eb41c81979.zip
r7948: Ensure we call the vfs connection hook before doing a vfs stat.
Allows database vfs backends to initialise with a working connection. Bugid #2827 Jeremy. (This used to be commit 7ef6850056f7fbb380038f5ec5bcb29d27fbf254)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/service.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 24f4df7694..b53d6e3ad9 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -604,6 +604,25 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
}
#endif
+ /* Add veto/hide lists */
+ if (!IS_IPC(conn) && !IS_PRINT(conn)) {
+ set_namearray( &conn->veto_list, lp_veto_files(snum));
+ set_namearray( &conn->hide_list, lp_hide_files(snum));
+ set_namearray( &conn->veto_oplock_list, lp_veto_oplocks(snum));
+ }
+
+ /* Invoke VFS make connection hook - do this before the VFS_STAT call to allow
+ any filesystems needing user credentials to initialize themselves. */
+
+ if (SMB_VFS_CONNECT(conn, lp_servicename(snum), user) < 0) {
+ DEBUG(0,("make_connection: VFS make connection failed!\n"));
+ change_to_root_user();
+ yield_connection(conn, lp_servicename(snum));
+ conn_free(conn);
+ *status = NT_STATUS_UNSUCCESSFUL;
+ return NULL;
+ }
+
/* win2000 does not check the permissions on the directory
during the tree connect, instead relying on permission
check during individual operations. To match this behaviour
@@ -612,6 +631,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
if (SMB_VFS_STAT(conn, conn->connectpath, &st) != 0 || !S_ISDIR(st.st_mode)) {
DEBUG(0,("'%s' does not exist or is not a directory, when connecting to [%s]\n", conn->connectpath, lp_servicename(snum)));
change_to_root_user();
+ /* Call VFS disconnect hook */
+ SMB_VFS_DISCONNECT(conn);
yield_connection(conn, lp_servicename(snum));
conn_free(conn);
*status = NT_STATUS_BAD_NETWORK_NAME;
@@ -646,27 +667,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
dbgtext( "(pid %d)\n", (int)sys_getpid() );
}
- /* Add veto/hide lists */
- if (!IS_IPC(conn) && !IS_PRINT(conn)) {
- set_namearray( &conn->veto_list, lp_veto_files(snum));
- set_namearray( &conn->hide_list, lp_hide_files(snum));
- set_namearray( &conn->veto_oplock_list, lp_veto_oplocks(snum));
- }
-
- /* Invoke VFS make connection hook */
-
- if (SMB_VFS_CONNECT(conn, lp_servicename(snum), user) < 0) {
- DEBUG(0,("make_connection: VFS make connection failed!\n"));
- change_to_root_user();
- yield_connection(conn, lp_servicename(snum));
- conn_free(conn);
- *status = NT_STATUS_UNSUCCESSFUL;
- return NULL;
- }
-
/* we've finished with the user stuff - go back to root */
change_to_root_user();
-
return(conn);
}