Pass a CORBA_Environment to bonobo_config_get_string so it doesn't g_warn

* e-passwords.c (e_passwords_get_password): Pass a
	CORBA_Environment to bonobo_config_get_string so it doesn't g_warn
	on error. (Since the "error" is most likely just that the password
	isn't cached.)
	(e_passwords_remember_password, e_passwords_get_password,
	e_passwords_add_password): Change "if (foo) { entire function; }"
	to "if (!foo) return;"

	* e-html-utils.c (special_chars): Don't allow single quote or
	backtick in email addresses, or pipes following URLs.

svn path=/trunk/; revision=13887
This commit is contained in:
Dan Winship
2001-10-22 18:46:46 +00:00
parent 708dc70ac5
commit 44faa44bff
3 changed files with 82 additions and 64 deletions

View File

@ -40,21 +40,20 @@ check_size (char **buffer, int *buffer_size, char *out, int len)
return out;
}
/* 1 = non-email-address chars: ()<>@,;:\"[] */
/* 2 = trailing garbage: ,.!?;:>)]}`'-_ */
/* 1 = non-email-address chars: ()<>@,;:\"[]`'| */
/* 2 = trailing url garbage: ,.!?;:>)]}`'-_| */
static int special_chars[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* nul - 0x0f */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */
1, 2, 1, 0, 0, 0, 0, 2, 1, 3, 0, 0, 3, 2, 2, 0, /* sp - / */
1, 2, 1, 0, 0, 0, 0, 3, 1, 3, 0, 0, 3, 2, 2, 0, /* sp - / */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 1, 0, 3, 2, /* 0 - ? */
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ - O */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 0, 2, /* P - _ */
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ` - o */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 /* p - del */
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ` - o */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0 /* p - del */
};
#define is_addr_char(c) (isprint (c) && !(special_chars[c] & 1))
#define is_addr_char_no_pipes(c) (is_addr_char(c) && (c) != '|')
#define is_trailing_garbage(c) (!isprint(c) || (special_chars[c] & 2))
static char *
@ -89,13 +88,13 @@ email_address_extract (const unsigned char **cur, char **out, const unsigned cha
char *addr;
/* *cur points to the '@'. Look backward for a valid local-part */
for (start = *cur; start - 1 >= linestart && is_addr_char_no_pipes (*(start - 1)); start--)
for (start = *cur; start - 1 >= linestart && is_addr_char (*(start - 1)); start--)
;
if (start == *cur)
return NULL;
/* Now look forward for a valid domain part */
for (end = *cur + 1, dot = NULL; is_addr_char_no_pipes (*end); end++) {
for (end = *cur + 1, dot = NULL; is_addr_char (*end); end++) {
if (*end == '.' && !dot)
dot = end;
}