On Thu, May 22, 2014 at 07:57:28PM +0200, Pavel Březina wrote:
> On 05/21/2014 11:03 PM, Jakub Hrozek wrote:
> >Hi,
> >
> >the attaches two patches implement DBus methods to retrieve SSSD domains
> >using the system bus as well as two example getters that leverage the
> >infrastructure to Get and GetAll the object properties.
> >
> >Pavel, I know you have a large patchset in a private tree that
> >implements the other getters and moves the domain methods into a
> >separate file. I'm fine with merging your and mine patches, I just
> >wanted to get the ball rolling on the list. Feel free to reply with your
> >patchset.
> 
> Hi,
> see the attachment.
> 
> I squash all my patches to these five - mainly discarded the moving
> the code around.
> 
> I kept you as the author for the methods as I made only very minor
> changes there. However, I took the ownership for the properties
> since there only very little of your original code remains there - I
> hope you don't mind.
> 
> The next three patches implements the SSSD components interface
> required for the OpenLMI provider. I'm sending it to this thread
> since it depends on the domain patches anyway - there is enough
> dependency fuzz already.
> 

> From a1a69124369eb50d37bc151802125b909fe7d1ec Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <[email protected]>
> Date: Tue, 6 May 2014 10:54:47 +0200
> Subject: [PATCH 4/5] utils: add get_known_services()
> 
> ---
>  src/monitor/monitor.c | 3 +--
>  src/util/util.c       | 8 ++++++++
>  src/util/util.h       | 2 ++
>  3 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
> index 
> a164ede8a46f5b383c56a23ada693ba6d2ca2210..5e6eb37fdbf30c4079b309d98a1b05fdffdf65c7
>  100644
> --- a/src/monitor/monitor.c
> +++ b/src/monitor/monitor.c
> @@ -888,8 +888,7 @@ done:
>  
>  static char *check_services(char **services)
>  {
> -    const char *known_services[] = { "nss", "pam", "sudo", "autofs", "ssh",
> -                                     "pac", "ifp", NULL };
> +    const char * const *known_services = get_known_services();
>      int i;
>      int ii;
>  
> diff --git a/src/util/util.c b/src/util/util.c
> index 
> fc37aad229813f328c9af007a005569bb02c5091..ad93ca1a0715e3a5f5c6c7371eb142718c38afa3
>  100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -806,3 +806,11 @@ bool check_ipv6_addr(struct in6_addr *addr, uint8_t 
> flags)
>  
>      return true;
>  }
> +
> +const char * const * get_known_services(void)
> +{
> +    static const char *svc[] = {"nss", "pam", "sudo", "autofs",
> +                                "ssh", "pac", "ifp", NULL };
> +
> +    return svc;
> +}
> diff --git a/src/util/util.h b/src/util/util.h
> index 
> 54c6c6c78b87398da66e276d67a04f4558cec790..de7f9e553ef8f91df88fe7a71284538358e8798d
>  100644
> --- a/src/util/util.h
> +++ b/src/util/util.h
> @@ -377,6 +377,8 @@ errno_t check_and_open_readonly(const char *filename, int 
> *fd,
>  bool check_ipv4_addr(struct in_addr *addr, uint8_t check);
>  bool check_ipv6_addr(struct in6_addr *addr, uint8_t check);
>  
> +const char * const * get_known_services(void);
> +
>  int split_on_separator(TALLOC_CTX *mem_ctx, const char *str,
>                         const char sep, bool trim, bool skip_empty,
>                         char ***_list, int *size);
> -- 
> 1.7.11.7
> 

ACK, see attached patch for what I tested with.
>From 4c28a6f7090a8f707fd3ee4bdd476becc7b52da3 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <[email protected]>
Date: Mon, 26 May 2014 19:13:16 +0200
Subject: [PATCH] tests: Add test for get_known_services

---
 src/tests/util-tests.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
index 
5d378e4f8eadfd6861adfa71caa2cc591ca9e649..198edf597b1bc8f1133e5c934e7f6fa2f6d4e021
 100644
--- a/src/tests/util-tests.c
+++ b/src/tests/util-tests.c
@@ -957,6 +957,27 @@ START_TEST(test_is_host_in_domain)
 }
 END_TEST
 
+START_TEST(test_known_service)
+{
+    const char * const * svcs;
+    bool found_nss;
+    int i;
+
+    /* Just make sure we can't find a bogus service and nss
+     * is always available
+     */
+    svcs = get_known_services();
+    for (i = 0; svcs[i]; i++) {
+        ck_assert_str_ne(svcs[i], "nosuchservice");
+        if (strcmp(svcs[i], "nss")) {
+            found_nss = true;
+        }
+    }
+
+    ck_assert(found_nss == true);
+}
+END_TEST
+
 Suite *util_suite(void)
 {
     Suite *s = suite_create("util");
@@ -976,6 +997,7 @@ Suite *util_suite(void)
     tcase_add_test (tc_util, test_check_ipv4_addr);
     tcase_add_test (tc_util, test_check_ipv6_addr);
     tcase_add_test (tc_util, test_is_host_in_domain);
+    tcase_add_test (tc_util, test_known_service);
     tcase_set_timeout(tc_util, 60);
 
     TCase *tc_utf8 = tcase_create("utf8");
-- 
1.9.0

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to