summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-08-22 19:11:55 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-08-22 19:11:55 +0000
commit2051bb7d0366e07c5ecda5e5f7cfedc4153d6228 (patch)
treeed0c6282879b77e9ba56a5d8b9b3e53ed355437f /source3/smbd
parent28b206f16303d69694174d69fdfe2853bcee56c8 (diff)
downloadsamba-2051bb7d0366e07c5ecda5e5f7cfedc4153d6228.tar.gz
samba-2051bb7d0366e07c5ecda5e5f7cfedc4153d6228.tar.bz2
samba-2051bb7d0366e07c5ecda5e5f7cfedc4153d6228.zip
A few changes:
drop paramaters: status utmp hostname change session code to always record each vuid current on the server. The sessionid struct is no longer packed, as I couldn't get that to work ;-) change smbstatus to show this info and less of the connections.tdb info (its not actualy that accurate). I'll get swat doing some of this shortly. (This used to be commit b068ad300527c44673bbee0aede7849199c89de7)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c4
-rw-r--r--source3/smbd/server.c8
-rw-r--r--source3/smbd/session.c43
3 files changed, 17 insertions, 38 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index bef1b15084..b4fb6693e6 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -127,9 +127,7 @@ int reply_special(char *inbuf,char *outbuf)
reload_services(True);
reopen_logs();
- if (lp_status(-1)) {
- claim_connection(NULL,"",MAXSTATUS,True);
- }
+ claim_connection(NULL,"",MAXSTATUS,True);
break;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 13071a5b65..5bcb47393a 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -459,9 +459,7 @@ void exit_server(char *reason)
invalidate_all_vuids();
/* delete our entry in the connections database. */
- if (lp_status(-1)) {
- yield_connection(NULL,"",MAXSTATUS);
- }
+ yield_connection(NULL,"",MAXSTATUS);
respond_to_all_remaining_local_messages();
decrement_smbd_process_count();
@@ -751,9 +749,7 @@ static void usage(char *pname)
}
/* Setup the main smbd so that we can get messages. */
- if (lp_status(-1)) {
- claim_connection(NULL,"",MAXSTATUS,True);
- }
+ claim_connection(NULL,"",MAXSTATUS,True);
/* Attempt to migrate from an old 2.0.x machine account file. */
if (!migrate_from_old_password_file(global_myworkgroup)) {
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 7616689fe0..78c635d7cf 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -28,17 +28,9 @@
#include "includes.h"
-#if defined(WITH_PAM) || defined(WITH_UTMP)
+extern fstring remote_machine;
static TDB_CONTEXT *tdb;
-struct sessionid {
- fstring username;
- fstring hostname;
- fstring id_str;
- uint32 id_num;
- uint32 pid;
-};
-
/* called when a session is created */
BOOL session_claim(uint16 vuid)
{
@@ -98,6 +90,10 @@ BOOL session_claim(uint16 vuid)
slprintf(sessionid.id_str, sizeof(sessionid.id_str)-1, SESSION_TEMPLATE, i);
sessionid.id_num = i;
sessionid.pid = pid;
+ sessionid.uid = vuser->uid;
+ sessionid.gid = vuser->gid;
+ fstrcpy(sessionid.remote_machine, remote_machine);
+ fstrcpy(sessionid.ip_addr, client_addr());
if (!smb_pam_claim_session(sessionid.username, sessionid.id_str, sessionid.hostname)) {
DEBUG(1,("pam_session rejected the session for %s [%s]\n",
@@ -106,12 +102,8 @@ BOOL session_claim(uint16 vuid)
return False;
}
- dlen = tdb_pack(dbuf, sizeof(dbuf), "fffdd",
- sessionid.username, sessionid.hostname, sessionid.id_str,
- sessionid.id_num, sessionid.pid);
-
- data.dptr = dbuf;
- data.dsize = dlen;
+ data.dptr = (char *)&sessionid;
+ data.dsize = sizeof(sessionid);
if (tdb_store(tdb, key, data, TDB_MODIFY) != 0) {
DEBUG(1,("session_claim: unable to create session id record\n"));
return False;
@@ -132,7 +124,7 @@ BOOL session_claim(uint16 vuid)
void session_yield(uint16 vuid)
{
user_struct *vuser = get_valid_user_struct(vuid);
- TDB_DATA data;
+ TDB_DATA dbuf;
struct sessionid sessionid;
TDB_DATA key;
fstring keystr;
@@ -148,17 +140,15 @@ void session_yield(uint16 vuid)
key.dptr = keystr;
key.dsize = strlen(keystr)+1;
- data = tdb_fetch(tdb, key);
- if (data.dptr == NULL) {
+ dbuf = tdb_fetch(tdb, key);
+
+ if (dbuf.dsize != sizeof(sessionid))
return;
- }
- tdb_unpack(data.dptr, data.dsize, "fffdd",
- &sessionid.username, &sessionid.hostname, &sessionid.id_str,
- &sessionid.id_num, &sessionid.pid);
+ memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
- safe_free(data.dptr);
- data.dptr = NULL;
+ safe_free(dbuf.dptr);
+ dbuf.dptr = NULL;
#if WITH_UTMP
if (lp_utmp()) {
@@ -172,8 +162,3 @@ void session_yield(uint16 vuid)
tdb_delete(tdb, key);
}
-#else
- /* null functions - no session support needed */
- BOOL session_claim(uint16 vuid) { return True; }
- void session_yield(uint16 vuid) {}
-#endif