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) {
        ~~  ~~~~~~~^~~~~~~~~~~~~~~

Reviewed-on: http://gerrit.openafs.org/11964
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 09bf3ebb26a3d8a4bd10571b394a59207a7f6980)

Change-Id: I94850d438902c358239142d696fae7206cef55a6
Reviewed-on: http://gerrit.openafs.org/12077
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Anders Kaseorg 2015-08-01 05:52:59 -04:00 committed by Stephan Wiesand
parent 9ef3a6ae65
commit b6294fd5f4

View File

@ -277,6 +277,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)
@ -302,23 +307,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;
}
}