[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Fri Jun 24 03:59:03 UTC 2016
The branch, master has been updated
via 9316a80 s3-libnet: Add a comment to make cleaŕ we want to fall through
via 539116e nsswitch: Fix memory leak in test_wbc_trusts()
via 3c9f081 nsswitch: Fix memory leak in test_wbc_groups()
via e9fabe3 nsswitch: Fix memory leak in test_wbc_users()
via 6a620ad nsswitch: Fix memory leak in test_wbc_domain_info()
via 9b732c2 nsswitch: Fix memory leak in test_wbc_pingdc2()
via 4961362 nsswitch: Fix memory leak in test_wbc_get_sidaliases()
via 2ae4086 nsswitch: Fix memory leak in test_wbc_pingdc()
via f479a1f nsswitch: Fix wbclient torture_assert_wbc_ok_goto_fail macro
via 8b91178 smbget: Fix a memory leak
from 22d1d7d s3-ctdb: Fail CTDB connection only on INACTIVE state
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9316a806db6dc43a7cb2921e731fc6e115bc9892
Author: Andreas Schneider <asn at samba.org>
Date: Thu Jun 23 14:18:35 2016 +0200
s3-libnet: Add a comment to make cleaŕ we want to fall through
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Fri Jun 24 05:58:35 CEST 2016 on sn-devel-144
commit 539116e5884131d73af8ad3e7ec04010477ccc22
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jun 22 08:53:51 2016 +0200
nsswitch: Fix memory leak in test_wbc_trusts()
Found by cppcheck.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
commit 3c9f0815fb0822c7e9521b5526c24addd9f89a34
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jun 22 08:48:12 2016 +0200
nsswitch: Fix memory leak in test_wbc_groups()
Found by cppcheck.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
commit e9fabe3a116e0172ab2b77b26bbd0706e51a2a81
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jun 22 08:25:54 2016 +0200
nsswitch: Fix memory leak in test_wbc_users()
Found by cppcheck.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
commit 6a620adb25ada71470ab890a3734c0007de55921
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jun 22 08:16:11 2016 +0200
nsswitch: Fix memory leak in test_wbc_domain_info()
Found by cppcheck.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
commit 9b732c2448a166fdbfc43d1dda23ba7164a79db4
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jun 22 08:04:53 2016 +0200
nsswitch: Fix memory leak in test_wbc_pingdc2()
Found by cppcheck.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
commit 4961362106152a1a0839a690cafe8824ea728745
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jun 22 08:01:05 2016 +0200
nsswitch: Fix memory leak in test_wbc_get_sidaliases()
Found by cppcheck.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
commit 2ae40865bef6fd4fcf0584e0bd744914ec18a9ca
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jun 22 07:56:20 2016 +0200
nsswitch: Fix memory leak in test_wbc_pingdc()
Found by cppcheck.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
commit f479a1f896d1582d41ac45ebdc003d438198fcda
Author: Andreas Schneider <asn at samba.org>
Date: Wed Jun 22 07:51:45 2016 +0200
nsswitch: Fix wbclient torture_assert_wbc_ok_goto_fail macro
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
commit 8b91178aa8eb43e82fbf019ddc0d6b8ba574a5c9
Author: Andreas Schneider <asn at samba.org>
Date: Tue Jun 21 15:56:23 2016 +0200
smbget: Fix a memory leak
Found by cppcheck.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Uri Simchoni <uri at samba.org>
-----------------------------------------------------------------------
Summary of changes:
nsswitch/libwbclient/tests/wbclient.c | 393 +++++++++++++++++++++++-----------
source3/libnet/libnet_join.c | 1 +
source3/utils/smbget.c | 1 +
3 files changed, 272 insertions(+), 123 deletions(-)
Changeset truncated at 500 lines:
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index 0de6096..0412bed 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -57,7 +57,7 @@
} while (0)
#define torture_assert_wbc_ok_goto_fail(torture_ctx,expr,cmt,cmt_arg) \
- torture_assert_wbc_equal(torture_ctx,expr,WBC_ERR_SUCCESS,cmt,cmt_arg)
+ torture_assert_wbc_equal_goto_fail(torture_ctx,expr,WBC_ERR_SUCCESS,cmt,cmt_arg)
#define torture_assert_str_equal_goto_fail(torture_ctx,got,expected,cmt)\
do { const char *__got = (got), *__expected = (expected); \
@@ -79,61 +79,91 @@ static bool test_wbc_ping(struct torture_context *tctx)
static bool test_wbc_pingdc(struct torture_context *tctx)
{
- struct wbcInterfaceDetails *details;
+ struct wbcInterfaceDetails *details = NULL;
+ wbcErr ret = false;
- torture_assert_wbc_equal(tctx, wbcPingDc("random_string", NULL), WBC_ERR_DOMAIN_NOT_FOUND,
- "%s", "wbcPingDc failed");
- torture_assert_wbc_ok(tctx, wbcPingDc(NULL, NULL),
+ torture_assert_wbc_equal_goto_fail(tctx,
+ wbcPingDc("random_string", NULL),
+ WBC_ERR_DOMAIN_NOT_FOUND,
+ "%s",
+ "wbcPingDc failed");
+ torture_assert_wbc_ok_goto_fail(tctx, wbcPingDc(NULL, NULL),
"%s", "wbcPingDc failed");
- torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
+ torture_assert_wbc_ok_goto_fail(tctx, wbcInterfaceDetails(&details),
"%s", "wbcInterfaceDetails failed");
- torture_assert(tctx, details,
+ torture_assert_goto(tctx, details, ret, fail,
"wbcInterfaceDetails returned NULL pointer");
- torture_assert(tctx, details->netbios_domain,
+ torture_assert_goto(tctx, details->netbios_domain, ret, fail,
"wbcInterfaceDetails returned NULL netbios_domain");
- torture_assert_wbc_ok(tctx, wbcPingDc(details->netbios_domain, NULL),
- "wbcPingDc(%s) failed", details->netbios_domain);
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcPingDc(details->netbios_domain, NULL),
+ "wbcPingDc(%s) failed",
+ details->netbios_domain);
- torture_assert_wbc_ok(tctx, wbcPingDc("BUILTIN", NULL),
- "%s", "wbcPingDc(BUILTIN) failed");
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcPingDc("BUILTIN", NULL),
+ "%s",
+ "wbcPingDc(BUILTIN) failed");
+ ret = true;
+fail:
wbcFreeMemory(details);
- return true;
+ return ret;
}
static bool test_wbc_pingdc2(struct torture_context *tctx)
{
- struct wbcInterfaceDetails *details;
+ struct wbcInterfaceDetails *details = NULL;
char *name = NULL;
+ wbcErr ret = false;
- torture_assert_wbc_equal(tctx, wbcPingDc2("random_string", NULL, &name),
- WBC_ERR_DOMAIN_NOT_FOUND, "%s",
- "wbcPingDc2 failed");
- torture_assert_wbc_ok(tctx, wbcPingDc2(NULL, NULL, &name), "%s",
- "wbcPingDc2 failed");
-
+ torture_assert_wbc_equal_goto_fail(tctx,
+ wbcPingDc2("random_string", NULL, &name),
+ WBC_ERR_DOMAIN_NOT_FOUND,
+ "%s",
+ "wbcPingDc2 failed");
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcPingDc2(NULL, NULL, &name),
+ "%s",
+ "wbcPingDc2 failed");
wbcFreeMemory(name);
-
- torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
- "%s", "wbcInterfaceDetails failed");
- torture_assert(tctx, details,
- "wbcInterfaceDetails returned NULL pointer");
- torture_assert(tctx, details->netbios_domain,
- "wbcInterfaceDetails returned NULL netbios_domain");
-
- torture_assert_wbc_ok(tctx, wbcPingDc2(details->netbios_domain, NULL, &name),
- "wbcPingDc2(%s) failed", details->netbios_domain);
+ name = NULL;
+
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcInterfaceDetails(&details),
+ "%s",
+ "wbcInterfaceDetails failed");
+ torture_assert_goto(tctx,
+ details,
+ ret,
+ fail,
+ "wbcInterfaceDetails returned NULL pointer");
+ torture_assert_goto(tctx,
+ details->netbios_domain,
+ ret,
+ fail,
+ "wbcInterfaceDetails returned NULL netbios_domain");
+
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcPingDc2(details->netbios_domain, NULL, &name),
+ "wbcPingDc2(%s) failed",
+ details->netbios_domain);
wbcFreeMemory(name);
+ name = NULL;
- torture_assert_wbc_ok(tctx, wbcPingDc2("BUILTIN", NULL, &name),
- "%s", "wbcPingDc2(BUILTIN) failed");
- wbcFreeMemory(name);
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcPingDc2("BUILTIN", NULL, &name),
+ "%s",
+ "wbcPingDc2(BUILTIN) failed");
+ ret = true;
+fail:
+ wbcFreeMemory(name);
wbcFreeMemory(details);
- return true;
+ return ret;
}
static bool test_wbc_library_details(struct torture_context *tctx)
@@ -225,143 +255,246 @@ static bool test_wbc_guidtostring(struct torture_context *tctx)
static bool test_wbc_domain_info(struct torture_context *tctx)
{
- struct wbcDomainInfo *info;
- struct wbcInterfaceDetails *details;
+ struct wbcDomainInfo *info = NULL;
+ struct wbcInterfaceDetails *details = NULL;
+ wbcErr ret = false;
- torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
- "%s", "wbcInterfaceDetails failed");
- torture_assert_wbc_ok(
- tctx, wbcDomainInfo(details->netbios_domain, &info),
- "%s", "wbcDomainInfo failed");
- wbcFreeMemory(details);
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcInterfaceDetails(&details),
+ "%s",
+ "wbcInterfaceDetails failed");
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcDomainInfo(details->netbios_domain, &info),
+ "%s",
+ "wbcDomainInfo failed");
+
+ torture_assert_goto(tctx,
+ info,
+ ret,
+ fail,
+ "wbcDomainInfo returned NULL pointer");
- torture_assert(tctx, info,
- "wbcDomainInfo returned NULL pointer");
+ ret = true;
+fail:
+ wbcFreeMemory(details);
wbcFreeMemory(info);
- return true;
+ return ret;
}
static bool test_wbc_users(struct torture_context *tctx)
{
const char *domain_name = NULL;
uint32_t num_users;
- const char **users;
- int i;
- struct wbcInterfaceDetails *details;
+ const char **users = NULL;
+ uint32_t i;
+ struct wbcInterfaceDetails *details = NULL;
+ struct wbcDomainSid *sids = NULL;
+ char *domain = NULL;
+ char *name = NULL;
+ char *sid_string = NULL;
+ wbcErr ret = false;
torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
"%s", "wbcInterfaceDetails failed");
domain_name = talloc_strdup(tctx, details->netbios_domain);
+ torture_assert_goto(tctx,
+ domain_name != NULL,
+ ret,
+ fail,
+ "Failed to allocate domain_name");
wbcFreeMemory(details);
-
- torture_assert_wbc_ok(tctx, wbcListUsers(domain_name, &num_users, &users),
- "%s", "wbcListUsers failed");
- torture_assert(tctx, !(num_users > 0 && !users),
- "wbcListUsers returned invalid results");
-
- for (i=0; i < MIN(num_users,100); i++) {
-
- struct wbcDomainSid sid, *sids;
+ details = NULL;
+
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcListUsers(domain_name, &num_users, &users),
+ "%s",
+ "wbcListUsers failed");
+ torture_assert_goto(tctx,
+ !(num_users > 0 && !users),
+ ret,
+ fail,
+ "wbcListUsers returned invalid results");
+
+ for (i = 0; i < MIN(num_users, 100); i++) {
+ struct wbcDomainSid sid;
enum wbcSidType name_type;
- char *domain;
- char *name;
- char *sid_string;
uint32_t num_sids;
- torture_assert_wbc_ok(tctx, wbcLookupName(domain_name, users[i], &sid, &name_type),
- "wbcLookupName of %s failed", users[i]);
- torture_assert_int_equal(tctx, name_type, WBC_SID_NAME_USER,
- "wbcLookupName expected WBC_SID_NAME_USER");
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcLookupName(domain_name, users[i], &sid, &name_type),
+ "wbcLookupName of %s failed",
+ users[i]);
+ torture_assert_int_equal_goto(tctx,
+ name_type, WBC_SID_NAME_USER,
+ ret,
+ fail,
+ "wbcLookupName expected WBC_SID_NAME_USER");
wbcSidToString(&sid, &sid_string);
- torture_assert_wbc_ok(tctx, wbcLookupSid(&sid, &domain, &name, &name_type),
- "wbcLookupSid of %s failed", sid_string);
- torture_assert_int_equal(tctx, name_type, WBC_SID_NAME_USER,
- "wbcLookupSid of expected WBC_SID_NAME_USER");
- torture_assert(tctx, name,
- "wbcLookupSid returned no name");
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcLookupSid(&sid,
+ &domain,
+ &name,
+ &name_type),
+ "wbcLookupSid of %s failed",
+ sid_string);
+ torture_assert_int_equal_goto(tctx,
+ name_type, WBC_SID_NAME_USER,
+ ret,
+ fail,
+ "wbcLookupSid of expected WBC_SID_NAME_USER");
+ torture_assert_goto(tctx,
+ name,
+ ret,
+ fail,
+ "wbcLookupSid returned no name");
wbcFreeMemory(domain);
+ domain = NULL;
wbcFreeMemory(name);
- torture_assert_wbc_ok(tctx, wbcLookupUserSids(&sid, true, &num_sids, &sids),
- "wbcLookupUserSids of %s failed", sid_string);
- torture_assert_wbc_ok(
- tctx, wbcGetDisplayName(&sid, &domain, &name,
- &name_type),
- "wbcGetDisplayName of %s failed", sid_string);
+ name = NULL;
+
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcLookupUserSids(&sid, true, &num_sids, &sids),
+ "wbcLookupUserSids of %s failed", sid_string);
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcGetDisplayName(&sid,
+ &domain,
+ &name,
+ &name_type),
+ "wbcGetDisplayName of %s failed",
+ sid_string);
wbcFreeMemory(domain);
+ domain = NULL;
wbcFreeMemory(name);
+ name = NULL;
wbcFreeMemory(sids);
+ sids = NULL;
wbcFreeMemory(sid_string);
+ sid_string = NULL;
}
+
+ ret = true;
+fail:
+ wbcFreeMemory(details);
wbcFreeMemory(users);
+ wbcFreeMemory(domain);
+ wbcFreeMemory(name);
+ wbcFreeMemory(sids);
+ wbcFreeMemory(sid_string);
- return true;
+ return ret;
}
static bool test_wbc_groups(struct torture_context *tctx)
{
+ wbcErr ret = false;
const char *domain_name = NULL;
uint32_t num_groups;
- const char **groups;
- int i;
- struct wbcInterfaceDetails *details;
+ const char **groups = NULL;
+ uint32_t i;
+ struct wbcInterfaceDetails *details = NULL;
+ char *domain = NULL;
+ char *name = NULL;
+ char *sid_string = NULL;
torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
"%s", "wbcInterfaceDetails failed");
domain_name = talloc_strdup(tctx, details->netbios_domain);
+ torture_assert_goto(tctx,
+ domain_name != NULL,
+ ret,
+ fail,
+ "Failed to allocate domain_name");
wbcFreeMemory(details);
-
- torture_assert_wbc_ok(tctx, wbcListGroups(domain_name, &num_groups, &groups),
- "wbcListGroups in %s failed", domain_name);
- torture_assert(tctx, !(num_groups > 0 && !groups),
- "wbcListGroups returned invalid results");
+ details = NULL;
+
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcListGroups(domain_name, &num_groups, &groups),
+ "wbcListGroups in %s failed",
+ domain_name);
+ torture_assert_goto(tctx,
+ !(num_groups > 0 && !groups),
+ ret,
+ fail,
+ "wbcListGroups returned invalid results");
for (i=0; i < MIN(num_groups,100); i++) {
-
struct wbcDomainSid sid;
enum wbcSidType name_type;
- char *domain;
- char *name;
- char *sid_string;
- torture_assert_wbc_ok(tctx, wbcLookupName(domain_name, groups[i], &sid, &name_type),
- "wbcLookupName for %s failed", domain_name);
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcLookupName(domain_name,
+ groups[i],
+ &sid,
+ &name_type),
+ "wbcLookupName for %s failed",
+ domain_name);
wbcSidToString(&sid, &sid_string);
- torture_assert_wbc_ok(tctx, wbcLookupSid(&sid, &domain, &name, &name_type),
- "wbcLookupSid of %s failed", sid_string);
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcLookupSid(&sid,
+ &domain,
+ &name,
+ &name_type),
+ "wbcLookupSid of %s failed",
+ sid_string);
+ torture_assert_goto(tctx,
+ name,
+ ret,
+ fail,
+ "wbcLookupSid returned no name");
+
+ wbcFreeMemory(domain);
+ domain = NULL;
+ wbcFreeMemory(name);
+ name = NULL;
wbcFreeMemory(sid_string);
- torture_assert(tctx, name,
- "wbcLookupSid returned no name");
+ sid_string = NULL;
}
+
+ ret = true;
+fail:
+ wbcFreeMemory(details);
wbcFreeMemory(groups);
+ wbcFreeMemory(domain);
+ wbcFreeMemory(name);
+ wbcFreeMemory(sid_string);
- return true;
+ return ret;
}
static bool test_wbc_trusts(struct torture_context *tctx)
{
- struct wbcDomainInfo *domains;
+ struct wbcDomainInfo *domains = NULL;
+ struct wbcAuthErrorInfo *error = NULL;
size_t num_domains;
- int i;
+ uint32_t i;
+ wbcErr ret = false;
- torture_assert_wbc_ok(tctx, wbcListTrusts(&domains, &num_domains),
- "%s", "wbcListTrusts failed");
- torture_assert(tctx, !(num_domains > 0 && !domains),
- "wbcListTrusts returned invalid results");
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcListTrusts(&domains, &num_domains),
+ "%s",
+ "wbcListTrusts failed");
+ torture_assert_goto(tctx,
+ !(num_domains > 0 && !domains),
+ ret,
+ fail,
+ "wbcListTrusts returned invalid results");
for (i=0; i < MIN(num_domains,100); i++) {
- struct wbcAuthErrorInfo *error;
/*
struct wbcDomainSid sid;
enum wbcSidType name_type;
char *domain;
char *name;
*/
- torture_assert_wbc_ok(tctx, wbcCheckTrustCredentials(domains[i].short_name, &error),
- "%s", "wbcCheckTrustCredentials failed");
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcCheckTrustCredentials(domains[i].short_name,
+ &error),
+ "%s",
+ "wbcCheckTrustCredentials failed");
/*
torture_assert_wbc_ok(tctx, wbcLookupName(domains[i].short_name, NULL, &sid, &name_type),
"wbcLookupName failed");
@@ -374,10 +507,16 @@ static bool test_wbc_trusts(struct torture_context *tctx)
torture_assert(tctx, name,
"wbcLookupSid returned no name");
*/
+ wbcFreeMemory(error);
+ error = NULL;
}
+
+ ret = true;
+fail:
wbcFreeMemory(domains);
+ wbcFreeMemory(error);
- return true;
+ return ret;
}
static bool test_wbc_lookupdc(struct torture_context *tctx)
@@ -504,36 +643,44 @@ fail:
static bool test_wbc_get_sidaliases(struct torture_context *tctx)
{
struct wbcDomainSid builtin;
- struct wbcDomainInfo *info;
- struct wbcInterfaceDetails *details;
+ struct wbcDomainInfo *info = NULL;
+ struct wbcInterfaceDetails *details = NULL;
struct wbcDomainSid sids[2];
- uint32_t *rids;
+ uint32_t *rids = NULL;
uint32_t num_rids;
- wbcErr ret;
+ wbcErr ret = false;
- torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
- "%s", "wbcInterfaceDetails failed");
- torture_assert_wbc_ok(
- tctx, wbcDomainInfo(details->netbios_domain, &info),
- "wbcDomainInfo of %s failed", details->netbios_domain);
- wbcFreeMemory(details);
+ torture_assert_wbc_ok_goto_fail(tctx,
+ wbcInterfaceDetails(&details),
+ "%s",
+ "wbcInterfaceDetails failed");
+ torture_assert_wbc_ok_goto_fail(tctx,
--
Samba Shared Repository
More information about the samba-cvs
mailing list