[SSSD] [PATCH] Add callback when the ID provider switches from offline to online

Sumit Bose sbose at redhat.com
Wed Apr 28 10:04:50 UTC 2010


On Tue, Apr 27, 2010 at 03:37:02PM -0400, Stephen Gallagher wrote:
> Allow backends to set a callback in the be_ctx that should be
> invoked when the ID provider goes online.
> 
> This can be used to perform regular maintenance tasks that are
> valid only when going online.
> 
> Specifically, we can use this to perform a deferred kinit on behalf
> of the user when we go online. We can also use this to trigger a
> dynamic DNS update for the IPA provider.
> 
> -- 
> Stephen Gallagher
> RHCE 804006346421761
> 
> Delivering value year after year.
> Red Hat ranks #1 in value among software vendors.
> http://www.redhat.com/promo/vendor/

>      }
>  
> +    /* Reconnection succeeded
> +     * Run any post-connection routines
> +     */
> +    if (state->be->online_cb_list) {
> +        DLIST_FOR_EACH(callback, state->be->online_cb_list) {
> +            ret = callback->cb(callback->pvt);
> +            if (ret != EOK) {
> +                DEBUG(0, ("Post-connection callback returned [%d][%s]",
> +                          ret, strerror(ret)));
> +                tevent_req_error(req, ret);
> +                break;
> +            }
> +        }
> +    }
> +

I have several comments here:
- I would suggest to move this loop into a separate subroutine like
  be_run_online_cb()
- Maybe it would make sense to call the callbacks with a timer event to
  make sure that they do not block the current request or other
  callbacks
- Currently the callbacks are run on every reconnect which might be
  intended, but is IMO different from running after the transition from
  offline to online. E.g. with GSSAPI we need to reconnect if the ticket
  becomes invalid although we haven't been offline. To catch only the
  offline-online transition I would suggest to add a run_online_cb flag
  which is set by be_mark_offline() and checked and unset by the
  proposed be_run_online_cb(). If the callbacks should be run after
  every successful connection it would be better to replace
  '*online_cb*' by something like '*connect_cb*'.
- Is it intended that only the id provider is running the callbacks?

bye,
Sumit

> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/sssd-devel




More information about the sssd-devel mailing list