[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Thu Sep 22 16:16:17 MDT 2011


The branch, master has been updated
       via  66f8070 lib/util: move some timespec helpers from source3 to the toplevel
       via  1bb6e67 s3:smb2_server: fix a logic error, we should sign non guest sessions
       via  16fd935 s4:selftest: skip flakey samba4.nbt.winsreplication for now
      from  d50fa9c Fix bug #8476 - Samba asserts when SMB2 client breaks the crediting rules.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 66f8070dd3a6a5c51c8e6d37deb7c52a9a717e1b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Sep 22 20:33:22 2011 +0200

    lib/util: move some timespec helpers from source3 to the toplevel
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Fri Sep 23 00:15:31 CEST 2011 on sn-devel-104

commit 1bb6e6758cffea967b6b8299553653cf4192f2e9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Sep 22 21:04:51 2011 +0200

    s3:smb2_server: fix a logic error, we should sign non guest sessions
    
    metze

commit 16fd935fc659555c203354b6c96fc23a55be5a3b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Sep 22 22:28:59 2011 +0200

    s4:selftest: skip flakey samba4.nbt.winsreplication for now
    
     [825/1154 in 43m52s] samba4.nbt.winsreplication(dc)
     Test if we always get back the same assoc_ctx
     Setup wrepl connections
     Test one pull replication cycle
     Setup wrepl connections
     Setup wrepl conflict pull connection
     UNEXPECTED(error): samba4.nbt.winsreplication.replica
     REASON: _StringException: _StringException: Unknown error/failure
    
    I don't have time to look into the problem currently.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 lib/util/time.c               |  117 +++++++++++++++++++++++++++++++++
 lib/util/time.h               |   10 +++
 source3/include/proto.h       |   10 ---
 source3/lib/time.c            |  146 -----------------------------------------
 source3/smbd/smb2_sesssetup.c |    2 +-
 source4/selftest/skip         |    1 +
 6 files changed, 129 insertions(+), 157 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/time.c b/lib/util/time.c
index 31aa05c..7216ea6 100644
--- a/lib/util/time.c
+++ b/lib/util/time.c
@@ -817,4 +817,121 @@ bool null_timespec(struct timespec ts)
 		ts.tv_sec == (time_t)-1;
 }
 
+/****************************************************************************
+ Convert a normalized timeval to a timespec.
+****************************************************************************/
 
+struct timespec convert_timeval_to_timespec(const struct timeval tv)
+{
+	struct timespec ts;
+	ts.tv_sec = tv.tv_sec;
+	ts.tv_nsec = tv.tv_usec * 1000;
+	return ts;
+}
+
+/****************************************************************************
+ Convert a normalized timespec to a timeval.
+****************************************************************************/
+
+struct timeval convert_timespec_to_timeval(const struct timespec ts)
+{
+	struct timeval tv;
+	tv.tv_sec = ts.tv_sec;
+	tv.tv_usec = ts.tv_nsec / 1000;
+	return tv;
+}
+
+/****************************************************************************
+ Return a timespec for the current time
+****************************************************************************/
+
+struct timespec timespec_current(void)
+{
+	struct timespec ts;
+	clock_gettime(CLOCK_REALTIME, &ts);
+	return ts;
+}
+
+/****************************************************************************
+ Return the lesser of two timespecs.
+****************************************************************************/
+
+struct timespec timespec_min(const struct timespec *ts1,
+			   const struct timespec *ts2)
+{
+	if (ts1->tv_sec < ts2->tv_sec) return *ts1;
+	if (ts1->tv_sec > ts2->tv_sec) return *ts2;
+	if (ts1->tv_nsec < ts2->tv_nsec) return *ts1;
+	return *ts2;
+}
+
+/****************************************************************************
+  compare two timespec structures. 
+  Return -1 if ts1 < ts2
+  Return 0 if ts1 == ts2
+  Return 1 if ts1 > ts2
+****************************************************************************/
+
+int timespec_compare(const struct timespec *ts1, const struct timespec *ts2)
+{
+	if (ts1->tv_sec  > ts2->tv_sec)  return 1;
+	if (ts1->tv_sec  < ts2->tv_sec)  return -1;
+	if (ts1->tv_nsec > ts2->tv_nsec) return 1;
+	if (ts1->tv_nsec < ts2->tv_nsec) return -1;
+	return 0;
+}
+
+/****************************************************************************
+ Round up a timespec if nsec > 500000000, round down if lower,
+ then zero nsec.
+****************************************************************************/
+
+void round_timespec_to_sec(struct timespec *ts)
+{
+	ts->tv_sec = convert_timespec_to_time_t(*ts);
+	ts->tv_nsec = 0;
+}
+
+/****************************************************************************
+ Round a timespec to usec value.
+****************************************************************************/
+
+void round_timespec_to_usec(struct timespec *ts)
+{
+	struct timeval tv = convert_timespec_to_timeval(*ts);
+	*ts = convert_timeval_to_timespec(tv);
+	while (ts->tv_nsec > 1000000000) {
+		ts->tv_sec += 1;
+		ts->tv_nsec -= 1000000000;
+	}
+}
+
+/****************************************************************************
+ Put a 8 byte filetime from a struct timespec. Uses GMT.
+****************************************************************************/
+
+void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts)
+{
+	uint64_t d;
+
+	if (ts.tv_sec ==0 && ts.tv_nsec == 0) {
+		*nt = 0;
+		return;
+	}
+	if (ts.tv_sec == TIME_T_MAX) {
+		*nt = 0x7fffffffffffffffLL;
+		return;
+	}
+	if (ts.tv_sec == (time_t)-1) {
+		*nt = (uint64_t)-1;
+		return;
+	}
+
+	d = ts.tv_sec;
+	d += TIME_FIXUP_CONSTANT_INT;
+	d *= 1000*1000*10;
+	/* d is now in 100ns units. */
+	d += (ts.tv_nsec / 100);
+
+	*nt = d;
+}
diff --git a/lib/util/time.h b/lib/util/time.h
index 204c261..047daec 100644
--- a/lib/util/time.h
+++ b/lib/util/time.h
@@ -300,4 +300,14 @@ struct timespec convert_time_t_to_timespec(time_t t);
 
 bool null_timespec(struct timespec ts);
 
