[SCM] Git repository for devscripts branch, master, updated. v2.12.4-1-g461e230
James McCoy
jamessan at debian.org
Sat Oct 6 19:21:49 UTC 2012
The following commit has been merged in the master branch:
commit 461e230f034aa17dcf359f4c6a6f6fad26a05a48
Author: James McCoy <jamessan at debian.org>
Date: Sat Oct 6 15:21:14 2012 -0400
bts: Provide a clearer error message when Authen::SASL isn't installed.
Closes: #689816
Signed-off-by: James McCoy <jamessan at debian.org>
diff --git a/debian/changelog b/debian/changelog
index 40c2616..0620887 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+devscripts (2.12.5) UNRELEASED; urgency=low
+
+ * bts:
+ + Provide a clearer error message when Authen::SASL isn't installed.
+ (Closes: #689816)
+
+ -- James McCoy <jamessan at debian.org> Sat, 06 Oct 2012 15:19:58 -0400
+
devscripts (2.12.4) unstable; urgency=low
[ James McCoy ]
diff --git a/scripts/bts.pl b/scripts/bts.pl
index c326898..e9382cd 100755
--- a/scripts/bts.pl
+++ b/scripts/bts.pl
@@ -69,6 +69,7 @@ my $it = undef;
my $last_user = '';
my $lwp_broken = undef;
my $smtp_ssl_broken = undef;
+my $authen_sasl_broken;
my $ua;
sub have_lwp() {
@@ -108,6 +109,23 @@ sub have_smtp_ssl() {
return $smtp_ssl_broken ? 0 : 1;
}
+sub have_authen_sasl() {
+ return ($authen_sasl_broken ? 0 : 1) if defined $authen_sasl_broken;
+ eval {
+ require Authen::SASL;
+ };
+
+ if ($@) {
+ if ($@ =~ m%^Can't locate Authen/SASL%) {
+ $authen_sasl_broken='the libauthen-sasl-perl package is not installed';
+ } else {
+ $authen_sasl_broken="couldn't load Authen::SASL: $@";
+ }
+ }
+ else { $authen_sasl_broken=''; }
+ return $authen_sasl_broken ? 0 : 1;
+}
+
# Constants
sub MIRROR_ERROR { 0; }
sub MIRROR_DOWNLOADED { 1; }
@@ -2545,7 +2563,7 @@ sub send_mail {
$smtp = Net::SMTP::SSL->new($host, Port => $port,
Hello => $smtphelo) or die "$progname: failed to open SMTPS connection to $smtphost\n($@)\n";
} else {
- die "$progname: Unable to establish SMTPS connection: $smtp_ssl_broken\n($@)\n";
+ die "$progname: Unable to establish SMTPS connection: $smtp_ssl_broken\n";
}
} else {
my ($host, $port) = split(/:/, $smtphost);
@@ -2555,9 +2573,13 @@ sub send_mail {
or die "$progname: failed to open SMTP connection to $smtphost\n($@)\n";
}
if ($smtpuser) {
- $smtppass = getpass() if not $smtppass;
- $smtp->auth($smtpuser, $smtppass)
- or die "$progname: failed to authenticate to $smtphost\n($@)\n";
+ if (have_authen_sasl) {
+ $smtppass = getpass() if not $smtppass;
+ $smtp->auth($smtpuser, $smtppass)
+ or die "$progname: failed to authenticate to $smtphost\n($@)\n";
+ } else {
+ die "$progname: failed to authenticate to $smtphost: $authen_sasl_broken\n";
+ }
}
$smtp->mail($fromaddress)
or die "$progname: failed to set SMTP from address $fromaddress\n($@)\n";
--
Git repository for devscripts
More information about the devscripts-devel
mailing list