[SSSD] [PATCHES] DEBUG: Add missing strings for error messages

Michal Židek mzidek at redhat.com
Thu Mar 12 14:39:51 UTC 2015


On 03/10/2015 08:56 PM, Lukas Slebodnik wrote:
> On (10/03/15 20:23), Michal Židek wrote:
>> Hi,
>>
>> we had more custom SSSD error codes than error
>> messages. Also order of messages was not correct
>> in one case. The attached patch fixes this.
>>
>> The second patch adds simple unit test to check
>> if the number of error codes and error messages
>> is the same.
>>
>> See attached patch.
>>
>> Thanks,
>> Michal
>
>>From bfffb612b1bba2824628ff59a799b14fad195a2a Mon Sep 17 00:00:00 2001
>> From: Michal Zidek <mzidek at redhat.com>
>> Date: Tue, 10 Mar 2015 17:30:48 +0100
>> Subject: [PATCH 1/2] DEBUG: Add missing strings for error messages
>>
>> We had more error codes than corresponding
>> messages. Also order of two messages was
>> wrong.
>> ---
>> src/util/util_errors.c | 3 +++
>> src/util/util_errors.h | 2 +-
>> 2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/util/util_errors.c b/src/util/util_errors.c
>> index 27d9ecc..5ce64a1 100644
>> --- a/src/util/util_errors.c
>> +++ b/src/util/util_errors.c
>> @@ -42,6 +42,9 @@ struct err_string error_to_str[] = {
>>      { "Network I/O Error" }, /* ERR_NETWORK_IO */
>>      { "Account Expired" }, /* ERR_ACCOUNT_EXPIRED */
>>      { "Password Expired" }, /* ERR_PASSWORD_EXPIRED */
>> +    { "Password Expired (reject access)" }, /* ERR_PASSWORD_EXPIRED_REJECT */
>> +    { "Password Expired (warn user)" }, /* ERR_PASSWORD_EXPIRED_WARN */
>> +    { "Password Expired (ask for new password)" }, /* ERR_PASSWORD_EXPIRED_RENEW */
>>      { "Host Access Denied" }, /* ERR_ACCESS_DENIED */
>>      { "SRV record not found" }, /* ERR_SRV_NOT_FOUND */
>>      { "SRV lookup error" }, /* ERR_SRV_LOOKUP_ERROR */
>> diff --git a/src/util/util_errors.h b/src/util/util_errors.h
>> index de0ed35..36d0098 100644
>> --- a/src/util/util_errors.h
>> +++ b/src/util/util_errors.h
>> @@ -53,10 +53,10 @@ enum sssd_errors {
>>      ERR_INVALID_CRED_TYPE,
>>      ERR_NO_CREDS,
>>      ERR_CREDS_EXPIRED,
>> +    ERR_CREDS_EXPIRED_CCACHE,
>>      ERR_CREDS_INVALID,
>>      ERR_NO_CACHED_CREDS,
>>      ERR_CACHED_CREDS_EXPIRED,
>> -    ERR_CREDS_EXPIRED_CCACHE,
>>      ERR_AUTH_DENIED,
>>      ERR_AUTH_FAILED,
>>      ERR_CHPASS_DENIED,
>> --
>> 2.1.0
>>
>
>>From 8144ea9404be5d87130450e5aa841f6840bc8fa1 Mon Sep 17 00:00:00 2001
>> From: Michal Zidek <mzidek at redhat.com>
>> Date: Tue, 10 Mar 2015 18:38:10 +0100
>> Subject: [PATCH 2/2] test: Check ERR_LAST
>>
>> Check if number of error codes and messages is the same.
>> ---
>> src/tests/util-tests.c | 14 ++++++++++++++
>> src/util/util_errors.c |  1 +
>> src/util/util_errors.h |  2 +-
>> 3 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
>> index 3829b21..dc0690c 100644
>> --- a/src/tests/util-tests.c
>> +++ b/src/tests/util-tests.c
>> @@ -1070,6 +1070,16 @@ START_TEST(test_convert_time)
>> }
>> END_TEST
>>
>> +START_TEST(test_sss_strerror_err_last)
>> +{
>> +    int ret;
>> +
>> +    ret = strcmp("ERR_LAST", sss_strerror(ERR_LAST));
>> +    fail_unless(ret == 0);
> Could you use macro ck_assert_str_eq from check.h for string comparision?
> It would print verose assertion rather then "ret != 0"
>
> LS

Goog idea. New patch attached.

Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-DEBUG-Add-missing-strings-for-error-messages.patch
Type: text/x-patch
Size: 1676 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20150312/b159e5cd/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-test-Check-ERR_LAST.patch
Type: text/x-patch
Size: 2322 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20150312/b159e5cd/attachment-0001.bin>


More information about the sssd-devel mailing list