+struct timespec convert_timeval_to_timespec(const struct timeval tv);
+struct timeval convert_timespec_to_timeval(const struct timespec ts);
+struct timespec timespec_current(void);
+struct timespec timespec_min(const struct timespec *ts1,
+			     const struct timespec *ts2);
+int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
+void round_timespec_to_sec(struct timespec *ts);
+void round_timespec_to_usec(struct timespec *ts);
+void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
+
 #endif /* _SAMBA_TIME_H_ */
diff --git a/source3/include/proto.h b/source3/include/proto.h
index d3ea6fc..f6e7236 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -463,22 +463,12 @@ time_t make_unix_date3(const void *date_ptr, int zone_offset);
 time_t srv_make_unix_date(const void *date_ptr);
 time_t srv_make_unix_date2(const void *date_ptr);
 time_t srv_make_unix_date3(const void *date_ptr);
-struct timespec convert_time_t_to_timespec(time_t t);
-struct timespec convert_timeval_to_timespec(const struct timeval tv);
-struct timeval convert_timespec_to_timeval(const struct timespec ts);
-struct timespec timespec_current(void);
-struct timespec timespec_min(const struct timespec *ts1,
-			   const struct timespec *ts2);
-int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
-void round_timespec_to_sec(struct timespec *ts);
-void round_timespec_to_usec(struct timespec *ts);
 struct timespec interpret_long_date(const char *p);
 void TimeInit(void);
 void get_process_uptime(struct timeval *ret_time);
 void get_startup_time(struct timeval *ret_time);
 time_t nt_time_to_unix_abs(const NTTIME *nt);
 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
-void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
 const char *time_to_asc(const time_t t);
 const char *display_time(NTTIME nttime);
