[Pkg-wmaker-commits] [wmbiff] 03/11: bugfix to avoid problems with the new regex scheme and the default mailbox (aliasing sucks.)

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:03:02 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_14
in repository wmbiff.

commit 54fb80fd4e1a6733ca8a8f7ff701044a14509e43
Author: bluehal <bluehal>
Date:   Tue Jan 28 11:13:48 2003 +0000

    bugfix to avoid problems with the new regex scheme and the default mailbox (aliasing sucks.)
---
 wmbiff/Imap4Client.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/wmbiff/Imap4Client.c b/wmbiff/Imap4Client.c
index e63d775..2534f7a 100644
--- a/wmbiff/Imap4Client.c
+++ b/wmbiff/Imap4Client.c
@@ -322,6 +322,7 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
 		".*imaps?:([^: ]{1,32}) ([^ ]{1,32}) ([^/: ]+)(/(\"[^\"]+\")|([^: ]+))?( [0-9]+)? *",
 		NULL
 	};
+	char *unaliased_str;
 
 	struct regulo regulos[] = {
 		{1, PCU.userName, regulo_strcpy},
@@ -332,6 +333,7 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
 		{0, NULL, NULL}
 	};
 
+
 	/* IMAP4 format: imap:user:password at server/mailbox[:port] */
 	/* If 'str' line is badly formatted, wmbiff won't display the mailbox. */
 	if (strncmp("sslimap:", str, 8) == 0 || strncmp("imaps:", str, 6) == 0) {
@@ -358,26 +360,31 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
 
 	/* defaults */
 	PCU.serverPort = (PCU.dossl != 0) ? 993 : 143;
+
+	/* argh, str and pc->path are aliases, so we can't just write the default
+	   value into the string we're about to parse. */
+	unaliased_str = strdup(str);
 	strcpy(pc->path, "INBOX");
 
 	for (matchedchars = 0, i = 0;
 		 regexes[i] != NULL && matchedchars <= 0; i++) {
-		matchedchars = regulo_match(regexes[i], str, regulos);
+		matchedchars = regulo_match(regexes[i], unaliased_str, regulos);
 	}
 
 	/* failed to match either regex */
 	if (matchedchars <= 0) {
 		pc->label[0] = '\0';
-		IMAP_DM(pc, DEBUG_ERROR, "Couldn't parse line %s (%d)\n", str,
-				matchedchars);
+		IMAP_DM(pc, DEBUG_ERROR, "Couldn't parse line %s (%d)\n",
+				unaliased_str, matchedchars);
 		return -1;
 	}
 
 	if (PCU.password[0] == '\0')
 		PCU.interactive_password = 1;
 
-	grab_authList(str + matchedchars, PCU.authList);
+	grab_authList(unaliased_str + matchedchars, PCU.authList);
 
+	free(unaliased_str);
 
 	IMAP_DM(pc, DEBUG_INFO, "userName= '%s'\n", PCU.userName);
 	IMAP_DM(pc, DEBUG_INFO, "password is %d characters long\n",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list