Skip Menu |

This queue is for tickets about the Net-Printer CPAN distribution.

Report information
The Basics
Id: 2098
Status: resolved
Worked: 1.2 hours (70 min)
Priority: 0/
Queue: Net-Printer

People
Owner: cfuhrman [...] panix.com
Requestors: selsky [...] columbia.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: rfc 1179 compliance
I'm able to use Net::Printer with non-RFC 1179 compliant printers. However, when I try to use the module with RFC 1179 compliant printers, I get a "malformed from address" error. http://web.mit.edu/source/third/lprng/doc/LPRng-HOWTO-6.html According to section 3.1 of the RFC, the source port of the LPD connection must be in the range 721 to 731. These ports require root access to bind to on unix since they are under 1024. Can there be an option for the module to be RFC 1179 compliant? Please take a look at the attached patch. It adds a "rfc1179" option to the constructor to allow the user to specify that they want to follow the RFC. I also updated the docs for this new option. Please let me know what you think.
--- Printer.pm.orig Wed Feb 12 20:53:07 2003 +++ Printer.pm Thu Feb 13 05:45:22 2003 @@ -177,9 +177,20 @@ # Parameter(s) my $self = shift; - $sock = IO::Socket::INET->new(Proto => 'tcp', - PeerAddr => $self->{server}, - PeerPort => $self->{port}); + if (uc($self->{rfc1179}) eq "NO") { + $sock = IO::Socket::INET->new(Proto => 'tcp', + PeerAddr => $self->{server}, + PeerPort => $self->{port}); + } else { + # RFC 1179 says "source port be in the range 721-731" + foreach my $p (721 .. 731) { + $sock = IO::Socket::INET->new( PeerAddr => $self->{server}, + PeerPort => $self->{port}, + Proto => 'tcp', + LocalPort => $p + ) and last; + } + } return $sock; @@ -760,6 +771,7 @@ "printer" => "lp", "server" => "localhost", "port" => 515, + "rfc1179" => "No", "debug" => "No" ); # Parameter(s); @@ -854,6 +866,9 @@ Default "515". lineconvert - [optional] Perform LF -> LF/CR translation. + Default "NO" + + rfc1179 - [optional] Use RFC 1179 compliant source address. Default "NO" =head2 Functions
Howdy, I have received your patches and will be testing them out when I get a chance. I have some reservations about running Net::Printer in rfc-compliant mode because I think it'd need to run with root privileges which is dangerous. I'll look into it and do some testing. Cheers!
From: selsky [...] columbia.edu
It would only need root access if you needed to be in RFC compliant mode. Otherwise, you can run it as any user. Show quoted text
> I have received your patches and will be testing them out when I get a > chance. I have some reservations about running Net::Printer in > rfc-compliant mode because I think it'd need to run with root privileges > which is dangerous. I'll look into it and do some testing.
Fixed in version 0.31. The new version should be in the CPAN Repository within the next day or so. Note that I added a warning in the documentation about running with root privileges with this option enabled.
Sending the previous mail has failed. Please contact your admin, they can find more details in the logs.