Skip to content

Commit

Permalink
some fixes and better debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Apr 11, 2011
1 parent c7fc619 commit b87d8b8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions shairport.pl
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ sub POPE {
join('', map { sprintf "%02X", $_ } @hw_addr) . "\@$apname",
"_raop._tcp",
"5000",
"tp=UDP","sm=false","sv=false","ek=1","et=0,1","cn=0,1","ch=2","ss=16","sr=44100","pw=false","vn=3","txtvers=1"
or die "could not run avahi-publish-service";
"tp=UDP","sm=false","sv=false","ek=1","et=0,1","cn=0,1","ch=2","ss=16","sr=44100","pw=false","vn=3","txtvers=1";
exec 'dns-sd',
'-R', join('', map { sprintf "%02X", $_ } @hw_addr) . "\@$apname",
"_raop._tcp",
"local", "5000",
"tp=UDP","sm=false","sv=false","ek=1","et=0,1","cn=0,1","ch=2","ss=16","sr=44100","pw=false","vn=3","txtvers=1";
die "could not run avahi-publish-service nor dns-sd";
}

sub REAP {
Expand All @@ -87,7 +92,7 @@ sub REAP {
};

my $airport_pem = join '', <DATA>;
my $rsa = Crypt::OpenSSL::RSA->new_private_key($airport_pem) || die;
my $rsa = Crypt::OpenSSL::RSA->new_private_key($airport_pem) || die "RSA private key import failed";

my $listen = new IO::Socket::INET(Listen => 1,
LocalPort => 5000,
Expand Down Expand Up @@ -219,7 +224,7 @@ sub conn_handle_request {
die("no AESIV") unless my $aesiv = decode_base64($sdp{aesiv});
die("no AESKEY") unless my $rsaaeskey = decode_base64($sdp{rsaaeskey});
$rsa->use_pkcs1_oaep_padding;
my $aeskey = $rsa->decrypt($rsaaeskey) || die;
my $aeskey = $rsa->decrypt($rsaaeskey) || die "RSA decrypt failed";

$conn->{aesiv} = $aesiv;
$conn->{aeskey} = $aeskey;
Expand Down

0 comments on commit b87d8b8

Please sign in to comment.