Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Dec 2011 20:53:06 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228662 - head/usr.sbin/keyserv
Message-ID:  <201112172053.pBHKr6wr076291@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sat Dec 17 20:53:06 2011
New Revision: 228662
URL: http://svn.freebsd.org/changeset/base/228662

Log:
  In usr.sbin/keyserv, fix some implicit enum conversions, and use the
  correct printf length modifiers for uid_t.
  
  MFC after:	1 week

Modified:
  head/usr.sbin/keyserv/crypt_server.c
  head/usr.sbin/keyserv/keyserv.c

Modified: head/usr.sbin/keyserv/crypt_server.c
==============================================================================
--- head/usr.sbin/keyserv/crypt_server.c	Sat Dec 17 20:25:23 2011	(r228661)
+++ head/usr.sbin/keyserv/crypt_server.c	Sat Dec 17 20:53:06 2011	(r228662)
@@ -223,8 +223,8 @@ des_crypt_1_svc(desargs *argp, struct sv
 
 	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

Modified: head/usr.sbin/keyserv/keyserv.c
==============================================================================
--- head/usr.sbin/keyserv/keyserv.c	Sat Dec 17 20:25:23 2011	(r228661)
+++ head/usr.sbin/keyserv/keyserv.c	Sat Dec 17 20:53:06 2011	(r228662)
@@ -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);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112172053.pBHKr6wr076291>