summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-11-17 12:52:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:46:24 -0500
commit58bf4b160eb292bb40c79f65e4bc6a6f244577b9 (patch)
tree1578ebca3fefc8928bcf2c06611a023f585f3236 /source4
parenteedb92ce724e505f94ed49f9b238be617c52ccb4 (diff)
downloadsamba-58bf4b160eb292bb40c79f65e4bc6a6f244577b9.tar.gz
samba-58bf4b160eb292bb40c79f65e4bc6a6f244577b9.tar.bz2
samba-58bf4b160eb292bb40c79f65e4bc6a6f244577b9.zip
r11759: fix up the SEC_SHARE handling, when we want to support that later
we need to fake a smbsrv_session for each smbsrv_tcon... metze (This used to be commit 5b5fb1772034fbfebbb7174df235c8c11d4819fe)
Diffstat (limited to 'source4')
-rw-r--r--source4/smb_server/receive.c18
-rw-r--r--source4/smb_server/session.c6
-rw-r--r--source4/smb_server/smb_server.h6
3 files changed, 14 insertions, 16 deletions
diff --git a/source4/smb_server/receive.c b/source4/smb_server/receive.c
index b339f1391a..371333b647 100644
--- a/source4/smb_server/receive.c
+++ b/source4/smb_server/receive.c
@@ -459,7 +459,6 @@ static void switch_message(int type, struct smbsrv_request *req)
{
int flags;
struct smbsrv_connection *smb_conn = req->smb_conn;
- uint16_t session_tag;
NTSTATUS status;
type &= 0xff;
@@ -476,24 +475,19 @@ static void switch_message(int type, struct smbsrv_request *req)
req->tcon = smbsrv_tcon_find(smb_conn, SVAL(req->in.hdr,HDR_TID));
- if (req->session == NULL) {
+ if (!req->session) {
/* setup the user context for this request if it
hasn't already been initialised (to cope with SMB
chaining) */
/* In share mode security we must ignore the vuid. */
if (smb_conn->config.security == SEC_SHARE) {
- session_tag = UID_FIELD_INVALID;
- } else {
- session_tag = SVAL(req->in.hdr,HDR_UID);
+ if (req->tcon) {
+ req->session = req->tcon->sec_share.session;
+ }
+ } else {
+ req->session = smbsrv_session_find(req->smb_conn, SVAL(req->in.hdr,HDR_UID));
}
-
- req->session = smbsrv_session_find(req->smb_conn, session_tag);
- if (req->session) {
- req->session->vuid = session_tag;
- }
- } else {
- session_tag = req->session->vuid;
}
DEBUG(3,("switch message %s (task_id %d)\n",smb_fn_name(type), req->smb_conn->connection->server_id));
diff --git a/source4/smb_server/session.c b/source4/smb_server/session.c
index 0bee536b93..50bea16ee2 100644
--- a/source4/smb_server/session.c
+++ b/source4/smb_server/session.c
@@ -106,9 +106,7 @@ struct smbsrv_session *smbsrv_register_session(struct smbsrv_connection *smb_con
int i;
/* Ensure no vuid gets registered in share level security. */
- /* TODO: replace lp_security with a flag in smbsrv_connection */
- if (lp_security() == SEC_SHARE)
- return UID_FIELD_INVALID;
+ if (smb_conn->config.security == SEC_SHARE) return NULL;
sess = talloc(smb_conn, struct smbsrv_session);
if (sess == NULL) {
@@ -120,7 +118,7 @@ struct smbsrv_session *smbsrv_register_session(struct smbsrv_connection *smb_con
i = idr_get_new_random(smb_conn->sessions.idtree_vuid, sess, UINT16_MAX);
if (i == -1) {
- DEBUG(1,("ERROR! Out of connection structures\n"));
+ DEBUG(1,("ERROR! Out of connection structures\n"));
talloc_free(sess);
return NULL;
}
diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h
index 4ab7637558..4b2f65d14a 100644
--- a/source4/smb_server/smb_server.h
+++ b/source4/smb_server/smb_server.h
@@ -80,6 +80,12 @@ struct smbsrv_tcon {
/* the reported device type */
char *dev_type;
+ /* some stuff to support share level security */
+ struct {
+ /* in share level security we need to fake up a session */
+ struct smbsrv_session *session;
+ } sec_share;
+
struct timeval connect_time;
};