[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Thu Jul 28 06:19:01 UTC 2022


The branch, master has been updated
       via  ffa84f2e5d3 py/uptodateness: more details in missing dn report
       via  9849e7440e3 util/genrand: don't ignore errors in random number generation
      from  4286e359b35 s3: smbd: Convert call_nt_transact_create() to use filename_convert_dirfsp().

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


- Log -----------------------------------------------------------------
commit ffa84f2e5d335626b5f7311af8d2a7056b3e5c6f
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Mon Jul 11 12:06:54 2022 +1200

    py/uptodateness: more details in missing dn report
    
    This does not fix bug 15127, but it improves reporting.
    
    https://bugzilla.samba.org/show_bug.cgi?id=15127
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Thu Jul 28 06:18:43 UTC 2022 on sn-devel-184

commit 9849e7440e30853c61a80ce1f11b7b244ed766fe
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Mon Aug 5 00:10:53 2019 +1200

    util/genrand: don't ignore errors in random number generation
    
    In this case it is probably better to crash out.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15103
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 lib/util/genrand.c           | 29 ++++++++++++++++++++++++++---
 lib/util/wscript_build       |  2 +-
 python/samba/uptodateness.py |  2 +-
 3 files changed, 28 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/genrand.c b/lib/util/genrand.c
index 18ffa0d95e6..fd6f457d27d 100644
--- a/lib/util/genrand.c
+++ b/lib/util/genrand.c
@@ -20,6 +20,7 @@
 */
 
 #include "replace.h"
+#include "lib/util/fault.h"
 #include "lib/util/genrand.h"
 
 #include <gnutls/gnutls.h>
@@ -31,10 +32,26 @@
  * https://nikmav.blogspot.com/2017/03/improving-by-simplifying-gnutls-prng.html
  */
 
+
+_NORETURN_ static void genrand_panic(int err,
+				     const char *location,
+				     const char *func)
+{
+	char buf[200];
+	snprintf(buf, sizeof(buf),
+		 "%s:%s: GnuTLS could not generate a random buffer: %s [%d]\n",
+		 location, func, gnutls_strerror_name(err), err);
+	smb_panic(buf);
+}
+
+
 _PUBLIC_ void generate_random_buffer(uint8_t *out, int len)
 {
 	/* Random number generator for temporary keys. */
-	gnutls_rnd(GNUTLS_RND_RANDOM, out, len);
+	int ret = gnutls_rnd(GNUTLS_RND_RANDOM, out, len);
+	if (ret != 0) {
+		genrand_panic(ret, __location__, __func__);
+	}
 }
 
 _PUBLIC_ void generate_secret_buffer(uint8_t *out, int len)
@@ -48,7 +65,10 @@ _PUBLIC_ void generate_secret_buffer(uint8_t *out, int len)
 	 * the limit for a re-seed. For its re-seed it mixes mixes data obtained
 	 * from the OS random device with the previous key.
 	 */
-	gnutls_rnd(GNUTLS_RND_KEY, out, len);
+	int ret = gnutls_rnd(GNUTLS_RND_KEY, out, len);
+	if (ret != 0) {
+		genrand_panic(ret, __location__, __func__);
+	}
 }
 
 _PUBLIC_ void generate_nonce_buffer(uint8_t *out, int len)
@@ -60,5 +80,8 @@ _PUBLIC_ void generate_nonce_buffer(uint8_t *out, int len)
 	 * bytes (typically few megabytes), or after few hours of operation
 	 * without reaching the limit has passed.
 	 */
-	gnutls_rnd(GNUTLS_RND_NONCE, out, len);
+	int ret = gnutls_rnd(GNUTLS_RND_NONCE, out, len);
+	if (ret != 0) {
+		genrand_panic(ret, __location__, __func__);
+	}
 }
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index df235c13a70..d26aa4e5843 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -143,7 +143,7 @@ bld.SAMBA_LIBRARY('msghdr',
 
 bld.SAMBA_LIBRARY('genrand',
                   source='genrand.c',
-                  deps='replace gnutls',
+                  deps='replace gnutls smb-panic',
                   local_include=False,
                   private_library=True)
 
diff --git a/python/samba/uptodateness.py b/python/samba/uptodateness.py
index db1ba53885b..49c984a5828 100644
--- a/python/samba/uptodateness.py
+++ b/python/samba/uptodateness.py
@@ -147,7 +147,7 @@ def get_utdv_distances(utdv_edges, dsas):
                     dist = peak - utdv_edges[dn2][dn1]
                     d[dn2] = dist
                 else:
-                    print("Missing dn %s from UTD vector" % dn1,
+                    print(f"Missing dn {dn1} from UTD vector for dsa {dn2}",
                           file=sys.stderr)
             else:
                 print("missing dn %s from UTD vector list" % dn2,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list