Poldi bug report: quieter, better prompts

Lionel Elie Mamane lionel at mamane.lu
Thu Jul 30 19:46:27 CEST 2009


Poldi is quite chatty in the PAM conversation, even when not in debug
mode. This patch cuts on that. It is mainly justified by the fact that
xscreensaver requires a positive user action (click "OK" button) for
every conv_tell, so I don't what any more than necessary / useful.

I've also tweaked the prompts I left in non-debug mode, and inserted
some helpful-for-the-user error messages in the PAM dialog.

--- poldi-0.4.1.orig/src/pam/pam_poldi.c
+++ poldi-0.4.1/src/pam/pam_poldi.c
@@ -480,12 +480,12 @@
     {
       if (ctx->debug)
 	log_msg_debug (ctx->loghandle, _("Waiting for card for user `%s'..."), pam_username);
-      conv_tell (ctx->conv, _("Waiting for card for user `%s'..."), pam_username);
+      conv_tell (ctx->conv, _("Insert authentication card for user `%s'"), pam_username);
     }
   else
     {
       if (ctx->debug)
 	log_msg_debug (ctx->loghandle, _("Waiting for card..."));
-      conv_tell (ctx->conv, _("Waiting for card..."));
+      conv_tell (ctx->conv, _("Insert authentication card"));
     }
 
--- poldi-0.4.1.orig/src/pam/auth-method-localdb/auth-localdb.c
+++ poldi-0.4.1/src/pam/auth-method-localdb/auth-localdb.c
@@ -117,10 +117,12 @@
     username = username_desired;
 
   if (ctx->debug)
-    log_msg_debug (ctx->conv,
-		   _("Trying authentication as user `%s'..."), username);
-  conv_tell (ctx->conv,
-	     _("Trying authentication as user `%s'..."), username);
+    {
+      log_msg_debug (ctx->conv,
+		     _("Trying authentication as user `%s'..."), username);
+      conv_tell (ctx->conv,
+		 _("Trying authentication as user `%s'..."), username);
+    }
 
   /* Verify (again) that the given account is associated with the
      serial number.  */
@@ -128,12 +130,14 @@
   if (err)
     {
       if (ctx->debug)
-	log_msg_debug (ctx->loghandle,
-		       _("Serial number %s is not associated with user %s"),
-		       ctx->cardinfo.serialno, username);
-      conv_tell (ctx->conv,
-		 _("Serial number %s is not associated with user %s"),
-		 ctx->cardinfo.serialno, username);
+	{
+	  log_msg_debug (ctx->loghandle,
+			 _("Serial number %s is not associated with user %s"),
+			 ctx->cardinfo.serialno, username);
+	  conv_tell (ctx->conv,
+		     _("Serial number %s is not associated with user %s"),
+		     ctx->cardinfo.serialno, username);
+	}
       err = gcry_error (GPG_ERR_INV_NAME);
       goto out;
     }
--- poldi-0.4.1.orig/src/pam/auth-support/getpin-cb.c
+++ poldi-0.4.1/src/pam/auth-support/getpin-cb.c
@@ -81,9 +81,12 @@
 	 Shouldn't they be done in scdaemon itself?  -mo */
 
       if (strlen (buffer) < 6)	/* FIXME? is it really minimum of 6 bytes? */
-	log_msg_error (ctx->loghandle, _("invalid PIN"));
+	{
+	  log_msg_error (ctx->loghandle, _("PIN too short"));
+	  conv_tell(ctx->conv, "%s", _("PIN too short"));
+	}
       else if (!all_digitsp (buffer))
 	log_msg_error (ctx->loghandle, _("invalid characters in PIN"));
       else
 	break;
     }
@@ -235,7 +241,7 @@
 	err = query_user (ctx, info_frobbed, buf, maxbuf);
       else
 	/* Use string which is more user friendly. */
-	err = query_user (ctx, _("||Please enter the PIN"), buf, maxbuf);
+	err = query_user (ctx, _("Please enter the PIN: "), buf, maxbuf);
     }
   else
     {
@@ -254,7 +260,7 @@
 	  if (info_frobbed)
 	    err = keypad_mode_enter (ctx, info_frobbed);
 	  else
-	    err = keypad_mode_enter (ctx, _("||Please enter the PIN"));
+	    err = keypad_mode_enter (ctx, _("Please enter the PIN: "));
 	}
       else
         err = gpg_error (GPG_ERR_INV_VALUE); /* FIXME: must signal


-- 
Lionel



More information about the Gnupg-devel mailing list