summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb_server.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-08 10:23:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:12 -0500
commite246a067515b1fdb725ca1f8e7b406cc84a89e81 (patch)
treeb12f8b4cf4a681bef53ed90be035022d949b1906 /source4/smb_server/smb_server.c
parent7eb3fc533d7016bc0f20adbc805a0fd926c783b4 (diff)
downloadsamba-e246a067515b1fdb725ca1f8e7b406cc84a89e81.tar.gz
samba-e246a067515b1fdb725ca1f8e7b406cc84a89e81.tar.bz2
samba-e246a067515b1fdb725ca1f8e7b406cc84a89e81.zip
r12126: get rid of the local ->terminate hacks, we do that genericly now
metze (This used to be commit a7baf165c10c00096265b790d5362905c527806a)
Diffstat (limited to 'source4/smb_server/smb_server.c')
-rw-r--r--source4/smb_server/smb_server.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index d51dec8db4..bffc19fc72 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -75,7 +75,7 @@ static NTSTATUS smbsrv_recv_generic_request(void *private, DATA_BLOB blob)
*/
void smbsrv_terminate_connection(struct smbsrv_connection *smb_conn, const char *reason)
{
- smb_conn->terminate = reason;
+ stream_terminate_connection(smb_conn->connection, reason);
}
/*
@@ -83,17 +83,12 @@ void smbsrv_terminate_connection(struct smbsrv_connection *smb_conn, const char
*/
static void smbsrv_recv(struct stream_connection *conn, uint16_t flags)
{
- struct smbsrv_connection *smb_conn = talloc_get_type(conn->private, struct smbsrv_connection);
+ struct smbsrv_connection *smb_conn = talloc_get_type(conn->private,
+ struct smbsrv_connection);
DEBUG(10,("smbsrv_recv\n"));
packet_recv(smb_conn->packet);
- if (smb_conn->terminate) {
- talloc_free(conn->event.fde);
- conn->event.fde = NULL;
- stream_terminate_connection(smb_conn->connection, smb_conn->terminate);
- return;
- }
/* free up temporary memory */
lp_talloc_free();
@@ -109,7 +104,6 @@ static void smbsrv_send(struct stream_connection *conn, uint16_t flags)
packet_queue_run(smb_conn->packet);
}
-
/*
handle socket recv errors
*/
@@ -131,11 +125,14 @@ static void smbsrv_accept(struct stream_connection *conn)
DEBUG(5,("smbsrv_accept\n"));
smb_conn = talloc_zero(conn, struct smbsrv_connection);
- if (!smb_conn) return;
+ if (!smb_conn) {
+ stream_terminate_connection(conn, "out of memory");
+ return;
+ }
smb_conn->packet = packet_init(smb_conn);
- if (smb_conn->packet == NULL) {
- stream_terminate_connection(conn, "out of memory");
+ if (!smb_conn->packet) {
+ smbsrv_terminate_connection(smb_conn, "out of memory");
return;
}
packet_set_private(smb_conn->packet, smb_conn);