Blob Blame History Raw
diff -up sudo-1.8.6p7/plugins/sudoers/match.c.digestmessagesfix sudo-1.8.6p7/plugins/sudoers/match.c
--- sudo-1.8.6p7/plugins/sudoers/match.c.digestmessagesfix	2015-09-01 15:33:27.493054381 +0200
+++ sudo-1.8.6p7/plugins/sudoers/match.c	2015-09-01 15:33:31.327054279 +0200
@@ -566,6 +566,21 @@ base64_decode(const char *in, unsigned c
   return io;
 }
 
+static const char *digesttype2str(int digest_type)
+{
+  switch(digest_type) {
+    case SUDO_DIGEST_SHA224:
+      return "SHA224";
+    case SUDO_DIGEST_SHA256:
+      return "SHA256";
+    case SUDO_DIGEST_SHA384:
+      return "SHA384";
+    case SUDO_DIGEST_SHA512:
+      return "SHA512";
+  }
+  return "<INVALID>";
+}
+
 static bool
 digest_matches(char *file, struct sudo_digest *sd)
 {
@@ -597,7 +612,7 @@ digest_matches(char *file, struct sudo_d
 	if (!isxdigit((unsigned char)sd->digest_str[i + i]) ||
 	    !isxdigit((unsigned char)sd->digest_str[i + i + 1])) {
 	  warningx(_("digest for %s (%s) is not in %s form"), file,
-		   sd->digest_str, sd->digest_str);
+		   sd->digest_str, digesttype2str(sd->digest_type));
 	  goto bad_format;
 	}
 	sudoers_digest[i] = hexchar(&sd->digest_str[i + i]);
@@ -619,7 +634,7 @@ digest_matches(char *file, struct sudo_d
     debug_return_bool(match);
  bad_format:
     warningx(_("digest for %s (%s) is not in %s form"), file,
-	     sd->digest_str, sd->digest_str);
+	     sd->digest_str, digesttype2str(sd->digest_type));
     if (sudoers_digest)
       efree(sudoers_digest);
     if (file_digest)