[SSSD] [PRELIMINARY][PATCH] ifp users and groups

Jakub Hrozek jhrozek at redhat.com
Thu May 14 14:34:09 UTC 2015


On Thu, May 14, 2015 at 02:22:53PM +0200, Pavel Březina wrote:
> On 05/14/2015 01:26 PM, Jakub Hrozek wrote:
> >On Wed, May 13, 2015 at 04:51:53PM +0200, Pavel Březina wrote:
> >>On 05/11/2015 05:58 PM, Jakub Hrozek wrote:
> >>>Thanks for the patches. They work quite well!
> >>>
> >>>One bug I found is that if you query a nonexistant object path with
> >>>GetAll, then all subsequent queries block. Maybe we don't finish some
> >>>request on error? This is what I tried:
> >>>[jhrozek at client] sssd $ [(review)] dbus-send --print-reply --system --dest=org.freedesktop.sssd.infopipe /org/freedesktop/sssd/infopipe/Users/redhat_2ecom/10327 org.freedesktop.DBus.Properties.GetAll string:org.freedesktop.sssd.infopipe.Users.User
> >>>Error org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus)
> >>>[jhrozek at client] sssd $ [(review)] dbus-send --print-reply --system --dest=org.freedesktop.sssd.infopipe /org/freedesktop/sssd/infopipe/Users/linux_2etest/465400000 org.freedesktop.DBus.Properties.GetAll string:org.freedesktop.sssd.infopipe.Users.User
> >>>Error org.freedesktop.DBus.Error.TimedOut: Activation of org.freedesktop.sssd.infopipe timed out
> >>>
> >>>The first objectpath is a copy-n-paste error from a different machine,
> >>>the second is legitimate. All works well unless I use the nonexistant path.
> >>
> >>Container wasn't closed properly and it broke the bus.
> >>
> >>diff --git a/src/sbus/sssd_dbus_invokers.c b/src/sbus/sssd_dbus_invokers.c
> >>index b2f0de0..f4d4ba3 100644
> >>--- a/src/sbus/sssd_dbus_invokers.c
> >>+++ b/src/sbus/sssd_dbus_invokers.c
> >>@@ -336,6 +336,12 @@ int sbus_invoke_get_aDOsasDE(DBusMessageIter *iter,
> >>      /* iterate over keys */
> >>
> >>      if (table == NULL) {
> >>+        dbret = dbus_message_iter_close_container(iter, &it_array);
> >>+        if (!dbret) {
> >>+            ret = EIO;
> >>+            goto done;
> >>+        }
> >>+
> >>          ret = EOK;
> >>          goto done;
> >>      }
> >>
> >>
> >>New patches are attached.
> >
> >I'm still testing functionality, but Coverity reported dead code:
> >Error: DEADCODE (CWE-561):
> >sssd-1.12.90/src/responder/ifp/ifp_groups.c:325: cond_notnull: Condition "req == NULL", taking false branch. Now the value of "req" is not "NULL".
> >sssd-1.12.90/src/responder/ifp/ifp_groups.c:357: notnull: At condition "req == NULL", the value of "req" cannot be "NULL".
> >sssd-1.12.90/src/responder/ifp/ifp_groups.c:357: dead_error_condition: The condition "req == NULL" cannot be true.
> >sssd-1.12.90/src/responder/ifp/ifp_groups.c:358: dead_error_begin: Execution cannot reach this statement: "ret = 12;".
> >#  356|                                             domain->name, name);
> >#  357|       if (req == NULL) {
> >#  358|->         ret = ENOMEM;
> >#  359|           goto immediately;
> >#  360|       }
> >
> >and ifp unit test is consistently failing for me:
> >FAIL: ifp_tests
> >===============
> >
> >[==========] Running 6 test(s).
> >[ RUN      ] ifp_test_req_create
> >[       OK ] ifp_test_req_create
> >[ RUN      ] ifp_test_req_wrong_uid
> >[       OK ] ifp_test_req_wrong_uid
> >[ RUN      ] test_el_to_dict
> >[       OK ] test_el_to_dict
> >[ RUN      ] test_attr_acl
> >s2[i]
> >/home/remote/jhrozek/devel/sssd/src/tests/cmocka/test_ifp.c:214: error: Failure!
> >
> >[  FAILED  ] test_attr_acl
> >[ RUN      ] test_attr_acl_ex
> >[       OK ] test_attr_acl_ex
> >[ RUN      ] test_attr_allowed
> >[       OK ] test_attr_allowed
> >[==========] 6 test(s) run.
> >[  PASSED  ] 5 test(s).
> >[  FAILED  ] 1 test(s), listed below:
> >[  FAILED  ] test_attr_acl
> >
> >  1 FAILED TEST(S)
> >_______________________________________________
> >sssd-devel mailing list
> >sssd-devel at lists.fedorahosted.org
> >https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
> >
> 
> Thanks for the review. New patches are attached.

The patches are now fine, but I found a way to crash the ifp provider by
looking up one of my users:
[jhrozek at client] ~ $ [] dbus-send --print-reply --system --dest=org.freedesktop.sssd.infopipe /org/freedesktop/sssd/infopipe/Users org.freedesktop.sssd.infopipe.Users.FindByName string:seuser                    
method return sender=:1.64 -> dest=:1.65 reply_serial=2
   object path "/org/freedesktop/sssd/infopipe/Users/linux_2etest/465400006"
[jhrozek at client] ~ $ [] dbus-send --print-reply --system --dest=org.freedesktop.sssd.infopipe /org/freedesktop/sssd/infopipe/Users/linux_2etest/465400006 org.freedesktop.DBus.Properties.GetAll string:org.freedesktop.sssd.infopipe.Users.User
Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

I'm not sure what exact info should I provide, this user is a member of one group:
ipa user-show --all --raw seuser
  dn: uid=seuser,cn=users,cn=accounts,dc=linux,dc=test
  uid: seuser
  givenname: se
  sn: user
  cn: se user
  initials: su
  homedirectory: /home/seuser
  gecos: se user
  loginshell: /bin/sh
  mail: seuser at linux.test
  uidnumber: 465400006
  gidnumber: 465400006
  nsaccountlock: FALSE
  has_password: TRUE
  has_keytab: TRUE
  displayName: se user
  ipaNTSecurityIdentifier: S-1-5-21-126042546-1138338015-323773745-1006
  ipaUniqueID: af8c216c-df6b-11e4-900b-525400805e63
  krbExtraData: AALZpCdVa2FkbWluZEBMSU5VWC5URVNUAA==
  krbLastFailedAuth: 20150410103509Z
  krbLastPwdChange: 20150410102425Z
  krbLastSuccessfulAuth: 20150507075036Z
  krbLoginFailedCount: 0
  krbPasswordExpiration: 20150709102425Z
  krbPrincipalName: seuser at LINUX.TEST
  krbTicketFlags: 128
  memberof: cn=ipausers,cn=groups,cn=accounts,dc=linux,dc=test
  memberof: cn=gr2,cn=groups,cn=accounts,dc=linux,dc=test
  memberof: ipaUniqueID=e7715958-df6b-11e4-af6a-525400805e63,cn=usermap,cn=selinux,dc=linux,dc=test
  mepManagedEntry: cn=seuser,cn=groups,cn=accounts,dc=linux,dc=test

Here is the backtrace:
(gdb) bt full                                                                                                                                                                                             [112/572]
#0  0x00007fb46106a8c7 in __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
        resultvar = 0
        pid = 1543
        selftid = 1543
#1  0x00007fb46106c52a in __GI_abort () at abort.c:89
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x1, sa_sigaction = 0x1}, sa_mask = {__val = {
              140412698948765, 8, 64, 140412702353152, 64, 140412753537832, 140412698950751, 
              140734394027568, 140412702353152, 64, 140412753537832, 64, 140412698684182, 0, 6454560, 
              140412753533888}}, sa_flags = 111, sa_restorer = 0x253e040}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007fb4644b7904 in _dbus_abort () from /lib64/libdbus-1.so.3
