r981 - in packages/libmail-imapclient-perl/trunk: . debian

Gunnar Wolf gwolf@costa.debian.org
Sat, 14 May 2005 22:05:07 +0000


Author: gwolf
Date: 2005-05-14 22:05:06 +0000 (Sat, 14 May 2005)
New Revision: 981

Modified:
   packages/libmail-imapclient-perl/trunk/IMAPClient.pm
   packages/libmail-imapclient-perl/trunk/IMAPClient.pod
   packages/libmail-imapclient-perl/trunk/Makefile.PL
   packages/libmail-imapclient-perl/trunk/debian/README.Debian
   packages/libmail-imapclient-perl/trunk/debian/changelog
   packages/libmail-imapclient-perl/trunk/debian/control
Log:
Added SSL support


Modified: packages/libmail-imapclient-perl/trunk/IMAPClient.pm
===================================================================
--- packages/libmail-imapclient-perl/trunk/IMAPClient.pm	2005-05-11 15:29:22 UTC (rev 980)
+++ packages/libmail-imapclient-perl/trunk/IMAPClient.pm	2005-05-14 22:05:06 UTC (rev 981)
@@ -8,6 +8,7 @@
 use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);
 use Socket();
 use IO::Socket();
+use IO::Socket::SSL();
 use IO::Select();
 use IO::File();
 use Carp qw(carp);
@@ -114,6 +115,7 @@
 			Authmechanism Authcallback Ranges
 			Readmethod Showcredentials
 			Prewritemethod
+			Ssl
 		)
  ) {
         no strict 'refs';
@@ -245,13 +247,15 @@
 		and 	$IO::Socket::INET::VERSION eq '1.25' 
 		and 	!$self->Port;
 	%$self = (%$self, @_);
-	my $sock = IO::Socket::INET->new(
+	my $sock = ($self->Ssl ? IO::Socket::SSL->new : IO::Socket::INET->new);
+	my $dp = ($self->Ssl ? 'imaps(993)' : 'imap(143)');
+	$sock->configure({
 		PeerAddr => $self->Server		,
-                PeerPort => $self->Port||'imap(143)'	,
+                PeerPort => $self->Port||$dp	       	,
                 Proto    => 'tcp' 			,
                 Timeout  => $self->Timeout||0		,
 		Debug	=> $self->Debug 		,
-	)						;
+	})						;
 
 	unless ( defined($sock) ) {
 		
@@ -302,9 +306,10 @@
 
 	my $id   = $self->User;
 	my $has_quotes = $id =~ /^".*"$/ ? 1 : 0;
-	my $string = 	"Login " . ( $has_quotes ? $id : qq("$id") ) . " " . 
-			"{" . length($self->Password) . 
-			"}\r\n".$self->Password."\r\n";
+	#my $string = 	"Login " . ( $has_quotes ? $id : qq("$id") ) . " " . 
+	#		"{" . length($self->Password) . 
+	#		"}\r\n".$self->Password."\r\n";
+	my $string = "Login " . ( $has_quotes ? $id : qq("$id") ) . " " . $self->Password .  "\r\n";
 	$self->_imap_command($string) 
 		and $self->State(Authenticated);
 	# $self->folders and $self->separator unless $self->NoAutoList;
@@ -1906,7 +1911,7 @@
                   return undef;
               }
               # successfully wrote to other end, keep going...
-              $count += $ret;
+              $count += $ret if defined($ret);
 		LINES: while ( $iBuffer =~ s/^(.*?\x0d?\x0a)// ) {
 		   my $current_line = $1;
 
@@ -2167,8 +2172,8 @@
                                 (?:"[^"]*"|NIL)\s+	 # "delimiter" or NIL
                                 (?:"([^"]*)"|(.*))\x0d\x0a$  # Name or "Folder name"
                         /ix;
-		$folders[-1] = '"' . $folders[-1] . '"' 
-			if $1 and !$self->exists($folders[-1]) ;
+		#$folders[-1] = '"' . $folders[-1] . '"' 
+		#	if $1 and !$self->exists($folders[-1]) ;
 		# $self->_debug("folders: line $list[$m]: 1=$1 and 2=$2\n");
         } 
 

Modified: packages/libmail-imapclient-perl/trunk/IMAPClient.pod
===================================================================
--- packages/libmail-imapclient-perl/trunk/IMAPClient.pod	2005-05-11 15:29:22 UTC (rev 980)
+++ packages/libmail-imapclient-perl/trunk/IMAPClient.pod	2005-05-14 22:05:06 UTC (rev 981)
@@ -3414,6 +3414,25 @@
 parameter/value pairs to the method, or later by calling the
 parameter's eponymous object method.
 
