[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Tue Sep 10 22:39:03 CEST 2013
The branch, master has been updated
via c8c0632 s3:smb2_find: Return that timestamps do not exist as directories
via 6bd5fef lib: serverid.h needs "struct db_record" declaration
via 2d14ab3 s3: rpc_server/srvsvc: use find_sessions() in NetSessDel
via 69470a2 s3:smbd/session: Added a routine find_sessions()
via 340f7f1 s3:smbd/session: add filters to gather_sessioninfo()
from f942d01 doc: Update documentation of pam_winbind krb5 support.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c8c0632c871e838fc4465b2a69b4e059e9a126c0
Author: Christof Schmitt <christof.schmitt at us.ibm.com>
Date: Thu Aug 29 19:36:00 2013 +0200
s3:smb2_find: Return that timestamps do not exist as directories
When a Windows client receives a large directory listing while
querying snapshots, it sends a find request asking for the
timestamp as a directory. A Windows server returns NO_SUCH_FILE,
so make sure Samba returns the same. Otherwise the client will
get confused and display timestamps in the 'previous versions' dialog.
Signed-off-by: Christof Schmitt <christof.schmitt at us.ibm.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Sep 10 22:38:51 CEST 2013 on sn-devel-104
commit 6bd5fef77dc89e925c65af8788528b226edf4fb7
Author: Volker Lendecke <vl at samba.org>
Date: Tue Sep 10 20:11:38 2013 +0200
lib: serverid.h needs "struct db_record" declaration
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2d14ab32bfb92d725912c5a2fa0a61d9d723f341
Author: Shekhar Amlekar <samlekar at in.ibm.com>
Date: Mon Jun 3 13:02:19 2013 +0530
s3: rpc_server/srvsvc: use find_sessions() in NetSessDel
instead of using list_sessions(), use find_sessions() that
builds the list of only the sessions of interest.
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 69470a2efdf36f306292515c1ed596b576e95120
Author: Shekhar Amlekar <samlekar at in.ibm.com>
Date: Tue Sep 10 11:58:07 2013 +0530
s3:smbd/session: Added a routine find_sessions()
this routine builds a list of sessions from a
particular remote machine or user.
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 340f7f125db0d08ae47620e1c90a3dcd20201487
Author: Shekhar Amlekar <samlekar at in.ibm.com>
Date: Tue Sep 10 10:39:03 2013 +0530
s3:smbd/session: add filters to gather_sessioninfo()
added capability to filter sessions based on remote
machine name and user name.
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/include/serverid.h | 1 +
source3/include/smb.h | 3 ++
source3/modules/vfs_shadow_copy2.c | 3 --
source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 31 ++++++++----------
source3/smbd/proto.h | 2 +
source3/smbd/session.c | 47 +++++++++++++++++++++++++++++
source3/smbd/smb2_find.c | 13 ++++++++
7 files changed, 80 insertions(+), 20 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/serverid.h b/source3/include/serverid.h
index 1833f53..9c84b74 100644
--- a/source3/include/serverid.h
+++ b/source3/include/serverid.h
@@ -21,6 +21,7 @@
#define __SERVERID_H__
#include "includes.h"
+#include "lib/dbwrap/dbwrap.h"
/*
* Register a server with its unique id
diff --git a/source3/include/smb.h b/source3/include/smb.h
index b6b04a4..1288222 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -567,6 +567,9 @@ Offset Data length.
#define NOTIFY_ACTION_REMOVED_STREAM 7
#define NOTIFY_ACTION_MODIFIED_STREAM 8
+/* timestamp format used in "previous versions" */
+#define GMT_NAME_LEN 24 /* length of a @GMT- name */
+#define GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
/* where to find the base of the SMB packet proper */
#define smb_base(buf) (((const char *)(buf))+4)
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 60f9628..aa7e50f 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -107,9 +107,6 @@
#include <ccan/hash/hash.h>
#include "util_tdb.h"
-#define GMT_NAME_LEN 24 /* length of a @GMT- name */
-#define GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
-
static bool shadow_copy2_find_slashes(TALLOC_CTX *mem_ctx, const char *str,
size_t **poffsets,
unsigned *pnum_offsets)
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 8f3a4cf..3d4ee22 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -1296,30 +1296,27 @@ WERROR _srvsvc_NetSessDel(struct pipes_struct *p,
machine += 2;
}
- num_sessions = list_sessions(p->mem_ctx, &session_list);
+ num_sessions = find_sessions(p->mem_ctx, username, machine,
+ &session_list);
for (snum = 0; snum < num_sessions; snum++) {
- if ((strequal(session_list[snum].username, username) || username[0] == '\0' ) &&
- strequal(session_list[snum].remote_machine, machine)) {
+ NTSTATUS ntstat;
- NTSTATUS ntstat;
-
- if (p->session_info->unix_token->uid != sec_initial_uid()) {
- not_root = True;
- become_root();
- }
+ if (p->session_info->unix_token->uid != sec_initial_uid()) {
+ not_root = True;
+ become_root();
+ }
- ntstat = messaging_send(p->msg_ctx,
- session_list[snum].pid,
- MSG_SHUTDOWN, &data_blob_null);
+ ntstat = messaging_send(p->msg_ctx,
+ session_list[snum].pid,
+ MSG_SHUTDOWN, &data_blob_null);
- if (NT_STATUS_IS_OK(ntstat))
- werr = WERR_OK;
+ if (NT_STATUS_IS_OK(ntstat))
+ werr = WERR_OK;
- if (not_root)
- unbecome_root();
- }
+ if (not_root)
+ unbecome_root();
}
DEBUG(5,("_srvsvc_NetSessDel: %d\n", __LINE__));
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 8b6987e..54d6da0 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1001,6 +1001,8 @@ bool session_init(void);
bool session_claim(struct smbXsrv_session *session);
void session_yield(struct smbXsrv_session *session);
int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
+int find_sessions(TALLOC_CTX *mem_ctx, const char *username,
+ const char *machine, struct sessionid **session_list);
/* The following definitions come from smbd/sesssetup.c */
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 01a8194..4ddb856 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -114,6 +114,8 @@ void session_yield(struct smbXsrv_session *session)
struct session_list {
TALLOC_CTX *mem_ctx;
int count;
+ const char *filter_user;
+ const char *filter_machine;
struct sessionid *sessions;
};
@@ -122,6 +124,21 @@ static int gather_sessioninfo(const char *key, struct sessionid *session,
{
struct session_list *sesslist = (struct session_list *)private_data;
+ /* filter the session if required */
+
+ if (sesslist->filter_user &&
+ (sesslist->filter_user[0] != '\0') &&
+ !strequal(session->username, sesslist->filter_user)) {
+ return 0;
+ }
+
+ if (sesslist->filter_machine &&
+ (sesslist->filter_machine[0] != '\0') &&
+ !strequal(session->remote_machine,
+ sesslist->filter_machine)) {
+ return 0;
+ }
+
sesslist->sessions = talloc_realloc(
sesslist->mem_ctx, sesslist->sessions, struct sessionid,
sesslist->count+1);
@@ -152,6 +169,8 @@ int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list)
sesslist.mem_ctx = mem_ctx;
sesslist.count = 0;
+ sesslist.filter_user = NULL;
+ sesslist.filter_machine = NULL;
sesslist.sessions = NULL;
status = sessionid_traverse_read(gather_sessioninfo, (void *) &sesslist);
@@ -165,3 +184,31 @@ int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list)
*session_list = sesslist.sessions;
return sesslist.count;
}
+
+/********************************************************************
+find the sessions that match the given username and machine
+********************************************************************/
+
+int find_sessions(TALLOC_CTX *mem_ctx, const char *username,
+ const char *machine, struct sessionid **session_list)
+{
+ struct session_list sesslist;
+ NTSTATUS status;
+
+ sesslist.mem_ctx = mem_ctx;
+ sesslist.count = 0;
+ sesslist.filter_user = username;
+ sesslist.filter_machine = machine;
+ sesslist.sessions = NULL;
+
+ status = sessionid_traverse_read(gather_sessioninfo, (void *)&sesslist);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(3, ("Session traverse failed: %s\n", nt_errstr(status)));
+ TALLOC_FREE(sesslist.sessions);
+ *session_list = NULL;
+ return 0;
+ }
+
+ *session_list = sesslist.sessions;
+ return sesslist.count;
+}
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
index c2c0559..c39a35d 100644
--- a/source3/smbd/smb2_find.c
+++ b/source3/smbd/smb2_find.c
@@ -224,6 +224,8 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
uint32_t dirtype = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY;
bool dont_descend = false;
bool ask_sharemode = true;
+ struct tm tm;
+ char *p;
req = tevent_req_create(mem_ctx, &state,
struct smbd_smb2_find_state);
@@ -259,6 +261,17 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}
+ p = strptime(in_file_name, GMT_FORMAT, &tm);
+ if ((p != NULL) && (*p =='\0')) {
+ /*
+ * Bogus find that asks for a shadow copy timestamp as a
+ * directory. The correct response is that it does not exist as
+ * a directory.
+ */
+ tevent_req_nterror(req, NT_STATUS_NO_SUCH_FILE);
+ return tevent_req_post(req, ev);
+ }
+
if (in_output_buffer_length > smb2req->sconn->smb2.max_trans) {
DEBUG(2,("smbd_smb2_find_send: "
"client ignored max trans:%s: 0x%08X: 0x%08X\n",
--
Samba Shared Repository
More information about the samba-cvs
mailing list