Index: lib/ipmi_main.c
===================================================================
RCS file: /cvsroot/ipmitool/ipmitool/lib/ipmi_main.c,v
retrieving revision 1.38
diff -u -r1.38 ipmi_main.c
--- lib/ipmi_main.c	11 Jan 2013 11:21:26 -0000	1.38
+++ lib/ipmi_main.c	12 Jan 2013 05:28:18 -0000
@@ -357,6 +357,8 @@
 {
 	struct ipmi_intf_support * sup;
 	int privlvl = 0;
+	uint8_t kgkey_asked = 0;
+	uint8_t password_asked = 0;
 	uint8_t target_addr = 0;
 	uint8_t target_channel = 0;
 
@@ -493,6 +495,8 @@
 						"from file %s", optarg);
 			break;
 		case 'a':
+			if (password_asked)
+				break;
 #ifdef HAVE_GETPASSPHRASE
 			tmp_pass = getpassphrase("Password: ");
 #else
@@ -503,6 +507,7 @@
 					free(password);
 				password = strdup(tmp_pass);
 				free(tmp_pass);
+				password_asked = 1;
 				if (password == NULL) {
 					lprintf(LOG_ERR, "%s: malloc failure", progname);
 					goto out_free;
@@ -540,6 +545,8 @@
 			}
 			break;
 		case 'Y':
+			if (kgkey_asked)
+				break;
 #ifdef HAVE_GETPASSPHRASE
 			tmp_pass = getpassphrase("Key: ");
 #else
@@ -550,6 +557,7 @@
 					free(kgkey);
 				kgkey = strdup(tmp_pass);
 				free(tmp_pass);
+				kgkey_asked = 1;
 				if (kgkey == NULL) {
 					lprintf(LOG_ERR, "%s: malloc failure", progname);
 					goto out_free;
