From 0e34177ee3d1065114212d9d43fec4e13def8abc Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 9 Jan 2010 12:01:38 +0100 Subject: [PATCH] ud-useradd: Properly encode realname in subjects and to header lines regardless of which template is being used --- debian/changelog | 4 +++- templates/welcome-message | 4 ++-- templates/welcome-message-60000 | 4 ++-- templates/welcome-message-800 | 4 ++-- ud-useradd | 16 ++++------------ 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/debian/changelog b/debian/changelog index a73095c..d08eb5a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,8 +13,10 @@ userdir-ldap (0.3.76xXx) unstable; urgency=low by ud-ldap. (defaults to true.) * Fix welcome-message to be like welcome-message-800 and 60000 wrt email headers + * ud-useradd: Properly encode realname in subjects and to header lines + regardless of which template is being used. - -- Peter Palfrader Sat, 09 Jan 2010 02:10:02 +0100 + -- Peter Palfrader Sat, 09 Jan 2010 11:58:30 +0100 userdir-ldap (0.3.75) unstable; urgency=low diff --git a/templates/welcome-message b/templates/welcome-message index 017528e..fbf25aa 100644 --- a/templates/welcome-message +++ b/templates/welcome-message @@ -1,9 +1,9 @@ -To: "__REALNAME__" <__EMAIL__> +To: "__ENCODED_REALNAME__" <__EMAIL__> From: __WHOAMI__ MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit -Subject: __HEADER_SUBJ__ +Subject: New ud-ldap account for __ENCODED_REALNAME__ Cc: new-maintainer@debian.org Reply-To: new-maintainer@debian.org Date: __DATE__ diff --git a/templates/welcome-message-60000 b/templates/welcome-message-60000 index dbc377f..e056189 100644 --- a/templates/welcome-message-60000 +++ b/templates/welcome-message-60000 @@ -1,8 +1,8 @@ -To: "__REALNAME__" <__EMAIL__> +To: "__ENCODED_REALNAME__" <__EMAIL__> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit -Subject: Debian Guest Account for __REALNAME__ +Subject: Debian Guest Account for __ENCODED_REALNAME__ Cc: debian-admin@lists.debian.org Reply-To: debian-admin@lists.debian.org Date: __DATE__ diff --git a/templates/welcome-message-800 b/templates/welcome-message-800 index d9e7f2d..347ad5f 100644 --- a/templates/welcome-message-800 +++ b/templates/welcome-message-800 @@ -1,9 +1,9 @@ -To: "__REALNAME__" <__EMAIL__> +To: "__ENCODED_REALNAME__" <__EMAIL__> From: __WHOAMI__ MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit -Subject: New Debian developer __REALNAME__ +Subject: New Debian developer __ENCODED_REALNAME__ Cc: da-manager@debian.org, debian-admin@debian.org Reply-To: da-manager@debian.org Date: __DATE__ diff --git a/ud-useradd b/ud-useradd index 243443f..3b3e3a8 100755 --- a/ud-useradd +++ b/ud-useradd @@ -243,21 +243,13 @@ if Res != "yes": # Initialize the substitution Map Subst = {} -encto = '' +encrealname = '' try: - encto = FullName.decode('us-ascii') + encrealname = FullName.decode('us-ascii') except UnicodeError: - encto = str(email.Header.Header(FullName, 'utf-8', 200)) + " " + emailaddr + encrealname = str(email.Header.Header(FullName, 'utf-8', 200)) -subjstring = "New Debian Maintainer " + FullName -encsubj = '' -try: - encsubj = subjstring.decode('us-ascii') -except UnicodeError: - encsubj = str(email.Header.Header(subjstring, 'utf-8', 200)) - -Subst["__HEADER_SUBJ__"] = encsubj -Subst["__HEADER_EMAIL"] = encto +Subst["__ENCODED_REALNAME__"] = encrealname Subst["__REALNAME__"] = FullName; Subst["__WHOAMI__"] = pwd.getpwuid(os.getuid())[0]; Subst["__DATE__"] = time.strftime("%a, %d %b %Y %H:%M:%S +0000",time.gmtime(time.time())); -- 2.20.1