diff --git a/source3/lib/time.c b/source3/lib/time.c
index db9ec0a..7fe5392 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -264,95 +264,6 @@ time_t srv_make_unix_date3(const void *date_ptr)
 }
 
 /****************************************************************************
- Convert a normalized timeval to a timespec.
-****************************************************************************/
-
-struct timespec convert_timeval_to_timespec(const struct timeval tv)
-{
-	struct timespec ts;
-	ts.tv_sec = tv.tv_sec;
-	ts.tv_nsec = tv.tv_usec * 1000;
-	return ts;
-}
-
-/****************************************************************************
- Convert a normalized timespec to a timeval.
-****************************************************************************/
-
-struct timeval convert_timespec_to_timeval(const struct timespec ts)
-{
-	struct timeval tv;
-	tv.tv_sec = ts.tv_sec;
-	tv.tv_usec = ts.tv_nsec / 1000;
-	return tv;
-}
-
-/****************************************************************************
- Return a timespec for the current time
-****************************************************************************/
-
-struct timespec timespec_current(void)
-{
-	struct timespec ts;
-	clock_gettime(CLOCK_REALTIME, &ts);
-	return ts;
-}
-
-/****************************************************************************
- Return the lesser of two timespecs.
-****************************************************************************/
-
-struct timespec timespec_min(const struct timespec *ts1,
-			   const struct timespec *ts2)
-{
-	if (ts1->tv_sec < ts2->tv_sec) return *ts1;
-	if (ts1->tv_sec > ts2->tv_sec) return *ts2;
-	if (ts1->tv_nsec < ts2->tv_nsec) return *ts1;
-	return *ts2;
-}
-
-/****************************************************************************
-  compare two timespec structures. 
-  Return -1 if ts1 < ts2
-  Return 0 if ts1 == ts2
-  Return 1 if ts1 > ts2
-****************************************************************************/
-
-int timespec_compare(const struct timespec *ts1, const struct timespec *ts2)
-{
-	if (ts1->tv_sec  > ts2->tv_sec)  return 1;
-	if (ts1->tv_sec  < ts2->tv_sec)  return -1;
-	if (ts1->tv_nsec > ts2->tv_nsec) return 1;
-	if (ts1->tv_nsec < ts2->tv_nsec) return -1;
-	return 0;
-}
-
-/****************************************************************************
- Round up a timespec if nsec > 500000000, round down if lower,
- then zero nsec.
-****************************************************************************/
-
-void round_timespec_to_sec(struct timespec *ts)
-{
-	ts->tv_sec = convert_timespec_to_time_t(*ts);
-	ts->tv_nsec = 0;
-}
-
-/****************************************************************************
- Round a timespec to usec value.
-****************************************************************************/
-
-void round_timespec_to_usec(struct timespec *ts)
-{
-	struct timeval tv = convert_timespec_to_timeval(*ts);
-	*ts = convert_timeval_to_timespec(tv);
-	while (ts->tv_nsec > 1000000000) {
-		ts->tv_sec += 1;
-		ts->tv_nsec -= 1000000000;
-	}
-}
-
-/****************************************************************************
  Interprets an nt time into a unix struct timespec.
  Differs from nt_time_to_unix in that an 8 byte value of 0xffffffffffffffff
  will be returned as (time_t)-1, whereas nt_time_to_unix returns 0 in this case.
@@ -469,63 +380,6 @@ time_t uint64s_nt_time_to_unix_abs(const uint64_t *src)
 }
 
 /****************************************************************************
- Put a 8 byte filetime from a struct timespec. Uses GMT.
-****************************************************************************/
-
-void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts)
-{
-	uint64_t d;
-
-	if (ts.tv_sec ==0 && ts.tv_nsec == 0) {
-		*nt = 0;
-		return;
-	}
-	if (ts.tv_sec == TIME_T_MAX) {
-		*nt = 0x7fffffffffffffffLL;
-		return;
-	}		
-	if (ts.tv_sec == (time_t)-1) {
-		*nt = (uint64_t)-1;
-		return;
-	}		
-
-	d = ts.tv_sec;
-	d += TIME_FIXUP_CONSTANT_INT;
-	d *= 1000*1000*10;
-	/* d is now in 100ns units. */
-	d += (ts.tv_nsec / 100);
-
-	*nt = d;
-}
-
-#if 0
-void nt_time_to_unix_timespec(struct timespec *ts, NTTIME t)
-{
-	if (ts == NULL) {
-		return;
-	}
-
-	/* t starts in 100 nsec units since 1601-01-01. */
-
-	t *= 100;
-	/* t is now in nsec units since 1601-01-01. */
-
-	t -= TIME_FIXUP_CONSTANT*1000*1000*100;
-	/* t is now in nsec units since the UNIX epoch 1970-01-01. */
-
-	ts->tv_sec  = t / 1000000000LL;
-
-	if (TIME_T_MIN > ts->tv_sec || ts->tv_sec > TIME_T_MAX) {
-		ts->tv_sec  = 0;
-		ts->tv_nsec = 0;
-		return;
-	}
-
-	ts->tv_nsec = t - ts->tv_sec*1000000000LL;
-}
-#endif
-
-/****************************************************************************
  Convert a time_t to a NTTIME structure
 
  This is an absolute version of the one above.
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index c81baa5..95badaf 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -269,7 +269,7 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session,
 	 * so that the response can be signed
 	 */
 	smb2req->session = session;
-	if (guest) {
+	if (!guest) {
 		smb2req->do_signing = true;
 	}
 
diff --git a/source4/selftest/skip b/source4/selftest/skip
index bd4fcc3..5400be1 100644
--- a/source4/selftest/skip
+++ b/source4/selftest/skip
@@ -77,3 +77,4 @@ bench # don't run benchmarks in our selftest
 # we should build a samba4ktutil and use that instead
 ^samba4.blackbox.ktpass # this test isn't portable ...
 ^samba4.drs.repl_schema.python # flakey test
+^samba4.nbt.winsreplication # flakey test


-- 
Samba Shared Repository


More information about the samba-cvs mailing list