+=head2 Ssl
+
+Example: 
+
+	$is_ssl_active = $imap->Ssl();
+	# or:
+	$imap->Ssl($activate_ssl);
+
+Specifies whether a connection should be established using a SSL (cyphered)
+channel or via a regular clear TCP connection. Of course, setting this
+parameter makes sense only before the connection is established.
+
+Please note that this parameter was specifically added for the Debian 
+packaging. If you are developing software to be deployed over different 
+machines, we suggest you not to use it - or to specify your users to install
+this patch. You can get it at Debian's bug tracking system at
+L<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=111960>, or at CPAN's
+L<http://rt.cpan.org/NoAuth/Bug.html?id=9256>.
+
 =cut
 
 

Modified: packages/libmail-imapclient-perl/trunk/Makefile.PL
===================================================================
--- packages/libmail-imapclient-perl/trunk/Makefile.PL	2005-05-11 15:29:22 UTC (rev 980)
+++ packages/libmail-imapclient-perl/trunk/Makefile.PL	2005-05-14 22:05:06 UTC (rev 981)
@@ -28,6 +28,7 @@
 				'Fcntl'		=> 0,
 				'IO::Select'	=> 0,
 				'IO::File'	=> 0,
+				'IO::Socket::SSL'=>0,
 				'Data::Dumper'	=> 0,
 				'Carp'		=> 0,
     },

Modified: packages/libmail-imapclient-perl/trunk/debian/README.Debian
===================================================================
--- packages/libmail-imapclient-perl/trunk/debian/README.Debian	2005-05-11 15:29:22 UTC (rev 980)
+++ packages/libmail-imapclient-perl/trunk/debian/README.Debian	2005-05-14 22:05:06 UTC (rev 981)
@@ -1,3 +1,12 @@
+			  SSL support added
+			  =================
+
+SSL support has been added to the Debian version of this module, via
+the boolean 'Ssl' attribute (see the documentation for further
+details). Now, SSL support is _not_ official, and if you write a
+program depending on it, it will break on non-Debian systems. Use with
+care. You have been warned.
+
 	  Missing documents from the upstream source package
 	  ==================================================
 

Modified: packages/libmail-imapclient-perl/trunk/debian/changelog
===================================================================
--- packages/libmail-imapclient-perl/trunk/debian/changelog	2005-05-11 15:29:22 UTC (rev 980)
+++ packages/libmail-imapclient-perl/trunk/debian/changelog	2005-05-14 22:05:06 UTC (rev 981)
@@ -1,3 +1,13 @@
+libmail-imapclient-perl (2.2.9+deb-3) unstable; urgency=low
+
+  * Added SSL support by including Joost Cassee's patch - Thanks a lot!
+    (Closes: #111960)
+  * SSL patch requires to add build-dependency and dependency on
+    libio-socket-ssl-perl - did so as well. Also wrote basic documentation
+    for it in the module's POD and Makefile
+
+ -- Gunnar Wolf <gwolf@debian.org>  Sat, 14 May 2005 16:27:15 -0500
+
 libmail-imapclient-perl (2.2.9+deb-2) unstable; urgency=low
 
   * Specified not to overwrite some manpages generated from .pod files

Modified: packages/libmail-imapclient-perl/trunk/debian/control
===================================================================
--- packages/libmail-imapclient-perl/trunk/debian/control	2005-05-11 15:29:22 UTC (rev 980)
+++ packages/libmail-imapclient-perl/trunk/debian/control	2005-05-14 22:05:06 UTC (rev 981)
@@ -3,14 +3,14 @@
 Section: perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.debian.org>
 Uploaders: Joachim Breitner <nomeata@debian.org>, Gunnar Wolf <gwolf@debian.org>
-Build-Depends-Indep: debhelper (>= 4), perl (>= 5.6.0-17), libparse-recdescent-perl
+Build-Depends-Indep: debhelper (>= 4), perl (>= 5.6.0-17), libparse-recdescent-perl, libio-socket-ssl-perl
 Standards-Version: 3.6.1
 
 Package: libmail-imapclient-perl
 Architecture: all
 Priority: optional
 Section: perl
-Depends: ${perl:Depends}, libparse-recdescent-perl
+Depends: ${perl:Depends}, libparse-recdescent-perl, libio-socket-ssl-perl
 Description: a perl library for manipulating IMAP mail stores
  This module provides perl routines that simplify a sockets connection
  to and an IMAP conversation with an IMAP server.