diff options
-rw-r--r-- | source4/ntvfs/cifs/vfs_cifs.c | 2 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_tcp.c | 10 | ||||
-rw-r--r-- | source4/smb_server/request.c | 4 | ||||
-rw-r--r-- | source4/smb_server/service.c | 3 | ||||
-rw-r--r-- | source4/smb_server/smb_server.c | 6 | ||||
-rw-r--r-- | source4/smbd/service.c | 14 | ||||
-rw-r--r-- | source4/smbd/service.h | 12 |
7 files changed, 15 insertions, 36 deletions
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index c9073b04cf..ecc2c7ebcb 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -51,7 +51,7 @@ struct async_info { static void idle_func(struct smbcli_transport *transport, void *p_private) { struct cvfs_private *private = p_private; - if (socket_pending(private->tcon->smb_conn->connection->socket->fde->fd)) { + if (socket_pending(private->tcon->smb_conn->connection->event.fde->fd)) { smbd_process_async(private->tcon->smb_conn); } } diff --git a/source4/rpc_server/dcerpc_tcp.c b/source4/rpc_server/dcerpc_tcp.c index a3290e0170..26ced8c087 100644 --- a/source4/rpc_server/dcerpc_tcp.c +++ b/source4/rpc_server/dcerpc_tcp.c @@ -139,7 +139,7 @@ void dcesrv_tcp_accept(struct server_connection *conn) * but the smb server can't handle it yet * --metze */ - set_blocking(conn->socket->fde->fd, False); + set_blocking(conn->event.fde->fd, False); return; } @@ -158,7 +158,7 @@ void dcesrv_tcp_recv(struct server_connection *conn, time_t t, uint16_t flags) return; } - ret = read(conn->socket->fde->fd, blob.data, blob.length); + ret = read(conn->event.fde->fd, blob.data, blob.length); if (ret == 0 || (ret == -1 && errno != EINTR)) { data_blob_free(&blob); dcesrv_terminate_connection(dce_conn, "eof on socket"); @@ -176,7 +176,7 @@ void dcesrv_tcp_recv(struct server_connection *conn, time_t t, uint16_t flags) data_blob_free(&blob); if (dce_conn->call_list && dce_conn->call_list->replies) { - conn->socket->fde->flags |= EVENT_FD_WRITE; + conn->event.fde->flags |= EVENT_FD_WRITE; } return; @@ -189,13 +189,13 @@ void dcesrv_tcp_send(struct server_connection *conn, time_t t, uint16_t flags) DEBUG(10,("dcesrv_tcp_send\n")); - status = dcesrv_output(dce_conn, conn->socket->fde, dcerpc_write_fn); + status = dcesrv_output(dce_conn, conn->event.fde, dcerpc_write_fn); if (NT_STATUS_IS_ERR(status)) { /* TODO: destroy fd_event? */ } if (!dce_conn->call_list || !dce_conn->call_list->replies) { - conn->socket->fde->flags &= ~EVENT_FD_WRITE; + conn->event.fde->flags &= ~EVENT_FD_WRITE; } return; diff --git a/source4/smb_server/request.c b/source4/smb_server/request.c index fad1d25bba..a5ca789a39 100644 --- a/source4/smb_server/request.c +++ b/source4/smb_server/request.c @@ -49,7 +49,7 @@ struct smbsrv_request *init_smb_request(struct smbsrv_connection *smb_conn) { struct smbsrv_request *req; - smb_conn->connection->socket->pkt_count++; + smb_conn->socket.pkt_count++; req = talloc_p(smb_conn, struct smbsrv_request); if (!req) { @@ -251,7 +251,7 @@ void req_send_reply_nosign(struct smbsrv_request *req) _smb_setlen(req->out.buffer, req->out.size - NBT_HDR_SIZE); } - if (write_data(req->smb_conn->connection->socket->fde->fd, req->out.buffer, req->out.size) != req->out.size) { + if (write_data(req->smb_conn->connection->event.fde->fd, req->out.buffer, req->out.size) != req->out.size) { smbsrv_terminate_connection(req->smb_conn, "failed to send reply\n"); } diff --git a/source4/smb_server/service.c b/source4/smb_server/service.c index e42b803690..54e96476fe 100644 --- a/source4/smb_server/service.c +++ b/source4/smb_server/service.c @@ -249,7 +249,8 @@ close a cnum void close_cnum(struct smbsrv_tcon *tcon) { DEBUG(3,("%s closed connection to service %s\n", - tcon->smb_conn->connection->socket->client_addr, lp_servicename(SNUM(tcon)))); + get_socket_addr(tcon, tcon->smb_conn->connection->event.fde->fd), + lp_servicename(SNUM(tcon)))); /* tell the ntvfs backend that we are disconnecting */ tcon->ntvfs_ops->disconnect(tcon); diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index cc43af8124..228ff4f4a3 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -64,7 +64,7 @@ static struct smbsrv_request *receive_smb_request(struct smbsrv_connection *smb_ char header[4]; struct smbsrv_request *req; - len = read_data(smb_conn->connection->socket->fde->fd, header, 4); + len = read_data(smb_conn->connection->event.fde->fd, header, 4); if (len != 4) { return NULL; } @@ -82,7 +82,7 @@ static struct smbsrv_request *receive_smb_request(struct smbsrv_connection *smb_ /* fill in the already received header */ memcpy(req->in.buffer, header, 4); - len2 = read_data(smb_conn->connection->socket->fde->fd, req->in.buffer + NBT_HDR_SIZE, len); + len2 = read_data(smb_conn->connection->event.fde->fd, req->in.buffer + NBT_HDR_SIZE, len); if (len2 != len) { return NULL; } @@ -831,7 +831,7 @@ void smbsrv_accept(struct server_connection *conn) /* set an initial client name based on its IP address. This will be replaced with the netbios name later if it gives us one */ - socket_addr = get_socket_addr(smb_conn, conn->socket->fde->fd); + socket_addr = get_socket_addr(smb_conn, conn->event.fde->fd); sub_set_remote_machine(socket_addr); /* now initialise a few default values associated with this smb socket */ diff --git a/source4/smbd/service.c b/source4/smbd/service.c index 2f4be5151d..bcdb953e56 100644 --- a/source4/smbd/service.c +++ b/source4/smbd/service.c @@ -210,17 +210,7 @@ struct server_connection *server_setup_connection(struct event_context *ev, stru srv_conn->service = server_socket->service; /* TODO: we need a generic socket subsystem */ - srv_conn->socket = talloc_p(srv_conn->mem_ctx, struct socket_context); - if (!srv_conn->socket) { - DEBUG(0,("talloc_p(srv_conn->mem_ctx, struct socket_context) failed\n")); - talloc_destroy(mem_ctx); - return NULL; - } - srv_conn->socket->private_data = NULL; - srv_conn->socket->ops = NULL; - srv_conn->socket->client_addr = NULL; - srv_conn->socket->pkt_count = 0; - srv_conn->socket->fde = srv_conn->event.fde; + srv_conn->socket = NULL; /* create a smb server context and add it to out event handling */ @@ -230,8 +220,6 @@ struct server_connection *server_setup_connection(struct event_context *ev, stru srv_conn->event.fde = event_add_fd(ev,&fde); srv_conn->event.idle = event_add_timed(ev,&idle); - srv_conn->socket->fde = srv_conn->event.fde; - return srv_conn; } diff --git a/source4/smbd/service.h b/source4/smbd/service.h index 41ad381f9e..5d72d388fd 100644 --- a/source4/smbd/service.h +++ b/source4/smbd/service.h @@ -63,17 +63,7 @@ struct server_service_ops { void (*service_exit)(struct server_service *srv_ctx, const char *reason); }; -struct socket_ops { - int dummy; -}; - -struct socket_context { - void *private_data; - struct socket_ops *ops; - const char *client_addr; - uint_t pkt_count; - struct fd_event *fde; -}; +struct socket_context; struct server_socket { struct server_socket *next,*prev; |