summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-06-16 15:57:48 +0200
committerAndrew Bartlett <abartlet@samba.org>2011-07-04 18:28:28 +1000
commitea2917c7a2cab1605da6fcd9e0b4aa3476b1ff68 (patch)
tree023a30f843f837232d24171b1703172413988dac
parent73d28912a4ff8393c655e239eb3d011cf67ad005 (diff)
downloadsamba-ea2917c7a2cab1605da6fcd9e0b4aa3476b1ff68.tar.gz
samba-ea2917c7a2cab1605da6fcd9e0b4aa3476b1ff68.tar.bz2
samba-ea2917c7a2cab1605da6fcd9e0b4aa3476b1ff68.zip
s3-smbd: Replace client_id in smbd session.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/smbd/session.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 48afb5389f..379a66ce8f 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -32,6 +32,7 @@
#include "dbwrap.h"
#include "session.h"
#include "auth.h"
+#include "../lib/tsocket/tsocket.h"
/********************************************************************
called when a session is created
@@ -46,6 +47,7 @@ bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser)
fstring keystr;
struct db_record *rec;
NTSTATUS status;
+ char *raddr;
vuser->session_keystr = NULL;
@@ -128,20 +130,20 @@ bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser)
SMB_ASSERT(rec != NULL);
- /* If 'hostname lookup' == yes, then do the DNS lookup. This is
- needed because utmp and PAM both expect DNS names
-
- client_name() handles this case internally.
- */
+ raddr = tsocket_address_inet_addr_string(sconn->remote_address,
+ talloc_tos());
+ if (raddr == NULL) {
+ return false;
+ }
fstrcpy(sessionid.username, vuser->session_info->unix_name);
- fstrcpy(sessionid.hostname, sconn->client_id.name);
+ fstrcpy(sessionid.hostname, sconn->remote_hostname);
sessionid.id_num = i; /* Only valid for utmp sessions */
sessionid.pid = pid;
sessionid.uid = vuser->session_info->utok.uid;
sessionid.gid = vuser->session_info->utok.gid;
fstrcpy(sessionid.remote_machine, get_remote_machine_name());
- fstrcpy(sessionid.ip_addr_str, sconn->client_id.addr);
+ fstrcpy(sessionid.ip_addr_str, raddr);
sessionid.connect_start = time(NULL);
if (!smb_pam_claim_session(sessionid.username, sessionid.id_str,