[SCM] Samba Shared Repository - branch master updated
Ralph Böhme
slow at samba.org
Mon Dec 9 17:34:02 UTC 2019
The branch, master has been updated
via f2a91426b79 smbd: Give a better error message for non-existing share modes
via b6ffbc7d923 net: Extend some debug information
via 37fa97b20e3 smbd: Call reopen_logs() in the notifyd
via 27c69b58929 smbd: Call reopen_logs() in the smbd scavenger
via a34d75f6f7e torture: Use sizeof() where appropriate
via f576c02bf93 smbd: Use NULL instead of 0 for a pointer type
via e1230f6e45b lib: add a comment to nt_time_to_full_timespec()
via f0813cbf4f5 lib: harden full_timespec_to_nt_time()
via 99d153fad12 lib: add NTTIME_MAX, NTTIME_MIN, NTTIME_OMIT and NTTIME_FREEZE definitions
from 67f455c3d57 s3:smbspool: Leave early if we print as root
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f2a91426b791d1fc1b1655dfd4b8af5d50142d08
Author: Volker Lendecke <vl at samba.org>
Date: Tue Dec 3 21:26:24 2019 +0100
smbd: Give a better error message for non-existing share modes
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Mon Dec 9 17:33:42 UTC 2019 on sn-devel-184
commit b6ffbc7d923cbe8c51a02e70d7ea8d2b8035b10e
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 29 15:45:56 2019 +0100
net: Extend some debug information
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 37fa97b20e30c13cd59f2a58f61d09a3ff761ac4
Author: Volker Lendecke <vl at samba.org>
Date: Tue Dec 3 13:23:06 2019 +0100
smbd: Call reopen_logs() in the notifyd
If you have per-process logfiles with %d, the notifyd will get its
own logfile
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 27c69b58929ea45bd7108372468cf6c63b80c449
Author: Volker Lendecke <vl at samba.org>
Date: Tue Dec 3 13:22:06 2019 +0100
smbd: Call reopen_logs() in the smbd scavenger
If you have per-process logfiles with %d, the scavenger will get its
own logfile
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit a34d75f6f7e56a76b4e3d5399742e5ac837bafdd
Author: Volker Lendecke <vl at samba.org>
Date: Tue Dec 3 12:52:09 2019 +0100
torture: Use sizeof() where appropriate
One magic number less that needs to be verified manually
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit f576c02bf9365ff538a46dadfe8ce1f1aa19664c
Author: Volker Lendecke <vl at samba.org>
Date: Wed Dec 4 14:43:02 2019 +0100
smbd: Use NULL instead of 0 for a pointer type
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit e1230f6e45bb076af9f6efda04405b0874430681
Author: Ralph Boehme <slow at samba.org>
Date: Fri Dec 6 16:48:19 2019 +0000
lib: add a comment to nt_time_to_full_timespec()
Add a hint explaining why and how -1 should be treated differently in the
future. Also make use of the helper function make_omit_timespec().
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit f0813cbf4f507462b5b9aa0e913483232e51bea5
Author: Ralph Boehme <slow at samba.org>
Date: Fri Dec 6 16:45:04 2019 +0000
lib: harden full_timespec_to_nt_time()
This protects against overflows when tv_sec is less then
TIME_FIXUP_CONSTANT_INT.
It also correctly limits the range of returned values to be
[NTTIME_MIN, NTTIME_MAX].
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 99d153fad120e0a9335ec474296f55a2e258561a
Author: Ralph Boehme <slow at samba.org>
Date: Fri Dec 6 16:44:37 2019 +0000
lib: add NTTIME_MAX, NTTIME_MIN, NTTIME_OMIT and NTTIME_FREEZE definitions
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/util/time.c | 44 ++++++++++++++++++++++++++--------
lib/util/time.h | 23 ++++++++++++++++++
source3/locking/share_mode_lock.c | 3 +++
source3/smbd/scavenger.c | 2 ++
source3/smbd/server.c | 4 +++-
source3/utils/net_tdb.c | 4 +++-
source4/torture/smb2/durable_v2_open.c | 4 +++-
7 files changed, 71 insertions(+), 13 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/time.c b/lib/util/time.c
index 0875c9fbda9..0fac5e2e397 100644
--- a/lib/util/time.c
+++ b/lib/util/time.c
@@ -1080,23 +1080,37 @@ struct timespec make_omit_timespec(void)
* Like unix_timespec_to_nt_time() but without the special casing of tv_sec=0
* and -1. Also dealing with SAMBA_UTIME_OMIT.
**/
-NTTIME full_timespec_to_nt_time(const struct timespec *ts)
+NTTIME full_timespec_to_nt_time(const struct timespec *_ts)
{
+ struct timespec ts = *_ts;
uint64_t d;
- if (ts->tv_sec == TIME_T_MAX) {
- return 0x7fffffffffffffffLL;
+ if (is_omit_timespec(_ts)) {
+ return NTTIME_OMIT;
}
- if (is_omit_timespec(ts)) {
- return 0;
+ /* Ensure tv_nsec is less than 1 sec. */
+ while (ts.tv_nsec > 1000000000) {
+ if (ts.tv_sec > TIME_T_MAX) {
+ return NTTIME_MAX;
+ }
+ ts.tv_sec += 1;
+ ts.tv_nsec -= 1000000000;
}
- d = ts->tv_sec;
- d += TIME_FIXUP_CONSTANT_INT;
+ if (ts.tv_sec >= TIME_T_MAX) {
+ return NTTIME_MAX;
+ }
+ if ((ts.tv_sec + TIME_FIXUP_CONSTANT_INT) <= 0) {
+ return NTTIME_MIN;
+ }
+
+ d = TIME_FIXUP_CONSTANT_INT;
+ d += ts.tv_sec;
+
d *= 1000*1000*10;
/* d is now in 100ns units. */
- d += (ts->tv_nsec / 100);
+ d += (ts.tv_nsec / 100);
return d;
}
@@ -1112,8 +1126,18 @@ struct timespec nt_time_to_full_timespec(NTTIME nt)
int64_t d;
struct timespec ret;
- if ((nt == 0) || (nt == (int64_t)-1)) {
- return (struct timespec){.tv_nsec = SAMBA_UTIME_OMIT};
+ if (nt == NTTIME_OMIT) {
+ return make_omit_timespec();
+ }
+ if (nt == NTTIME_FREEZE) {
+ /*
+ * This should be returned as SAMBA_UTIME_FREEZE in the
+ * future.
+ */
+ return make_omit_timespec();
+ }
+ if (nt > NTTIME_MAX) {
+ nt = NTTIME_MAX;
}
d = (int64_t)nt;
diff --git a/lib/util/time.h b/lib/util/time.h
index 0610710cd11..dfb86b45a88 100644
--- a/lib/util/time.h
+++ b/lib/util/time.h
@@ -41,6 +41,29 @@
#define TIME_T_MAX MIN(INT32_MAX,_TYPE_MAXIMUM(time_t))
#endif
+/*
+ * According to Windows API FileTimeToSystemTime() documentation the highest
+ * allows value " ... must be less than 0x8000000000000000.".
+ */
+#define NTTIME_MAX INT64_MAX
+
+/*
+ * The lowest possible value when NTTIME=0 is used as sentinel value.
+ */
+#define NTTIME_MIN 1
+
+/*
+ * NTTIME_OMIT in a setinfo tells us to not modify the corresponding on-disk
+ * timestamp value.
+ */
+#define NTTIME_OMIT 0
+
+/*
+ * Disable automatic timestamp updates, as described in MS-FSA. Samba doesn't
+ * implement this yet.
+ */
+#define NTTIME_FREEZE UINT64_MAX
+
#define SAMBA_UTIME_NOW UTIME_NOW
#define SAMBA_UTIME_OMIT UTIME_OMIT
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 72290126a0d..dacb5efab85 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -558,6 +558,9 @@ static NTSTATUS get_static_share_mode_data(
d = fresh_share_mode_lock(
lock_db, servicepath, smb_fname, old_write_time);
if (d == NULL) {
+ if (smb_fname == NULL) {
+ return NT_STATUS_NOT_FOUND;
+ }
return NT_STATUS_NO_MEMORY;
}
} else {
diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c
index cd5c85d2871..de07719468b 100644
--- a/source3/smbd/scavenger.c
+++ b/source3/smbd/scavenger.c
@@ -250,6 +250,8 @@ static bool smbd_scavenger_start(struct smbd_scavenger_state *state)
return false;
}
+ reopen_logs();
+
state->am_scavenger = true;
*state->scavenger_id = messaging_server_id(state->msg);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 6e7292079c6..8fd4752ea45 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -419,7 +419,7 @@ static bool smbd_notifyd_init(struct messaging_context *msg, bool interactive,
}
if (pid != 0) {
- if (am_parent != 0) {
+ if (am_parent != NULL) {
add_child_pid(am_parent, pid);
}
*ppid = pid_to_procid(pid);
@@ -433,6 +433,8 @@ static bool smbd_notifyd_init(struct messaging_context *msg, bool interactive,
exit(1);
}
+ reopen_logs();
+
/* Set up sighup handler for notifyd */
se = tevent_add_signal(ev,
ev,
diff --git a/source3/utils/net_tdb.c b/source3/utils/net_tdb.c
index a03cc0e2c09..49dbd04664a 100644
--- a/source3/utils/net_tdb.c
+++ b/source3/utils/net_tdb.c
@@ -51,7 +51,9 @@ static int net_tdb_locking_fetch(TALLOC_CTX *mem_ctx, const char *hexkey,
blob = strhex_to_data_blob(mem_ctx, hexkey);
if (blob.length != sizeof(struct file_id)) {
- d_printf("Invalid length of key\n");
+ d_printf("Invalid length %zu of key, expected %zu\n",
+ blob.length,
+ sizeof(struct file_id));
return -1;
}
diff --git a/source4/torture/smb2/durable_v2_open.c b/source4/torture/smb2/durable_v2_open.c
index 7c8a17fdac9..4e70b9bfe17 100644
--- a/source4/torture/smb2/durable_v2_open.c
+++ b/source4/torture/smb2/durable_v2_open.c
@@ -2058,7 +2058,9 @@ static bool test_durable_v2_reconnect_delay(struct torture_context *tctx,
previous_session_id = smb2cli_session_current_id(tree->session->smbXcli);
/* Choose a random name in case the state is left a little funky. */
- snprintf(fname, 256, "durable_v2_reconnect_delay_%s.dat",
+ snprintf(fname,
+ sizeof(fname),
+ "durable_v2_reconnect_delay_%s.dat",
generate_random_str(tctx, 8));
smb2_util_unlink(tree, fname);
--
Samba Shared Repository
More information about the samba-cvs
mailing list