No symbol table info available.
#3  0x00007fb4644add2e in _dbus_warn_check_failed () from /lib64/libdbus-1.so.3
No symbol table info available.
#4  0x00007fb4644a0314 in dbus_message_iter_append_basic () from /lib64/libdbus-1.so.3
No symbol table info available.
#5  0x00007fb4655b0e57 in sbus_invoke_get_array (sbus_req=0x2534e70, 
    function_ptr=0x40c88a <ifp_users_user_get_groups>, item_size=8, dbus_type=111, iter=0x7fff47905180)
    at src/sbus/sssd_dbus_invokers.c:106
        handler_fn = 0x40c88a <ifp_users_user_get_groups>
        array_type = "o"
        array = {dummy1 = 0x2535e80, dummy2 = 0x7c04e00000, dummy3 = 39018860, dummy4 = 0, 
          dummy5 = 39018192, dummy6 = 0, dummy7 = 205, dummy8 = 32692, dummy9 = 39018192, dummy10 = 0, 
          dummy11 = 345, pad1 = 212, pad2 = 208, pad3 = 0x90}
        dbret = 1
---Type <return> to continue, or q <return> to quit--- 
        values = 0x253e030 "p\356S\002"
        addr = 0x253e040
        num_values = 3
        i = 2
#6  0x00007fb4655b131c in sbus_invoke_get_ao (iter=0x7fff47905180, sbus_req=0x2534e70, 
    function_ptr=0x40c88a <ifp_users_user_get_groups>) at src/sbus/sssd_dbus_invokers.c:302
