|PATCH] dsdb group audit test : Fix string compares
Gary Lockyer
gary at catalyst.net.nz
Wed Nov 14 20:38:25 UTC 2018
Replace the uses of:
strncmp(expected, value, strlen(expected))
With:
strcmp(expected, value)
Review appreciated
Gary
-------------- next part --------------
From 5917921d681025ddd71b3843b9300bcf228c184e Mon Sep 17 00:00:00 2001
From: Gary Lockyer <gary at catalyst.net.nz>
Date: Wed, 14 Nov 2018 14:03:37 +1300
Subject: [PATCH] dsdb group_audit tests: fix use of strncmp
Replace the uses of:
strncmp(expected, value, strlen(expected))
With:
strcmp(expected, value)
Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
---
source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c b/source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c
index 6ec218beb54..02b4985fb71 100644
--- a/source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c
+++ b/source4/dsdb/samdb/ldb_modules/tests/test_group_audit.c
@@ -137,7 +137,7 @@ static void _check_group_change_message(
}
value = json_string_value(v);
- if (strncmp("groupChange", value, strlen("groupChange") != 0)) {
+ if (strcmp("groupChange", value) != 0) {
cm_print_error(
"Unexpected type \"%s\" != \"groupChange\"\n",
value);
@@ -172,7 +172,7 @@ static void _check_group_change_message(
}
value = json_string_value(v);
- if (strncmp(user, value, strlen(user) != 0)) {
+ if (strcmp(user, value) != 0) {
cm_print_error(
"Unexpected user name \"%s\" != \"%s\"\n",
value,
@@ -190,7 +190,7 @@ static void _check_group_change_message(
}
value = json_string_value(v);
- if (strncmp(action, value, strlen(action) != 0)) {
+ if (strcmp(action, value) != 0) {
print_error(
"Unexpected action \"%s\" != \"%s\"\n",
value,
--
2.17.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20181115/208b676a/signature.sig>
More information about the samba-technical
mailing list