[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Wed Nov 8 10:29:02 UTC 2017


The branch, master has been updated
       via  aed7fae ctdb-tests: Fix some harmless CIDs
      from  d12ba2d manpages: add vfs_nfs4acl_xattr.8

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


- Log -----------------------------------------------------------------
commit aed7faeab4b1c701768bb3c56b3f3bbfd2801938
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 8 09:22:29 2017 +1100

    ctdb-tests: Fix some harmless CIDs
    
    CID 1420632: Resource leaks (RESOURCE LEAK)
    CID 1420631: Security best practices violations (TOCTOU)
    CID 1417432: Resource leaks (RESOURCE LEAK)
    CID 1417429: Security best practices violations (TOCTOU)
    CID 1417427: Resource leaks (RESOURCE LEAK)
    
    These are all in test code and constrained to the test environment, so
    can't result in privilege escape.  No backport necessary.  However, we
    might as well get them off the list.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Wed Nov  8 11:28:40 CET 2017 on sn-devel-144

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

Summary of changes:
 ctdb/tests/src/sock_daemon_test.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/tests/src/sock_daemon_test.c b/ctdb/tests/src/sock_daemon_test.c
index bba0df2..95045d1 100644
--- a/ctdb/tests/src/sock_daemon_test.c
+++ b/ctdb/tests/src/sock_daemon_test.c
@@ -216,16 +216,16 @@ static void test2(TALLOC_CTX *mem_ctx, const char *pidfile,
 	assert(n == sizeof(ret));
 	assert(ret == 1);
 
-	ret = stat(pidfile, &st);
-	assert(ret == 0);
-	assert(S_ISREG(st.st_mode));
-
 	pidfile_fd = open(pidfile, O_RDONLY, 0644);
 	assert(pidfile_fd != -1);
+	ret = fstat(pidfile_fd, &st);
+	assert(ret == 0);
+	assert(S_ISREG(st.st_mode));
 	n = read(pidfile_fd, pidstr, sizeof(pidstr)-1);
 	assert(n != -1);
 	pid2 = (pid_t)atoi(pidstr);
 	assert(pid == pid2);
+	close(pidfile_fd);
 
 	ret = kill(pid, SIGHUP);
 	assert(ret == 0);
@@ -1315,6 +1315,7 @@ static void test9(TALLOC_CTX *mem_ctx, const char *pidfile,
 	assert(n != -1);
 	pid2 = (pid_t)atoi(pidstr);
 	assert(pid != pid2);
+	close(pidfile_fd);
 
 	ret = kill(pid2, SIGTERM);
 	assert(ret == 0);
@@ -1431,16 +1432,13 @@ static void test10(TALLOC_CTX *mem_ctx, const char *pidfile,
 	assert(n == sizeof(ret));
 	assert(ret == 1);
 
-	ret = stat(pidfile, &st);
-	assert(ret == 0);
-	assert(S_ISREG(st.st_mode));
-
 	pidfile_fd = open(pidfile, O_RDONLY, 0644);
 	assert(pidfile_fd != -1);
 	n = read(pidfile_fd, pidstr, sizeof(pidstr)-1);
 	assert(n != -1);
 	pid2 = (pid_t)atoi(pidstr);
 	assert(pid == pid2);
+	close(pidfile_fd);
 
 	ret = kill(pid, SIGTERM);
 	assert(ret == 0);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list