diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-03-15 17:28:46 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:57:26 -0500 |
commit | 2e7df84576d26bc37eb87b7e3c79fcb3fb358d68 (patch) | |
tree | 2b30c038028b0a1530d0236fa196efaa3d63b0f5 /source4/smb_server/tcon.c | |
parent | 84aea6eca58b20f32fad0de0f43d9a5c7de247c9 (diff) | |
download | samba-2e7df84576d26bc37eb87b7e3c79fcb3fb358d68.tar.gz samba-2e7df84576d26bc37eb87b7e3c79fcb3fb358d68.tar.bz2 samba-2e7df84576d26bc37eb87b7e3c79fcb3fb358d68.zip |
r14456: don't access the smbsrv_tcon inside the ntvfs modules
metze
(This used to be commit 5709c1c4e1a561dd9af98cfefbbbdac9b18765b7)
Diffstat (limited to 'source4/smb_server/tcon.c')
-rw-r--r-- | source4/smb_server/tcon.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/source4/smb_server/tcon.c b/source4/smb_server/tcon.c index 90fe20a4c8..95e42d6537 100644 --- a/source4/smb_server/tcon.c +++ b/source4/smb_server/tcon.c @@ -93,16 +93,16 @@ static int smbsrv_tcon_destructor(void *ptr) { struct smbsrv_tcon *tcon = talloc_get_type(ptr, struct smbsrv_tcon); struct smbsrv_tcons_context *tcons_ctx; - struct socket_address *client_addr; + client_addr = socket_get_peer_addr(tcon->smb_conn->connection->socket, ptr); DEBUG(3,("%s closed connection to service %s\n", client_addr ? client_addr->addr : "(unknown)", - lp_servicename(tcon->service))); + tcon->share_name)); /* tell the ntvfs backend that we are disconnecting */ - if (tcon->ntvfs_ctx) { - ntvfs_disconnect(tcon->ntvfs_ctx); + if (tcon->ntvfs) { + ntvfs_disconnect(tcon->ntvfs); } if (tcon->smb2.session) { @@ -119,7 +119,9 @@ static int smbsrv_tcon_destructor(void *ptr) /* find first available connection slot */ -static struct smbsrv_tcon *smbsrv_tcon_new(struct smbsrv_connection *smb_conn, struct smbsrv_session *smb_sess) +static struct smbsrv_tcon *smbsrv_tcon_new(struct smbsrv_connection *smb_conn, + struct smbsrv_session *smb_sess, + const char *share_name) { TALLOC_CTX *mem_ctx; struct smbsrv_tcons_context *tcons_ctx; @@ -138,11 +140,13 @@ static struct smbsrv_tcon *smbsrv_tcon_new(struct smbsrv_connection *smb_conn, s if (!tcon) return NULL; tcon->smb_conn = smb_conn; tcon->smb2.session = smb_sess; + tcon->share_name = talloc_strdup(tcon, share_name); + if (!tcon->share_name) goto failed; i = idr_get_new_random(tcons_ctx->idtree_tid, tcon, tcons_ctx->idtree_limit); if (i == -1) { DEBUG(1,("ERROR! Out of connection structures\n")); - return NULL; + goto failed; } tcon->tid = i; @@ -153,14 +157,18 @@ static struct smbsrv_tcon *smbsrv_tcon_new(struct smbsrv_connection *smb_conn, s tcon->statistics.connect_time = timeval_current(); return tcon; + +failed: + talloc_free(tcon); + return NULL; } -struct smbsrv_tcon *smbsrv_smb_tcon_new(struct smbsrv_connection *smb_conn) +struct smbsrv_tcon *smbsrv_smb_tcon_new(struct smbsrv_connection *smb_conn, const char *share_name) { - return smbsrv_tcon_new(smb_conn, NULL); + return smbsrv_tcon_new(smb_conn, NULL, share_name); } -struct smbsrv_tcon *smbsrv_smb2_tcon_new(struct smbsrv_session *smb_sess) +struct smbsrv_tcon *smbsrv_smb2_tcon_new(struct smbsrv_session *smb_sess, const char *share_name) { - return smbsrv_tcon_new(smb_sess->smb_conn, smb_sess); + return smbsrv_tcon_new(smb_sess->smb_conn, smb_sess, share_name); } |