[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu Dec 12 17:50:15 MST 2013
The branch, master has been updated
via ce975e6 s4:rpc_server/lsa_lookup fix a compile warning
via 2e1ed2c s4:libcli fix compiler warnings
via 7964a83 s4:kdc fix compiler warnings
via 877fe25 s4:echo_server fix compiler warnings
via 9c2951a s4:dsdb fix compiler warnings
via cad07c7 s4:dsdb fix compiler warnings
via 2bd15d1 s4:dsdb fix compiler warnings
via fbc2dfd s4:dsdb fix compiler warnings
via f9e5cdf s4:dsdb fix compiler warnings
via e5cb10f s4:dsdb fix compiler warnings
via fa50656 s3:winbindd fix a compiler warning
via ca8353e s3:smbd/smb2 fix compiler warnings
via 805515b s3:printing fix a compiler warning
via 65868f2 s3:libsmb fix a compiler warning
via 66e35a9 libcli: fix compiler warnings
via 23fc48c lib/clap fix compiler warnings
via 6d88bfc lib/tdb: fix compiler warnings
via 35b4ba0 lib/ldb fix compiler warnings
via 9784ed9 lib/ldb fix compiler warnings
via f1acab1 lib/ldb-samba: fix a compiler warning
via 094747a lib/compression: fix a compiler warnings
via 0275410 waf docs: build the new vfs worm man page
via 8a1cda8 docs-man: add manual page for the new worm vfs module
via 5b127a6 s3-waf: build new vfs_worm module
via 2004317 s3-modules: add new vfs_worm module
via b2dfd57 lib-util: add functions to get elapsed from given timespec structs
from 11f7445 docs: Add kill-client-ip to smbcontrol manpage
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ce975e61b8de3e02e06aa19126c485c2b057a523
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 20:31:21 2013 +0100
s4:rpc_server/lsa_lookup fix a compile warning
about a set, but unused variable
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Dec 13 01:49:50 CET 2013 on sn-devel-104
commit 2e1ed2c74b9a0209547a2f461cd4d8cf7de25582
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:54:37 2013 +0100
s4:libcli fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 7964a8344787ffce332d98dcbc0f2f64222693b3
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:54:05 2013 +0100
s4:kdc fix compiler warnings
about set but unused variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 877fe25a0194709993457354c9b43729d3b9d72e
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:53:49 2013 +0100
s4:echo_server fix compiler warnings
about set but unused variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 9c2951a9ca8228c714a1c1c834392077d050b569
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:53:15 2013 +0100
s4:dsdb fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit cad07c76768a96cb3ae8027f653926f11ee545ff
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:52:30 2013 +0100
s4:dsdb fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2bd15d1b830b177ea234aa29ff696379abbcd683
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:52:29 2013 +0100
s4:dsdb fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit fbc2dfddf46d26f9ded3531148764533bacf13ff
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:52:29 2013 +0100
s4:dsdb fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f9e5cdfa3f8ae08eb72ab4693ad67a8c730c8479
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:52:29 2013 +0100
s4:dsdb fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e5cb10f59122acc56a465c19885fe74a39985700
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:52:29 2013 +0100
s4:dsdb fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit fa506569913ec437f5a943eb0afd27df5358411f
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:50:36 2013 +0100
s3:winbindd fix a compiler warning
about a potentially uninitialized variable
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit ca8353efaa217b6384f2147f54ca347b0ae70bf3
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:49:44 2013 +0100
s3:smbd/smb2 fix compiler warnings
about a potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 805515b83f02be29815654c4a0d09d324ba50abc
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:49:18 2013 +0100
s3:printing fix a compiler warning
about a potentially uninitialized variable
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 65868f2025c3213d1e75dc87d92acdfbfbd6c11f
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:48:59 2013 +0100
s3:libsmb fix a compiler warning
about a potentially uninitialized variable
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 66e35a93a5508feef0015c872237e639e771a351
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:48:25 2013 +0100
libcli: fix compiler warnings
about missing prototypes
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 23fc48cfb194cec646f05d79dcfc23c2549d6ff8
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:47:50 2013 +0100
lib/clap fix compiler warnings
about set but unused variable
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 6d88bfcab47abe55fb731b16d7f4fea47d5cd744
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:47:05 2013 +0100
lib/tdb: fix compiler warnings
about a variable shadowing a global declaration
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 35b4ba0193d783d85283b07f520f0af8dc2c1260
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:46:30 2013 +0100
lib/ldb fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 9784ed9fb75022fcd7eaef24108ed8c6acf7f86f
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:45:58 2013 +0100
lib/ldb fix compiler warnings
about potentially uninitialized variables
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f1acab164338f1536c8e5793e967a00389d0ac70
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:45:14 2013 +0100
lib/ldb-samba: fix a compiler warning
about macro redefinition
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 094747aaf35dab9886fd567b45b1213e7dbe76c0
Author: Christian Ambach <ambi at samba.org>
Date: Tue Dec 10 17:43:55 2013 +0100
lib/compression: fix a compiler warnings
about set but unused variable
Signed-off-by: Christian Ambach <ambi at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0275410e02d9c8fd8c728b1d7811a3dfc05ab4e4
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Nov 20 14:24:21 2013 +0100
waf docs: build the new vfs worm man page
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 8a1cda83fc0a63c20cc3212578ef9310cf7df12d
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Nov 20 13:00:04 2013 +0100
docs-man: add manual page for the new worm vfs module
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 5b127a6f6be78174c46973bf3d9630528710b199
Author: Volker Lendecke <vl at samba.org>
Date: Wed Nov 20 12:11:41 2013 +0100
s3-waf: build new vfs_worm module
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2004317c09d781a4ec1275aaa4a29289e798eff3
Author: Volker Lendecke <vl at samba.org>
Date: Wed Nov 20 12:09:47 2013 +0100
s3-modules: add new vfs_worm module
VFS module to disallow writes for older files.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b2dfd57669ba5835feb024b4ce1b3208a797d568
Author: Volker Lendecke <vl at samba.org>
Date: Wed Nov 20 12:00:17 2013 +0100
lib-util: add functions to get elapsed from given timespec structs
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
docs-xml/manpages/vfs_worm.8.xml | 93 +++++++++++++++++++++++
docs-xml/wscript_build | 1 +
lib/compression/testsuite.c | 2 -
lib/ldb-samba/ldb_wrap.c | 1 +
lib/ldb/common/ldb_dn.c | 4 +-
lib/ldb/ldb_map/ldb_map_inbound.c | 4 +-
lib/tdb/common/summary.c | 10 +-
lib/tdb/test/run-3G-file.c | 6 +-
lib/util/time.c | 18 +++++
lib/util/time.h | 10 +++
libcli/cldap/cldap.c | 3 +-
libcli/nbt/nbtname.c | 1 +
source3/libsmb/cliconnect.c | 2 +-
source3/modules/vfs_worm.c | 97 ++++++++++++++++++++++++
source3/modules/wscript_build | 8 ++
source3/printing/spoolssd.c | 2 +-
source3/smbd/smb2_close.c | 16 ++--
source3/smbd/smb2_sesssetup.c | 4 +-
source3/winbindd/wb_group_members.c | 4 +-
source3/wscript | 1 +
source4/dsdb/samdb/ldb_modules/descriptor.c | 2 +-
source4/dsdb/samdb/ldb_modules/dirsync.c | 2 +-
source4/dsdb/samdb/ldb_modules/password_hash.c | 4 +-
source4/dsdb/samdb/ldb_modules/samba_dsdb.c | 2 +-
source4/dsdb/samdb/ldb_modules/samldb.c | 2 +-
source4/dsdb/samdb/ldb_modules/update_keytab.c | 2 +-
source4/echo_server/echo_server.c | 3 +-
source4/kdc/kdc.c | 3 +-
source4/libcli/clilist.c | 4 +-
source4/rpc_server/lsa/lsa_lookup.c | 2 +-
30 files changed, 268 insertions(+), 45 deletions(-)
create mode 100644 docs-xml/manpages/vfs_worm.8.xml
create mode 100644 source3/modules/vfs_worm.c
Changeset truncated at 500 lines:
diff --git a/docs-xml/manpages/vfs_worm.8.xml b/docs-xml/manpages/vfs_worm.8.xml
new file mode 100644
index 0000000..9758cac
--- /dev/null
+++ b/docs-xml/manpages/vfs_worm.8.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+<refentry id="vfs_worm.8">
+
+<refmeta>
+ <refentrytitle>vfs_worm</refentrytitle>
+ <manvolnum>8</manvolnum>
+ <refmiscinfo class="source">Samba</refmiscinfo>
+ <refmiscinfo class="manual">System Administration tools</refmiscinfo>
+ <refmiscinfo class="version">4.1</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+ <refname>vfs_worm</refname>
+ <refpurpose>disallows writes for older file</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+ <cmdsynopsis>
+ <command>vfs objects = worm</command>
+ </cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+ <title>DESCRIPTION</title>
+
+ <para>This VFS module is part of the
+ <citerefentry><refentrytitle>samba</refentrytitle>
+ <manvolnum>7</manvolnum></citerefentry> suite.</para>
+
+ <para>The <command>vfs_worm</command> module controls the writability
+ of files and folders depending on their change time and a
+ adjustable grace period.</para>
+
+ <para>If the change time of a file or directory is older than
+ the specified grace period, the write access will be denied,
+ independent of further access controls (e.g. by the filesystem).</para>
+
+ <para>In the case that the grace period is not exceed, the worm
+ module will not impact any access controls.</para>
+</refsect1>
+
+<refsect1>
+ <title>OPTIONS</title>
+
+ <variablelist>
+
+ <varlistentry>
+ <term>worm:grace_period = SECONDS</term>
+ <listitem>
+ <para>Period in seconds which defines the time how long the
+ write access should be handled by the normal access controls.
+ After this grace period the file or directory becomes read
+ only.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+</refsect1>
+
+<refsect1>
+ <title>EXAMPLES</title>
+
+ <para>Deny the write access to files and folders, which are older
+ than five minutes (300 seconds):</para>
+
+<programlisting>
+ <smbconfsection name="[wormshare]"/>
+ <smbconfoption name="vfs objects">worm</smbconfoption>
+ <smbconfoption name="worm:grace_period">300</smbconfoption>
+</programlisting>
+
+</refsect1>
+
+<refsect1>
+ <title>VERSION</title>
+
+ <para>This man page is correct for version 4.2 of the Samba suite.
+ </para>
+</refsect1>
+
+<refsect1>
+ <title>AUTHOR</title>
+
+ <para>The original Samba software and related utilities
+ were created by Andrew Tridgell. Samba is now developed
+ by the Samba Team as an Open Source project similar
+ to the way the Linux kernel is developed.</para>
+
+</refsect1>
+
+</refentry>
diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
index 9c6042f..a752758 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -80,6 +80,7 @@ manpages='''
manpages/vfs_syncops.8
manpages/vfs_time_audit.8
manpages/vfs_tsmsm.8
+ manpages/vfs_worm.8
manpages/vfs_xattr_tdb.8
manpages/vfstest.1
manpages/wbinfo.1
diff --git a/lib/compression/testsuite.c b/lib/compression/testsuite.c
index 5758891..d897c88 100644
--- a/lib/compression/testsuite.c
+++ b/lib/compression/testsuite.c
@@ -29,7 +29,6 @@
static bool test_lzxpress(struct torture_context *test)
{
TALLOC_CTX *tmp_ctx = talloc_new(test);
- uint8_t *data;
const char *fixed_data = "this is a test. and this is a test too";
const uint8_t fixed_out[] = { 0x00, 0x20, 0x00, 0x04, 0x74, 0x68, 0x69, 0x73,
0x20, 0x10, 0x00, 0x61, 0x20, 0x74, 0x65, 0x73,
@@ -39,7 +38,6 @@ static bool test_lzxpress(struct torture_context *test)
ssize_t c_size;
uint8_t *out, *out2;
- data = talloc_size(tmp_ctx, 1023);
out = talloc_size(tmp_ctx, 2048);
memset(out, 0x42, talloc_get_size(out));
diff --git a/lib/ldb-samba/ldb_wrap.c b/lib/ldb-samba/ldb_wrap.c
index 65956ef..05d0451 100644
--- a/lib/ldb-samba/ldb_wrap.c
+++ b/lib/ldb-samba/ldb_wrap.c
@@ -37,6 +37,7 @@
#include "../lib/util/dlinklist.h"
#include <tdb.h>
+#undef DBGC_CLASS
#define DBGC_CLASS DBGC_LDB
/*
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c
index 14596f6..6b6f90c 100644
--- a/lib/ldb/common/ldb_dn.c
+++ b/lib/ldb/common/ldb_dn.c
@@ -287,7 +287,7 @@ char *ldb_dn_escape_value(TALLOC_CTX *mem_ctx, struct ldb_val value)
*/
static bool ldb_dn_explode(struct ldb_dn *dn)
{
- char *p, *ex_name, *ex_value, *data, *d, *dt, *t;
+ char *p, *ex_name = NULL, *ex_value = NULL, *data, *d, *dt, *t;
bool trim = true;
bool in_extended = true;
bool in_ex_name = false;
@@ -298,7 +298,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
bool is_oid = false;
bool escape = false;
unsigned int x;
- size_t l;
+ size_t l = 0;
int ret;
char *parse_dn;
bool is_index;
diff --git a/lib/ldb/ldb_map/ldb_map_inbound.c b/lib/ldb/ldb_map/ldb_map_inbound.c
index 06d52aa..461e681 100644
--- a/lib/ldb/ldb_map/ldb_map_inbound.c
+++ b/lib/ldb/ldb_map/ldb_map_inbound.c
@@ -476,7 +476,7 @@ static int map_add_do_local(struct map_context *ac)
int ldb_map_modify(struct ldb_module *module, struct ldb_request *req)
{
const struct ldb_message *msg = req->op.mod.message;
- struct ldb_request *search_req;
+ struct ldb_request *search_req = NULL;
struct ldb_message *remote_msg;
struct ldb_context *ldb;
struct map_context *ac;
@@ -699,7 +699,7 @@ static int map_delete_do_local(struct map_context *ac)
/* Rename a record. */
int ldb_map_rename(struct ldb_module *module, struct ldb_request *req)
{
- struct ldb_request *search_req;
+ struct ldb_request *search_req = NULL;
struct ldb_context *ldb;
struct map_context *ac;
int ret;
diff --git a/lib/tdb/common/summary.c b/lib/tdb/common/summary.c
index 3c6f755..a22c17d 100644
--- a/lib/tdb/common/summary.c
+++ b/lib/tdb/common/summary.c
@@ -88,7 +88,7 @@ static size_t get_hash_length(struct tdb_context *tdb, unsigned int i)
_PUBLIC_ char *tdb_summary(struct tdb_context *tdb)
{
tdb_off_t off, rec_off;
- struct tally freet, keys, data, dead, extra, hash, uncoal;
+ struct tally freet, keys, data, dead, extra, hashval, uncoal;
struct tdb_record rec;
char *ret = NULL;
bool locked;
@@ -114,7 +114,7 @@ _PUBLIC_ char *tdb_summary(struct tdb_context *tdb)
tally_init(&data);
tally_init(&dead);
tally_init(&extra);
- tally_init(&hash);
+ tally_init(&hashval);
tally_init(&uncoal);
for (off = TDB_DATA_START(tdb->hash_size);
@@ -161,7 +161,7 @@ _PUBLIC_ char *tdb_summary(struct tdb_context *tdb)
tally_add(&uncoal, unc - 1);
for (off = 0; off < tdb->hash_size; off++)
- tally_add(&hash, get_hash_length(tdb, off));
+ tally_add(&hashval, get_hash_length(tdb, off));
/* 20 is max length of a %zu. */
len = strlen(SUMMARY_FORMAT) + 35*20 + 1;
@@ -180,8 +180,8 @@ _PUBLIC_ char *tdb_summary(struct tdb_context *tdb)
dead.min, tally_mean(&dead), dead.max,
freet.num,
freet.min, tally_mean(&freet), freet.max,
- hash.num,
- hash.min, tally_mean(&hash), hash.max,
+ hashval.num,
+ hashval.min, tally_mean(&hashval), hashval.max,
uncoal.total,
uncoal.min, tally_mean(&uncoal), uncoal.max,
keys.total * 100.0 / tdb->map_size,
diff --git a/lib/tdb/test/run-3G-file.c b/lib/tdb/test/run-3G-file.c
index 3ee9de1..f21544a 100644
--- a/lib/tdb/test/run-3G-file.c
+++ b/lib/tdb/test/run-3G-file.c
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
{
struct tdb_context *tdb;
TDB_DATA key, orig_data, data;
- uint32_t hash;
+ uint32_t hashval;
tdb_off_t rec_ptr;
struct tdb_record rec;
int ret;
@@ -113,8 +113,8 @@ int main(int argc, char *argv[])
free(data.dptr);
/* That currently fills at the end, make sure that's true. */
- hash = tdb->hash_fn(&key);
- rec_ptr = tdb_find_lock_hash(tdb, key, hash, F_RDLCK, &rec);
+ hashval = tdb->hash_fn(&key);
+ rec_ptr = tdb_find_lock_hash(tdb, key, hashval, F_RDLCK, &rec);
ok1(rec_ptr);
ok1(rec_ptr > 2U*1024*1024*1024);
tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK);
diff --git a/lib/util/time.c b/lib/util/time.c
index 05251dd..a09490a 100644
--- a/lib/util/time.c
+++ b/lib/util/time.c
@@ -652,6 +652,24 @@ _PUBLIC_ double timeval_elapsed(const struct timeval *tv)
struct timeval tv2 = timeval_current();
return timeval_elapsed2(tv, &tv2);
}
+/**
+ * return the number of seconds elapsed between two times
+ **/
+_PUBLIC_ double timespec_elapsed2(const struct timespec *ts1,
+ const struct timespec *ts2)
+{
+ return (ts2->tv_sec - ts1->tv_sec) +
+ (ts2->tv_nsec - ts1->tv_nsec)*1.0e-9;
+}
+
+/**
+ * return the number of seconds elapsed since a given time
+ */
+_PUBLIC_ double timespec_elapsed(const struct timespec *ts)
+{
+ struct timespec ts2 = timespec_current();
+ return timespec_elapsed2(ts, &ts2);
+}
/**
return the lesser of two timevals
diff --git a/lib/util/time.h b/lib/util/time.h
index 69ba783..b5302f8 100644
--- a/lib/util/time.h
+++ b/lib/util/time.h
@@ -247,6 +247,16 @@ double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2);
double timeval_elapsed(const struct timeval *tv);
/**
+ return the number of seconds elapsed between two times
+*/
+double timespec_elapsed2(const struct timespec *ts1,
+ const struct timespec *ts2);
+/**
+ return the number of seconds elapsed since a given time
+*/
+double timespec_elapsed(const struct timespec *ts);
+
+/**
return the lesser of two timevals
*/
struct timeval timeval_min(const struct timeval *tv1,
diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c
index e543091..eb4f102 100644
--- a/libcli/cldap/cldap.c
+++ b/libcli/cldap/cldap.c
@@ -930,8 +930,7 @@ char *cldap_netlogon_create_filter(TALLOC_CTX *mem_ctx,
}
if (io->in.domain_guid) {
struct GUID guid;
- NTSTATUS status;
- status = GUID_from_string(io->in.domain_guid, &guid);
+ GUID_from_string(io->in.domain_guid, &guid);
if (filter == NULL) {
return NULL;
}
diff --git a/libcli/nbt/nbtname.c b/libcli/nbt/nbtname.c
index fd49334..5be7830 100644
--- a/libcli/nbt/nbtname.c
+++ b/libcli/nbt/nbtname.c
@@ -28,6 +28,7 @@
#include "librpc/gen_ndr/ndr_misc.h"
#include "system/locale.h"
#include "lib/util/util_net.h"
+#include "libcli/nbt/libnbt.h"
/*
decompress a 'compressed' name component
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 3c9d03a..964d5fd 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -3029,7 +3029,7 @@ static void cli_connect_nb_done(struct tevent_req *subreq)
struct cli_connect_nb_state *state = tevent_req_data(
req, struct cli_connect_nb_state);
NTSTATUS status;
- int fd;
+ int fd = 0;
uint16_t port;
status = cli_connect_sock_recv(subreq, &fd, &port);
diff --git a/source3/modules/vfs_worm.c b/source3/modules/vfs_worm.c
new file mode 100644
index 0000000..77a18ca
--- /dev/null
+++ b/source3/modules/vfs_worm.c
@@ -0,0 +1,97 @@
+/*
+ * VFS module to disallow writes for older files
+ *
+ * Copyright (C) 2013, Volker Lendecke
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include "smbd/smbd.h"
+#include "system/filesys.h"
+#include "libcli/security/security.h"
+
+static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
+ struct smb_request *req,
+ uint16_t root_dir_fid,
+ struct smb_filename *smb_fname,
+ uint32_t access_mask,
+ uint32_t share_access,
+ uint32_t create_disposition,
+ uint32_t create_options,
+ uint32_t file_attributes,
+ uint32_t oplock_request,
+ uint64_t allocation_size,
+ uint32_t private_flags,
+ struct security_descriptor *sd,
+ struct ea_list *ea_list,
+ files_struct **result,
+ int *pinfo)
+{
+ bool readonly = false;
+ const uint32_t write_access_flags =
+ FILE_WRITE_DATA | FILE_APPEND_DATA |
+ FILE_WRITE_ATTRIBUTES | DELETE_ACCESS |
+ WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS;
+ NTSTATUS status;
+
+ if (VALID_STAT(smb_fname->st)) {
+ double age;
+ age = timespec_elapsed(&smb_fname->st.st_ex_ctime);
+ if (age > lp_parm_int(SNUM(handle->conn), "worm",
+ "grace_period", 3600)) {
+ readonly = true;
+ }
+ }
+
+ if (readonly && (access_mask & write_access_flags)) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ status = SMB_VFS_NEXT_CREATE_FILE(
+ handle, req, root_dir_fid, smb_fname, access_mask,
+ share_access, create_disposition, create_options,
+ file_attributes, oplock_request, allocation_size,
+ private_flags, sd, ea_list, result, pinfo);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ /*
+ * Access via MAXIMUM_ALLOWED_ACCESS?
+ */
+ if (readonly && ((*result)->access_mask & write_access_flags)) {
+ close_file(req, *result, NORMAL_CLOSE);
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ return NT_STATUS_OK;
+}
+
+static struct vfs_fn_pointers vfs_worm_fns = {
+ .create_file_fn = vfs_worm_create_file,
+};
+
+NTSTATUS vfs_worm_init(void);
+NTSTATUS vfs_worm_init(void)
+{
+ NTSTATUS ret;
+
+ ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "worm",
+ &vfs_worm_fns);
+ if (!NT_STATUS_IS_OK(ret)) {
+ return ret;
+ }
+
+ return ret;
+}
diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
index 32e541f..25c9d5b 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -474,3 +474,11 @@ bld.SAMBA3_MODULE('vfs_glusterfs',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_glusterfs'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_glusterfs'),
allow_undefined_symbols=False)
+
+bld.SAMBA3_MODULE('vfs_worm',
+ subsystem='vfs',
+ source='vfs_worm.c',
+ deps='samba-util',
+ init_function='',
+ internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_worm'),
+ enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_worm'))
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 8f182f8..0b6980a 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -372,7 +372,7 @@ static int spoolss_children_main(struct tevent_context *ev_ctx,
{
struct spoolss_children_data *data;
bool ok;
- int ret;
+ int ret = 0;
ok = spoolss_child_init(ev_ctx, child_id, pf);
if (!ok) {
diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c
index c4f0f19..dce8cac 100644
--- a/source3/smbd/smb2_close.c
+++ b/source3/smbd/smb2_close.c
@@ -83,14 +83,14 @@ static void smbd_smb2_request_close_done(struct tevent_req *subreq)
tevent_req_callback_data(subreq,
struct smbd_smb2_request);
DATA_BLOB outbody;
- uint16_t out_flags;
- NTTIME out_creation_time;
- NTTIME out_last_access_time;
- NTTIME out_last_write_time;
- NTTIME out_change_time;
- uint64_t out_allocation_size;
- uint64_t out_end_of_file;
- uint32_t out_file_attributes;
+ uint16_t out_flags = 0;
+ NTTIME out_creation_time = 0;
+ NTTIME out_last_access_time = 0;
+ NTTIME out_last_write_time = 0;
+ NTTIME out_change_time = 0;
+ uint64_t out_allocation_size = 0;
+ uint64_t out_end_of_file = 0;
+ uint32_t out_file_attributes = 0;
NTSTATUS status;
NTSTATUS error;
--
Samba Shared Repository
More information about the samba-cvs
mailing list