kuser: Fix coverity issues

This commit is contained in:
Nicolas Williams
2022-01-20 13:28:39 -06:00
parent be6305b601
commit 62176f07d9
3 changed files with 6 additions and 5 deletions

View File

@@ -166,12 +166,13 @@ create_krb5_tickets(krb5_context context, krb5_keytab kt)
ret = krb5_copy_principal(context, client_principal, &cred.client);
if (ret == 0)
ret = krb5_copy_principal(context, server_principal, &cred.server);
if (ret)
krb5_err(context, 1, ret, "krb5_copy_principal");
ret = krb5_copy_principal(context, server_principal, &cred.server);
ret = krb5_generate_random_keyblock(context, session_etype, &cred.session);
if (ret)
krb5_err(context, 1, ret, "krb5_copy_principal");
krb5_generate_random_keyblock(context, session_etype, &cred.session);
krb5_err(context, 1, ret, "krb5_generate_random_keyblock");
cred.times.authtime = time(NULL);
cred.times.starttime = time(NULL);

View File

@@ -502,7 +502,7 @@ renew_validate(krb5_context context,
* no need to check the error here, it's only to be
* friendly to the user
*/
krb5_get_credentials(context, KRB5_GC_CACHED, cache, &in, &out);
(void) krb5_get_credentials(context, KRB5_GC_CACHED, cache, &in, &out);
}
flags.i = 0;

View File

@@ -553,7 +553,7 @@ list_caches(krb5_context context, struct klist_options *opt)
if (opt->json_flag)
rtbl_set_flags(ct, RTBL_JSON);
while (krb5_cccol_cursor_next(context, cursor, &id) == 0) {
while (krb5_cccol_cursor_next(context, cursor, &id) == 0 && id != NULL) {
int expired = 0;
char *name;
time_t t;