Package: irssi-plugin-xmpp / 0.53-1~bpo8+1

singpolyma-0106-Cleanup-password-handling.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 411f4f07b7283b70e8f54939c8eeb19223571b3b Mon Sep 17 00:00:00 2001
From: Stephen Paul Weber <singpolyma@singpolyma.net>
Date: Wed, 18 Mar 2015 10:47:16 -0500
Subject: [PATCH 06/10] Cleanup password handling

---
 src/core/tools.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/core/tools.c b/src/core/tools.c
index 510de99..7628162 100644
--- a/src/core/tools.c
+++ b/src/core/tools.c
@@ -43,14 +43,15 @@ char *call_gpg_round(char *switches, char *input, char *input2, \
 	size_t output_size = 0;
 	char buf[100], buf2[100] = "";
 	const char *keyid = settings_get_str("xmpp_pgp");
+	int send_password = keyid && !settings_get_str("xmpp_pgp_agent");
 
 	/* If no keyID, then we don't need a password */
-	if(keyid && !settings_get_str("xmpp_pgp_agent")) {
+	if(send_password) {
 		if(pipe(pipefd)) goto pgp_error;
 		if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:");
 		if(!pgp_passwd) goto pgp_error;
 
-		if(write(pipefd[1], pgp_passwd, strlen(pgp_passwd)) < 1) goto pgp_error;
+		if(write(pipefd[1], pgp_passwd, strlen(pgp_passwd)) < 0) goto pgp_error;
 		if(close(pipefd[1])) goto pgp_error;
 	}
 
@@ -136,7 +137,7 @@ char *call_gpg_round(char *switches, char *input, char *input2, \
 
 done:
 	if(tmp2_fd)   close(tmp2_fd);
-	if(keyid)     close(pipefd[0]);
+	if(send_password)  close(pipefd[0]);
 	free(cmd);
 
 	return output;
-- 
2.1.4