r23224 - in /trunk/libnet-sip-perl: Changes META.yml THANKS debian/changelog lib/Net/SIP.pm lib/Net/SIP/Authorize.pm lib/Net/SIP/Authorize.pod t/08_register_with_auth.t t/09_fdleak.t t/10_fdleak.t

ghostbar-guest at users.alioth.debian.org ghostbar-guest at users.alioth.debian.org
Tue Jul 15 11:25:04 UTC 2008


Author: ghostbar-guest
Date: Tue Jul 15 11:25:01 2008
New Revision: 23224

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=23224
Log:
* New upstream release
* This was so easy that I don't dare to release it.

Modified:
    trunk/libnet-sip-perl/Changes
    trunk/libnet-sip-perl/META.yml
    trunk/libnet-sip-perl/THANKS
    trunk/libnet-sip-perl/debian/changelog
    trunk/libnet-sip-perl/lib/Net/SIP.pm
    trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pm
    trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pod
    trunk/libnet-sip-perl/t/08_register_with_auth.t
    trunk/libnet-sip-perl/t/09_fdleak.t
    trunk/libnet-sip-perl/t/10_fdleak.t

Modified: trunk/libnet-sip-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/Changes?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/Changes (original)
+++ trunk/libnet-sip-perl/Changes Tue Jul 15 11:25:01 2008
@@ -1,6 +1,7 @@
 Revision history for Net::SIP
 
-0.45_3
+
+0.46
    - support for canceling a call after some time of ringing based on
      input from http://rt.cpan.org/Ticket/Display.html?id=34576
      see Net::SIP::Simple::Call documentation for sub reinvite, parameters
@@ -13,6 +14,9 @@
      because of EINTR
    - fixes in handling response in Net::SIP::Endpoint::Context for the case,
      that multiple requests shared the same tid (e.g. INVITE,CANCEL)
+   - support for user2a1 instead of user2pass in Net::SIP::Authorize based
+     on input from Alex Revetski <revetski[AT]gmail[DOT]com>
+     http://rt.cpan.org/Ticket/Display.html?id=34648
 
 0.45
    - Net::SIP::Packet::sdp_body - content type is case insensitive,

Modified: trunk/libnet-sip-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/META.yml?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/META.yml (original)
+++ trunk/libnet-sip-perl/META.yml Tue Jul 15 11:25:01 2008
@@ -1,11 +1,11 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Net-SIP
-version:      0.45_3
+version:      0.46
 version_from: lib/Net/SIP.pm
 installdirs:  site
 requires:
     Net::DNS:                      0.56
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30_01
+generated_by: ExtUtils::MakeMaker version 6.17

Modified: trunk/libnet-sip-perl/THANKS
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/THANKS?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/THANKS (original)
+++ trunk/libnet-sip-perl/THANKS Tue Jul 15 11:25:01 2008
@@ -11,3 +11,4 @@
 <fiorellino[AT]gmail[DOT]com>
 <andrew[DOT]pogrebennyk[AT]portaone[DOT]com>
 Roland Mas <lolando[AT]debian[DOT]org>
+Alex Revetski <revetski[AT]gmail[DOT]com>

