summaryrefslogtreecommitdiff
path: root/source3/smbd/session.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-10-03 20:43:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:31:09 -0500
commit0d87820380416955a132d565a479b4234f78c113 (patch)
tree9e6debb4b26796a386c188e7933ab7032e77e838 /source3/smbd/session.c
parent334b288831c1730cb88fb431f684b9062e139efd (diff)
downloadsamba-0d87820380416955a132d565a479b4234f78c113.tar.gz
samba-0d87820380416955a132d565a479b4234f78c113.tar.bz2
samba-0d87820380416955a132d565a479b4234f78c113.zip
r25492: Start adding IPv6 compatible code to lib/util_sock.c and deal with
the ripple effects this causes. utmp has to change etc. Remove some global varables and store address/port in the unexpected db. Jeremy. (This used to be commit 18c6a2211d9e25233d01715b3f78977edcd6d869)
Diffstat (limited to 'source3/smbd/session.c')
-rw-r--r--source3/smbd/session.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 3cc93c1a7f..c7cdf41fb5 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -62,8 +62,6 @@ BOOL session_claim(user_struct *vuser)
{
TDB_DATA key, data;
int i = 0;
- struct sockaddr sa;
- struct in_addr *client_ip;
struct sessionid sessionid;
struct server_id pid = procid_self();
fstring keystr;
@@ -124,7 +122,7 @@ BOOL session_claim(user_struct *vuser)
TALLOC_FREE(rec);
}
-
+
if (i == MAX_SESSION_ID) {
SMB_ASSERT(rec == NULL);
DEBUG(1,("session_claim: out of session IDs "
@@ -147,16 +145,16 @@ BOOL session_claim(user_struct *vuser)
return False;
}
- snprintf(sessionid.id_str, sizeof(sessionid.id_str),
- SESSION_TEMPLATE, (long unsigned int)sys_getpid(),
+ snprintf(sessionid.id_str, sizeof(sessionid.id_str),
+ SESSION_TEMPLATE, (long unsigned int)sys_getpid(),
vuser->vuid);
}
SMB_ASSERT(rec != NULL);
/* If 'hostname lookup' == yes, then do the DNS lookup. This is
- needed because utmp and PAM both expect DNS names
-
+ needed because utmp and PAM both expect DNS names
+
client_name() handles this case internally.
*/
@@ -172,11 +170,9 @@ 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, client_addr());
+ fstrcpy(sessionid.ip_addr_str, client_addr());
sessionid.connect_start = time(NULL);
- client_ip = client_inaddr(&sa);
-
if (!smb_pam_claim_session(sessionid.username, sessionid.id_str,
sessionid.hostname)) {
DEBUG(1,("pam_session rejected the session for %s [%s]\n",
@@ -200,8 +196,8 @@ BOOL session_claim(user_struct *vuser)
}
if (lp_utmp()) {
- sys_utmp_claim(sessionid.username, sessionid.hostname,
- client_ip,
+ sys_utmp_claim(sessionid.username, sessionid.hostname,
+ sessionid.ip_addr_str,
sessionid.id_str, sessionid.id_num);
}
@@ -224,7 +220,6 @@ void session_yield(user_struct *vuser)
{
TDB_DATA key;
struct sessionid sessionid;
- struct in_addr *client_ip;
struct db_context *ctx;
struct db_record *rec;
@@ -245,11 +240,9 @@ void session_yield(user_struct *vuser)
memcpy(&sessionid, rec->value.dptr, sizeof(sessionid));
- client_ip = interpret_addr2(sessionid.ip_addr);
-
if (lp_utmp()) {
sys_utmp_yield(sessionid.username, sessionid.hostname,
- client_ip,
+ sessionid.ip_addr_str,
sessionid.id_str, sessionid.id_num);
}