Bug#433888: bug-buddy: refuses email addresses that are valid per RFC 3696
Ben Finney
ben+debian at benfinney.id.au
Fri Jul 20 05:51:00 UTC 2007
Package: bug-buddy
Version: 2.18.1-2+b1
Severity: normal
Tags: patch
When the 'bug-buddy' dialogue asks for an email address to use for the
bug report's From field, the "Send" button is unavailable until the
specified email address is validated. The checking done by the
'check_email' function is too strict, and incorrectly rejects many
addresses that are valid.
The attached patch modifies the checks to be more in line with the
recommendations in RFC 3696, "Application Techniques for Checking and
Transformation of Names" section 3, "Restrictions on email addresses".
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.21-2-powerpc
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_AU.UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages bug-buddy depends on:
ii gconf2 2.18.0.1-3 GNOME configuration database syste
ii gdb 6.4.90.dfsg-1 The GNU Debugger
ii libbonobo2-0 2.18.0-2 Bonobo CORBA interfaces library
ii libc6 2.6-2 GNU C Library: Shared libraries
ii libebook1.2-9 1.10.2-2+b1 Client library for evolution addre
ii libgconf2-4 2.18.0.1-3 GNOME configuration database syste
ii libglade2-0 1:2.6.1-1 library to load .glade files at ru
ii libglib2.0-0 2.12.12-1+b1 The GLib library of C routines
ii libgnome-menu2 2.18.3-1 an implementation of the freedeskt
ii libgnome2-0 2.18.0-4 The GNOME 2 library - runtime file
ii libgnomeui-0 2.18.1-2 The GNOME 2 libraries (User Interf
ii libgnomevfs2-0 1:2.18.1-2 GNOME Virtual File System (runtime
ii libgtk2.0-0 2.10.13-1 The GTK+ graphical user interface
ii libgtop2-7 2.14.9-1 gtop system monitoring library
ii liborbit2 1:2.14.7-0.1 libraries for ORBit2 - a CORBA ORB
ii libsoup2.2-8 2.2.100-1 an HTTP library implementation in
ii libxml2 2.6.29.dfsg-1 GNOME XML library
ii scrollkeeper 0.3.14-13 A free electronic cataloging syste
bug-buddy recommends no packages.
-- no debconf information
--
\ "Pinky, are you pondering what I'm pondering?" "I think so, |
`\ Brain, but culottes have a tendency to ride up so." -- _Pinky |
_o__) and The Brain_ |
Ben Finney <ben at benfinney.id.au>
-------------- next part --------------
diff -ruN bug-buddy-2.18.1/src/bug-buddy.c bug-buddy-2.18.1-email-rfc3696/src/bug-buddy.c
--- bug-buddy-2.18.1/src/bug-buddy.c 2007-02-19 04:25:18.000000000 +1100
+++ bug-buddy-2.18.1-email-rfc3696/src/bug-buddy.c 2007-07-19 15:15:49.000000000 +1000
@@ -825,12 +825,9 @@
return FALSE;
for (character = local_part; *character; character++) {
- /* If character is alphanumeric it is valid. */
- if (g_ascii_isalnum (*character))
- continue;
-
- /* If character is "-", "_" or "." it is valid. */
- if (*character == '-' || *character == '_' || *character == '.')
+ /* RFC 3696 says *any* printable ASCII character can
+ * appear in local-part, subject to quoting rules. */
+ if (g_ascii_isprint (*character))
continue;
/* Not valid character, not valid local part. */
@@ -905,21 +902,30 @@
{
char *local_part;
char *domain;
- char **parts;
+ char *address_reversed;
+ char **parts_reversed;
gboolean is_valid;
- parts = g_strsplit (address, "@", 2);
+ /* Split on the *last* '@' character:
+ * First reverse the address, then split, then reverse each
+ * part back to normal */
+ address_reversed = g_strreverse (address);
+ parts_reversed = g_strsplit (address_reversed, "@", 2);
+ domain = g_strreverse (parts_reversed[0]);
+ local_part = g_strreverse (parts_reversed[1]);
+ g_strfreev (parts_reversed);
+ g_strfreev (address_reversed);
/* Check we have the 2 parts */
- if (!(local_part = parts[0]) || !(domain = parts[1])) {
- g_strfreev (parts);
- return FALSE;
+ if (!(local_part) || !(domain)) {
+ /* We don't have both parts, address can't be valid */
+ is_valid = FALSE;
+ } else {
+ /* Check each part is valid */
+ is_valid = email_local_part_is_valid (local_part)
+ && email_domain_is_valid (domain);
}
- is_valid = email_local_part_is_valid (local_part)
- && email_domain_is_valid (domain);
-
- g_strfreev (parts);
return is_valid;
}
More information about the pkg-gnome-maintainers
mailing list