summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-04-26 23:52:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:43 -0500
commit595183b9163ab7075e04ef210ca9c75aae041841 (patch)
tree1caf6d386bdeb1ad4adba0568b19c24e04358ac8 /source3/smbd
parent7981bd7f04c8950347298258ea23feff56c1db12 (diff)
downloadsamba-595183b9163ab7075e04ef210ca9c75aae041841.tar.gz
samba-595183b9163ab7075e04ef210ca9c75aae041841.tar.bz2
samba-595183b9163ab7075e04ef210ca9c75aae041841.zip
r6497: Ensure yield_connection() is called on all appropriate error conditions.
Jeremy. (This used to be commit f895f087adbc367a984bfa073f31f890db25a286)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/service.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index d39d3d3836..d4d6274dff 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -521,7 +521,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
/* Initialise VFS function pointers */
if (!smbd_vfs_init(conn)) {
- DEBUG(0, ("vfs_init failed for service %s\n", lp_servicename(SNUM(conn))));
+ DEBUG(0, ("vfs_init failed for service %s\n", lp_servicename(snum)));
conn_free(conn);
*status = NT_STATUS_BAD_NETWORK_NAME;
return NULL;
@@ -544,8 +544,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
/* ROOT Activities: */
/* check number of connections */
if (!claim_connection(conn,
- lp_servicename(SNUM(conn)),
- lp_max_connections(SNUM(conn)),
+ lp_servicename(snum),
+ lp_max_connections(snum),
False,0)) {
DEBUG(1,("too many connections - rejected\n"));
conn_free(conn);
@@ -555,16 +555,16 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
/* Preexecs are done here as they might make the dir we are to ChDir to below */
/* execute any "root preexec = " line */
- if (*lp_rootpreexec(SNUM(conn))) {
+ if (*lp_rootpreexec(snum)) {
int ret;
pstring cmd;
- pstrcpy(cmd,lp_rootpreexec(SNUM(conn)));
+ pstrcpy(cmd,lp_rootpreexec(snum));
standard_sub_conn(conn,cmd,sizeof(cmd));
DEBUG(5,("cmd=%s\n",cmd));
ret = smbrun(cmd,NULL);
- if (ret != 0 && lp_rootpreexec_close(SNUM(conn))) {
+ if (ret != 0 && lp_rootpreexec_close(snum)) {
DEBUG(1,("root preexec gave %d - failing connection\n", ret));
- yield_connection(conn, lp_servicename(SNUM(conn)));
+ yield_connection(conn, lp_servicename(snum));
conn_free(conn);
*status = NT_STATUS_ACCESS_DENIED;
return NULL;
@@ -575,6 +575,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
if (!change_to_user(conn, conn->vuid)) {
/* No point continuing if they fail the basic checks */
DEBUG(0,("Can't become connected user!\n"));
+ yield_connection(conn, lp_servicename(snum));
conn_free(conn);
*status = NT_STATUS_LOGON_FAILURE;
return NULL;
@@ -584,16 +585,16 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
/* Preexecs are done here as they might make the dir we are to ChDir to below */
/* execute any "preexec = " line */
- if (*lp_preexec(SNUM(conn))) {
+ if (*lp_preexec(snum)) {
int ret;
pstring cmd;
- pstrcpy(cmd,lp_preexec(SNUM(conn)));
+ pstrcpy(cmd,lp_preexec(snum));
standard_sub_conn(conn,cmd,sizeof(cmd));
ret = smbrun(cmd,NULL);
- if (ret != 0 && lp_preexec_close(SNUM(conn))) {
+ if (ret != 0 && lp_preexec_close(snum)) {
DEBUG(1,("preexec gave %d - failing connection\n", ret));
change_to_root_user();
- yield_connection(conn, lp_servicename(SNUM(conn)));
+ yield_connection(conn, lp_servicename(snum));
conn_free(conn);
*status = NT_STATUS_ACCESS_DENIED;
return NULL;
@@ -601,7 +602,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
}
#ifdef WITH_FAKE_KASERVER
- if (lp_afs_share(SNUM(conn))) {
+ if (lp_afs_share(snum)) {
afs_login(conn);
}
#endif
@@ -612,9 +613,9 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
I have disabled this chdir check (tridge) */
/* the alternative is just to check the directory exists */
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(conn))));
+ 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();
- yield_connection(conn, lp_servicename(SNUM(conn)));
+ yield_connection(conn, lp_servicename(snum));
conn_free(conn);
*status = NT_STATUS_BAD_NETWORK_NAME;
return NULL;
@@ -642,7 +643,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
if( DEBUGLVL( IS_IPC(conn) ? 3 : 1 ) ) {
dbgtext( "%s (%s) ", get_remote_machine_name(), conn->client_address );
dbgtext( "%s", srv_is_signing_active() ? "signed " : "");
- dbgtext( "connect to service %s ", lp_servicename(SNUM(conn)) );
+ dbgtext( "connect to service %s ", lp_servicename(snum) );
dbgtext( "initially as user %s ", user );
dbgtext( "(uid=%d, gid=%d) ", (int)geteuid(), (int)getegid() );
dbgtext( "(pid %d)\n", (int)sys_getpid() );
@@ -650,9 +651,9 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
/* Add veto/hide lists */
if (!IS_IPC(conn) && !IS_PRINT(conn)) {
- set_namearray( &conn->veto_list, lp_veto_files(SNUM(conn)));
- set_namearray( &conn->hide_list, lp_hide_files(SNUM(conn)));
- set_namearray( &conn->veto_oplock_list, lp_veto_oplocks(SNUM(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 */
@@ -660,6 +661,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
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;
@@ -812,8 +814,9 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password,
}
/****************************************************************************
-close a cnum
+ Close a cnum.
****************************************************************************/
+
void close_cnum(connection_struct *conn, uint16 vuid)
{
if (IS_IPC(conn)) {