From 09bf3ebb26a3d8a4bd10571b394a59207a7f6980 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 1 Aug 2015 05:52:59 -0400 Subject: [PATCH] src/kauth/krb_udp.c: Remove redundant NULL check for array address Resolves this warning with clang: krb_udp.c:302:13: warning: address of array 'tentry.misc_auth_bytes' will always evaluate to 'true' [-Wpointer-bool-conversion] if (tentry.misc_auth_bytes) { ~~ ~~~~~~~^~~~~~~~~~~~~~~ Change-Id: I0656b055090654eada2cd63476330fb288490acc Reviewed-on: http://gerrit.openafs.org/11964 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/kauth/krb_udp.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/kauth/krb_udp.c b/src/kauth/krb_udp.c index 88a37a079..d3e670eee 100644 --- a/src/kauth/krb_udp.c +++ b/src/kauth/krb_udp.c @@ -274,6 +274,11 @@ UDP_Authenticate(int ksoc, struct sockaddr_in *client, char *name, if (to) { /* if user exists check other stuff */ afs_int32 sto; struct kaentry sentry; + + unsigned char misc_auth_bytes[4]; + afs_uint32 temp; /* unsigned for safety */ + afs_uint32 pwexpires; + save_principal(udpAuthPrincipal, name, inst, 0); tgt = ((strcmp(sname, KA_TGS_NAME) == 0) @@ -299,23 +304,17 @@ UDP_Authenticate(int ksoc, struct sockaddr_in *client, char *name, goto abort; } - if (tentry.misc_auth_bytes) { - unsigned char misc_auth_bytes[4]; - afs_uint32 temp; /* unsigned for safety */ - afs_uint32 pwexpires; - - memcpy(&temp, tentry.misc_auth_bytes, sizeof(afs_uint32)); - temp = ntohl(temp); - unpack_long(temp, misc_auth_bytes); - pwexpires = misc_auth_bytes[0]; - if (pwexpires) { - pwexpires = - ntohl(tentry.change_password_time) + - 24 * 60 * 60 * pwexpires; - if (pwexpires < now) { - code = KERB_ERR_AUTH_EXP; /* was KAPWEXPIRED */ - goto abort; - } + memcpy(&temp, tentry.misc_auth_bytes, sizeof(afs_uint32)); + temp = ntohl(temp); + unpack_long(temp, misc_auth_bytes); + pwexpires = misc_auth_bytes[0]; + if (pwexpires) { + pwexpires = + ntohl(tentry.change_password_time) + + 24 * 60 * 60 * pwexpires; + if (pwexpires < now) { + code = KERB_ERR_AUTH_EXP; /* was KAPWEXPIRED */ + goto abort; } } -- 2.39.5