No locals.
#7  0x00007fb4655b1b95 in sbus_invoke_get_all (sbus_req=0x2534e70) at src/sbus/sssd_dbus_invokers.c:545                                                                                                    [77/572]
        props = 0x41c8c0 <iface_ifp_users_user.properties>
        handler_fn = 0x40c88a <ifp_users_user_get_groups>
        reply = 0x2535e80
        iter = {dummy1 = 0x2535e80, dummy2 = 0x7c01e00000, dummy3 = 38928492, dummy4 = 0, 
          dummy5 = 38973104, dummy6 = 0, dummy7 = 5, dummy8 = 32692, dummy9 = 39018192, dummy10 = 0, 
          dummy11 = 0, pad1 = 0, pad2 = 1682634734, pad3 = 0x90}
        array = {dummy1 = 0x2535e80, dummy2 = 0x7c02e00000, dummy3 = 39018860, dummy4 = 0, 
          dummy5 = 38973104, dummy6 = 0, dummy7 = 1, dummy8 = 32692, dummy9 = 39018192, dummy10 = 0, 
          dummy11 = 192, pad1 = 8, pad2 = 0, pad3 = 0x90}
        dict = {dummy1 = 0x2535e80, dummy2 = 0x7c03e00000, dummy3 = 39019884, dummy4 = 0, 
          dummy5 = 38973104, dummy6 = 0, dummy7 = 4, dummy8 = 32692, dummy9 = 39018192, dummy10 = 0, 
          dummy11 = 203, pad1 = 8, pad2 = 0, pad3 = 0x90}
        variant = {dummy1 = 0x2535e80, dummy2 = 0x7c04e00000, dummy3 = 39024236, dummy4 = 0, 
          dummy5 = 39018192, dummy6 = 0, dummy7 = 206, dummy8 = 32692, dummy9 = 39018192, dummy10 = 0, 
          dummy11 = 208, pad1 = 8, pad2 = 0, pad3 = 0x90}
        dbret = 1
        ret = 0
        i = 6
---Type <return> to continue, or q <return> to quit---
        __FUNCTION__ = "sbus_invoke_get_all"
#8  0x00007fb4655b254e in sbus_properties_get_all (sbus_req=0x25318d0, pvt=0x2535590)
    at src/sbus/sssd_dbus_properties.c:335
        error = 0x0
        sbus_subreq = 0x2534e70
        conn = 0x2535590
        iface = 0x2538f40
        interface_name = 0x25361d4 "org.freedesktop.sssd.infopipe.Users.User"
        bret = true
#9  0x00007fb4655b26df in sbus_request_invoke_or_finish (dbus_req=0x25318d0, 
    handler_fn=0x7fb4655b2400 <sbus_properties_get_all>, handler_data=0x2535590, invoker_fn=0x0)
    at src/sbus/sssd_dbus_request.c:70
        error = {name = 0x7fff479058e0 "\006", 
          message = 0x7fb4655d5900 "src/sbus/sssd_dbus_interface.c:984", dummy1 = 0, dummy2 = 0, 
          dummy3 = 0, dummy4 = 0, dummy5 = 1, padding1 = 0x253e8b0}
        ret = 39053088
        __FUNCTION__ = "sbus_request_invoke_or_finish"
#10 0x00007fb4655b0368 in sbus_message_handler_got_caller_id (req=0x253e720)
    at src/sbus/sssd_dbus_interface.c:999
        sbus_req = 0x25318d0
        method = 0x7fb4657e2a10 <iface_methods+80>
        handler = 0x7fb4655b2400 <sbus_properties_get_all>
        invoker = 0x0
        pvt = 0x2535590
        error = 0x2536180
        ret = 0
#11 0x00007fb4655b386e in sbus_get_sender_id_done (pending=0x252bcd0, ptr=0x253e720)
    at src/sbus/sssd_dbus_request.c:472
        req = 0x253e720
        state = 0x253e8b0
        reply = 0x252d080
        dbus_error = {name = 0x0, message = 0x0, dummy1 = 1, dummy2 = 0, dummy3 = 0, dummy4 = 0, 
          dummy5 = 0, padding1 = 0x7fb4644a535a <_dbus_pending_call_complete+26>}
        key = {type = HASH_KEY_STRING, {str = 0x253e930 ":1.66", ul = 39053616}}
        value = {type = HASH_VALUE_UINT, {ptr = 0x3e8, i = 1000, ui = 1000, l = 1000, ul = 1000, 
            f = 1.40129846e-42, d = 4.9406564584124654e-321}}
        dbret = 1
        ret = 0
        uid = 1000
        __FUNCTION__ = "sbus_get_sender_id_done"
#12 0x00007fb4644929b2 in complete_pending_call_and_unlock () from /lib64/libdbus-1.so.3
No symbol table info available.
#13 0x00007fb464495e81 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3
No symbol table info available.
#14 0x00007fb4655ad32d in sbus_dispatch (ev=0x25204a0, te=0x2530e80, tv=..., data=0x2535590)
    at src/sbus/sssd_dbus_connection.c:96
        new_event = 0x2530e80
        conn = 0x2535590
        dbus_conn = 0x2535bc0
        ret = 0
        __FUNCTION__ = "sbus_dispatch"
#15 0x00007fb461a1806d in tevent_common_loop_timer_delay (ev=ev at entry=0x25204a0)
---Type <return> to continue, or q <return> to quit---
    at ../tevent_timed.c:341
        current_time = {tv_sec = 1431613794, tv_usec = 716629}
        te = 0x2530e80

(the rest if just tevent ...)



More information about the sssd-devel mailing list