ehlo,

simple patch attached + shell based unit test.

LS
From e21ab30e79bbf033f6fab8549b6f7e79e4f4d194 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lsleb...@redhat.com>
Date: Sat, 17 Sep 2016 21:05:36 +0200
Subject: [PATCH 1/4] Remove double semicolon at the end of line

---
 src/db/sysdb_ops.c                         |  2 +-
 src/lib/idmap/sss_idmap.c                  |  2 +-
 src/lib/sifp/sss_sifp_parser.c             |  2 +-
 src/providers/ad/ad_gpo.c                  |  2 +-
 src/providers/ipa/ipa_subdomains_id.c      |  2 +-
 src/providers/ipa/ipa_sudo_conversion.c    |  2 +-
 src/providers/krb5/krb5_child.c            |  2 +-
 src/providers/ldap/sdap_async.c            |  6 +++---
 src/providers/ldap/sdap_async_initgroups.c |  2 +-
 src/providers/ldap/sdap_async_netgroups.c  |  2 +-
 src/responder/pam/pamsrv_cmd.c             |  2 +-
 src/sss_client/sudo/sss_sudo.c             |  2 +-
 src/tests/krb5_child-test.c                | 10 +++++-----
 src/tests/sbus_codegen_tests.c             |  4 ++--
 src/tools/sss_groupshow.c                  |  2 +-
 src/util/string_utils.c                    |  2 +-
 src/util/usertools.c                       |  2 +-
 17 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 
