<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Handling of Bugzilla emailsuffix parameter</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000099" vlink="#660066" alink="#FF0000">
<div align="center">
<p>
<a href="http://www.ravenbrook.com/">Ravenbrook</a> /
<a href="http://www.ravenbrook.com/project/">Projects</a> /
<a href="http://www.ravenbrook.com/project/p4dti/">Perforce Defect Tracking Integration</a> /
<a href="../../index.html">Version 2.0 Product Sources</a> /
<a href="../index.html">Design</a>
</p>
<p><i><a href="http://www.ravenbrook.com/project/p4dti/">Perforce Defect Tracking Integration Project</a></i></p>
<hr />
<h1>Handling of Bugzilla emailsuffix parameter</h1>
<address>
<a href="mailto:gdr@ravenbrook.com">Gareth Rees</a>,
<a href="http://www.ravenbrook.com/">Ravenbrook Limited</a>,
2002-01-24
</address>
</div>
<h2><a id="section-1" name="section-1">1. Introduction</a></h2>
<p> This document describes the <code>emailsuffix</code> feature in
Bugzilla, and how this feature is supported in the P4DTI. </p>
<p> The intended readership is P4DTI development staff. </p>
<p> This document is not confidential. </p>
<h2><a id="section-2" name="section-2">2. Bugzilla's <code>emailsuffix</code> feature</a></h2>
<p> This discussion applies to Bugzilla 2.14, 2.14.x, 2.16, and
2.16.x. No doubt the algorithm will change in future Bugzilla
releases. </p>
<p> The help text for Bugzilla's <code>emailregexp</code> parameter
says: </p>
<blockquote>This defines the regexp to use for legal email addresses.
The default tries to match fully qualified email addresses. Another
popular value to put here is <tt>^[^@]*$</tt>, which means "local
usernames, no @ allowed.</blockquote>
<p> The default value for <code>emailregexp</code> is
<tt>^[^@]*@[^@]*\\.[^@]*$</tt>. </p>
<p> The help text for the <code>emailsuffix</code> parameter says: </p>
<blockquote>This is a string to append to any email addresses when
actually sending mail to that address. It is useful if you have changed
the <tt>emailregexp</tt> param to only allow local usernames, but you
want the mail to be delivered to
username@my.local.hostname.</blockquote>
<p> The default value for <code>emailsuffix</code> is the empty
string. </p>
<p> When logging in: </p>
<ul>
<li> The login name must match the <code>emailregexp</code> parameter
(<code>CGI.pl</code> line 767). </li>
<li> The login name must match the <code>login_name</code> field in
the <code>profiles</code> table exactly (<code>CGI.pl</code> line
771). </li>
<li> The <code>emailsuffix</code> parameter is not consulted. </li>
</ul>
<p> When sending e-mail, a user's e-mail address is constructing by
appending the <code>emailsuffix</code> parameter to the login name (for
example, <code>CGI.pl</code> line 734). No check is made to see if
login name already contains an "@", or if the resulting address makes
sense according to [<a title="Standard for the format of ARPA Internet
text messages" href="ftp://src.doc.ic.ac.uk/rfc/rfc822.txt">RFC
822</a>]. </p>
<h2><a id="section-3" name="section-3">3. Consquences of Bugzilla's design</a></h2>
<p> There are bad consequences of this design: </p>
<ul>
<li> You can easily get into situations from which the administrator
can't log in and so can't fix the problem. For example, setting
<code>emailregexp</code> to something that doesn't match the
administrator's login. </li>
<li> You can't get Bugzilla into a state where everyone has usernames
consisting only of the local part of their address unless you go into
the database and change things by hand. This is because the
administrator account is created when you install Bugzilla and at that
point <code>emailregexp</code> still has its original value, requiring
an "@" in the administrator's login name. </li>
<li> If you have <code>emailsuffix</code> set, but some users still
have their full e-mail address as their login name, then those users
won't get e-mail because the constructed e-mail address will be
wrong. </li>
<li> If you decide later to turn off <code>emailsuffix</code> (perhaps
because you've now got users from more than one domain), then people
with local-part-only login names won't get e-mail. You'll have to go
into the database and fix up all the login names. </li>
</ul>
<p> But presumably Bugzilla administrators live with these problems
somehow. </p>
<h2><a id="section-4" name="section-4">4. How the P4DTI supports the <code>emailsuffix</code> feature</a></h2>
<p> To support the feature, we need to be able to read Bugzilla's
<code>emailsuffix</code> parameter. Unfortunately, Bugzilla's server
parameters are not stored in Bugzilla's database, but instead in the
file <code>data/params</code> in the Bugzilla's installation. This file
is possibly not available for reading by the P4DTI since it may be on a
different machine. </p>
<p> So we patch Bugzilla to write its parameters to the table
<code>p4dti_bugzilla_parameters</code> in the database whenever the
parameters are edited [<a title="Bugzilla database schema extensions
for integration with Perforce"
href="http://www.ravenbrook.com/project/p4dti/version/1.5/design/bugzilla-p4dti-schema/#table-p4dti_bugzilla_parameters">NB
2000-11-14</a>]. </p>
<p> This has the consquence that the Bugzilla administrator who installs
the P4DTI (or upgrades from a version of P4DTI without this feature)
needs to patch Bugzilla and run the <code>editparams.cgi</code> CGI
script in order to force the table to be generated [<a title="Perforce
Defect Tracking Integration Administrator's Guide"
href="../../manual/ag/index.html#section-5.4.3">RB 2000-08-10,
5.4.3</a>]. </p>
<p> The P4DTI's algorithm is then very simple. When we fetch e-mail
addresses from the Bugzilla <code>profiles</code> table (in the function
<code>user_id_and_email_list</code> in [<a title="bugzilla.py --
interface to Bugzilla"
href="../../code/replicator/bugzilla.py">NB
2000-11-21</a>]), we append the <code>emailsuffix</code> parameter if we
know it. The logic in the user translator is thus unaffected. </p>
<h2><a id="section-A" name="section-A">A. References</a></h2>
<table>
<tr valign="top">
<td>[<a id="ref-NB-2000-11-14" name="ref-NB-2000-11-14" href="../bugzilla-p4dti-schema/index.html">NB 2000-11-14</a>]</td>
<td>
"Bugzilla database schema extensions for integration with Perforce";
<a href="mailto:nb@ravenbrook.com">Nick Barnes</a>;
<a href="http://www.ravenbrook.com/">Ravenbrook Limited</a>;
2000-11-14.
</td>
</tr>
<tr valign="top">
<td>[<a id="ref-NB-2000-11-21" name="ref-NB-2000-11-21" href="../../code/replicator/bugzilla.py">NB 2000-11-21</a>]</td>
<td>
"bugzilla.py -- interface to Bugzilla";
<a href="mailto:nb@ravenbrook.com">Nick Barnes</a>;
<a href="http://www.ravenbrook.com/">Ravenbrook Limited</a>;
2000-11-21.
</td>
</tr>
<tr valign="top">
<td>[<a id="ref-RB-2000-08-10" name="ref-RB-2000-08-10" href="../../manual/ag/index.html">RB 2000-08-10</a>]</td>
<td>
"Perforce Defect Tracking Integration Administrator's Guide";
<a href="mailto:rb@ravenbrook.com">Richard Brooksby</a>;
<a href="http://www.ravenbrook.com/">Ravenbrook Limited</a>;
2000-08-10.
</td>
</tr>
<tr valign="top">
<td>[<a id="ref-RFC-822" name="ref-RFC-822" href="ftp://src.doc.ic.ac.uk/rfc/rfc822.txt">RFC 822</a>]</td>
<td>
"Standard for the format of ARPA Internet text messages";
David H Crocker;
1982-08-13.
</td>
</tr>
</table>
<h2><a id="section-B" name="section-B">B. Document History</a></h2>
<table>
<tr valign="top">
<td>2002-01-24</td>
<td><a href="mailto:gdr@ravenbrook.com">GDR</a></td>
<td>Created.</td>
</tr>
<tr valign="top">
<td>2002-01-31</td>
<td><a href="mailto:nb@ravenbrook.com">NB</a></td>
<td>Added Bugzilla 2.14.1.</td>
</tr>
<tr valign="top">
<td>2002-10-04</td>
<td><a href="mailto:nb@ravenbrook.com">NB</a></td>
<td>Added notes on later Bugzilla releases.</td>
</tr>
</table>
<hr />
<p> <small>This document is copyright © 2001 Perforce Software, Inc. All rights reserved.</small> </p>
<p> <small>Redistribution and use of this document in any form, with or without modification, is permitted provided that redistributions of this document retain the above copyright notice, this condition and the following disclaimer.</small> </p>
<p> <small> <strong> This document is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright holders and contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this document, even if advised of the possibility of such damage. </strong> </small> </p>
<div align="center">
<p><code>$Id: //info.ravenbrook.com/project/p4dti/version/2.0/design/bugzilla-emailsuffix/index.html#2 $</code></p>
<p>
<a href="http://www.ravenbrook.com/">Ravenbrook</a> /
<a href="http://www.ravenbrook.com/project/">Projects</a> /
<a href="http://www.ravenbrook.com/project/p4dti/">Perforce Defect Tracking Integration</a> /
<a href="../../index.html">Version 2.0 Product Sources</a> /
<a href="../index.html">Design</a>
</p>
</div>
</body>
</html>