summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-03 23:20:10 -0700
committerJeremy Allison <jra@samba.org>2007-11-03 23:20:10 -0700
commit5b0b4f23ef5fec3d1ad518237f973d4e014b5766 (patch)
treef75cdfaef81e5fcc0cf7061e0141b97831508ee1 /source3/smbd
parent51a0354d751f48a2542984c81e218da33669bbeb (diff)
downloadsamba-5b0b4f23ef5fec3d1ad518237f973d4e014b5766.tar.gz
samba-5b0b4f23ef5fec3d1ad518237f973d4e014b5766.tar.bz2
samba-5b0b4f23ef5fec3d1ad518237f973d4e014b5766.zip
Remove most of the remaining globals out of lib/util_sock.c.
I have a plan for dealing with the remaining..... Watch this space. Jeremy. (This used to be commit 963fc7685212689f02b3adcc05b4273ee5c382d4)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/connection.c3
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/server.c5
-rw-r--r--source3/smbd/service.c7
-rw-r--r--source3/smbd/session.c7
-rw-r--r--source3/smbd/sesssetup.c4
6 files changed, 17 insertions, 11 deletions
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index f041513820..95e45a6990 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -152,7 +152,8 @@ 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(addr,sizeof(addr)),
+ strlcpy(crec.addr,conn?conn->client_address:
+ client_addr(get_client_fd(),addr,sizeof(addr)),
sizeof(crec.addr));
dbuf.dptr = (uint8 *)&crec;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 24feac4630..aa39b01258 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1472,7 +1472,7 @@ static void process_smb(char *inbuf, size_t nread, size_t unread_bytes)
/* 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(addr,sizeof(addr)) ) );
+ client_addr(get_client_fd(),addr,sizeof(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 e77573b9c6..fbf886ee67 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -59,9 +59,12 @@ int smbd_server_fd(void)
static void smbd_set_server_fd(int fd)
{
server_fd = fd;
- client_setfd(fd);
}
+int get_client_fd(void)
+{
+ return server_fd;
+}
struct event_context *smbd_event_context(void)
{
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 502fadedc7..2402be3aed 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -758,8 +758,9 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
add_session_user(user);
- safe_strcpy(conn->client_address, client_addr(addr,sizeof(addr)),
- sizeof(conn->client_address)-1);
+ safe_strcpy(conn->client_address,
+ client_addr(get_client_fd(),addr,sizeof(addr)),
+ sizeof(conn->client_address)-1);
conn->num_files_open = 0;
conn->lastused = conn->lastused_count = time(NULL);
conn->used = True;
@@ -1303,7 +1304,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(addr,sizeof(addr)),
+ client_addr(get_client_fd(),addr,sizeof(addr)),
service));
*status = NT_STATUS_BAD_NETWORK_NAME;
return NULL;
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 69f4a37c85..000b2f5d9c 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -159,9 +159,9 @@ bool session_claim(user_struct *vuser)
client_name() handles this case internally.
*/
- hostname = client_name();
+ hostname = client_name(get_client_fd());
if (strcmp(hostname, "UNKNOWN") == 0) {
- hostname = client_addr(addr,sizeof(addr));
+ hostname = client_addr(get_client_fd(),addr,sizeof(addr));
}
fstrcpy(sessionid.username, vuser->user.unix_name);
@@ -171,7 +171,8 @@ 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(addr,sizeof(addr)));
+ fstrcpy(sessionid.ip_addr_str,
+ client_addr(get_client_fd(),addr,sizeof(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 87cb3b435b..0e8483c81e 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -1317,8 +1317,8 @@ static void setup_new_vc_session(void)
#endif
if (lp_reset_on_zero_vc()) {
connections_forall(shutdown_other_smbds,
- CONST_DISCARD(void *,
- client_addr(addr,sizeof(addr))));
+ CONST_DISCARD(void *,
+ client_addr(get_client_fd(),addr,sizeof(addr))));
}
}