[PATCH] cleanups

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed Oct 28 13:24:57 UTC 2015


Hi!

Review&push appreciated!

Thanks, Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de

Besuchen Sie uns vom 10.-11.11.15 auf der ISSE!
Information Security Solutions Europe Conference
Hotel Palace Berlin, 20%-Rabattcode: "ISSE15SP"

Meet us at Information Security Conference ISSE!
November 10th - 11th 2015 in Hotel Palace Berlin
For 20% discount take voucher code:  "ISSE15SP"
-------------- next part --------------
From ad57d47682c67ede68f129f68b6c5888faa1d072 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 28 Oct 2015 12:04:56 +0100
Subject: [PATCH 1/7] smbd: Fix a comment

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/smbd/server.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index ceb9599..5fa0885 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1211,8 +1211,9 @@ extern void build_options(bool screen);
 		exit(1);
 	}
 
-	/* we want to re-seed early to prevent time delays causing
-           client problems at a later date. (tridge) */
+	/*
+	 * We want to die early if we can't open /dev/urandom
+	 */
 	generate_random_buffer(NULL, 0);
 
 	/* get initial effective uid and gid */
-- 
1.9.1


From 74a0594a786a71238814b580088c0f17e6593216 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 28 Oct 2015 12:29:50 +0100
Subject: [PATCH 2/7] lib: dbwrap_local_open references loadparm_context

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 lib/dbwrap/dbwrap.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h
index 0a5c918..5e13a59 100644
--- a/lib/dbwrap/dbwrap.h
+++ b/lib/dbwrap/dbwrap.h
@@ -24,6 +24,7 @@
 #include <talloc.h>
 #include "libcli/util/ntstatus.h"
 #include "tdb.h"
+#include "lib/param/loadparm.h"
 
 struct db_record;
 struct db_context;
-- 
1.9.1


From ca66c781671b9d872ef226371efeb9633bf54874 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 12 Jul 2015 18:43:35 +0200
Subject: [PATCH 3/7] lib: Include samba_util.h in server_id_db.h

Usually this came in via server_id.h's includes.h. This will go.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/lib/server_id_db_util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/lib/server_id_db_util.c b/source3/lib/server_id_db_util.c
index bc1eb0c..98ee07d 100644
--- a/source3/lib/server_id_db_util.c
+++ b/source3/lib/server_id_db_util.c
@@ -20,6 +20,7 @@
 #include "replace.h"
 #include "server_id_db_util.h"
 #include "serverid.h"
+#include "lib/util/samba_util.h"
 
 static int server_id_db_check_exclusive(
 	struct server_id_db *db, const char *name,
-- 
1.9.1


From 14af0a41af9c770164c1aa501eb967656016f7a6 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 12 Jul 2015 18:45:18 +0200
Subject: [PATCH 4/7] lib: Remove a includes.h reference

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/include/serverid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/include/serverid.h b/source3/include/serverid.h
index 03022dc..5db61b9 100644
--- a/source3/include/serverid.h
+++ b/source3/include/serverid.h
@@ -20,7 +20,7 @@
 #ifndef __SERVERID_H__
 #define __SERVERID_H__
 
-#include "includes.h"
+#include "replace.h"
 #include "lib/dbwrap/dbwrap.h"
 
 /*
-- 
1.9.1


From 608901e541d0e5f8cf5ac873bc70864945c4edca Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 30 Jun 2015 20:41:55 +0200
Subject: [PATCH 5/7] examples: Fix unchecked result warnings

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 examples/libsmbclient/get_auth_data_fn.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/examples/libsmbclient/get_auth_data_fn.h b/examples/libsmbclient/get_auth_data_fn.h
index 6b91c97..5f2be72 100644
--- a/examples/libsmbclient/get_auth_data_fn.h
+++ b/examples/libsmbclient/get_auth_data_fn.h
@@ -16,6 +16,7 @@ get_auth_data_fn(const char * pServer,
     char            workgroup[256] = { '\0' };
     char            username[256] = { '\0' };
     char            password[256] = { '\0' };
+    char           *ret;
 
     static int krb5_set = 1;
 
@@ -36,7 +37,10 @@ get_auth_data_fn(const char * pServer,
     }
 
     fprintf(stdout, "Workgroup: [%s] ", pWorkgroup);
-    fgets(temp, sizeof(temp), stdin);
+    ret = fgets(temp, sizeof(temp), stdin);
+    if (ret == NULL) {
+	    return;
+    }
     
     if (temp[strlen(temp) - 1] == '\n') /* A new line? */
     {
@@ -49,7 +53,10 @@ get_auth_data_fn(const char * pServer,
     }
     
     fprintf(stdout, "Username: [%s] ", pUsername);
-    fgets(temp, sizeof(temp), stdin);
+    ret = fgets(temp, sizeof(temp), stdin);
+    if (ret == NULL) {
+	    return;
+    }
     
     if (temp[strlen(temp) - 1] == '\n') /* A new line? */
     {
@@ -62,7 +69,10 @@ get_auth_data_fn(const char * pServer,
     }
     
     fprintf(stdout, "Password: ");
-    fgets(temp, sizeof(temp), stdin);
+    ret = fgets(temp, sizeof(temp), stdin);
+    if (ret == NULL) {
+	    return;
+    }
     
     if (temp[strlen(temp) - 1] == '\n') /* A new line? */
     {
-- 
1.9.1


From f050e945685e1db275299f0782ddbccf2a3c640c Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 12 Jul 2015 14:33:55 +0200
Subject: [PATCH 6/7] messages: messages.h needs data_blob.h

Normally it somehow comes via includes.h, but if you want to directly
include messages.h you need this

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/include/messages.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/include/messages.h b/source3/include/messages.h
index 9a3ea25..35f5ea7 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -59,6 +59,7 @@
 #define MSG_SRVID_SAMBA 0x0000000100000000LL
 
 #include "librpc/gen_ndr/server_id.h"
+#include "lib/util/data_blob.h"
 
 #define MSG_BROADCAST_PID_STR	"0:0"
 
-- 
1.9.1


From 61ab177d980d8c1080a442e48b829a4919137643 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 23 Jun 2015 18:29:53 +0200
Subject: [PATCH 7/7] ldb: Fix a "ignoring return value" warning

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 lib/ldb-samba/ldb_wrap.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/ldb-samba/ldb_wrap.c b/lib/ldb-samba/ldb_wrap.c
index 05d0451..838306f 100644
--- a/lib/ldb-samba/ldb_wrap.c
+++ b/lib/ldb-samba/ldb_wrap.c
@@ -67,8 +67,12 @@ static void ldb_wrap_debug(void *context, enum ldb_debug_level level,
 	};
 	if (CHECK_DEBUGLVL(samba_level)) {
 		char *s = NULL;
-		vasprintf(&s, fmt, ap);
-		if (!s) return;
+		int ret;
+
+		ret = vasprintf(&s, fmt, ap);
+		if (ret == -1) {
+			return;
+		}
 		DEBUG(samba_level, ("ldb: %s\n", s));
 		free(s);
 	}
-- 
1.9.1



More information about the samba-technical mailing list