File vpnc-fix-wrong-exit-code-on-authentication-fail.patch of Package vpnc.4374

Index: vpnc/vpnc.c
===================================================================
--- vpnc.orig/vpnc.c
+++ vpnc/vpnc.c
@@ -890,7 +890,10 @@ static void phase2_fatal(struct sa_block
 
 	send_delete_isakmp(s);
 
-	error(1, 0, msg, val_to_string(id, isakmp_notify_enum_array), id);
+	if (id == ISAKMP_N_AUTHENTICATION_FAILED)
+		error(2, 0, msg);
+	else
+		error(1, 0, msg, val_to_string(id, isakmp_notify_enum_array), id);
 }
 
 static uint8_t *gen_keymat(struct sa_block *s,
@@ -2461,8 +2464,9 @@ static int do_phase2_xauth(struct sa_blo
 			case ISAKMP_XAUTH_02_ATTRIB_NEXT_PIN:
 				if (passwd_used && config[CONFIG_NON_INTERACTIVE]) {
 					reject = ISAKMP_N_AUTHENTICATION_FAILED;
-					phase2_fatal(s, "noninteractive can't reuse password", reject);
-					error(2, 0, "authentication failed (requires interactive mode)");
+					phase2_fatal(s, "noninteractive can't reuse password\n"
+							"authentication failed (requires interactive mode)",
+							reject);
 				} else if (seen_answer || passwd_used || config[CONFIG_XAUTH_INTERACTIVE]) {
 					char *pass, *prompt = NULL;
 
openSUSE Build Service is sponsored by