summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-05-30 10:09:22 -0700
committerJeremy Allison <jra@samba.org>2008-05-30 10:09:22 -0700
commita991c5a7c30253fa36e1ee65fb717d62acf3a806 (patch)
treef744dcbdef7864a1f5915564bde3e11e133a1ecd /source3/smbd
parent2e9136e085f9a88741c594b44037b2f86474882f (diff)
parent3e20aeb18e418a5a1a7821fd8c3f0d0bc5169489 (diff)
downloadsamba-a991c5a7c30253fa36e1ee65fb717d62acf3a806.tar.gz
samba-a991c5a7c30253fa36e1ee65fb717d62acf3a806.tar.bz2
samba-a991c5a7c30253fa36e1ee65fb717d62acf3a806.zip
Merge branch 'v3-3-test' of ssh://jra@git.samba.org/data/git/samba into v3-3-test
(This used to be commit 3d01248f63d0d476c16236453983ffe759d0b2c2)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/close.c34
-rw-r--r--source3/smbd/oplock.c2
-rw-r--r--source3/smbd/oplock_linux.c48
-rw-r--r--source3/smbd/process.c4
-rw-r--r--source3/smbd/server.c2
5 files changed, 40 insertions, 50 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index df188bafe1..818b4c70a8 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -736,3 +736,37 @@ NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type)
return status;
}
+
+/****************************************************************************
+ Deal with an (authorized) message to close a file given the share mode
+ entry.
+****************************************************************************/
+
+void msg_close_file(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
+{
+ files_struct *fsp = NULL;
+ struct share_mode_entry e;
+
+ message_to_share_mode_entry(&e, (char *)data->data);
+
+ if(DEBUGLVL(10)) {
+ char *sm_str = share_mode_str(NULL, 0, &e);
+ if (!sm_str) {
+ smb_panic("talloc failed");
+ }
+ DEBUG(10,("msg_close_file: got request to close share mode "
+ "entry %s\n", sm_str));
+ TALLOC_FREE(sm_str);
+ }
+
+ fsp = file_find_dif(e.id, e.share_file_id);
+ if (!fsp) {
+ DEBUG(10,("msg_close_file: failed to find file.\n"));
+ return;
+ }
+ close_file(fsp, NORMAL_CLOSE);
+}
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index c3409547fe..23411294df 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -824,7 +824,7 @@ void release_level_2_oplocks_on_change(files_struct *fsp)
Linearize a share mode entry struct to an internal oplock break message.
****************************************************************************/
-void share_mode_entry_to_message(char *msg, struct share_mode_entry *e)
+void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e)
{
SIVAL(msg,0,(uint32)e->pid.pid);
SSVAL(msg,4,e->op_mid);
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index fa7cb42bc6..08df228f8f 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -22,22 +22,6 @@
#if HAVE_KERNEL_OPLOCKS_LINUX
-/* these can be removed when they are in glibc headers */
-struct cap_user_header {
- uint32 version;
- int pid;
-} header;
-struct cap_user_data {
- uint32 effective;
- uint32 permitted;
- uint32 inheritable;
-} data;
-
-extern int capget(struct cap_user_header * hdrp,
- struct cap_user_data * datap);
-extern int capset(struct cap_user_header * hdrp,
- const struct cap_user_data * datap);
-
static SIG_ATOMIC_T signals_received;
#define FD_PENDING_SIZE 100
static SIG_ATOMIC_T fd_pending_array[FD_PENDING_SIZE];
@@ -75,40 +59,12 @@ static void signal_handler(int sig, siginfo_t *info, void *unused)
sys_select_signal(RT_SIGNAL_LEASE);
}
-/****************************************************************************
- Try to gain a linux capability.
-****************************************************************************/
-
-static void set_capability(unsigned capability)
-{
-#ifndef _LINUX_CAPABILITY_VERSION
-#define _LINUX_CAPABILITY_VERSION 0x19980330
-#endif
- header.version = _LINUX_CAPABILITY_VERSION;
- header.pid = 0;
-
- if (capget(&header, &data) == -1) {
- DEBUG(3,("Unable to get kernel capabilities (%s)\n",
- strerror(errno)));
- return;
- }
-
- if (0 == (data.effective & (1<<capability))) {
- data.effective |= (1<<capability);
-
- if (capset(&header, &data) == -1) {
- DEBUG(3,("Unable to set %d capability (%s)\n",
- capability, strerror(errno)));
- }
- }
-}
-
/*
* public function to get linux lease capability. Needed by some VFS modules (eg. gpfs.c)
*/
void linux_set_lease_capability(void)
{
- set_capability(CAP_LEASE);
+ set_effective_capability(LEASE_CAPABILITY);
}
/*
@@ -136,7 +92,7 @@ int linux_setlease(int fd, int leasetype)
ret = fcntl(fd, F_SETLEASE, leasetype);
if (ret == -1 && errno == EACCES) {
- set_capability(CAP_LEASE);
+ set_effective_capability(LEASE_CAPABILITY);
ret = fcntl(fd, F_SETLEASE, leasetype);
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index c8ad19dd15..71e38634b7 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -120,9 +120,7 @@ static bool valid_packet_size(size_t len)
if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) {
DEBUG(0,("Invalid packet length! (%lu bytes).\n",
(unsigned long)len));
- if (len > BUFFER_SIZE + (SAFETY_MARGIN/2)) {
- return false;
- }
+ return false;
}
return true;
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index cf02589864..035469cd62 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1392,6 +1392,8 @@ extern void build_options(bool screen);
MSG_SMB_FORCE_TDIS, msg_force_tdis);
messaging_register(smbd_messaging_context(), NULL,
MSG_SMB_RELEASE_IP, msg_release_ip);
+ messaging_register(smbd_messaging_context(), NULL,
+ MSG_SMB_CLOSE_FILE, msg_close_file);
if ((lp_keepalive() != 0)
&& !(event_add_idle(smbd_event_context(), NULL,