From 376711b828bc4a69825b73615ce5aeb5f4905eb4 Mon Sep 17 00:00:00 2001 From: dim Date: Sat, 17 Dec 2011 20:53:06 +0000 Subject: [PATCH] In usr.sbin/keyserv, fix some implicit enum conversions, and use the correct printf length modifiers for uid_t. MFC after: 1 week --- usr.sbin/keyserv/crypt_server.c | 4 ++-- usr.sbin/keyserv/keyserv.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/usr.sbin/keyserv/crypt_server.c b/usr.sbin/keyserv/crypt_server.c index 45f6f6e9de78..b4c60363fe42 100644 --- a/usr.sbin/keyserv/crypt_server.c +++ b/usr.sbin/keyserv/crypt_server.c @@ -223,8 +223,8 @@ des_crypt_1_svc(desargs *argp, struct svc_req *rqstp) bcopy(argp->des_key, dparm.des_key, 8); bcopy(argp->des_ivec, dparm.des_ivec, 8); - dparm.des_mode = argp->des_mode; - dparm.des_dir = argp->des_dir; + dparm.des_mode = (argp->des_mode == CBC_DES) ? CBC : ECB; + dparm.des_dir = (argp->des_dir == ENCRYPT_DES) ? ENCRYPT : DECRYPT; #ifdef BROKEN_DES dparm.UDES.UDES_buf = argp->desbuf.desbuf_val; #endif diff --git a/usr.sbin/keyserv/keyserv.c b/usr.sbin/keyserv/keyserv.c index 04e4972e483c..2366ba07fe27 100644 --- a/usr.sbin/keyserv/keyserv.c +++ b/usr.sbin/keyserv/keyserv.c @@ -361,7 +361,7 @@ key_set_1_svc_prog(uid, key) static keystatus status; if (debugging) { - (void) fprintf(stderr, "set(%ld, %.*s) = ", uid, + (void) fprintf(stderr, "set(%u, %.*s) = ", uid, (int) sizeof (keybuf), key); } status = pk_setkey(uid, key); @@ -380,7 +380,7 @@ key_encrypt_pk_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "encrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "encrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -408,7 +408,7 @@ key_decrypt_pk_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "decrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "decrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -460,7 +460,7 @@ key_net_get_2_svc_prog(uid, arg) static key_netstres keynetname; if (debugging) - (void) fprintf(stderr, "net_get(%ld) = ", uid); + (void) fprintf(stderr, "net_get(%u) = ", uid); keynetname.status = pk_netget(uid, &keynetname.key_netstres_u.knet); if (debugging) { @@ -489,8 +489,8 @@ key_get_conv_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) - (void) fprintf(stderr, "get_conv(%ld, %.*s) = ", uid, - (int)sizeof (arg), arg); + (void) fprintf(stderr, "get_conv(%u, %.*s) = ", uid, + (int)sizeof (keybuf), arg); res.status = pk_get_conv_key(uid, arg, &res); @@ -517,7 +517,7 @@ key_encrypt_1_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "encrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "encrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -545,7 +545,7 @@ key_decrypt_1_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "decrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "decrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -789,7 +789,7 @@ root_auth(trans, rqstp) } if (debugging) - fprintf(stderr, "local_uid %ld\n", uid); + fprintf(stderr, "local_uid %u\n", uid); if (uid == 0) return (1); if (rqstp->rq_cred.oa_flavor == AUTH_SYS) { @@ -800,7 +800,7 @@ root_auth(trans, rqstp) } else { if (debugging) fprintf(stderr, - "local_uid %ld mismatches auth %ld\n", uid, + "local_uid %u mismatches auth %u\n", uid, ((uid_t) ((struct authunix_parms *)rqstp->rq_clntcred)->aup_uid)); return (0); }