summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/connection.c3
-rw-r--r--source3/smbd/process.c5
-rw-r--r--source3/smbd/server.c4
-rw-r--r--source3/smbd/service.c6
-rw-r--r--source3/smbd/session.c5
-rw-r--r--source3/smbd/sesssetup.c4
6 files changed, 19 insertions, 8 deletions
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index e9f1b82fbf..4b89668640 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -128,6 +128,7 @@ bool claim_connection(connection_struct *conn, const char *name,
struct connections_data crec;
TDB_DATA dbuf;
NTSTATUS status;
+ char addr[INET6_ADDRSTRLEN];
DEBUG(5,("claiming [%s]\n", name));
@@ -151,7 +152,7 @@ bool claim_connection(connection_struct *conn, const char *name,
crec.bcast_msg_flags = msg_flags;
strlcpy(crec.machine,get_remote_machine_name(),sizeof(crec.machine));
- strlcpy(crec.addr,conn?conn->client_address:client_addr(),
+ strlcpy(crec.addr,conn?conn->client_address:client_addr(addr),
sizeof(crec.addr));
dbuf.dptr = (uint8 *)&crec;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 11fdb03d72..f35e7054d7 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1460,15 +1460,18 @@ static void process_smb(char *inbuf, size_t nread, size_t unread_bytes)
DO_PROFILE_INC(smb_count);
if (trans_num == 0) {
+ char addr[INET6_ADDRSTRLEN];
+
/* on the first packet, check the global hosts allow/ hosts
deny parameters before doing any parsing of the packet
passed to us by the client. This prevents attacks on our
parsing code from hosts not in the hosts allow list */
+
if (!check_access(smbd_server_fd(), lp_hostsallow(-1),
lp_hostsdeny(-1))) {
/* send a negative session response "not listening on calling name" */
static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81};
- DEBUG( 1, ( "Connection denied from %s\n", client_addr() ) );
+ DEBUG( 1, ( "Connection denied from %s\n", client_addr(addr) ) );
(void)send_smb(smbd_server_fd(),(char *)buf);
exit_server_cleanly("connection denied");
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index fa8e163081..34b3d4a32a 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -602,6 +602,8 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
if (allowable_number_of_smbd_processes() &&
smbd_server_fd() != -1 &&
((child = sys_fork())==0)) {
+ char remaddr[INET6_ADDRSTRLEN];
+
/* Child code ... */
/* Stop zombies, the parent explicitly handles
@@ -622,7 +624,7 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
/* this is needed so that we get decent entries
in smbstatus for port 445 connects */
- set_remote_machine_name(get_peer_addr(smbd_server_fd()),
+ set_remote_machine_name(get_peer_addr(smbd_server_fd(),remaddr),
False);
/* Reset the state of the random
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index bb279b701f..2901cd3417 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -642,6 +642,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
fstring user;
fstring dev;
int ret;
+ char addr[INET6_ADDRSTRLEN];
*user = 0;
fstrcpy(dev, pdev);
@@ -757,7 +758,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
add_session_user(user);
- safe_strcpy(conn->client_address, client_addr(),
+ safe_strcpy(conn->client_address, client_addr(addr),
sizeof(conn->client_address)-1);
conn->num_files_open = 0;
conn->lastused = conn->lastused_count = time(NULL);
@@ -1204,6 +1205,7 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password,
fstring service;
fstring dev;
int snum = -1;
+ char addr[INET6_ADDRSTRLEN];
fstrcpy(dev, pdev);
@@ -1300,7 +1302,7 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password,
}
DEBUG(0,("%s (%s) couldn't find service %s\n",
- get_remote_machine_name(), client_addr(), service));
+ get_remote_machine_name(), client_addr(addr), service));
*status = NT_STATUS_BAD_NETWORK_NAME;
return NULL;
}
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index ebbb40eb5a..15154162b9 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -69,6 +69,7 @@ bool session_claim(user_struct *vuser)
struct db_context *ctx;
struct db_record *rec;
NTSTATUS status;
+ char addr[INET6_ADDRSTRLEN];
vuser->session_keystr = NULL;
@@ -160,7 +161,7 @@ bool session_claim(user_struct *vuser)
hostname = client_name();
if (strcmp(hostname, "UNKNOWN") == 0) {
- hostname = client_addr();
+ hostname = client_addr(addr);
}
fstrcpy(sessionid.username, vuser->user.unix_name);
@@ -170,7 +171,7 @@ bool session_claim(user_struct *vuser)
sessionid.uid = vuser->uid;
sessionid.gid = vuser->gid;
fstrcpy(sessionid.remote_machine, get_remote_machine_name());
- fstrcpy(sessionid.ip_addr_str, client_addr());
+ fstrcpy(sessionid.ip_addr_str, client_addr(addr));
sessionid.connect_start = time(NULL);
if (!smb_pam_claim_session(sessionid.username, sessionid.id_str,
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index bc298d11f7..35efbc009f 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -1307,6 +1307,8 @@ static int shutdown_other_smbds(struct db_record *rec,
static void setup_new_vc_session(void)
{
+ char addr[INET6_ADDRSTRLEN];
+
DEBUG(2,("setup_new_vc_session: New VC == 0, if NT4.x "
"compatible we would close all old resources.\n"));
#if 0
@@ -1315,7 +1317,7 @@ static void setup_new_vc_session(void)
#endif
if (lp_reset_on_zero_vc()) {
connections_forall(shutdown_other_smbds,
- CONST_DISCARD(void *,client_addr()));
+ CONST_DISCARD(void *,client_addr(addr)));
}
}