summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-08-25 00:46:42 +0200
committerMichael Adam <obnox@samba.org>2011-10-11 14:17:57 +0200
commitec057c369f64b35853c13c54af94c3bf5bebd630 (patch)
treea7a565fb876e9c2d43088b7f8880abebc5343a2b /source3
parent43a13b55fc75c24a4a90c271d5ea6ea8f468b6cf (diff)
downloadsamba-ec057c369f64b35853c13c54af94c3bf5bebd630.tar.gz
samba-ec057c369f64b35853c13c54af94c3bf5bebd630.tar.bz2
samba-ec057c369f64b35853c13c54af94c3bf5bebd630.zip
s3:smbd: convert session.c to use dbwrap wrapper functions only
Avoid direct use of the db_record and db_context structs.
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/session.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 6672b64516..0797d1b41f 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -76,6 +76,7 @@ bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser)
*/
struct server_id sess_pid;
+ TDB_DATA value;
snprintf(keystr, sizeof(keystr), "ID/%d", i);
@@ -85,13 +86,15 @@ bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser)
return False;
}
- if (rec->value.dsize != sizeof(sessionid)) {
+ value = dbwrap_record_get_value(rec);
+
+ if (value.dsize != sizeof(sessionid)) {
DEBUG(1, ("Re-using invalid record\n"));
break;
}
memcpy(&sess_pid,
- ((char *)rec->value.dptr)
+ ((char *)value.dptr)
+ offsetof(struct sessionid, pid),
sizeof(sess_pid));
@@ -162,7 +165,7 @@ bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser)
data.dptr = (uint8 *)&sessionid;
data.dsize = sizeof(sessionid);
- status = rec->store(rec, data, TDB_REPLACE);
+ status = dbwrap_record_store(rec, data, TDB_REPLACE);
TALLOC_FREE(rec);
@@ -194,6 +197,7 @@ void session_yield(user_struct *vuser)
{
struct sessionid sessionid;
struct db_record *rec;
+ TDB_DATA value;
if (!vuser->session_keystr) {
return;
@@ -204,10 +208,12 @@ void session_yield(user_struct *vuser)
return;
}
- if (rec->value.dsize != sizeof(sessionid))
+ value = dbwrap_record_get_value(rec);
+
+ if (value.dsize != sizeof(sessionid))
return;
- memcpy(&sessionid, rec->value.dptr, sizeof(sessionid));
+ memcpy(&sessionid, value.dptr, sizeof(sessionid));
if (lp_utmp()) {
sys_utmp_yield(sessionid.username, sessionid.hostname,
@@ -218,7 +224,7 @@ void session_yield(user_struct *vuser)
smb_pam_close_session(sessionid.username, sessionid.id_str,
sessionid.hostname);
- rec->delete_rec(rec);
+ dbwrap_record_delete(rec);
TALLOC_FREE(rec);
}