On Mon, 2012-01-23 at 18:55 +0100, Pavel Březina wrote:
Dne 23.1.2012 18:31, Jakub Hrozek napsal(a):
> On Mon, Jan 23, 2012 at 04:54:10PM +0100, Pavel Březina wrote:
>> Dne 23.1.2012 11:29, Jakub Hrozek napsal(a):
>>> On Sun, Jan 22, 2012 at 08:14:21PM -0500, Stephen Gallagher wrote:
>>>> On Sun, 2012-01-22 at 22:08 +0100, Jakub Hrozek wrote:
>>>>> A number of new responders is currently being developed in addition
to
>>>>> the existing NSS and PAM responders that only deal with accounts.
The
>>>>> new responders often deal with different data such as automounter
maps
>>>>> or sudoer rules. It is prudent to let these responders communicate
with
>>>>> back ends using their own protocol.
>>>>>
>>>>> Attached is a patch that refactors the requests in Data Provider so
that
>>>>> they are more generic. The commits message is slightly more verbose
than
>>>>> usual this time to explain all the changes.
>>>>>
>>>>> I'm going to include a sudo request shortly as an example of a
new
>>>>> non-account request.
>>>>>
>>>>> [PATCH] DP: Refactor responder_dp_req so it's reusable by other
responders:
>>>>> * the internal requst is now more generic and is decoupled from
>>>>> account-specific data. There is a new sss_dp_issue_request()
wrapper
>>>>> that issues a BE request or registers a callback
>>>>> * the public requests all use struct sss_dp_req_state as the
tevent_req
>>>>> state data. This allows to report back data from the internal
request
>>>>> even if the caller is just a callback notifier
>>>>> * each specific request now uses an _info structure that contains
all
>>>>> the data necessary to construct a DBusMessage passed to provider
>>>>> * each specific request now defines a sss_dp_get_$data_msg callback
that
>>>>> is called from the sss_dp_issue_request() common wraper. The
purpose
>>>>> of the wrapper is to construct a DBusMessage and bind it to a
DBus
>>>>> method so the message can be just sent over to back end
>>>>>
>>>>> The miscellanous changes include:
>>>>> * change SSS_DP_ constants to an enum. This way, a switch() would
error
>>>>> if a value is not handled.
>>>>> * rename sss_dp_get_account_int_send() to
sss_dp_internal_get_send()
>>>>> request because the internal request is going to handle more than
just
>>>>> account data
>>>>>
>>>>> The patch must be applied on top of all Stephen's patches that
are
>>>>> currently on the list, including the services support.
>>>>
>>>> Nack.
>>>>
>>>> Just to remain consistent with the old approach, please start the enum
>>>> explicitly at 1.
>>>>
>>>
>>> Done.
>>
>> Nack.
>>
>> If you want the compiler to check that all enum are handled in
>> switch() you have to provide a properly typed variable.
>>
>> info->type has to be of type 'enum sss_dp_type'
>>
>> And we have to split this enum to two - one for accounts and one for sudo.
>>
>
> That's a great point.
>
> New patch is attached.
Ack.
Pushed to master.