From fe45888e228d1452b8301b3b074794bd443a7fa5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 24 Sep 2004 03:34:55 +0000 Subject: r2581: added "hosts allow" and "hosts deny" checking in smbd. I needed this as my box keeps getting hit by viruses spreading on my companies internal network, which screws up my debug log badly (sigh). metze, I'm not sure if you think access.c should go in the socket library or not. It is closely tied to the socket functions, but you may prefer it separate. The access.c code is a port from Samba3, but with some cleanups to make it (slighly) less ugly. (This used to be commit 058b2fd99e3957d7d2a9544fd27071f1122eab68) --- source4/smb_server/service.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/smb_server/service.c') diff --git a/source4/smb_server/service.c b/source4/smb_server/service.c index bc436172a1..5f698fe20b 100644 --- a/source4/smb_server/service.c +++ b/source4/smb_server/service.c @@ -143,6 +143,13 @@ static NTSTATUS make_connection_snum(struct smbsrv_request *req, struct smbsrv_tcon *tcon; NTSTATUS status; + if (!socket_check_access(req->smb_conn->connection->socket, + lp_servicename(snum), + lp_hostsallow(snum), + lp_hostsdeny(snum))) { + return NT_STATUS_ACCESS_DENIED; + } + tcon = conn_new(req->smb_conn); if (!tcon) { DEBUG(0,("Couldn't find free connection.\n")); -- cgit