5d9c9fb24a149f8215b3027dcb4b0e1a183e4b43..29f4b1d1597bd98541a152dd6462caa864fbf2fd
 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -4815,7 +4815,7 @@ errno_t sysdb_handle_original_uuid(const char *orig_name,
 
     if (ret != EOK) {
         DEBUG(SSSDBG_OP_FAILURE, "sysdb_attrs_add_string failed.\n");
-        return ret;;
+        return ret;
     }
 
     return EOK;
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c
index 
58b0ec62118c9e01b61d987bf77179e774313b11..ffb218c844bff18e8a000398e9d646556ca295cf
 100644
--- a/src/lib/idmap/sss_idmap.c
+++ b/src/lib/idmap/sss_idmap.c
@@ -916,7 +916,7 @@ get_range(struct sss_idmap_ctx *ctx,
           long long rid,
           struct idmap_range_params **_range)
 {
-    char *secondary_name = NULL;;
+    char *secondary_name = NULL;
     enum idmap_error_code err;
     int first_rid;
     struct idmap_range_params *range;
diff --git a/src/lib/sifp/sss_sifp_parser.c b/src/lib/sifp/sss_sifp_parser.c
index 
eaa57d8d5e67ec07d0fe89e003ee011dcd40a75f..65babb5bc5430a541ade4cec0350e0846962fd67
 100644
--- a/src/lib/sifp/sss_sifp_parser.c
+++ b/src/lib/sifp/sss_sifp_parser.c
@@ -469,7 +469,7 @@ sss_sifp_parse_variant(sss_sifp_ctx *ctx,
         /* case DBUS_TYPE_DICT_ENTRY may only be contained within an array
          * in variant */
         case DBUS_TYPE_ARRAY:
-            ret = sss_sifp_parse_array(ctx, &variant_iter, attr);;
+            ret = sss_sifp_parse_array(ctx, &variant_iter, attr);
             break;
         default:
             ret = SSS_SIFP_NOT_SUPPORTED;
diff --git a/src/providers/ad/ad_gpo.c b/src/providers/ad/ad_gpo.c
index 
63c68ce35922ca0407ae6ea32c0a78100e14504b..2b06a0ec8c24a0da44b0da00718c84c228242d24
 100644
--- a/src/providers/ad/ad_gpo.c
+++ b/src/providers/ad/ad_gpo.c
@@ -2491,7 +2491,7 @@ ad_gpo_populate_som_list(TALLOC_CTX *mem_ctx,
     }
 
     /* first, populate the OU and Domain SOMs */
-    tmp_dn = target_dn;;
+    tmp_dn = target_dn;
     while ((ad_gpo_parent_dn(tmp_ctx, ldb_ctx, tmp_dn, &parent_dn)) == EOK) {
 
         if ((strncasecmp(parent_dn, "OU=", strlen("OU=")) == 0) ||
diff --git a/src/providers/ipa/ipa_subdomains_id.c 
b/src/providers/ipa/ipa_subdomains_id.c
index 
5369ec4c624544f7f3aec88ddaa30eac91c51735..97c96e3818f37d0cf3e282f68d3a013122a2a55b
 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -669,7 +669,7 @@ ipa_get_ad_acct_send(TALLOC_CTX *mem_ctx,
     struct ipa_get_ad_acct_state *state;
     struct sdap_domain *sdom;
     struct sdap_id_conn_ctx **clist;
-    struct sdap_id_ctx *sdap_id_ctx;;
+    struct sdap_id_ctx *sdap_id_ctx;
     struct ad_id_ctx *ad_id_ctx;
 
     req = tevent_req_create(mem_ctx, &state, struct ipa_get_ad_acct_state);
diff --git a/src/providers/ipa/ipa_sudo_conversion.c 
b/src/providers/ipa/ipa_sudo_conversion.c
index 
21186d2455fb28c2743131ef98920eb00753f0d6..9dbc8604df544ce0865a2e99facf92cfd697123b
 100644
--- a/src/providers/ipa/ipa_sudo_conversion.c
+++ b/src/providers/ipa/ipa_sudo_conversion.c
@@ -634,7 +634,7 @@ static errno_t get_sudo_cmd_rdn(TALLOC_CTX *mem_ctx,
     }
 
     *_rdn_val = rdn_val;
-    *_rdn_attr = map[IPA_AT_SUDOCMD_CMD].name;;
+    *_rdn_attr = map[IPA_AT_SUDOCMD_CMD].name;
 
     return EOK;
 }
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index 
82522995e310f20c58922f814e14e81a84b9bcb9..df94bc4c481b090d50f9b0119ccde5a373d9e20b
 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -2612,7 +2612,7 @@ static krb5_error_code privileged_krb5_setup(struct 
krb5_req *kr,
     ret = check_use_fast(&kr->fast_val);
     if (ret != EOK) {
         DEBUG(SSSDBG_CRIT_FAILURE, "check_use_fast failed.\n");
-        return ret;;
+        return ret;
     }
 
     /* For ccache types FILE: and DIR: we might need to create some directory
diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c
index 
f374112935a7befa1d059df97f3119c14d8f5da5..246e12a1f386da1841963d5c1d1c4d2870cc1b6b
 100644
--- a/src/providers/ldap/sdap_async.c
+++ b/src/providers/ldap/sdap_async.c
@@ -2097,7 +2097,7 @@ static void sdap_x_deref_search_done(struct tevent_req 
*subreq)
 
 static int sdap_x_deref_search_ctrls_destructor(void *ptr)
 {
-    LDAPControl **ctrls = talloc_get_type(ptr, LDAPControl *);;
+    LDAPControl **ctrls = talloc_get_type(ptr, LDAPControl *);
 
     if (ctrls && ctrls[0]) {
         ldap_control_free(ctrls[0]);
@@ -2289,7 +2289,7 @@ static void sdap_sd_search_done(struct tevent_req *subreq)
 
 static int sdap_sd_search_ctrls_destructor(void *ptr)
 {
-    LDAPControl **ctrls = talloc_get_type(ptr, LDAPControl *);;
+    LDAPControl **ctrls = talloc_get_type(ptr, LDAPControl *);
     if (ctrls && ctrls[0]) {
         ldap_control_free(ctrls[0]);
     }
@@ -2548,7 +2548,7 @@ static void sdap_asq_search_done(struct tevent_req 
*subreq)
 
 static int sdap_asq_search_ctrls_destructor(void *ptr)
 {
-    LDAPControl **ctrls = talloc_get_type(ptr, LDAPControl *);;
+    LDAPControl **ctrls = talloc_get_type(ptr, LDAPControl *);
 
     if (ctrls && ctrls[0]) {
         ldap_control_free(ctrls[0]);
diff --git a/src/providers/ldap/sdap_async_initgroups.c 
b/src/providers/ldap/sdap_async_initgroups.c
index 
f9593f0dfaa2dc6e33fd6c9d1f0c9b78cad3a1d9..df39de3cc5daf9ce23e1d9abe8b72f06ae45e9cd
 100644
--- a/src/providers/ldap/sdap_async_initgroups.c
+++ b/src/providers/ldap/sdap_async_initgroups.c
@@ -816,7 +816,7 @@ static struct tevent_req 
*sdap_initgr_nested_send(TALLOC_CTX *memctx,
     }
 
     state->groups = talloc_zero_array(state, struct sysdb_attrs *,
-                                      state->memberof->num_values + 1);;
+                                      state->memberof->num_values + 1);
     if (!state->groups) {
         ret = ENOMEM;
         goto immediate;
diff --git a/src/providers/ldap/sdap_async_netgroups.c 
b/src/providers/ldap/sdap_async_netgroups.c
index 
e1d69ad769f542cccffca50547932a5bfb352230..f4a1d165f77a15f150e99844d69716c6c8785bee
 100644
--- a/src/providers/ldap/sdap_async_netgroups.c
+++ b/src/providers/ldap/sdap_async_netgroups.c
@@ -313,7 +313,7 @@ struct tevent_req *netgr_translate_members_send(TALLOC_CTX 
*memctx,
     dn_filter = talloc_strdup(state, "(|");
     if (dn_filter == NULL) {
         DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup failed.\n");
-        ret = ENOMEM;;
+        ret = ENOMEM;
         goto fail;
     }
 
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index 
be54fbf9b627d0ec1c3b0416401885245794cf9f..e52fc764245a2dd604bd149b956f8204fa865342
 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -1286,7 +1286,7 @@ static void pam_forwarder_cert_cb(struct tevent_req *req)
         if (pd->logon_name == NULL) {
             DEBUG(SSSDBG_CRIT_FAILURE,
                   "No certificate found and no logon name given, " \
-                  "authentication not possible.\n");;
+                  "authentication not possible.\n");
             ret = ENOENT;
         } else {
             if (pd->cmd == SSS_PAM_AUTHENTICATE) {
diff --git a/src/sss_client/sudo/sss_sudo.c b/src/sss_client/sudo/sss_sudo.c
index 
202029934ccb7c979b9b740fc7e466888825e042..3651740019349c590877a18f9e42c23b9ad41d0d
 100644
--- a/src/sss_client/sudo/sss_sudo.c
+++ b/src/sss_client/sudo/sss_sudo.c
@@ -226,7 +226,7 @@ void sss_sudo_free_rules(unsigned int num_rules, struct 
sss_sudo_rule *rules)
 
 void sss_sudo_free_attrs(unsigned int num_attrs, struct sss_sudo_attr *attrs)
 {
-    struct sss_sudo_attr *attr = NULL;;
+    struct sss_sudo_attr *attr = NULL;
     int i, j;
 
     if (attrs == NULL) {
diff --git a/src/tests/krb5_child-test.c b/src/tests/krb5_child-test.c
index 
50acc88ed0c312b2662f01fe41247781f235a54d..d570d52229a23a557d1f32b90cbb815239b57e74
 100644
--- a/src/tests/krb5_child-test.c
+++ b/src/tests/krb5_child-test.c
@@ -390,11 +390,11 @@ main(int argc, const char *argv[])
 
     int pc_debug = 0;
     int pc_timeout = 0;
-    const char *pc_user = NULL;;
-    const char *pc_passwd = NULL;;
-    const char *pc_realm = NULL;;
-    const char *pc_ccname = NULL;;
-    const char *pc_ccname_tp = NULL;;
+    const char *pc_user = NULL;
+    const char *pc_passwd = NULL;
+    const char *pc_realm = NULL;
+    const char *pc_ccname = NULL;
+    const char *pc_ccname_tp = NULL;
     char *password = NULL;
     bool rm_ccache = true;
 
diff --git a/src/tests/sbus_codegen_tests.c b/src/tests/sbus_codegen_tests.c
index 
55d4657385cfc697985b570e4310164558e2d647..8b48f715cbc25139099d6d6c4c2d633eeb491a18
 100644
--- a/src/tests/sbus_codegen_tests.c
+++ b/src/tests/sbus_codegen_tests.c
@@ -966,7 +966,7 @@ static void parse_get_array_reply(DBusMessage *reply, const 
int type,
     ck_assert_int_eq(dbus_message_iter_get_element_type(&variter), type);
     dbus_message_iter_recurse(&variter, &arriter);
     if (type == DBUS_TYPE_STRING || type == DBUS_TYPE_OBJECT_PATH) {
-        int n = 0, i = 0;;
+        int n = 0, i = 0;
         const char **strings;
         const char *s;
 
@@ -1325,7 +1325,7 @@ void check_arr_prop(DBusMessageIter *variter, struct 
prop_test *p)
 
     dbus_message_iter_recurse(variter, &arriter);
     if (type == DBUS_TYPE_STRING || type == DBUS_TYPE_OBJECT_PATH) {
-        int n = 0, i = 0;;
+        int n = 0, i = 0;
         const char *s;
 
         do {
diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c
index 
00f6f12939b6bef2dd10085f8cf99304e87f1211..258d458b0d1a4cb56c8fb61060cb43a1c88c1ed0
 100644
--- a/src/tools/sss_groupshow.c
+++ b/src/tools/sss_groupshow.c
@@ -58,7 +58,7 @@ const char *rdn_as_string(TALLOC_CTX *mem_ctx,
         return NULL;
     }
 
-    return ldb_dn_escape_value(mem_ctx, *val);;
+    return ldb_dn_escape_value(mem_ctx, *val);
 }
 
 static int parse_memberofs(struct ldb_context *ldb,
diff --git a/src/util/string_utils.c b/src/util/string_utils.c
index 
5e43bbef34e8b514e29ffc5e576f8b57dbab4890..872b7e29e55e8628085affd07f3363019aae5ee9
 100644
--- a/src/util/string_utils.c
+++ b/src/util/string_utils.c
@@ -100,7 +100,7 @@ errno_t guid_blob_to_string_buf(const uint8_t *blob, char 
*str_buf,
          blob[5], blob[4],
          blob[7], blob[6],
          blob[8], blob[9],
-         blob[10], blob[11],blob[12], blob[13],blob[14], blob[15]);;
+         blob[10], blob[11],blob[12], blob[13],blob[14], blob[15]);
     if (ret != (GUID_STR_BUF_SIZE -1)) {
         DEBUG(SSSDBG_CRIT_FAILURE, "snprintf failed.\n");
         return EIO;
diff --git a/src/util/usertools.c b/src/util/usertools.c
index 
e0d520ad1057b4ddcfd7830674afa9dfa3b37ebd..12fc85b8f20858975b01c49468834be158b43f1c
 100644
--- a/src/util/usertools.c
+++ b/src/util/usertools.c
@@ -210,7 +210,7 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx 
*cdb,
 {
     TALLOC_CTX *tmpctx = NULL;
     char *conf_path = NULL;
-    char *re_pattern = NULL;;
+    char *re_pattern = NULL;
     char *fq_fmt = NULL;
     int ret;
 
-- 
2.9.3

From 3bda37e85e811e8ef3fc378912d5d5fa284db6bd Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lsleb...@redhat.com>
Date: Sat, 17 Sep 2016 21:12:36 +0200
Subject: [PATCH 2/4] TESTS: Add simple test for double semicolon

---
 Makefile.am                     |  2 ++
 src/tests/double_semicolon_test | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100755 src/tests/double_semicolon_test

diff --git a/Makefile.am b/Makefile.am
index 
f89af5a9d6d26c732574aa3651de8c175f538b28..6a06bbbd9954d7e7d84a2d8d733b8d15c1f3f61f
 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -321,6 +321,7 @@ TESTS = \
     $(non_interactive_cmocka_based_tests) \
     $(non_interactive_check_based_tests) \
     src/tests/whitespace_test \
+    src/tests/double_semicolon_test \
     $(NULL)
 
 sssdlib_LTLIBRARIES = \
@@ -410,6 +411,7 @@ dist_noinst_SCRIPTS = \
     src/tests/pysss_murmur-test.py3.sh \
     src/tests/python-test.py \
     src/tests/whitespace_test \
+    src/tests/double_semicolon_test \
     src/tests/krb5_proxy_check_test_data.conf \
     $(NULL)
 
diff --git a/src/tests/double_semicolon_test b/src/tests/double_semicolon_test
new file mode 100755
index 
0000000000000000000000000000000000000000..3e28307ea597aa77d8ab6acd01edd5257dce432e
--- /dev/null
+++ b/src/tests/double_semicolon_test
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+set -e -u -o pipefail
+
+# An AWK regex matching tracked file paths to be included for the search.
+# Example: '.*\.po|README'
+PATH_INCLUDE_REGEX='.*\.c|.*\.h'
+
+export GIT_DIR="$ABS_TOP_SRCDIR/.git"
+export GIT_WORK_TREE="$ABS_TOP_SRCDIR"
+
+if [ ! -d "$GIT_DIR" ]; then
+    echo "Git repository is required for this test!" 1>&2
+    exit 77
+fi
+
+{
+    # Look for lines with with double semicolon at the end of line
+    # in all files tracked by Git
+    git grep -n -I ';\s*;$' -- "$(git rev-parse --show-toplevel)" ||
+        # Don't fail if no such lines were found anywhere
+        [[ $? == 1 ]]
+} |
+    awk -- "
+        BEGIN {
+            found = 0
+        }
+        /^($PATH_INCLUDE_REGEX):/ {
+            if (!found) {
+                print \"Double semicolon found:\"
+                found = 1
+            }
+            print
+        }
+        END {
+            exit found
+        }
+    "
-- 
2.9.3

_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to