Modified: trunk/libnet-sip-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/debian/changelog?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/debian/changelog (original)
+++ trunk/libnet-sip-perl/debian/changelog Tue Jul 15 11:25:01 2008
@@ -1,3 +1,9 @@
+libnet-sip-perl (0.46-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Jose Luis Rivas <ghostbar38 at gmail.com>  Tue, 15 Jul 2008 06:53:53 -0430
+
 libnet-sip-perl (0.45.3-1) unstable; urgency=low
 
   [ Martín Ferrari ]

Modified: trunk/libnet-sip-perl/lib/Net/SIP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP.pm?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP.pm Tue Jul 15 11:25:01 2008
@@ -4,7 +4,7 @@
 require 5.008;
 
 package Net::SIP;
-our $VERSION = '0.45_3';
+our $VERSION = '0.46';
 
 # this includes nearly everything else
 use Net::SIP::Simple ();

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pm?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pm Tue Jul 15 11:25:01 2008
@@ -13,7 +13,7 @@
 use Net::SIP::Debug;
 use Net::SIP::Util ':all';
 use Digest::MD5 'md5_hex';
-use fields qw( realm opaque user2pass i_am_proxy dispatcher );
+use fields qw( realm opaque user2pass user2a1 i_am_proxy dispatcher );
 
 ###########################################################################
 # creates new Authorize object
@@ -31,7 +31,11 @@
 	my $self = fields::new( $class );
 	$self->{realm} = $args{realm} || 'p5-net-sip';
 	$self->{opaque} = $args{opaque};
-	$self->{user2pass} = $args{user2pass} || croak 'no user2pass known';
+	
+	$args{user2pass} || $args{user2a1} || croak 'no user2pass or user2a1 known';
+	
+	$self->{user2pass} = $args{user2pass};
+	$self->{user2a1} = $args{user2a1}; 
 	$self->{i_am_proxy} = $args{i_am_proxy};
 	$self->{dispatcher} = $args{dispatcher} || croak 'no dispatcher';
 	return $self;
@@ -62,14 +66,14 @@
 		;
 	my @auth = $packet->get_header( $rq_key );
 	my $user2pass = $self->{user2pass};
+	my $user2a1 = $self->{user2a1};
 	my $realm = $self->{realm};
 	my $opaque = $self->{opaque};
 
 	# there might be multiple auth, pick the right realm
-	my (@keep_auth,$authorized);
+	my (@keep_auth,$authorized);	
+	
 	foreach my $auth ( @auth ) {
-
-
 		# RFC 2617
 		my ($data,$param) = sip_hdrval2parts( $rq_key => $auth );
 		if ( $param->{realm} ne $realm ) {
@@ -96,17 +100,32 @@
 			next;
 		};
 
-		# we support with and w/o qop
-		my $pass = ref($user2pass) eq 'HASH' ? $user2pass->{$user} 
-			: invoke_callback( $user2pass,$user );
-		my $a1 = join( ':',$user,$realm,$pass );
+		# we support with and w/o qop	
+		# get a1_hex from either user2a1 or user2pass
 		my $a2 = join( ':',$packet->method,$uri );
+		my $a1_hex;
+		if ( ref($user2a1)) {
+			if ( ref($user2a1) eq 'HASH' ) {
+				$a1_hex = $user2a1->{$user}
+			} else {
+				$a1_hex = invoke_callback( $user2a1,$user,$realm );
+			}
+		} 
+		if ( ! defined($a1_hex) && ref($user2pass)) {
+			my $pass;
+			if ( ref($user2pass) eq 'HASH' ) {
+				$pass = $user2pass->{$user}
+			} else {
+				$pass = invoke_callback( $user2pass,$user );
+			}
+			$a1_hex = md5_hex(join( ':',$user,$realm,$pass ));
+		} 
 
 		my $want_response;
 		if ( $qop ) {
 			# 3.2.2.1
 			$want_response = md5_hex( join( ':',
-				md5_hex($a1),
+				$a1_hex,
 				$nonce,
 				1,
 				$cnonce,
@@ -114,9 +133,9 @@
 				md5_hex($a2)
 			));
 		} else {
-			 # 3.2.2.1 compability with RFC2069
+			 # 3.2.2.1 compability with RFC2069			 
 			 $want_response = md5_hex( join( ':',
-			 	md5_hex($a1),
+			 	$a1_hex,
 				$nonce,
 				md5_hex($a2)
 			));

Modified: trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pod?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pod (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Authorize.pod Tue Jul 15 11:25:01 2008
@@ -46,10 +46,18 @@
 Optional value for C<opaque> parameter for the authentication request.
 If none is given no C<opaque> parameter will be used.
 
+=item user2a1
+
+Either hash reference with C<user,a1_hex> mapping or callback, which gives
+C<a1_hex> if called with C<user,realm>.
+For the meaning of C<a1_hex> see RFC 2617.
+
 =item user2pass
 
 Either hash reference with C<user,password> mapping or callback,
 which gives C<password> if called with C<user>.
+This parameter will only be used if C<user2a1> does not result in 
+a defined C<a1_hex> for C<user>.
 
 =item i_am_proxy
 

Modified: trunk/libnet-sip-perl/t/08_register_with_auth.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/t/08_register_with_auth.t?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/t/08_register_with_auth.t (original)
+++ trunk/libnet-sip-perl/t/08_register_with_auth.t Tue Jul 15 11:25:01 2008
@@ -11,6 +11,7 @@
 do './testlib.pl' || do './t/testlib.pl' || die "no testlib";
 
 use Net::SIP ':all';
+use Digest::MD5 'md5_hex';
 
 my ($csock,$caddr) = create_socket();
 my ($ssock,$saddr) = create_socket();
@@ -96,7 +97,8 @@
 	my $ua = Simple->new( leg => $lsock );
 	my $auth = Authorize->new(
 		dispatcher => $ua->{dispatcher},
-		user2pass => sub { $_[0] eq 'wolf' ? 'lobo' : 'secret' },
+		user2a1   => { '007' => md5_hex('007:REALM.example.com:secret') },
+		user2pass => sub { $_[0] eq 'wolf' ? 'lobo' : 'no-useful-password' },
 		realm => 'REALM.example.com',
 		opaque => 'HumptyDumpty',
 		i_am_proxy => 0,

Modified: trunk/libnet-sip-perl/t/09_fdleak.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/t/09_fdleak.t?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/t/09_fdleak.t (original)
+++ trunk/libnet-sip-perl/t/09_fdleak.t Tue Jul 15 11:25:01 2008
@@ -44,6 +44,10 @@
 
 sub uac {
 	( my $caddr = $saddr ) =~s{:\d+}{:0}; # same ip, port will be picked
+	# for some strange reason on glib2.7 or whatever the cause is this not
+	# only allocates a new fd, but a pipe too. So just ignore the first fd
+	# and use the next
+	my $tfd_ignore = newfd();
 	my $tfd = newfd();
 	my $fnbase = fileno($tfd) +1;
 	my $show_diff = sub {

Modified: trunk/libnet-sip-perl/t/10_fdleak.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/t/10_fdleak.t?rev=23224&op=diff
==============================================================================
--- trunk/libnet-sip-perl/t/10_fdleak.t (original)
+++ trunk/libnet-sip-perl/t/10_fdleak.t Tue Jul 15 11:25:01 2008
@@ -51,6 +51,10 @@
 
 sub uac {
 	( my $caddr = $saddr ) =~s{:\d+}{:0}; # same ip, port will be picked
+	# for some strange reason on glib2.7 or whatever the cause is this not
+	# only allocates a new fd, but a pipe too. So just ignore the first fd
+	# and use the next
+	my $tfd_ignore = newfd();
 	my $tfd = newfd();
 	my $fnbase = fileno($tfd) +1;
 	my $show_diff = sub {




More information about the Pkg-perl-cvs-commits mailing list