[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Fri Nov 15 18:49:04 UTC 2019


The branch, master has been updated
       via  f1fa0d3b9df librpc: Use the fact that file_save() now uses O_EXCL in dcerpc_log_packet()
       via  5e63e54f589 lib/util: change file_save_mode() to use O_EXCL
       via  55b2cb47a97 s3-build: add missing gnutls dependency
      from  8e8313b2b57 third_party: Update nss_wrapper to version 1.1.7

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


- Log -----------------------------------------------------------------
commit f1fa0d3b9dfef17a5129b53695fa454f1a8b8b68
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Nov 11 13:53:33 2019 +1300

    librpc: Use the fact that file_save() now uses O_EXCL in dcerpc_log_packet()
    
    This avoids a race with file_exist() and demostrates a better
    way to use this function.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Fri Nov 15 18:48:27 UTC 2019 on sn-devel-184

commit 5e63e54f589b25af550f0d4e28e3c28e0a337c0d
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Nov 11 13:52:22 2019 +1300

    lib/util: change file_save_mode() to use O_EXCL
    
    Almost all the callers are debug tools or developer debugging aids
    and these callers clearly expect to create a new file.
    
    Unchanged in behaviour is:
     - TLS certificate creation.  This already confirms the files do no exist
       prior to generation.
    
    These will now no longer overwrite the given filename
     - net ads pac save
     - net eventlog export
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 55b2cb47a9701376aa9e844390c8c4ee2d7fa6e9
Author: Björn Baumbach <bb at sernet.de>
Date:   Fri Nov 15 13:21:48 2019 +0100

    s3-build: add missing gnutls dependency
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 WHATSNEW.txt             |  7 +++++++
 lib/util/util_file.c     |  2 +-
 librpc/rpc/dcerpc_util.c | 12 ++++++------
 source3/wscript_build    |  5 ++++-
 4 files changed, 18 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index cc43b29b3d1..376cd2862f1 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -53,6 +53,13 @@ cryptography effectively wraps bad cryptography, but for now that above
 applies.
 
 
+"net ads kerberos pac save" and "net eventlog export"
+-----------------------------------------------------
+
+The "net ads kerberos pac save" and "net eventlog export" tools will
+no longer silently overwrite an existing file during data export.  If
+the filename given exits, an error will be shown.
+
 REMOVED FEATURES
 ================
 
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 5260ee9d721..0c890f9b5ea 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -329,7 +329,7 @@ _PUBLIC_ bool file_save_mode(const char *fname, const void *packet,
 {
 	ssize_t num_written;
 	int fd;
-	fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, mode);
+	fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, mode);
 	if (fd == -1) {
 		return false;
 	}
diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
index 01dc2e7061d..1fb3fa72075 100644
--- a/librpc/rpc/dcerpc_util.c
+++ b/librpc/rpc/dcerpc_util.c
@@ -1425,19 +1425,19 @@ void dcerpc_log_packet(const char *lockdir,
 	for (i=0;i<num_examples;i++) {
 		char *name=NULL;
 		int ret;
+		bool saved;
 		ret = asprintf(&name, "%s/rpclog/%s-%u.%d.%s",
 			       lockdir, ndr->name, opnum, i,
 			       (flags&NDR_IN)?"in":"out");
 		if (ret == -1) {
 			return;
 		}
-		if (!file_exist(name)) {
-			if (file_save(name, pkt->data, pkt->length)) {
-				DEBUG(10,("Logged rpc packet to %s\n", name));
-			}
-			free(name);
+
+		saved = file_save(name, pkt->data, pkt->length);
+		free(name);
+		if (saved) {
+			DBG_DEBUG("Logged rpc packet to %s\n", name);
 			break;
 		}
-		free(name);
 	}
 }
diff --git a/source3/wscript_build b/source3/wscript_build
index 54982a92954..1cf734fe4c7 100644
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -786,7 +786,10 @@ bld.SAMBA3_SUBSYSTEM('LEASES_UTIL',
 if bld.CONFIG_GET("WITH_PROFILE"):
     bld.SAMBA3_SUBSYSTEM('PROFILE',
                          source='profile/profile.c',
-                         deps='samba-util')
+                         deps='''
+                              samba-util
+                              gnutls
+                              ''')
 else:
     bld.SAMBA3_SUBSYSTEM('PROFILE',
                          source='profile/profile_dummy.c',


-- 
Samba Shared Repository



More information about the samba-cvs mailing list