On Thu, 2012-11-29 at 11:48 +0100, Pavel Březina wrote:
On 11/28/2012 05:24 AM, Simo Sorce wrote:
> In particular note that we merge ipa_account_info_netgroups_done()
> and ipa_account_info_users_done() into a single fucntion called
> ipa_account_info_done() that handles both cases
>
> We also remove the auxiliary function ipa_account_info_complete() that
> unnecessarily violates the tevent_req style and instead use a new function
> named ipa_account_info_error_text() to generate error text.
> ---
> src/providers/ipa/ipa_id.c | 128 ++++++++++++++++++-------------------------
> 1 files changed, 54 insertions(+), 74 deletions(-)
>
> diff --git a/src/providers/ipa/ipa_id.c b/src/providers/ipa/ipa_id.c
> index
953e089b7093bb3304ef8caf0c8145d67901a638..8e4309f865daec3a574ffdb486c2dda7225cc120 100644
> --- a/src/providers/ipa/ipa_id.c
> +++ b/src/providers/ipa/ipa_id.c
> @@ -30,23 +30,45 @@
> #include "providers/ldap/sdap_async.h"
> #include "providers/ipa/ipa_id.h"
>
> +static const char *ipa_account_info_error_text(int ret, int *dp_error,
> + const char *default_text)
> +{
> + switch (*dp_error) {
> + case DP_ERR_OK:
> + if (ret == EOK) {
> + return NULL;
> + }
> + DEBUG(SSSDBG_CRIT_FAILURE, ("Bug: dp_error is OK on failed
request"));
Missing \n.
> + *dp_error = DP_ERR_FATAL;
> + break;
> + case DP_ERR_OFFLINE:
> + return "Offline";
> + case DP_ERR_FATAL:
> + if (ret == ENOMEM) {
> + return "Out of memory";
> + }
> + break;
> + default:
> + break;
> + }
> +
> + return default_text;
> +}
Otherwise it's good. I like ipa_account_info_handler() as well :)
Attached just this patch with the requested fix.
Simo.
--
Simo Sorce * Red Hat, Inc * New York