From: Graham Barr Date: Sat, 10 Apr 2004 08:08:42 +0000 (+0000) Subject: Sync with libnet 1.18 X-Git-Tag: accepted/trunk/20130322.191538~22087 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f92f3fcb12a65edac7bb06adfe71799496ff86b6;p=platform%2Fupstream%2Fperl.git Sync with libnet 1.18 p4raw-id: //depot/perl@22686 --- diff --git a/MANIFEST b/MANIFEST index 1826e0a..1f8239d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1450,7 +1450,7 @@ lib/Memoize/t/tie_sdbm.t Memoize SDBM interface test lib/Memoize/t/tie_storable.t Memoize Storable interface test lib/Memoize/t/tie.t Memoize tied file test lib/Memoize/t/unmemoize.t Memoize 'unmemoize' function test -lib/Net/ChangeLog.libnet libnet +lib/Net/Changes.libnet libnet lib/Net/Cmd.pm libnet lib/Net/Config.eg libnet lib/Net/Config.pm libnet @@ -1501,6 +1501,7 @@ lib/Net/servent.pm By-name interface to Perl's builtin getserv* lib/Net/servent.t See if Net::servtent works lib/Net/SMTP.pm libnet lib/Net/t/config.t libnet +lib/Net/t/datasend.t libnet lib/Net/t/ftp.t libnet lib/Net/t/hostname.t libnet lib/Net/Time.pm libnet diff --git a/lib/Net/ChangeLog.libnet b/lib/Net/ChangeLog.libnet deleted file mode 100644 index 26d7ac8..0000000 --- a/lib/Net/ChangeLog.libnet +++ /dev/null @@ -1,1363 +0,0 @@ -Change 830 on 2003/09/25 by (Graham Barr) - - Net::FTP - - documentation fixes - -Change 829 on 2003/09/25 by (Graham Barr) - - Net::FTP - - Allow spaces after the file size in the response to SIZE - -Change 828 on 2003/09/25 by (Graham Barr) - - Net::Domain - - Avoid infinite loop - -Change 821 on 2003/06/18 by (Graham Barr) - - Release 1.16 - -Change 820 on 2003/06/17 by (Graham Barr) - - Net::FTP - - Fix uninit warning when sending the ALLO command inside put - -Change 819 on 2003/06/13 by (Graham Barr) - - Release 1.15 - -Change 818 on 2003/06/13 by (Graham Barr) - - Net::FTP - - Fix merge error spotted by Slaven Rezic - -Change 817 on 2003/06/13 by (Graham Barr) - - Set INSTALLDIRS to 'perl' for perl >= 5.008 - -Change 816 on 2003/06/13 by (Graham Barr) - - Add SIGNATURE - -Change 806 on 2003/06/02 by (Graham Barr) - - Release 1.14 - -Change 805 on 2003/06/02 by (Graham Barr) - - Net::Cmd - - Avoid process death from SIGPIPE - -Change 804 on 2003/05/27 by (Graham Barr) - - Net::FTP - - Support for ALLO command (patch from Matthew N. Andrews) - -Change 803 on 2003/05/27 by (Graham Barr) - - libnetFAQ - - Fix URLs - -Change 802 on 2003/05/21 by (Graham Barr) - - Use read/print instead of sysread/syswrite for local files - so CRLF translation happens if it needs to - -Change 801 on 2003/05/20 by (Graham Barr) - - Net::FTP, Net::NNTP - - doc updates from Jarkko - -Change 800 on 2003/05/20 by (Graham Barr) - - Net::Domain - - Look in environment on VMS for domainname - (patch from Michael Cartmell) - -Change 799 on 2003/05/20 by (Graham Barr) - - Net::SMTP - - Allow multiple hosts to be passed to new() as an array reference - -Change 798 on 2003/05/20 by (Graham Barr) - - Net::FTP - - Add some error checking to the examples in the SYNOPSIS - -Change 797 on 2003/05/20 by (Graham Barr) - - Net::SMTP - - Support MTAs with broken HELO response - (patch from Michael Driscoll) - -Change 796 on 2003/05/20 by (Graham Barr) - - Net::POP3 - - Add small example to SYNOPSIS - -Change 795 on 2003/05/20 by (Graham Barr) - - Net::NNTP - - Add post clarifications to pod - -Change 794 on 2003/05/20 by (Graham Barr) - - Net::SMTP, Net::Cmd - - Support for BINARYMIME - (patch from Richard Coles) - -Change 793 on 2003/05/20 by (Graham Barr) - - Net::FTP - - Allow the firewall type to be specified in Net::Config - (patch from Philip Newton) - -Change 792 on 2003/05/20 by (Graham Barr) - - Net::SMTP - - Fixes to the DSN parameter to mail() - (patch from Rafael Garcia-Suarez) - -Change 791 on 2003/05/20 by (Graham Barr) - - Net::FTP::A - - Fix CRLF translation in write() - -Change 790 on 2003/05/20 by (Graham Barr) - - Net::Cmd - - Improve performance of CRLF translation when sending data - -Change 789 on 2003/05/20 by (Graham Barr) - - Net::SMTP - - Make the use of email address extraction configurable. By default - it is now back how it was - -Change 788 on 2003/05/20 by (Graham Barr) - - Net::NNTP - - Prevent instance methods being called as class methods when debug is turned on - -Change 772 on 2003/03/03 by (Graham Barr) - - Release 1.13 - -Change 755 on 2002/11/03 by (Graham Barr) - - Fix typo - -Change 749 on 2002/09/23 by (Graham Barr) - - Net::POP3 - - Make more compilant. +OK and -ERR responses do not have to be followed - by a space. - -Change 748 on 2002/09/23 by (Graham Barr) - - Net::FTP - - Fix unique name extraction to pick up name on initial - response, not just the final response - -Change 737 on 2002/07/18 by (Graham Barr) - - Net::Cmd - - Compatability fix for 5.004 - -Change 736 on 2002/07/16 by (Graham Barr) - - Net::Cmd - - Ensure all debug output is via ->debug_print - -Change 735 on 2002/07/15 by (Graham Barr) - - Net::FTP - - Allow the user to specify a local address to use for sockets - -Change 734 on 2002/07/15 by (Graham Barr) - - Net::SMTP - - Avoid extra spaces on the end of the AUTH command - -Change 728 on 2002/05/28 by (Graham Barr) - - Release 1.12 - -Change 727 on 2002/05/28 by (Graham Barr) - - Net::SMTP - - Use Authen::SASL to do auth - -Change 724 on 2002/05/24 by (Graham Barr) - - Net::SMTP - - Minor change to address sanitize code, mainly to allow <> - -Change 723 on 2002/05/24 by (Graham Barr) - - Net::FTP - - Minor change to pattern to extract unique filename from server response - -Change 717 on 2002/04/02 by (Graham Barr) - - Release 1.11 - -Change 716 on 2002/04/02 by (Graham Barr) - - Net::FTP::dataconn - - Fix for select to avoid occasional hangups - -Change 715 on 2002/04/02 by (Graham Barr) - - Tweak parsing of hello response - -Change 706 on 2002/02/28 by (Graham Barr) - - Release 1.10 - -Change 705 on 2002/02/28 by (Graham Barr) - - Net::FTP::I - - Don't call sysread multiple times after calling select() as it - may block. - -Change 704 on 2002/02/25 by (Graham Barr) - - Net::POP3 - - Patches from Ville Skytta for various cleanup and use Digest::MD5 - -Change 703 on 2002/02/25 by (Graham Barr) - - Net::Cmd, Net::NNTP, Net::POP3, Net::SMTP - - Add support for returning tied filehandles from some operations - -Change 702 on 2002/02/25 by (Graham Barr) - - Net::Config - - New config script for MacOS from Chris Nandor - -Change 701 on 2002/02/25 by (Graham Barr) - - Net::FTP - - Allow tied handles to be passed to get/put - -Change 700 on 2002/02/25 by (Graham Barr) - - t/* - - Skip tests if no Socket module - -Change 699 on 2002/02/25 by (Graham Barr) - - t/netrc.t - - Fix RE context - -Change 698 on 2002/02/25 by (Graham Barr) - - Net::Cmd - - Pod changes from Robin Barker - -Change 697 on 2002/02/22 by (Graham Barr) - - Net::FTP - - Don't do EBCDIC translation on a binary transfer - -Change 696 on 2002/02/22 by (Graham Barr) - - Net::FTP - - Fix docs for anonymous login - -Change 695 on 2002/02/22 by (Graham Barr) - - Net::SMTP - - Support binding to a local port/address - -Change 694 on 2002/02/22 by (Graham Barr) - - Net::Netrc - - Support exscaping in the netrc file - -Change 688 on 2001/12/10 by (Graham Barr) - - Release 1.0901 - -Change 687 on 2001/12/10 by (Graham Barr) - - More test updates from the core - -Change 686 on 2001/11/27 by (Graham Barr) - - Skip tests if we are on an EBCDIC machine, but Convert::EBCDIC is not installed - Make tests run with 5.004 - -Change 685 on 2001/11/27 by (Graham Barr) - - Net::SMTP - - Don't attempt to resolve the hostname to send in the greating. - If it is not provided, use localhost.localdomain - (patch from Eduardo Perez Ureta) - -Change 684 on 2001/11/26 by (Graham Barr) - - netrc.t - - fix RE for libnet_t.pl - -Change 683 on 2001/11/20 by (Graham Barr) - - Various doc cleanups - -Change 675 on 2001/11/20 by (Graham Barr) - - t/hostname.t - - Add test to check that hostname() does not modify $_ - -Change 674 on 2001/11/20 by (Graham Barr) - - Net::Config - - Dont treat "test_hosts" as an array of host names - -Change 673 on 2001/11/20 by (Graham Barr) - - Added test for Net::Netrc - patch from chromatic - -Change 672 on 2001/11/20 by (Graham Barr) - - Net::FTP - - Dont send QUIT on DESTROY. Causes problems when fork() is used. - -Change 671 on 2001/11/20 by (Graham Barr) - - Net::Domain - - Fix bug causing $_ to be modified - -Change 670 on 2001/11/20 by (Graham Barr) - - Net::FTP - - Send -anonymous@ as the password for the anonymous user, not - the real username. Patch from Eduardo Perez Ureta - -Change 669 on 2001/11/20 by (Graham Barr) - - Add VERSION numbers to Net::FTP::L and Net::FTP::E - -Change 668 on 2001/11/20 by (Graham Barr) - - Net::Config - - Read some default values using Mac::InternetConfig if we are on the Mac - patch from Chris Nandor - -Change 667 on 2001/11/20 by (Graham Barr) - - Net::SMTP - - Add support for SASL AUTH (only PLAIN right now) - patch from Meng Weng Wong - -Change 666 on 2001/11/20 by (Graham Barr) - - t/config.t - - Use a fake inet_aton so we know that it will fail when expected - -Change 665 on 2001/11/02 by (Graham Barr) - - Release 1.09 - -Change 664 on 2001/10/29 by (Graham Barr) - - Added test for Net::Config from chromatic - -Change 663 on 2001/10/26 by (Graham Barr) - - More fixes from the core for undefs - -Change 662 on 2001/10/26 by (Graham Barr) - - Make tests compatable with the perl core distribution - -Change 661 on 2001/10/26 by (Graham Barr) - - Add install-nomake to install libnet on machines that do not - have make available - -Change 660 on 2001/10/26 by (Graham Barr) - - Net::Cmd - - Ensure we don't insert an extra CR during LF=>CRLF when the CR already exists - -Change 659 on 2001/10/22 by (Graham Barr) - - Net::Domain - - Be more robust if no hostname or domainname - (especially the latter) - -Change 658 on 2001/10/22 by (Graham Barr) - - Net::Config - - Protect eval's from user defining $SIG{__DIE__} - -Change 657 on 2001/10/22 by (Graham Barr) - - Net::Config - - Fix handling of single values passed, when a ref to an array is wanted - -Change 656 on 2001/10/22 by (Graham Barr) - - Net::Config - - Pod updates from chromatic - -Change 655 on 2001/10/22 by (Graham Barr) - - Net::SMTP - - Don't be sensetive to extra spaces on reply to HELO - -Change 654 on 2001/10/22 by (Graham Barr) - - Net::Netrc - - Update lookup() docs to describe what happens if no .netrc file is found - -Change 653 on 2001/10/22 by (Graham Barr) - - Net::FTP - - Fix hash() to match docs (patch from Doug Wilson) - -Change 652 on 2001/09/21 by (Graham Barr) - - Net::FTP - - Fix patterns in ->size and ->supported - -Change 651 on 2001/09/21 by (Graham Barr) - - Net::Config, Net::Netrc - - Handle $home on w2k - -Change 650 on 2001/09/21 by (Graham Barr) - - Net::Domain - - Fix some potential undef warnings - -Change 649 on 2001/09/21 by (Graham Barr) - - Net::FTP - - Add FirewallType as an option to ->new - -Change 648 on 2001/09/21 by (Graham Barr) - - Net::FTP - - use sysopen instead of open so we don't get caught by special chars in the filename - -Change 630 on 2001/08/31 by (Graham Barr) - - Net::FTP::I - - Avoid uninit warning - -Change 627 on 2001/08/20 by (Graham Barr) - - Remove tests for modules removed from dist - -Change 626 on 2001/08/17 by (Graham Barr) - - Increment VERSIONs - -Change 625 on 2001/08/17 by (Graham Barr) - - Doc updates and add cc and bcc as aliases for recipient - -Change 624 on 2001/08/17 by (Graham Barr) - - Don't set ENV variables - -Change 623 on 2001/08/17 by (Graham Barr) - - Support mixed case in the EHLO response - -Change 622 on 2001/08/06 by (Graham Barr) - - Documentation update - -Change 621 on 2001/08/06 by (Graham Barr) - - Set the status if command returns due to the connection being closed - -Change 620 on 2001/08/06 by (Graham Barr) - - Fix for _msg_spec when passed the same msg number twice, pass N instead of N-N - -Change 619 on 2001/05/29 by (Graham Barr) - - Remove DummyInetd - -Change 618 on 2001/05/29 by (Graham Barr) - - Move snpp into its own distribution - -Change 615 on 2001/05/29 by (Graham Barr) - - Move PH to its own dist - -Change 614 on 2001/05/29 by (Graham Barr) - - Move TFTP out of libnet - -Change 612 on 2001/03/29 by (Graham Barr) - - Support some non standard servers that return more than - just a number in response to SIZE. But the size must be - the last thing on the response line [Jeffery W Long] - -Change 603 on 2000/10/06 by (Graham Barr) - - Net::Config - - Added documentation for ftp_firewall_type - -Change 574 on 2000/08/24 by (Graham Barr) - - Net::FTP - - Make listen socket listen on same interfacce as the command connection - this fixes a problem when going via a SOCKS firewall - -Change 573 on 2000/08/24 by (Graham Barr) - - Net::Netrc - - Exclude cygwin from the stat check - -Change 572 on 2000/08/24 by (Graham Barr) - - Net::FTP - - Fix bug in return value from ->rmdir - - Added ->restart() - Net::FTP::dataconn - - Added ->bytes_read - -Change 518 on 2000/05/16 by (Graham Barr) - - Net::FTP::A, Net::FTP::I - - Restrict the number of bytes given to syswrite to be at - most net_ftp_blksize. This fixes a bug on VMS where the OS will - return an error if syswrite is given more than 65535 bytes. - -Change 504 on 2000/05/02 by (Graham Barr) - - Net::NNTP - * Doc fix for the description of the return value from ->list() - -Change 503 on 2000/05/02 by (Graham Barr) - - Net::POP3 - * chnage new MD5 to MD5->new - -Change 472 on 2000/03/30 by (Graham Barr) - - Net::Cmd - - More typos in os390 code - -Change 471 on 2000/03/30 by (Graham Barr) - - Net::Cmd - - Fix bug in new os390 code - -Change 470 on 2000/03/30 by (Graham Barr) - - Generate HTML - -Change 469 on 2000/03/30 by (Graham Barr) - - Documentation updates - -Change 468 on 2000/03/30 by (Graham Barr) - - Added Net::SNPP::HylaFAX.pm - -Change 458 on 2000/03/29 by (Graham Barr) - - Net::Cmd, Net::FTP - - Support for os390, modified from a patch from Dan Campbell - -Change 455 on 2000/03/29 by (Graham Barr) - - Net::Domain - - silence warnings on Win32 that domainname does not exist - -Change 454 on 2000/03/29 by (Graham Barr) - - Net::FTP - - More error checking in ->get() - -Change 453 on 2000/03/29 by (Graham Barr) - - Net::FTP - - update pattern to dig out unique filename from stou - -Change 452 on 2000/03/29 by (Graham Barr) - - t/ftp.t - - silently pass if the stor to /pub fails - -Change 451 on 2000/03/29 by (Graham Barr) - - Net::FTP - - Add Timeout to listen socket - -Change 450 on 2000/03/29 by (Graham Barr) - - Makefile.PL - - only add ppd conditional on perl version - -Change 449 on 2000/03/29 by (Graham Barr) - - Fixed mput example in FAQ to use glob() - -Change 448 on 2000/03/29 by (Graham Barr) - - Update README to reflect new way Configure works - -Change 447 on 2000/03/29 by (Graham Barr) - - Net::Config - - Check that $home is defined before we use it - -Change 446 on 2000/03/29 by (Graham Barr) - - Net::FTP - - add link to autoftp example - -Change 445 on 2000/03/29 by (Graham Barr) - - Net::FTP::A, Net::FTP::I - - Move the timeout check into the loop to prevent hanging - on write. - -Change 444 on 2000/03/29 by (Graham Barr) - - Net::Cmd, Net::FTP::A, Net::FTP::I - - MacOS does not like the setting of $SIG{PIPE} so check $^O - -Change 432 on 2000/03/29 by (Graham Barr) - - POD cleanup - -Change 431 on 2000/03/29 by (Graham Barr) - - Net::NNTP - - Allow a filehandle to be passed to article, head and body - -Change 430 on 2000/03/29 by (Graham Barr) - - Net::TFTP - - There is no quit method, so don't document one - -Change 402 on 2000/03/23 by (Graham Barr) - - Net::Config - - Fix typos in requires_firewall(), Thanks to Johan Vromans - -Change 401 on 2000/03/23 by (Graham Barr) - - Net::FTP - - fix rmdir for when ls() returns full paths - -Change 379 on 2000/03/13 by (Graham Barr) - - Release 1.0702 - -Change 378 on 2000/03/10 by (Graham Barr) - - Net::FTP::A - - Fix to stop possible forever loop - -Change 377 on 2000/03/10 by (Graham Barr) - - Net::FTP::A - - use " not ' - -Change 376 on 2000/03/10 by (Graham Barr) - - Net::Config - - need to import inet_aton and inet_ntoa - -Change 375 on 2000/03/10 by (Graham Barr) - - Net::Config - - change arg to split to /\./ from "." - -Change 374 on 2000/03/07 by (Graham Barr) - - Net::FTP::A - - Fix return value of read() - -Change 373 on 2000/03/07 by (Graham Barr) - - Net::FTP::I - - Fix typo - -Change 372 on 2000/03/07 by (Graham Barr) - - Release 1.07 - -Change 371 on 2000/03/06 by (Graham Barr) - - - Moved FAQ to Net/libnetFAQ.pod - -Change 370 on 2000/03/06 by (Graham Barr) - - - Added mput and mget examples - -Change 369 on 2000/03/06 by (Graham Barr) - - - Added support for the xwho command in qpage, but no docs yet. - -Change 368 on 2000/03/06 by (Graham Barr) - - new Configure script - -Change 367 on 2000/03/06 by (Graham Barr) - - Local-ize $SIG{__DIE__} - -Change 361 on 2000/02/17 by (Graham Barr) - - Net::FTP - - Fix arg count check in cwd() - -Change 351 on 2000/01/31 by (Graham Barr) - - Net::Cmd - - Fixed bug in getline returning an empty line - - Added optional filehandle argument to read_until_dot. - - Net::POP3 - - get now takes an optional filehandle argument, if given the - message is sent to the handle. - -Change 348 on 2000/01/17 by (Graham Barr) - - Net::Cmd - - fix getline not to drop blank lines - -Change 347 on 2000/01/12 by (Graham Barr) - - Net::Time - - Fix use of uninitialized warning caused by _socket - -Change 346 on 2000/01/11 by (Graham Barr) - - Net::FTP - - Change firewall code to use Net::Config->requires_firewall - - Net::Config - - renamed is_external to be requires_firewall - -Change 345 on 2000/01/06 by (Graham Barr) - - Net::FTP - - Added workaround for a Y2K bug that exists with the MDTM - command on some servers. - -Change 341 on 1999/09/29 by (Graham Barr) - - Net::FTP, Net::FTP::A, Net::FTP::I, Net::FTP::datacon - - Added BlockSize option to control size of blocks read from server - (defaults to 10K) - -Change 340 on 1999/09/28 by (Graham Barr) - - Net::FTP, Configure - - First attempt to add multiple firewall type support - -Change 339 on 1999/09/28 by (Graham Barr) - - Added ppd info to Makefile.PL and libnet.ppd to MANIFEST - -Change 333 on 1999/09/18 by (Graham Barr) - - Release 1.0607 - -Change 332 on 1999/09/18 by (Graham Barr) - - Configure - - Fix typo - -Change 331 on 1999/09/18 by (Graham Barr) - - Net::FTP - - get and put now accept *FD as well as \*FD for the local filehandle - -Change 330 on 1999/09/18 by (Graham Barr) - - Net::Domain - - Added support for VMS as suggest by lane@DUPHY4.Physics.Drexel.Edu - -Change 329 on 1999/09/18 by (Graham Barr) - - Net::Netrc - - Added support for spaces in passwords - -Change 328 on 1999/09/18 by (Graham Barr) - - Net::Cmd - - Map \n's in commands to " " - -Change 327 on 1999/09/18 by (Graham Barr) - - Net::Netrc - - Applied patch from Randy Merrell to fix / escaping - -Change 318 on 1999/08/06 by (Graham Barr) - - Net::Cmd - - Remove use of defined(@ISA) - -Change 316 on 1999/07/11 by (Graham Barr) - - Net::POP3 - - Added ping method supplied by William Rolston - -Change 309 on 1999/05/05 by (Graham Barr) - - Net::FTP - - Check that writes to local file succeed - -Change 308 on 1999/05/05 by (Graham Barr) - - Net::FTP - - Fix bug ->size when SIZE and STAT are not implemented - -Change 307 on 1999/05/05 by (Graham Barr) - - Net::POP3 - - The return value for apop is now the same as login - -Change 306 on 1999/05/05 by (Graham Barr) - - Net::POP3 - - login now returns "0E0" when there are no messages on te server. - This is true in a boolean context, but zero in a numeric context - -Change 305 on 1999/05/05 by (Graham Barr) - - Net::FTP::A - - Fixed bug when sending a file in ascii mode that already contains - \r\n character sequences - - Made improvements to speed of \r\n <-> \n translation - -Change 304 on 1999/05/05 by (Graham Barr) - - Net::FTP - - Added hash mark printing - -Change 264 on 1999/03/18 by (Graham Barr) - - Net::TFTP - - Fix typo in CLOSE() - -Change 262 on 1999/03/16 by (Graham Barr) - - Net::FTP - - new should only call authorize if there is user/passwd data - - Net::SMTP - - Allow ->to to ignore bad addresses - -Change 254 on 1999/02/24 by (Graham Barr) - - Added some debug to t/ftp.t to help understand failure - -Change 253 on 1999/02/17 by (Graham Barr) - - Net::Cmd - - Added checks for a closed connection - -Change 252 on 1999/02/17 by (Graham Barr) - - Net::Domain - - set FQDN = IP if host does not have a name - -Change 248 on 1999/02/06 by (Graham Barr) - - Net::Domain - - check for defined(&main::SYS_gethostname) before calling syscall - as user may have a UNIVERSAL::AUTOLOADER defined - -Change 245 on 1999/01/18 by (Graham Barr) - - Net::FTP - - Modify mkdir to call ->cwd(), not ->cd() - -Change 206 on 1998/10/21 by (Graham Barr) - - Fix typo in Net::Cmd - -Change 204 on 1998/10/18 by (Graham Barr) - - Net::SMTP - - DESTROY now does nothing, so any half-sent message should be aborted - -Change 198 on 1998/10/16 by (Graham Barr) - - Net::Config added - - Configure, Makefile.PL - - Canges to handle new Net::Config module - -Change 197 on 1998/10/16 by (Graham Barr) - - Net::FTP - - Fixed return vlue of _ACCT - - Net::Cmd - - Fixed datasend to ensure all data is sent - - Fixed a || bug in getline - - Some FAQ updates - -Change 196 on 1998/10/16 by (Graham Barr) - - Net::TFTP - - Initial public release - -Change 195 on 1998/10/04 by (Graham Barr) - - Net::FTP - - Fixed bad use of ||= in cwd() - - Net::POP3 - - Fixed pattern for -ERR (had +ERR) - -Change 191 on 1998/09/26 by (Graham Barr) - - Net::POP3 - - Fix bug in UIDL - -Change 187 on 1998/09/02 by (Graham Barr) - - Net::TFTP - - Some cleanup of the code - - removed leading - from named args - -Change 185 on 1998/08/24 by (Graham Barr) - - Net::TFTP - - Initial version - -Change 184 on 1998/08/23 by (Graham Barr) - - Remove mention of Net::SNMP from README - -Change 183 on 1998/08/07 by (Graham Barr) - - Net::Domain - - Fix problem with returning last name instead of first name for a - win32 multi-homed machine - -Change 182 on 1998/08/07 by (Graham Barr) - - Net::FTP - - _list_cmd returned (undef) instead of () - - Fix typo in docs - - Net::NNTP - - Fix typo in docs - -Change 181 on 1998/08/05 by (Graham Barr) - - Net::FTP - - Allow spaces in filenames (ick!) - -Change 179 on 1998/08/05 by (Graham Barr) - - Net::FTP - - added new rmdir from Dunkin Software - - fix to the code generating the listen port - -Change 171 on 1998/07/09 by (Graham Barr) - - Net::FTP - - login will now send ACCT if $acct is defined and the PASS - command completed with 2xx or 3xx - - Added a check for the close of the dataconn in _store_cmd - - Debug trace will hide any parameter given to ACCT - -Change 167 on 1998/07/04 by (Graham Barr) - - - Added Config.eg, an example Config.pm - - Removed set method from Net::Config - - Removed check for Data::Dumper from Makefile.PL - -Change 157 on 1998/06/20 by (Graham Barr) - - Net::FTP - - Another small tweak to ->supported() - -Change 156 on 1998/06/19 by (Graham Barr) - - Net::FTP - - Tweak to ->supported() to better detect reports from some - servers (NcFTPd) - -Change 153 on 1998/06/17 by (Graham Barr) - - Net::FTP - - Fix "Use of uninitialized" warning, patch from - Lars Thegler - -Change 148 on 1998/06/07 by (Graham Barr) - - Net::SMTP - - Fix typo - -Change 147 on 1998/06/07 by (Graham Barr) - - Net::SMTP - - Added ->supports() - - Added ->etrn() - - Updated FAQ - -Change 141 on 1998/05/24 by (Graham Barr) - - Net::SMTP - - Added banner() method - -Change 132 on 1998/04/19 by (Graham Barr) - - Net::POP3 - - Added ResvPort option to new() - -Change 131 on 1998/04/19 by (Graham Barr) - - Makefile.PL - - Patch for running $^X Configure under VMS - -Change 130 on 1998/04/19 by (Graham Barr) - - Net::FTP, Net::POP3 - - wrapped getpwuid in eval {} as some OSs (eg NT) do not support it - -Change 129 on 1998/04/19 by (Graham Barr) - - Net::FTP - - Enhanced ->size() to try different approaces if SIZE is - not implemented - -Change 128 on 1998/04/16 by (Graham Barr) - - Net::Time - - Correct number of seconds in a year - -Change 126 on 1998/04/07 by (Graham Barr) - - Net::FTP, Net::FTP::A, Net::FTP::I, Net::Cmd - - changes for undef checking on sysread/syswrite - -Change 118 on 1998/02/24 by (Graham Barr) - - Net::FTP - - Added site method - -Change 117 on 1998/02/24 by (Graham Barr) - - Net::POP3 - - Remove use of map in a void context - -Change 116 on 1998/02/21 by (Graham Barr) - - Net::FTP - - Changes to mkdir for recursive creates. - -Change 114 on 1998/02/21 by (Graham Barr) - - Net::Domain - - Change $SIG{__DIE__} to $SIG{'__DIE__'} to stop warning in 5.003 - -Change 113 on 1998/02/18 by (Graham Barr) - - Net::FTP::A - - modified regexp in write for converting to CRLF, should now work with MacOS - - Net::FTP - - Added use of File::Basename - - Small tweak to abort() - - Net::Time - - Changed inet_time to handle MacOS - - Net::Netrc - - Fixes for MacOS - - Net::Domain - - Fixes for MacOS - - Net::SMTP - - Fix for new() to fail if HELO command fails - -Change 108 on 1998/02/15 by (Graham Barr) - - Net::FTP - - Added check for filenames with spaces, \r or \n - -Change 107 on 1998/02/07 by (Graham Barr) - - Net::FTP - - Ensure dataconn object is in reading mode for data transfers - -Change 101 on 1998/01/23 by (Graham Barr) - - Renamed FAQ.pod as FAQ - -Change 100 on 1998/01/23 by (Graham Barr) - - Net::NNTP - - Added Reader option to new() - -Change 99 on 1998/01/23 by (Graham Barr) - - Net::POP3 - - fix pass() to call popstat() if pattern does not match for - message count - -Change 98 on 1998/01/23 by (Graham Barr) - - Restore changes lost in disk-crash - - *** Patch 1.0605 - - Sun Dec 21 1997 (Graham Barr) - - Net::FTP - - Fix for pasv_xfer, previous version hung if an error occured - while setting up the link between the two servers. - - Sun Dec 14 1997 (Graham Barr) - - Net::Domain - - Fix for 'Use of uninitialized' when setting $SIG{__DIE__} - - Sat Dec 13 1997 (Graham Barr) - - Net::Domain, Net::Netrc - - patches from Nick Ing-Simmons for MSWin32 - - *** Patch 1.0604 - - Thu Dec 11 1997 (Graham Barr) - - Net::FTP - - Removed use of AutoLoader, it was causing problems on - some platforms - -Change 92 on 1997/12/09 by (Graham Barr) - - Net::FTP - - Fix to pasv_xfer, the command stream on the source side was left - out of sync. - -Change 91 on 1997/12/05 by (Graham Barr) - - MANIFEST, FAQ.pod - - Added initial FAQ document - -Change 90 on 1997/12/05 by (Graham Barr) - - Net::FTP - - Set $@ if ->new() fails - -Change 82 on 1997/11/30 by (Graham Barr) - - x - -Change 79 on 1997/11/30 by (Graham Barr) - - Net::Cmd - - Fix for read_until_dot entering an endless loop, now returns undef - - Net::POP3 - - Fix ->list() and ->uidl() to handle undef being returned from - ->read_until_dot() - -Change 78 on 1997/11/30 by (Graham Barr) - - Net::FTP - - Fix to login() and authorize() for OS/2 which does not - support getpw*() - -Change 65 on 1997/11/28 by (Graham Barr) - - Net::Domain - - If user has defined $SIG{__DIE__} then failures inside eval - still call it. local-ized $SIG{__DIE__} to stop this as Net::Domain - used eval to hide such errors. - -Change 64 on 1997/11/28 by (Graham Barr) - - t/nntp.t - - Now exits passing if commands fail due to not having - authorization. - -Change 61 on 1997/11/26 by (Graham Barr) - - none - -Change 60 on 1997/11/26 by (Graham Barr) - - Net::FTP::I - - Fix to prevent ABOR being sent when xfer is complete - - Change to write() to ensure whole packet is sent - - Net::FTP - - Moved $TELNET_ vars to top of file so that autosplit does not place them - in the wrong file and cause "Use of undefined ...." - - Clarification on the result from ->size() added to docs. - - pasv_xfer changed to use stor as stou is not a "MUST-have" command - - added pasv_xfer_unique - - Net::PH - - Documentation updates. - - t/nntp.t - - Modified to test for a list of groups - -Change 58 on 1997/11/18 by (Graham Barr) - - t/nntp.t - - Modified to check for more groups before failure - -Change 56 on 1997/11/18 by (Graham Barr) - - Net::SMTP - - Corrected documentation for ->expand() - -Change 54 on 1997/11/18 by (Graham Barr) - - Makefile.PL - - change to code for creating Net::Config - - Net::FTP::A - - Change to write() to ensure whole packet is sent - - Documentation correction to dir() and ls() - - Net::FTP::dataconn - - Stop abort be called when a write socket is being closed. - - Net::NNTP - - Changes to postok logic - - Net::PH - - fields() now also returns a reference to an ordered array of tag names - if called in an array context. - - Net::Cmd - - Catch added for SIGPIPE while in ->command() - -Change 43 on 1997/11/05 by (Graham Barr) - - rename files - -Change 39 on 1997/11/05 by (Graham Barr) - - Configure - - Fix croak problem - -Change 38 on 1997/11/05 by (Graham Barr) - - Net::FTP, Net::NNTP, Net::PH, Net::POP3, Net::SMTP, Net::SNPP - - Fix error cause by calling close method when "unexpected EOF: - has been encountered. - - t/require.t - - Remove Net::Telnet test - -Change 37 on 1997/11/01 by (Graham Barr) - - Release 1.06 - -Change 36 on 1997/11/01 by (Graham Barr) - - none - -Change 35 on 1997/11/01 by (Graham Barr) - - Net::FTP - - Fixed undef warning in login() when $ruser does not exist in .netrc - -Change 34 on 1997/11/01 by (Graham Barr) - - Net::FTP - - Added new supported() method - -Change 33 on 1997/11/01 by (Graham Barr) - - Net::FTP - - DESTORY now sends quit command - - corrected OOB commands sent prior to an abort command - - close will call abort unless eof seen - - documentation updates - - Net::FTP::datacon - - abort() will read a byte if non have been read - - Net::FTP::A - - read was using arg#3 as an offset ?? change to use as timeout, this - now matches Net::FTP::I::read and the docs - - speedup to read() - -Change 18 on 1997/10/04 by (Graham Barr) - - Release 1.17 - -Change 15 on 1997/09/27 by (Graham Barr) - - Email address and documentation changes - -Change 14 on 1997/09/27 by (Graham Barr) - - Net::FTP - - Added account method so ACCT command can be sent independantly - of ->login() - - Fixed a bug which caused an infinite loop if EOF happend on the - command channel while executing code to work around MS FTP - servers - - Net::Cmd - - Fixed undefined warning when an unexpected EOF is encountered - - Net::NNTP - - Added a call to ->reader() from within ->new(), just in case we are - talking to an INN server, but we have transfer rights. This will - ensure we are talking to nnrpd. - - Net::SNPP - - Fixed a bug in ->new() while locating default host - -Change 13 on 1997/09/27 by (Graham Barr) - - Net::FTP - - Modified code which determined whether to connect via a Firewall. - if the Firewall wall option is passed then it will be used, - reguardless of whether the real machine can be reached. - - The Firewall option to new is now used in preference over - the FTP_FIREWALL environment variable. - -Change 12 on 1997/09/27 by (Graham Barr) - - Net::Cmd - - modified ->response() to return CMD_ERROR if ->getline() returns - undef - -Change 6 on 1997/09/14 by (Graham Barr) - - Small tweak to Makefile,PL to remove requirement for Data::Dumper - -Change 3 on 1997/09/13 by (Graham Barr) - - Makefile.PL - - Local config file libnet.cfg installed as Net::Config - -Change 2 on 1997/09/13 by (Graham Barr) - - Net::FTP - - Modified to use AutoLoader - - Fixed Net::FTP::[AI]::write to trap SIGPIPE errors - and return an error, instead of aborting the script - -Change 1 on 1997/09/13 by (Graham Barr) - - A new beginning - diff --git a/lib/Net/Changes.libnet b/lib/Net/Changes.libnet new file mode 100644 index 0000000..9e5f0a1 --- /dev/null +++ b/lib/Net/Changes.libnet @@ -0,0 +1,30 @@ +libnet 1.18 -- Mon Mar 22 16:19:01 GMT 2004 + +Bug Fixes + * Fixed bug in CRLF translation in Net::Cmd datasend/dataend methods + * Fixed bug in converting numbers returned by PASV command into a + packed IP address + * Fixed bug that caused Net::FTP->get to truncate the local file after + the restart method had been called + * Fixed bug in Net::FTP-.rmdir when the server returned . and .. in + the contents of a directory + * Fixed bug in POP3 that was sending unnecessary RSETs + +Enhancements + * Added support for POP3 CAPA command + * Added support for XVERP to Net::SMTP + * Added Net::POP3->banner method to return the banner received from + the server during connect + * Added Net::POP3->auth method for performing authentication using + SASL, requires Authen::SASL + * Added Host option to ->new constructor of FTP, NNTP, SMTP and POP3 + which can be used instead of passing the host as the first argument + * Added ->host method to FTP, NNTP, SMTP and POP3 to return the host + string used for the connect. This is useful to determine which host + was connected to when multiple hosts are specified + * Added support for more non-standard responses to Net::FTP->size + * Updated POD for Net::SMTP wrt. not passing a Hello parameter to the + constructor. (Jeff Macdonald) + +ChangeLogs for releases prior to 1.18 may be found at +http://svn.mutatus.co.uk/browse/libnet/tags/libnet-1.17/ChangeLog diff --git a/lib/Net/Cmd.pm b/lib/Net/Cmd.pm index 6899a97..0324a9b 100644 --- a/lib/Net/Cmd.pm +++ b/lib/Net/Cmd.pm @@ -1,4 +1,4 @@ -# Net::Cmd.pm $Id: //depot/libnet/Net/Cmd.pm#33 $ +# Net::Cmd.pm $Id: //depot/libnet/Net/Cmd.pm#34 $ # # Copyright (c) 1995-1997 Graham Barr . All rights reserved. # This program is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ BEGIN { } } -$VERSION = "2.24"; +$VERSION = "2.25"; @ISA = qw(Exporter); @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING); @@ -198,7 +198,7 @@ sub command $cmd->dataend() - if(exists ${*$cmd}{'net_cmd_need_crlf'}); + if(exists ${*$cmd}{'net_cmd_last_ch'}); if (scalar(@_)) { @@ -392,13 +392,10 @@ sub datasend return 0 unless defined(fileno($cmd)); - unless (length $line) { - # Even though we are not sending anything, the fact we were - # called means that dataend needs to be called before the next - # command, which happens of net_cmd_need_crlf exists - ${*$cmd}{'net_cmd_need_crlf'} ||= 0; - return 1; - } + my $last_ch = ${*$cmd}{'net_cmd_last_ch'}; + $last_ch = ${*$cmd}{'net_cmd_last_ch'} = "\012" unless defined $last_ch; + + return 1 unless length $line; if($cmd->debug) { foreach my $b (split(/\n/,$line)) { @@ -406,13 +403,22 @@ sub datasend } } - $line =~ s/\r?\n/\r\n/sg; $line =~ tr/\r\n/\015\012/ unless "\r" eq "\015"; - $line =~ s/(\012\.)/$1./sog; - $line =~ s/^\./../ unless ${*$cmd}{'net_cmd_need_crlf'}; + my $first_ch = ''; + + if ($last_ch eq "\015") { + $first_ch = "\012" if $line =~ s/^\012//; + } + elsif ($last_ch eq "\012") { + $first_ch = "." if $line =~ /^\./; + } + + $line =~ s/\015?\012(\.?)/\015\012$1$1/sg; - ${*$cmd}{'net_cmd_need_crlf'} = substr($line,-1,1) ne "\012"; + substr($line,0,0) = $first_ch; + + ${*$cmd}{'net_cmd_last_ch'} = substr($line,-1,1); my $len = length($line); my $offset = 0; @@ -500,19 +506,26 @@ sub dataend return 0 unless defined(fileno($cmd)); - return 1 - unless(exists ${*$cmd}{'net_cmd_need_crlf'}); + my $ch = ${*$cmd}{'net_cmd_last_ch'}; + my $tosend; + + if (!defined $ch) { + return 1; + } + elsif ($ch ne "\012") { + $tosend = "\015\012"; + } + + $tosend .= ".\015\012"; local $SIG{PIPE} = 'IGNORE' unless $^O eq 'MacOS'; - syswrite($cmd,"\015\012",2) - if ${*$cmd}{'net_cmd_need_crlf'}; $cmd->debug_print(1, ".\n") if($cmd->debug); - syswrite($cmd,".\015\012",3); + syswrite($cmd,$tosend, length $tosend); - delete ${*$cmd}{'net_cmd_need_crlf'}; + delete ${*$cmd}{'net_cmd_last_ch'}; $cmd->response() == CMD_OK; } @@ -759,6 +772,6 @@ it under the same terms as Perl itself. =for html
-I<$Id: //depot/libnet/Net/Cmd.pm#33 $> +I<$Id: //depot/libnet/Net/Cmd.pm#34 $> =cut diff --git a/lib/Net/FTP.pm b/lib/Net/FTP.pm index beda695..7aad1a6 100644 --- a/lib/Net/FTP.pm +++ b/lib/Net/FTP.pm @@ -1,6 +1,6 @@ # Net::FTP.pm # -# Copyright (c) 1995-8 Graham Barr . All rights reserved. +# Copyright (c) 1995-2003 Graham Barr . All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # @@ -22,7 +22,7 @@ use Net::Config; use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC); # use AutoLoader qw(AUTOLOAD); -$VERSION = "2.72"; # $Id: //depot/libnet/Net/FTP.pm#80 $ +$VERSION = "2.74"; # $Id: //depot/libnet/Net/FTP.pm#84 $ @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about @@ -50,8 +50,14 @@ BEGIN { sub new { my $pkg = shift; - my $peer = shift; - my %arg = @_; + my ($peer,%arg); + if (@_ % 2) { + $peer = shift ; + %arg = @_; + } else { + %arg = @_; + $peer=delete $arg{Host}; + } my $host = $peer; my $fire = undef; @@ -124,6 +130,13 @@ sub new ## User interface methods ## + +sub host { + my $me = shift; + ${*$me}{'net_ftp_host'}; +} + + sub hash { my $ftp = shift; # self @@ -206,7 +219,7 @@ sub size { my $io; if($ftp->supported("SIZE")) { return $ftp->_SIZE($file) - ? ($ftp->message =~ /(\d+)\s*$/)[0] + ? ($ftp->message =~ /(\d+)\s*(bytes?\s*)?$/)[0] : undef; } elsif($ftp->supported("STAT")) { @@ -443,8 +456,7 @@ sub get croak("Bad remote filename '$remote'\n") if $remote =~ /[\r\n]/s; - ${*$ftp}{'net_ftp_rest'} = $where - if ($where); + ${*$ftp}{'net_ftp_rest'} = $where if defined $where; delete ${*$ftp}{'net_ftp_port'}; delete ${*$ftp}{'net_ftp_pasv'}; @@ -460,7 +472,7 @@ sub get { $loc = \*FD; - unless(sysopen($loc, $local, O_CREAT | O_WRONLY | ($where ? O_APPEND : O_TRUNC))) + unless(sysopen($loc, $local, O_CREAT | O_WRONLY | (${*$ftp}{'net_ftp_rest'} ? O_APPEND : O_TRUNC))) { carp "Cannot open Local file $local: $!\n"; $data->abort; @@ -581,14 +593,14 @@ sub rmdir # Try to delete the contents # Get a list of all the files in the directory - my $filelist = $ftp->ls($dir); + my @filelist = grep { !/^\.{1,2}$/ } $ftp->ls($dir); return undef - unless $filelist && @$filelist; # failed, it is probably not a directory + unless @filelist; # failed, it is probably not a directory # Go thru and delete each file or the directory my $file; - foreach $file (map { m,/, ? $_ : "$dir/$_" } @$filelist) + foreach $file (map { m,/, ? $_ : "$dir/$_" } @filelist) { next # successfully deleted the file if $ftp->delete($file); @@ -713,7 +725,7 @@ sub _store_cmd # _store_cmd call, figure out if the local file is a regular file(not # a pipe, or device) and if so get the file size from stat, and send # an ALLO command before sending the STOR, STOU, or APPE command. - my $size = -f $local && -s _; # no ALLO if sending data from a pipe + my $size = do { local $^W; -f $local && -s _ }; # no ALLO if sending data from a pipe $ftp->_ALLO($size) if $size; } croak("Bad remote filename '$remote'\n") @@ -939,7 +951,7 @@ sub _dataconn if(defined ${*$ftp}{'net_ftp_pasv'}) { - my @port = split(/,/,${*$ftp}{'net_ftp_pasv'}); + my @port = map { 0+$_ } split(/,/,${*$ftp}{'net_ftp_pasv'}); $data = $pkg->new(PeerAddr => join(".",@port[0..3]), PeerPort => $port[4] * 256 + $port[5], @@ -1280,14 +1292,23 @@ this if you really know what you're doing). =over 4 -=item new (HOST [,OPTIONS]) +=item new ([ HOST ] [, OPTIONS ]) This is the constructor for a new Net::FTP object. C is the name of the remote host to which an FTP connection is required. +C is optional. If C is not given then it may instead be +passed as the C option described below. + C are passed in a hash like fashion, using key and value pairs. Possible options are: +B - FTP host to connect to. It may be a single scalar, as defined for +the C option in L, or a reference to +an array with hosts to try in turn. The L method will return the value +which was used to connect to the host. + + B - The name of a machine which acts as an FTP firewall. This can be overridden by an environment variable C. If specified, and the given host cannot be directly connected to, then the @@ -1416,8 +1437,6 @@ C will attempt to create all the directories in the given path. Returns the full pathname to the new directory. -=item ls ( [ DIR ] ) - =item alloc ( SIZE [, RECORD_SIZE] ) The alloc command allows you to give the ftp server a hint about the size @@ -1432,6 +1451,8 @@ automatically for normal files so that this method need only be called if you are transfering data from a socket, named pipe, or other stream not associated with a normal file. +=item ls ( [ DIR ] ) + Get a directory listing of C, or the current directory. In an array context, returns a list of lines returned from the server. In @@ -1761,12 +1782,8 @@ Roderick Schertler - for various inputs =head1 COPYRIGHT -Copyright (c) 1995-1998 Graham Barr. All rights reserved. +Copyright (c) 1995-2003 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=for html
- -I<$Id: //depot/libnet/Net/FTP.pm#80 $> - =cut diff --git a/lib/Net/NNTP.pm b/lib/Net/NNTP.pm index acf2bf1..f9a6ddf 100644 --- a/lib/Net/NNTP.pm +++ b/lib/Net/NNTP.pm @@ -14,16 +14,21 @@ use Carp; use Time::Local; use Net::Config; -$VERSION = "2.22"; # $Id: //depot/libnet/Net/NNTP.pm#18 $ +$VERSION = "2.23"; @ISA = qw(Net::Cmd IO::Socket::INET); sub new { my $self = shift; my $type = ref($self) || $self; - my $host; - $host = shift if @_ % 2; - my %arg = @_; + my ($host,%arg); + if (@_ % 2) { + $host = shift ; + %arg = @_; + } else { + %arg = @_; + $host=delete $arg{Host}; + } my $obj; $host ||= $ENV{NNTPSERVER} || $ENV{NEWSHOST}; @@ -82,6 +87,11 @@ sub new $obj; } +sub host { + my $me = shift; + ${*$me}{'net_nntp_host'}; +} + sub debug_text { my $nntp = shift; @@ -713,13 +723,19 @@ in RFC977. C inherits its communication methods from C This is the constructor for a new Net::NNTP object. C is the name of the remote host to which a NNTP connection is required. If not -given two environment variables are checked, first C then +given then it may be passed as the C option described below. If no host is passed +then two environment variables are checked, first C then C, then C is checked, and if a host is not found then C is used. C are passed in a hash like fashion, using key and value pairs. Possible options are: +B - NNTP host to connect to. It may be a single scalar, as defined for +the C option in L, or a reference to +an array with hosts to try in turn. The L method will return the value +which was used to connect to the host. + B - Maximum time, in seconds, to wait for a response from the NNTP server, a value of zero will cause all IO operations to block. (default: 120) @@ -841,6 +857,12 @@ that it will allow posting. =item authinfo ( USER, PASS ) +Authenticates to the server (using AUTHINFO USER / AUTHINFO PASS) +using the supplied username and password. Please note that the +password is sent in clear text to the server. This command should not +be used with valuable passwords unless the connection to the server is +somehow protected. + =item list () Obtain information about all the active newsgroups. The results is a reference diff --git a/lib/Net/POP3.pm b/lib/Net/POP3.pm index 01b0bb8..3a5aec0 100644 --- a/lib/Net/POP3.pm +++ b/lib/Net/POP3.pm @@ -1,6 +1,6 @@ # Net::POP3.pm # -# Copyright (c) 1995-1997 Graham Barr . All rights reserved. +# Copyright (c) 1995-2004 Graham Barr . All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. @@ -13,7 +13,7 @@ use Net::Cmd; use Carp; use Net::Config; -$VERSION = "2.24"; # $Id: //depot/libnet/Net/POP3.pm#24 $ +$VERSION = "2.27"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -21,9 +21,14 @@ sub new { my $self = shift; my $type = ref($self) || $self; - my $host; - $host = shift if @_ % 2; - my %arg = @_; + my ($host,%arg); + if (@_ % 2) { + $host = shift ; + %arg = @_; + } else { + %arg = @_; + $host=delete $arg{Host}; + } my $hosts = defined $host ? [ $host ] : $NetConfig{pop3_hosts}; my $obj; my @localport = exists $arg{ResvPort} ? ( LocalPort => $arg{ResvPort} ): (); @@ -60,6 +65,11 @@ sub new $obj; } +sub host { + my $me = shift; + ${*$me}{'net_pop3_host'}; +} + ## ## We don't want people sending me their passwords when they report problems ## now do we :-) @@ -227,7 +237,9 @@ sub getfh sub delete { @_ == 2 or croak 'usage: $pop3->delete( MSGNUM )'; - $_[0]->_DELE($_[1]); + my $me = shift; + return 0 unless $me->_DELE(@_); + ${*$me}{'net_pop3_deleted'} = 1; } sub uidl @@ -311,6 +323,8 @@ sub _PING { shift->command('PING',$_[0])->response() == CMD_OK } sub _RPOP { shift->command('RPOP',$_[0])->response() == CMD_OK } sub _LAST { shift->command('LAST')->response() == CMD_OK } +sub _CAPA { shift->command('CAPA')->response() == CMD_OK } + sub quit { my $me = shift; @@ -323,7 +337,7 @@ sub DESTROY { my $me = shift; - if(defined fileno($me)) + if(defined fileno($me) and ${*$me}{'net_pop3_deleted'}) { $me->reset; $me->quit; @@ -334,28 +348,111 @@ sub DESTROY ## POP3 has weird responses, so we emulate them to look the same :-) ## -sub response -{ - my $cmd = shift; - my $str = $cmd->getline() || return undef; - my $code = "500"; +sub response { + my $cmd = shift; + my $str = $cmd->getline() or return undef; + my $code = "500"; - $cmd->debug_print(0,$str) - if ($cmd->debug); + $cmd->debug_print(0, $str) + if ($cmd->debug); - if($str =~ s/^\+OK\s*//io) - { - $code = "200" + if ($str =~ s/^\+OK\s*//io) { + $code = "200"; } - else - { - $str =~ s/^-ERR\s*//io; + elsif ($str =~ s/^\+\s*//io) { + $code = "300"; + } + else { + $str =~ s/^-ERR\s*//io; } - ${*$cmd}{'net_cmd_resp'} = [ $str ]; - ${*$cmd}{'net_cmd_code'} = $code; + ${*$cmd}{'net_cmd_resp'} = [$str]; + ${*$cmd}{'net_cmd_code'} = $code; - substr($code,0,1); + substr($code, 0, 1); +} + + +sub capa { + my $this = shift; + my ($capa, %capabilities); + + # Fake a capability here + $capabilities{APOP} = '' if ($this->banner() =~ /<.*>/); + + return \%capabilities unless $this->_CAPA(); + + $capa = $this->read_until_dot(); + %capabilities = map { /^\s*(\S+)\s*(.*)/ } @$capa; + $capabilities{APOP} = '' if ($this->banner() =~ /<.*>/); + + return ${*$this}{'net_pop3e_capabilities'} = \%capabilities; +} + +sub capabilities { + my $this = shift; + + ${*$this}{'net_pop3e_capabilities'} || $this->capa; +} + +sub auth { + my ($self, $username, $password) = @_; + + eval { + require MIME::Base64; + require Authen::SASL; + } or return $self->set_error(500,["Need MIME::Base64 and Authen::SASL todo auth"]); + + my $capa = $self->capa; + my $mechanisms = $capa->{SASL} || 'CRAM-MD5'; + + my $sasl; + + if (ref($username) and UNIVERSAL::isa($username,'Authen::SASL')) { + $sasl = $username; + $sasl->mechanism($mechanisms); + } + else { + die "auth(username, password)" if not length $username; + $sasl = Authen::SASL->new(mechanism=> $mechanisms, + callback => { user => $username, + pass => $password, + authname => $username, + }); + } + + # We should probably allow the user to pass the host, but I don't + # currently know and SASL mechanisms that are used by smtp that need it + my $client = $sasl->client_new('pop3',${*$self}{'net_pop3_host'},0); + my $str = $client->client_start; + + # We dont support sasl mechanisms that encrypt the socket traffic. + # todo that we would really need to change the ISA hierarchy + # so we dont inherit from IO::Socket, but instead hold it in an attribute + + my @cmd = ("AUTH", $client->mechanism); + my $code; + + push @cmd, MIME::Base64::encode_base64($str,'') + if defined $str and length $str; + + while (($code = $self->command(@cmd)->response()) == CMD_MORE) { + @cmd = (MIME::Base64::encode_base64( + $client->client_step( + MIME::Base64::decode_base64( + ($self->message)[0] + ) + ), '' + )); + } + + $code == CMD_OK; +} + +sub banner { + my $this = shift; + + return ${*$this}{'net_pop3_banner'}; } 1; @@ -399,17 +496,23 @@ on the object. =over 4 -=item new ( [ HOST, ] [ OPTIONS ] ) +=item new ( [ HOST ] [, OPTIONS ] 0 This is the constructor for a new Net::POP3 object. C is the -name of the remote host to which a POP3 connection is required. +name of the remote host to which an POP3 connection is required. -If C is not given, then the C specified in C -will be used. +C is optional. If C is not given then it may instead be +passed as the C option described below. If neither is given then +the C specified in C will be used. C are passed in a hash like fashion, using key and value pairs. Possible options are: +B - POP3 host to connect to. It may be a single scalar, as defined for +the C option in L, or a reference to +an array with hosts to try in turn. The L method will return the value +which was used to connect to the host. + B - If given then the socket for the C object will be bound to the local port given using C when the socket is created. @@ -430,6 +533,10 @@ empty list. =over 4 +=item auth ( USERNAME, PASSWORD ) + +Attempt SASL authentication. + =item user ( USER ) Send the USER command. @@ -459,6 +566,23 @@ Similar to L, but the password is not sent in clear text. To use this method you must have the Digest::MD5 or the MD5 module installed, otherwise this method will return I. +=item banner () + +Return the sever's connection banner + +=item capa () + +Return a reference to a hash of the capabilties of the server. APOP +is added as a pseudo capability. Note that I've been unable to +find a list of the standard capability values, and some appear to +be multi-word and some are not. We make an attempt at intelligently +parsing them, but it may not be correct. + +=item capabilities () + +Just like capa, but only uses a cache from the last time we asked +the server, so as to avoid asking more than once. + =item top ( MSGNUM [, NUMLINES ] ) Get the header and the first C of the body for the message @@ -542,12 +666,8 @@ Graham Barr =head1 COPYRIGHT -Copyright (c) 1995-1997 Graham Barr. All rights reserved. +Copyright (c) 1995-2003 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=for html
- -I<$Id: //depot/libnet/Net/POP3.pm#24 $> - =cut diff --git a/lib/Net/README.libnet b/lib/Net/README.libnet index ca47fe5..af582ba 100644 --- a/lib/Net/README.libnet +++ b/lib/Net/README.libnet @@ -16,17 +16,21 @@ Net::Time RFC867 Daytime Protocol Net::Time RFC868 Time Protocol Net::NNTP RFC977 Network News Transfer Protocol Net::POP3 RFC1939 Post Office Protocol 3 -Net::SNPP RFC1861 Simple Network Pager Protocol - -FUTURE WORK AVAILABILITY The latest version of libnet is available from the Comprehensive Perl Archive Network (CPAN). To find a CPAN site near you see: - http://www.perl.com/CPAN - ^ no slash here !! + http://search.cpan.org/~gbarr/libnet/ + +The subversion source repository can be browsed at + + http://svn.mutatus.co.uk/browse/libnet/ + +If you have a subversion client, then you can checkout the latest code with + + svn co http://svn.mutatus.co.uk/repos/libnet/trunk libnet INSTALLATION @@ -97,7 +101,7 @@ include a transcript of a run. COPYRIGHT - © 1996-2000 Graham Barr. All rights reserved. + © 1996-2004 Graham Barr. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm index 424854e..e7276de 100644 --- a/lib/Net/SMTP.pm +++ b/lib/Net/SMTP.pm @@ -1,6 +1,6 @@ # Net::SMTP.pm # -# Copyright (c) 1995-1997 Graham Barr . All rights reserved. +# Copyright (c) 1995-2004 Graham Barr . All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. @@ -16,7 +16,7 @@ use IO::Socket; use Net::Cmd; use Net::Config; -$VERSION = "2.26"; # $Id: //depot/libnet/Net/SMTP.pm#31 $ +$VERSION = "2.28"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -24,9 +24,14 @@ sub new { my $self = shift; my $type = ref($self) || $self; - my $host; - $host = shift if @_ % 2; - my %arg = @_; + my ($host,%arg); + if (@_ % 2) { + $host = shift ; + %arg = @_; + } else { + %arg = @_; + $host=delete $arg{Host}; + } my $hosts = defined $host ? $host : $NetConfig{smtp_hosts}; my $obj; @@ -72,6 +77,11 @@ sub new $obj; } +sub host { + my $me = shift; + ${*$me}{'net_smtp_host'}; +} + ## ## User interface methods ## @@ -300,6 +310,18 @@ sub mail } } + if(defined($v = delete $opt{XVERP})) + { + if(exists $esmtp->{'XVERP'}) + { + $opts .= " XVERP" + } + else + { + carp 'Net::SMTP::mail: XVERP option not supported by host'; + } + } + carp 'Net::SMTP::recipient: unknown option(s) ' . join(" ", keys %opt) . ' - ignored' @@ -566,23 +588,26 @@ known as mailhost: =over 4 -=item new Net::SMTP [ HOST, ] [ OPTIONS ] +=item new ( [ HOST ] [, OPTIONS ] ) This is the constructor for a new Net::SMTP object. C is the name of the remote host to which an SMTP connection is required. -If C is an array reference then each value will be attempted -in turn until a connection is made. - -If C is not given, then the C specified in C -will be used. +C is optional. If C is not given then it may instead be +passed as the C option described below. If neither is given then +the C specified in C will be used. C are passed in a hash like fashion, using key and value pairs. Possible options are: B - SMTP requires that you identify yourself. This option -specifies a string to pass as your mail domain. If not -given a guess will be taken. +specifies a string to pass as your mail domain. If not given localhost.localdomain +will be used. + +B - SMTP host to connect to. It may be a single scalar, as defined for +the C option in L, or a reference to +an array with hosts to try in turn. The L method will return the value +which was used to connect to the host. B and B - These parameters are passed directly to IO::Socket to allow binding the socket to a local port. @@ -606,6 +631,20 @@ Example: Debug => 1, ); + # the same + $smtp = Net::SMTP->new( + Host => 'mailhost', + Hello => 'my.mail.domain' + Timeout => 30, + Debug => 1, + ); + + # Connect to the default server from Net::config + $smtp = Net::SMTP->new( + Hello => 'my.mail.domain' + Timeout => 30, + ); + =back =head1 METHODS @@ -634,6 +673,11 @@ command (or HELO if EHLO fails). Since this method is invoked automatically when the Net::SMTP object is constructed the user should normally not have to call it manually. +=item host () + +Returns the value used by the constructor, and passed to IO::Socket::INET, +to connect to the host. + =item etrn ( DOMAIN ) Request a queue run for the DOMAIN given. @@ -663,6 +707,7 @@ in hash like fashion, using key and value pairs. Possible options are: Bits => "7" | "8" | "binary" Transaction =>
Envelope => + XVERP => 1 The C and C parameters are used for DSN (Delivery Status Notification). @@ -673,27 +718,63 @@ Reset the status of the server. This may be called after a message has been initiated, but before any data has been sent, to cancel the sending of the message. -=item recipient ( ADDRESS [, ADDRESS [ ...]] [, OPTIONS ] ) +=item recipient ( ADDRESS [, ADDRESS, [...]] [, OPTIONS ] ) Notify the server that the current message should be sent to all of the addresses given. Each address is sent as a separate command to the server. -Should the sending of any address result in a failure then the -process is aborted and a I value is returned. It is up to the -user to call C if they so desire. +Should the sending of any address result in a failure then the process is +aborted and a I value is returned. It is up to the user to call +C if they so desire. -The C method can some additional OPTIONS which is passed -in hash like fashion, using key and value pairs. Possible options are: +The C method can also pass additional case-sensitive OPTIONS as an +anonymous hash using key and value pairs. Possible options are: - Notify => - SkipBad => ignore bad addresses + Notify => ['NEVER'] or ['SUCCESS','FAILURE','DELAY'] (see below) + SkipBad => 1 (to ignore bad addresses) -If C is true the C will not return an error when a -bad address is encountered and it will return an array of addresses -that did succeed. +If C is true the C will not return an error when a bad +address is encountered and it will return an array of addresses that did +succeed. $smtp->recipient($recipient1,$recipient2); # Good $smtp->recipient($recipient1,$recipient2, { SkipBad => 1 }); # Good - $smtp->recipient("$recipient,$recipient2"); # BAD + $smtp->recipient($recipient1,$recipient2, { Notify => ['FAILURE','DELAY'], SkipBad => 1 }); # Good + @goodrecips=$smtp->recipient(@recipients, { Notify => ['FAILURE'], SkipBad => 1 }); # Good + $smtp->recipient("$recipient,$recipient2"); # BAD + +Notify is used to request Delivery Status Notifications (DSNs), but your +SMTP/ESMTP service may not respect this request depending upon its version and +your site's SMTP configuration. + +Leaving out the Notify option usually defaults an SMTP service to its default +behavior equivalent to ['FAILURE'] notifications only, but again this may be +dependent upon your site's SMTP configuration. + +The NEVER keyword must appear by itself if used within the Notify option and "requests +that a DSN not be returned to the sender under any conditions." + + {Notify => ['NEVER']} + + $smtp->recipient(@recipients, { Notify => ['NEVER'], SkipBad => 1 }); # Good + +You may use any combination of these three values 'SUCCESS','FAILURE','DELAY' in +the anonymous array reference as defined by RFC3461 (see http://rfc.net/rfc3461.html +for more information. Note: quotations in this topic from same.). + +A Notify parameter of 'SUCCESS' or 'FAILURE' "requests that a DSN be issued on +successful delivery or delivery failure, respectively." + +A Notify parameter of 'DELAY' "indicates the sender's willingness to receive +delayed DSNs. Delayed DSNs may be issued if delivery of a message has been +delayed for an unusual amount of time (as determined by the Message Transfer +Agent (MTA) at which the message is delayed), but the final delivery status +(whether successful or failure) cannot be determined. The absence of the DELAY +keyword in a NOTIFY parameter requests that a "delayed" DSN NOT be issued under +any conditions." + + {Notify => ['SUCCESS','FAILURE','DELAY']} + + $smtp->recipient(@recipients, { Notify => ['FAILURE','DELAY'], SkipBad => 1 }); # Good =item to ( ADDRESS [, ADDRESS [...]] ) @@ -724,6 +805,9 @@ which contains the text read from the server. Verify that C
is a legitimate mailing address. +Most sites usually disable this feature in their SMTP service configuration. +Use "Debug => 1" option under new() to see if disabled. + =item help ( [ $subject ] ) Request help text from the server. Returns the text or undef upon failure @@ -760,12 +844,8 @@ Graham Barr =head1 COPYRIGHT -Copyright (c) 1995-1997 Graham Barr. All rights reserved. +Copyright (c) 1995-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=for html
- -I<$Id: //depot/libnet/Net/SMTP.pm#31 $> - =cut diff --git a/lib/Net/Time.pm b/lib/Net/Time.pm index 3fad07e..8b8be60 100644 --- a/lib/Net/Time.pm +++ b/lib/Net/Time.pm @@ -1,6 +1,6 @@ # Net::Time.pm # -# Copyright (c) 1995-1998 Graham Barr . All rights reserved. +# Copyright (c) 1995-2004 Graham Barr . All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. @@ -17,7 +17,7 @@ use IO::Select; @ISA = qw(Exporter); @EXPORT_OK = qw(inet_time inet_daytime); -$VERSION = "2.09"; # $Id: //depot/libnet/Net/Time.pm#9 $ +$VERSION = "2.10"; $TIMEOUT = 120; @@ -61,7 +61,7 @@ sub inet_time my $offset = 0 | 0; return undef - unless $s->recv($buf, length(pack("N",0))); + unless defined $s->recv($buf, length(pack("N",0))); # unpack, we | 0 to ensure we have an unsigned my $time = (unpack("N",$buf))[0] | 0; @@ -87,7 +87,7 @@ sub inet_daytime my $s = _socket('daytime',13,@_) || return undef; my $buf = ''; - $s->recv($buf, 1024) ? $buf + defined($s->recv($buf, 1024)) ? $buf : undef; } @@ -140,12 +140,8 @@ Graham Barr =head1 COPYRIGHT -Copyright (c) 1995-1998 Graham Barr. All rights reserved. +Copyright (c) 1995-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=for html
- -I<$Id: //depot/libnet/Net/Time.pm#9 $> - =cut diff --git a/lib/Net/t/datasend.t b/lib/Net/t/datasend.t new file mode 100644 index 0000000..48655fa --- /dev/null +++ b/lib/Net/t/datasend.t @@ -0,0 +1,143 @@ +#!./perl -w + +BEGIN { + package Foo; + + use IO::File; + use Net::Cmd; + @ISA = qw(Net::Cmd IO::File); + + sub timeout { 0 } + + sub new { + my $fh = shift->new_tmpfile; + binmode($fh); + $fh; + } + + sub output { + my $self = shift; + seek($self,0,0); + local $/ = undef; + scalar(<$self>); + } + + sub response { + return Net::Cmd::CMD_OK; + } +} + +(my $libnet_t = __FILE__) =~ s/datasend.t/libnet_t.pl/; +require $libnet_t or die; + +print "1..15\n"; + +sub check { + my $expect = pop; + my $cmd = Foo->new; + $cmd->datasend unless @_; + foreach my $line (@_) { + $cmd->datasend($line); + } + $cmd->dataend; + is($cmd->output, $expect); +} + +my $cmd; + +check( + # nothing + + ".\015\012" +); + +check( + "a", + + "a\015\012.\015\012", +); + +check( + "a\r", + + "a\015\015\012.\015\012", +); + +check( + "a\rb", + + "a\015b\015\012.\015\012", +); + +check( + "a\rb\n", + + "a\015b\015\012.\015\012", +); + +check( + "a\rb\n\n", + + "a\015b\015\012\015\012.\015\012", +); + +check( + "a\r", + "\nb", + + "a\015\012b\015\012.\015\012", +); + +check( + "a\r", + "\nb\n", + + "a\015\012b\015\012.\015\012", +); + +check( + "a\r", + "\nb\r\n", + + "a\015\012b\015\012.\015\012", +); + +check( + "a\r", + "\nb\r\n\n", + + "a\015\012b\015\012\015\012.\015\012", +); + +check( + "a\n.b\n", + + "a\015\012..b\015\012.\015\012", +); + +check( + ".a\n.b\n", + + "..a\015\012..b\015\012.\015\012", +); + +check( + ".a\n", + ".b\n", + + "..a\015\012..b\015\012.\015\012", +); + +check( + ".a", + ".b\n", + + "..a.b\015\012.\015\012", +); + +check( + "a\n.", + + "a\015\012..\015\012.\015\012", +); + diff --git a/lib/Net/t/hostname.t b/lib/Net/t/hostname.t index e085591..9db66a9 100644 --- a/lib/Net/t/hostname.t +++ b/lib/Net/t/hostname.t @@ -32,11 +32,11 @@ else { print "not ok 1\n"; } -# This check thats hostanme does not overwrite $_ +# This checks thats hostanme does not overwrite $_ my @domain = qw(foo.example.com bar.example.jp); my @copy = @domain; -my @dummy = grep { hostname eq $_ } @domain; +my @dummy = grep { defined hostname() and hostname() eq $_ } @domain; ($domain[0] && $domain[0] eq $copy[0]) ? print "ok 2\n"