[Bug 884354] perl: possible arbitrary code execution via Locale::Maketext
by Red Hat Bugzilla
Product: Security Response
https://bugzilla.redhat.com/show_bug.cgi?id=884354
--- Comment #3 from Petr Pisar <ppisar(a)redhat.com> ---
Created attachment 658787
--> https://bugzilla.redhat.com/attachment.cgi?id=658787&action=edit
Template for reproducer
Could show the attack vector? Attached is small code showing how to use
Locale::Maketext. Please modify it to explain the vulnerability.
I think the vulnerability is effective only when attacker has first argument of
maketext() under control.
However that means the attacker can run any code even without this
`vulnerability'. It's like saying glibc's gettext() is vulnerable. But that's
not true.
Sure gettext("%s", user_input) is not safe, but this is flaw in the caller, not
in the gettext. The same applies to Locale::Maketext::maketext().
--
You are receiving this mail because:
You are on the CC list for the bug.
11 years, 6 months
[perl-AnyEvent-XMPP] 0.54 bump
by Jitka Plesnikova
commit 4335693352edc6980d6046a69d4ae274df8acf60
Author: Jitka Plesnikova <jplesnik(a)redhat.com>
Date: Thu Dec 6 12:59:11 2012 +0100
0.54 bump
.gitignore | 1 +
perl-AnyEvent-XMPP.spec | 14 ++++++++++----
sources | 2 +-
3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 23f48b1..b371633 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
AnyEvent-XMPP-0.51.tar.gz
/AnyEvent-XMPP-0.52.tar.gz
/AnyEvent-XMPP-0.53.tar.gz
+/AnyEvent-XMPP-0.54.tar.gz
diff --git a/perl-AnyEvent-XMPP.spec b/perl-AnyEvent-XMPP.spec
index 4d8d6de..6d0af07 100644
--- a/perl-AnyEvent-XMPP.spec
+++ b/perl-AnyEvent-XMPP.spec
@@ -1,11 +1,11 @@
Name: perl-AnyEvent-XMPP
-Version: 0.53
+Version: 0.54
Release: 1%{?dist}
Summary: Implementation of the XMPP Protocol
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/dist/AnyEvent-XMPP/
-Source0: http://www.cpan.org/authors/id/E/EL/ELMEX/AnyEvent-XMPP-%{version}.tar.gz
+Source0: http://www.cpan.org/authors/id/M/MS/MSTPLBG/AnyEvent-XMPP-%{version}.tar.gz
Patch0: AnyEvent-XMPP-0.51-timezone.patch
BuildArch: noarch
BuildRequires: perl(base)
@@ -30,6 +30,8 @@ BuildRequires: perl(XML::Parser::Expat)
BuildRequires: perl(XML::Twig)
BuildRequires: perl(XML::Writer)
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
+# Add Net::SSLeay to prevent issues like RT#80148
+Requires: perl(Net::SSLeay) >= 1.33
%{?perl_default_filter}
@@ -49,9 +51,8 @@ perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}
%install
-make pure_install PERL_INSTALL_ROOT=%{buildroot}
+make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} \;
-find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \;
%{_fixperms} %{buildroot}/*
%check
@@ -63,6 +64,11 @@ make test
%{_mandir}/man3/*
%changelog
+* Thu Dec 06 2012 Jitka Plesnikova <jplesnik(a)redhat.com> - 0.54-1
+- 0.54 bump
+- Replace PERL_INSTALL_ROOT with DESTDIR
+- Remove the deleting empty directories
+
* Fri Oct 12 2012 Petr Šabata <contyk(a)redhat.com> - 0.53-1
- 0.53 bump
diff --git a/sources b/sources
index 09d830f..c2eb5d6 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-8156151fa8c7a7d1f30fd3296ed6cab1 AnyEvent-XMPP-0.53.tar.gz
+20b008e67537eb3125e4376a0ba09883 AnyEvent-XMPP-0.54.tar.gz
11 years, 6 months
[perl-Net-DNS] 0.69 bump
by Petr Sabata
commit 924bfeebd5f6a14e73b2c775bc8208c56ac8de9a
Author: Petr Šabata <contyk(a)redhat.com>
Date: Thu Dec 6 13:00:26 2012 +0100
0.69 bump
.gitignore | 1 +
perl-Net-DNS.spec | 18 +++++++++++-------
sources | 2 +-
3 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 40e607f..d1edc14 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ Net-DNS-0.65.tar.gz
/Net-DNS-0.66.tar.gz
/Net-DNS-0.67.tar.gz
/Net-DNS-0.68.tar.gz
+/Net-DNS-0.69.tar.gz
diff --git a/perl-Net-DNS.spec b/perl-Net-DNS.spec
index 0951f0e..e71ea2a 100644
--- a/perl-Net-DNS.spec
+++ b/perl-Net-DNS.spec
@@ -1,15 +1,15 @@
Name: perl-Net-DNS
-Version: 0.68
-Release: 5%{?dist}
+Version: 0.69
+Release: 1%{?dist}
Summary: DNS resolver modules for Perl
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://www.net-dns.org/
-Source0: http://www.cpan.org/authors/id/O/OL/OLAF/Net-DNS-%{version}.tar.gz
+Source0: http://search.cpan.org/CPAN/authors/id/N/NL/NLNETLABS/Net-DNS-%{version}....
BuildRequires: %{_bindir}/iconv
BuildRequires: perl(base)
-BuildRequires: perl(constant)
BuildRequires: perl(Carp)
+BuildRequires: perl(constant)
BuildRequires: perl(Data::Dumper)
%if ! (0%{?rhel} >= 7)
BuildRequires: perl(Digest::BubbleBabble)
@@ -26,8 +26,9 @@ BuildRequires: perl(IO::Socket)
BuildRequires: perl(IO::Socket::INET)
BuildRequires: perl(IO::Socket::INET6)
BuildRequires: perl(MIME::Base64) >= 2.11
+BuildRequires: perl(Net::LibIDN)
BuildRequires: perl(Socket)
-BuildRequires: perl(Text::ParseWords)
+BuildRequires: perl(Test::Builder)
BuildRequires: perl(Test::More) >= 0.18
BuildRequires: perl(Test::Pod)
BuildRequires: perl(XSLoader)
@@ -71,10 +72,9 @@ perl Makefile.PL INSTALLDIRS=vendor --no-online-tests
make %{?_smp_mflags} OPTIMIZE="%{optflags}"
%install
-make pure_install PERL_INSTALL_ROOT=%{buildroot}
+make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
find %{buildroot} -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'
-find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null ';'
chmod -R u+w %{buildroot}/*
for i in Changes; do
iconv -f iso8859-1 -t utf-8 $i > $i.conv && /bin/mv -f $i.conv $i
@@ -101,6 +101,10 @@ make test
%{_mandir}/man3/Net::DNS::Nameserver*
%changelog
+* Thu Dec 06 2012 Petr Šabata <contyk(a)redhat.com> - 0.69-1
+- 0.69 bump
+- Update source URL
+
* Fri Aug 10 2012 Petr Pisar <ppisar(a)redhat.com> - 0.68-5
- Digest::BubbleBabble is not available in RHEL >= 7
diff --git a/sources b/sources
index 9e8f3ab..70093a6 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-05c0f6955747758bb5c9578d9bc6c3a5 Net-DNS-0.68.tar.gz
+aa5cfa963df08d40cbf529cf2a344468 Net-DNS-0.69.tar.gz
11 years, 6 months
[perl-CDDB_get] Import
by Petr Pisar
commit 8afa240702426934c7c02ff99fb6656c3f351fe8
Author: Petr Písař <ppisar(a)redhat.com>
Date: Thu Dec 6 09:31:22 2012 +0100
Import
.gitignore | 1 +
...get-2.28-Do-not-include-current-directory.patch | 22 +
CDDB_get-2.28-cddb.pl-is-not-a-library.patch | 925 ++++++++++++++++++++
perl-CDDB_get.spec | 58 ++
sources | 1 +
5 files changed, 1007 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..954e4cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/CDDB_get-2.28.tar.gz
diff --git a/CDDB_get-2.28-Do-not-include-current-directory.patch b/CDDB_get-2.28-Do-not-include-current-directory.patch
new file mode 100644
index 0000000..e44b727
--- /dev/null
+++ b/CDDB_get-2.28-Do-not-include-current-directory.patch
@@ -0,0 +1,22 @@
+From 2f0f46bad8ba1c942190aebd7a8223398484bd2c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar(a)redhat.com>
+Date: Fri, 14 Sep 2012 15:24:35 +0200
+Subject: [PATCH 1/2] Do not include current directory
+
+---
+ cddb.pl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cddb.pl b/cddb.pl
+index f7f22b0..9ca7ea7 100755
+--- a/cddb.pl
++++ b/cddb.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl -I.
++#!/usr/bin/perl
+ #
+ # CDDB - Read the CDDB entry for an audio CD in your drive
+ #
+--
+1.7.11.4
+
diff --git a/CDDB_get-2.28-cddb.pl-is-not-a-library.patch b/CDDB_get-2.28-cddb.pl-is-not-a-library.patch
new file mode 100644
index 0000000..35e1022
--- /dev/null
+++ b/CDDB_get-2.28-cddb.pl-is-not-a-library.patch
@@ -0,0 +1,925 @@
+From a3a4b7a330f76def505dda32e1b58158678d2778 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar(a)redhat.com>
+Date: Fri, 14 Sep 2012 15:26:23 +0200
+Subject: [PATCH 2/2] cddb.pl is not a library
+
+---
+ Makefile.PL | 2 +-
+ cddb.pl | 442 --------------------------------------------------------
+ scripts/cddb.pl | 442 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 443 insertions(+), 443 deletions(-)
+ delete mode 100755 cddb.pl
+ create mode 100755 scripts/cddb.pl
+
+diff --git a/Makefile.PL b/Makefile.PL
+index 81083dc..064a9e2 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -4,7 +4,7 @@ use ExtUtils::MakeMaker;
+ WriteMakefile(
+ 'NAME' => 'CDDB_get',
+ 'VERSION_FROM' => 'CDDB_get.pm', # finds $VERSION
+- 'EXE_FILES' => ['cddb.pl'],
++ 'EXE_FILES' => ['scripts/cddb.pl'],
+ 'ABSTRACT' => "This module/script gets the CDDB info for an audio cd.",
+ 'AUTHOR' => "Armin Obersteiner <armin at xos dot net>",
+ # 'PREREQ_PM' => {
+diff --git a/cddb.pl b/cddb.pl
+deleted file mode 100755
+index 9ca7ea7..0000000
+--- a/cddb.pl
++++ /dev/null
+@@ -1,442 +0,0 @@
+-#!/usr/bin/perl
+-#
+-# CDDB - Read the CDDB entry for an audio CD in your drive
+-#
+-# This module/script gets the CDDB info for an audio cd. You need
+-# LINUX, a cdrom drive and an active internet connection in order
+-# to do that.
+-#
+-# (c) 2004 Armin Obersteiner <armin(a)xos.net>
+-#
+-# LICENSE
+-#
+-# This library is released under the same conditions as Perl, that
+-# is, either of the following:
+-#
+-# a) the GNU General Public License Version 2 as published by the
+-# Free Software Foundation,
+-#
+-# b) the Artistic License.
+-#
+-
+-#use CDDB_get qw( get_cddb get_discids );
+-
+-use Data::Dumper;
+-use Getopt::Std;
+-
+-use strict;
+-
+-my %option = ();
+-getopts("oghdtsi:SfDlOFc:H:CIRGP", \%option);
+-
+-if($option{h}) {
+- print "$0: gets CDDB info of a CD\n";
+- print " no argument - gets CDDB info of CD in your drive\n";
+- print " -c device (other than default device)\n";
+- print " -o offline mode - just stores CD info\n";
+- print " -d output in xmcd format\n";
+- print " -s save in xmcd format\n";
+- print " -i db. one of: mysql, pg, oracle, sqlite\n";
+- print " -O overwrite file or db\n";
+- print " -t output toc\n";
+- print " -l output lame command\n";
+- print " -f http mode (e.g. through firewalls)\n";
+- print " -F some stateful firewalls/http proxies need additional newlines\n";
+- print " -g get CDDB info for stored CDs\n";
+- print " -I non interactive mode\n";
+- print " -H CDDB hostname\n";
+- print " -C use local cache\n";
+- print " -R readonly cache\n";
+- print " -G cache has not the diskid as filenames (much slower)\n";
+- print " -P cache path (default: /tmp/xmcd)\n";
+- print " -D put CDDB_get in debug mode\n";
+- exit;
+-}
+-
+-my %config;
+-
+-my $diskid;
+-my $total;
+-my $toc;
+-my $savedir="/tmp/cddb";
+-my $xmcddir="/tmp/xmcd";
+-
+-if($option{C}) {
+- # use CDDB_cache qw( get_cddb get_discids );
+- require CDDB_cache;
+- CDDB_cache->import( qw( get_cddb get_discids ) );
+-
+- $CDDB_cache::debug=1 if($option{D});
+- $CDDB_cache::readonly=1 if($option{R});
+- $CDDB_cache::grep=1 if($option{G});
+-
+- $CDDB_cache::dir="/tmp/xmcd"; # default
+- # $CDDB_cache::dir="/opt/kde2/share/apps/kscd/cddb";
+- $CDDB_cache::dir=$option{P} if($option{P});
+-
+-} else {
+- # use CDDB_get qw( get_cddb get_discids );
+- require CDDB_get;
+- CDDB_get->import( qw( get_cddb get_discids ) );
+-}
+-
+-$CDDB_get::debug=1 if($option{D});
+-
+-# following variables just need to be declared if different from defaults
+-# defaults are listed below (cdrom default is os specific)
+-
+-# $config{CDDB_HOST}="freedb.freedb.org"; # set cddb host
+-if($option{H}) {
+- $config{CDDB_HOST}=$option{H};
+-}
+-# $config{CDDB_PORT}=8880; # set cddb port
+-# $config{CDDB_MODE}="cddb"; # set cddb mode: cddb or http, this is switched with -f
+-# $config{CD_DEVICE}="/dev/cdrom"; # set cd device
+-
+-# $config{HELLO_ID} ="root nowhere.com fastrip 0.77"; # hello string: username hostname clientname version
+-# $config{PROTO_VERSION} = 5; # cddb protokol version
+-
+-
+-# get proxy settings for cddb mode
+-
+-$config{HTTP_PROXY}=$ENV{http_proxy} if $ENV{http_proxy}; # maybe wanna use a proxy ?
+-
+-$config{CDDB_MODE}="http" if($option{f});
+-if($option{F}) {
+- $config{CDDB_MODE}="http";
+- $config{FW}=1;
+-}
+-
+-$config{CD_DEVICE}=$option{c} if $option{c};
+-
+-# user interaction welcome?
+-
+-$config{input}=1; # 1: ask user if more than one possibility
+- # 0: no user interaction
+-$config{multi}=0; # 1: do not ask user and get all of them
+- # 0: just the first one
+-
+-$config{input}=0 if($option{I});
+-
+-my %db;
+-
+-if($option{i}) {
+- require DBI;
+-
+- $db{table_cds} = "cds";
+- $db{table_tracks} = "tracks";
+-
+- # not needed for sqlite
+- $db{host} = "localhost";
+- $db{port} = "3306";
+-
+- # not needed for oracle/sqlite
+- $db{name} = "mp3-test";
+-
+- # just for oracle
+- $db{sid} = "xxx";
+- $db{home} = "xxx";
+-
+- # just for sqlite
+- $db{file} = "xxx";
+-
+- # not needed for sqlite
+- $db{user} = "root";
+- $db{passwd} = "xxx";
+-
+-
+- if($option{i} eq "mysql") {
+- $db{connect} = sub { "dbi:mysql:database=$db{name};host=$db{host};port=$db{port}", $db{user}, $db{passwd} };
+- } elsif($option{i} eq "pg") {
+- $db{connect} = sub { "dbi:Pg:dbname=$db{dbname};host=$db{host};port=$db{port}", $db{user}, $db{passwd} };
+- } elsif($option{i} eq "oracle") {
+- $db{connect} = sub { "dbi:Oracle:host=$db{host};sid=$db{sid};port=$db{port}", $db{user}, $db{passwd} };
+- $ENV{ORACLE_HOME} = $db{home};
+- } elsif($option{i} eq "sqlite") {
+- $db{connect} = sub { "dbi:SQLite:dbname=$db{file}","","" };
+- } else {
+- die "unkown database: $option{i}";
+- }
+-}
+-
+-if($option{o}) {
+- my $ids=get_discids($config{CD_DEVICE});
+-
+- unless(-e $savedir) {
+- mkdir $savedir,0755 or die "cannot create $savedir";
+- }
+-
+- open OUT,">$savedir/$ids->[0]\_$$" or die "cannot open outfile";
+- print OUT Data::Dumper->Dump($ids,["diskid","total","toc"]);
+- close OUT;
+-
+- print STDERR "saved in: $savedir/$ids->[0]\_$$\n";
+- exit;
+-}
+-
+-if($option{g}) {
+- print STDERR "retrieving stored cds ...\n";
+-
+- opendir(DIR, $savedir) or die "cannot opendir $savedir";
+- while (defined(my $file = readdir(DIR))) {
+- next if($file =~ /^\./);
+- print "\n";
+-
+- my $in=`/bin/cat $savedir/$file`;
+- my $exit = $? >> 8;
+-
+- if($exit>0) {
+- die "error reading file";
+- }
+-
+- unless($in=~ m/^\$diskid\s+=\s+('\d+'|\d+);\s+ # $diskid
+- \$total\s+=\s+('\d+'|\d+);\s+ # $total
+- \$toc\s+=\s+\[\s+ # $toc
+- (\{\s+
+- ('(frame|frames|min|sec|data)'\s+=\>\s+('\d+'|\d+)(,|)\s+){5}
+- \}(,|)\s+)+
+- \];\s+$/xs) {
+- print "not a save file: $savedir/$file\n";
+- next;
+- }
+-
+- eval $in;
+-
+- if($@) {
+- print "not a save file (eval error): $savedir/$file\n";
+- next;
+- }
+-
+- my %cd=get_cddb(\%config,[$diskid,$total,$toc]);
+-
+- unless(defined $cd{title}) {
+- print "no cddb entry found: $savedir/$file\n";
+- }
+-
+- unlink "$savedir/$file";
+-
+- next unless defined $cd{title};
+-
+- if($option{d} || $option{s}) {
+- print_xmcd(\%cd,$option{s});
+- } elsif($option{i}) {
+- insert_db(\%cd,\%db);
+- } elsif($option{l}) {
+- print_lame(\%cd);
+- } else {
+- print_cd(\%cd);
+- }
+- }
+- closedir(DIR);
+- exit;
+-}
+-
+-# get it on
+-
+-unless($config{multi}) {
+- my %cd;
+-
+- # for those who don't like 'die' in modules ;-)
+- eval {
+- %cd = get_cddb(\%config);
+- };
+- if ($@) {
+- print "fatal error: $!\n";
+- exit;
+- }
+-
+- print Dumper(\%cd) if $option{D};
+-
+- unless(defined $cd{title}) {
+- die "no cddb entry found";
+- }
+-
+- # do somthing with the results
+-
+- if($option{d} || $option{s}) {
+- print_xmcd(\%cd,$option{s});
+- } elsif($option{i}) {
+- insert_db(\%cd,\%db);
+- } elsif($option{l}) {
+- print_lame(\%cd);
+- } else {
+- print_cd(\%cd);
+- }
+-} else {
+- my @cd;
+-
+- # for those who don't like 'die' in modules ;-)
+- eval {
+- @cd=get_cddb(\%config);
+- };
+- if ($@) {
+- print "fatal error: $!\n";
+- exit;
+- }
+-
+- print Dumper(\@cd) if $option{D};
+-
+- for my $c (@cd) {
+- unless(defined $c->{title}) {
+- die "no cddb entry found";
+- }
+-
+- # do somthing with the results
+-
+- if($option{d} || $option{s}) {
+- print_xmcd($c,$option{s});
+- } elsif($option{i}) {
+- insert_db($c,\%db);
+- } elsif($option{l}) {
+- print_lame($c);
+- print "\n";
+- } else {
+- print_cd($c);
+- print "\n";
+- }
+- }
+-}
+-
+-exit;
+-
+-
+-# subroutines
+-
+-sub print_cd {
+- my $cd=shift;
+-
+- print "artist: $cd->{artist}\n";
+- print "title: $cd->{title}\n";
+- print "category: $cd->{cat}\n";
+- print "genre: $cd->{genre}\n" if($cd->{genre});
+- print "year: $cd->{year}\n" if($cd->{year});
+- print "cddbid: $cd->{id}\n";
+- print "trackno: $cd->{tno}\n";
+-
+- my $n=1;
+- foreach my $i ( @{$cd->{track}} ) {
+- if($option{t}) {
+- my $from=$cd->{frames}[$n-1];
+- my $to=$cd->{frames}[$n]-1;
+- my $dur=$to-$from;
+- my $min=int($dur/75/60);
+- my $sec=int($dur/75)-$min*60;
+- my $frm=($dur-$sec*75-$min*75*60)*100/75;
+- my $out=sprintf "track %2d: %8d - %8d [%2d:%.2d.%.2d]: $i\n",$n,$from,$to,$min,$sec,$frm;
+- print "$out";
+- } else {
+- print "track $n: $i\n";
+- }
+- $n++;
+- }
+-}
+-
+-sub print_xmcd {
+- my $cd=shift;
+- my $save=shift;
+-
+- *OUT=*STDOUT;
+-
+- if($save) {
+- unless(-e $xmcddir) {
+- mkdir $xmcddir,0755 or die "cannot create $savedir";
+- }
+-
+- unless($option{O}) {
+- if(-e "$xmcddir/$cd->{id}") {
+- print "XMCD file exists\n";
+- exit;
+- }
+- }
+-
+- open XMCD,">$xmcddir/$cd->{id}" or die "cannot open outfile";
+- *OUT=*XMCD;
+- }
+-
+- for(@{$cd->{raw}}) {
+- print OUT "$_";
+- }
+-
+- if($save) {
+- print STDERR "saved in: $xmcddir/$cd->{id}\n";
+- close OUT;
+- }
+-}
+-
+-sub insert_db {
+- my $cd=shift;
+- my $db=shift;
+-
+- my ($artist, $title, $category, $cddbid, $trackno) =
+- ($cd->{artist}, $cd->{title}, $cd->{cat}, $cd->{id}, $cd->{tno});
+-
+- my $sql = "SELECT cddbid FROM $db->{table_cds} WHERE CDDBID = \'$cddbid\'";
+- my $dbh = DBI->connect($db->{connect}->()) or die "cannot connect to db: $DBI::errstr";
+- my $sth = $dbh->prepare($sql);
+- my $r = $sth->execute or die "cannot check for cd: $DBI::errstr";
+- if ($r == 1) {
+- print "cd already in db\n";
+- if($option{O}) {
+- my $sql = "DELETE FROM $db->{table_cds} WHERE CDDBID = \'$cddbid\'";
+- my $sth = $dbh->prepare($sql);
+- my $r = $sth->execute or die "cannot delete from $db->{table_cds}: $DBI::errstr";
+- $sql = "DELETE FROM $db->{table_tracks} WHERE CDDBID = \'$cddbid\'";
+- $sth = $dbh->prepare($sql);
+- $r = $sth->execute or die "cannot delete from $db->{table_tracks}: $DBI::errstr";
+- } else {
+- exit;
+- }
+- }
+-
+- $title =~ s/'/\\'/g;
+- $artist =~ s/'/\\'/g;
+- $category =~ s/'/\\'/g;
+-
+- $sql = "INSERT INTO $db->{table_cds} (cddbid, artist, title, category, tracks) VALUES (\'$cddbid\', \'$artist\', \'$title\', \'$category\' , \'$trackno\')";
+- $sth = $dbh->prepare($sql);
+- $r = $sth->execute or die "failed to insert cd: $DBI::errstr";
+-
+- my $n=1;
+-
+- print "titel: $title\n";
+- print "artist: $artist\n";
+- print "category: $category\n\n";
+-
+- for my $t ( @{$cd->{track}} ) {
+- $t =~ s/'/\\'/g;
+- my $dur=($cd->{frames}[$n]-1-$cd->{frames}[$n-1])/75;
+- my $hour=int($dur/3600);
+- my $min=int($dur/60-$hour*60);
+- my $sec=$dur-$hour*3600-$min*60;
+- my $fr=substr(sprintf("%5.2f",$sec-int($sec)),2,3);
+- my $time=sprintf "%.2d:%.2d:%.2d%s",$hour,$min,int($sec),$fr;
+-
+- print "track $n: $t [$time]\n";
+-
+- my $sql = "INSERT INTO $db->{table_tracks} (cddbid, title, trackno, time)
+- VALUES (\'$cddbid\',\'$t\', \'$n\', \'$time\')";
+- my $sth = $dbh->prepare($sql);
+- my $r = $sth->execute or die "failed to insert track $n: $DBI::errstr";
+- $n++;
+- }
+-
+- $dbh->disconnect();
+-}
+-
+-sub print_lame {
+- my $cd=shift;
+-
+- print_cd($cd);
+- print "\n";
+-
+- my $n=1;
+- for my $i ( @{$cd->{track}} ) {
+- $i =~ s/"/'/g;
+- print 'lame --tl "'.$cd->{title}.'" --ta "'.$cd->{artist}.'" --tt "'.$i.'" ';
+- printf "audio_%02d.wav ",$n;
+- $i =~ s/[^\S]|['"\/]/_/g;
+- $i =~ s/_+-_+/-/g;
+- print " $i.mp3\n";
+- $n++;
+- }
+-}
+diff --git a/scripts/cddb.pl b/scripts/cddb.pl
+new file mode 100755
+index 0000000..9ca7ea7
+--- /dev/null
++++ b/scripts/cddb.pl
+@@ -0,0 +1,442 @@
++#!/usr/bin/perl
++#
++# CDDB - Read the CDDB entry for an audio CD in your drive
++#
++# This module/script gets the CDDB info for an audio cd. You need
++# LINUX, a cdrom drive and an active internet connection in order
++# to do that.
++#
++# (c) 2004 Armin Obersteiner <armin(a)xos.net>
++#
++# LICENSE
++#
++# This library is released under the same conditions as Perl, that
++# is, either of the following:
++#
++# a) the GNU General Public License Version 2 as published by the
++# Free Software Foundation,
++#
++# b) the Artistic License.
++#
++
++#use CDDB_get qw( get_cddb get_discids );
++
++use Data::Dumper;
++use Getopt::Std;
++
++use strict;
++
++my %option = ();
++getopts("oghdtsi:SfDlOFc:H:CIRGP", \%option);
++
++if($option{h}) {
++ print "$0: gets CDDB info of a CD\n";
++ print " no argument - gets CDDB info of CD in your drive\n";
++ print " -c device (other than default device)\n";
++ print " -o offline mode - just stores CD info\n";
++ print " -d output in xmcd format\n";
++ print " -s save in xmcd format\n";
++ print " -i db. one of: mysql, pg, oracle, sqlite\n";
++ print " -O overwrite file or db\n";
++ print " -t output toc\n";
++ print " -l output lame command\n";
++ print " -f http mode (e.g. through firewalls)\n";
++ print " -F some stateful firewalls/http proxies need additional newlines\n";
++ print " -g get CDDB info for stored CDs\n";
++ print " -I non interactive mode\n";
++ print " -H CDDB hostname\n";
++ print " -C use local cache\n";
++ print " -R readonly cache\n";
++ print " -G cache has not the diskid as filenames (much slower)\n";
++ print " -P cache path (default: /tmp/xmcd)\n";
++ print " -D put CDDB_get in debug mode\n";
++ exit;
++}
++
++my %config;
++
++my $diskid;
++my $total;
++my $toc;
++my $savedir="/tmp/cddb";
++my $xmcddir="/tmp/xmcd";
++
++if($option{C}) {
++ # use CDDB_cache qw( get_cddb get_discids );
++ require CDDB_cache;
++ CDDB_cache->import( qw( get_cddb get_discids ) );
++
++ $CDDB_cache::debug=1 if($option{D});
++ $CDDB_cache::readonly=1 if($option{R});
++ $CDDB_cache::grep=1 if($option{G});
++
++ $CDDB_cache::dir="/tmp/xmcd"; # default
++ # $CDDB_cache::dir="/opt/kde2/share/apps/kscd/cddb";
++ $CDDB_cache::dir=$option{P} if($option{P});
++
++} else {
++ # use CDDB_get qw( get_cddb get_discids );
++ require CDDB_get;
++ CDDB_get->import( qw( get_cddb get_discids ) );
++}
++
++$CDDB_get::debug=1 if($option{D});
++
++# following variables just need to be declared if different from defaults
++# defaults are listed below (cdrom default is os specific)
++
++# $config{CDDB_HOST}="freedb.freedb.org"; # set cddb host
++if($option{H}) {
++ $config{CDDB_HOST}=$option{H};
++}
++# $config{CDDB_PORT}=8880; # set cddb port
++# $config{CDDB_MODE}="cddb"; # set cddb mode: cddb or http, this is switched with -f
++# $config{CD_DEVICE}="/dev/cdrom"; # set cd device
++
++# $config{HELLO_ID} ="root nowhere.com fastrip 0.77"; # hello string: username hostname clientname version
++# $config{PROTO_VERSION} = 5; # cddb protokol version
++
++
++# get proxy settings for cddb mode
++
++$config{HTTP_PROXY}=$ENV{http_proxy} if $ENV{http_proxy}; # maybe wanna use a proxy ?
++
++$config{CDDB_MODE}="http" if($option{f});
++if($option{F}) {
++ $config{CDDB_MODE}="http";
++ $config{FW}=1;
++}
++
++$config{CD_DEVICE}=$option{c} if $option{c};
++
++# user interaction welcome?
++
++$config{input}=1; # 1: ask user if more than one possibility
++ # 0: no user interaction
++$config{multi}=0; # 1: do not ask user and get all of them
++ # 0: just the first one
++
++$config{input}=0 if($option{I});
++
++my %db;
++
++if($option{i}) {
++ require DBI;
++
++ $db{table_cds} = "cds";
++ $db{table_tracks} = "tracks";
++
++ # not needed for sqlite
++ $db{host} = "localhost";
++ $db{port} = "3306";
++
++ # not needed for oracle/sqlite
++ $db{name} = "mp3-test";
++
++ # just for oracle
++ $db{sid} = "xxx";
++ $db{home} = "xxx";
++
++ # just for sqlite
++ $db{file} = "xxx";
++
++ # not needed for sqlite
++ $db{user} = "root";
++ $db{passwd} = "xxx";
++
++
++ if($option{i} eq "mysql") {
++ $db{connect} = sub { "dbi:mysql:database=$db{name};host=$db{host};port=$db{port}", $db{user}, $db{passwd} };
++ } elsif($option{i} eq "pg") {
++ $db{connect} = sub { "dbi:Pg:dbname=$db{dbname};host=$db{host};port=$db{port}", $db{user}, $db{passwd} };
++ } elsif($option{i} eq "oracle") {
++ $db{connect} = sub { "dbi:Oracle:host=$db{host};sid=$db{sid};port=$db{port}", $db{user}, $db{passwd} };
++ $ENV{ORACLE_HOME} = $db{home};
++ } elsif($option{i} eq "sqlite") {
++ $db{connect} = sub { "dbi:SQLite:dbname=$db{file}","","" };
++ } else {
++ die "unkown database: $option{i}";
++ }
++}
++
++if($option{o}) {
++ my $ids=get_discids($config{CD_DEVICE});
++
++ unless(-e $savedir) {
++ mkdir $savedir,0755 or die "cannot create $savedir";
++ }
++
++ open OUT,">$savedir/$ids->[0]\_$$" or die "cannot open outfile";
++ print OUT Data::Dumper->Dump($ids,["diskid","total","toc"]);
++ close OUT;
++
++ print STDERR "saved in: $savedir/$ids->[0]\_$$\n";
++ exit;
++}
++
++if($option{g}) {
++ print STDERR "retrieving stored cds ...\n";
++
++ opendir(DIR, $savedir) or die "cannot opendir $savedir";
++ while (defined(my $file = readdir(DIR))) {
++ next if($file =~ /^\./);
++ print "\n";
++
++ my $in=`/bin/cat $savedir/$file`;
++ my $exit = $? >> 8;
++
++ if($exit>0) {
++ die "error reading file";
++ }
++
++ unless($in=~ m/^\$diskid\s+=\s+('\d+'|\d+);\s+ # $diskid
++ \$total\s+=\s+('\d+'|\d+);\s+ # $total
++ \$toc\s+=\s+\[\s+ # $toc
++ (\{\s+
++ ('(frame|frames|min|sec|data)'\s+=\>\s+('\d+'|\d+)(,|)\s+){5}
++ \}(,|)\s+)+
++ \];\s+$/xs) {
++ print "not a save file: $savedir/$file\n";
++ next;
++ }
++
++ eval $in;
++
++ if($@) {
++ print "not a save file (eval error): $savedir/$file\n";
++ next;
++ }
++
++ my %cd=get_cddb(\%config,[$diskid,$total,$toc]);
++
++ unless(defined $cd{title}) {
++ print "no cddb entry found: $savedir/$file\n";
++ }
++
++ unlink "$savedir/$file";
++
++ next unless defined $cd{title};
++
++ if($option{d} || $option{s}) {
++ print_xmcd(\%cd,$option{s});
++ } elsif($option{i}) {
++ insert_db(\%cd,\%db);
++ } elsif($option{l}) {
++ print_lame(\%cd);
++ } else {
++ print_cd(\%cd);
++ }
++ }
++ closedir(DIR);
++ exit;
++}
++
++# get it on
++
++unless($config{multi}) {
++ my %cd;
++
++ # for those who don't like 'die' in modules ;-)
++ eval {
++ %cd = get_cddb(\%config);
++ };
++ if ($@) {
++ print "fatal error: $!\n";
++ exit;
++ }
++
++ print Dumper(\%cd) if $option{D};
++
++ unless(defined $cd{title}) {
++ die "no cddb entry found";
++ }
++
++ # do somthing with the results
++
++ if($option{d} || $option{s}) {
++ print_xmcd(\%cd,$option{s});
++ } elsif($option{i}) {
++ insert_db(\%cd,\%db);
++ } elsif($option{l}) {
++ print_lame(\%cd);
++ } else {
++ print_cd(\%cd);
++ }
++} else {
++ my @cd;
++
++ # for those who don't like 'die' in modules ;-)
++ eval {
++ @cd=get_cddb(\%config);
++ };
++ if ($@) {
++ print "fatal error: $!\n";
++ exit;
++ }
++
++ print Dumper(\@cd) if $option{D};
++
++ for my $c (@cd) {
++ unless(defined $c->{title}) {
++ die "no cddb entry found";
++ }
++
++ # do somthing with the results
++
++ if($option{d} || $option{s}) {
++ print_xmcd($c,$option{s});
++ } elsif($option{i}) {
++ insert_db($c,\%db);
++ } elsif($option{l}) {
++ print_lame($c);
++ print "\n";
++ } else {
++ print_cd($c);
++ print "\n";
++ }
++ }
++}
++
++exit;
++
++
++# subroutines
++
++sub print_cd {
++ my $cd=shift;
++
++ print "artist: $cd->{artist}\n";
++ print "title: $cd->{title}\n";
++ print "category: $cd->{cat}\n";
++ print "genre: $cd->{genre}\n" if($cd->{genre});
++ print "year: $cd->{year}\n" if($cd->{year});
++ print "cddbid: $cd->{id}\n";
++ print "trackno: $cd->{tno}\n";
++
++ my $n=1;
++ foreach my $i ( @{$cd->{track}} ) {
++ if($option{t}) {
++ my $from=$cd->{frames}[$n-1];
++ my $to=$cd->{frames}[$n]-1;
++ my $dur=$to-$from;
++ my $min=int($dur/75/60);
++ my $sec=int($dur/75)-$min*60;
++ my $frm=($dur-$sec*75-$min*75*60)*100/75;
++ my $out=sprintf "track %2d: %8d - %8d [%2d:%.2d.%.2d]: $i\n",$n,$from,$to,$min,$sec,$frm;
++ print "$out";
++ } else {
++ print "track $n: $i\n";
++ }
++ $n++;
++ }
++}
++
++sub print_xmcd {
++ my $cd=shift;
++ my $save=shift;
++
++ *OUT=*STDOUT;
++
++ if($save) {
++ unless(-e $xmcddir) {
++ mkdir $xmcddir,0755 or die "cannot create $savedir";
++ }
++
++ unless($option{O}) {
++ if(-e "$xmcddir/$cd->{id}") {
++ print "XMCD file exists\n";
++ exit;
++ }
++ }
++
++ open XMCD,">$xmcddir/$cd->{id}" or die "cannot open outfile";
++ *OUT=*XMCD;
++ }
++
++ for(@{$cd->{raw}}) {
++ print OUT "$_";
++ }
++
++ if($save) {
++ print STDERR "saved in: $xmcddir/$cd->{id}\n";
++ close OUT;
++ }
++}
++
++sub insert_db {
++ my $cd=shift;
++ my $db=shift;
++
++ my ($artist, $title, $category, $cddbid, $trackno) =
++ ($cd->{artist}, $cd->{title}, $cd->{cat}, $cd->{id}, $cd->{tno});
++
++ my $sql = "SELECT cddbid FROM $db->{table_cds} WHERE CDDBID = \'$cddbid\'";
++ my $dbh = DBI->connect($db->{connect}->()) or die "cannot connect to db: $DBI::errstr";
++ my $sth = $dbh->prepare($sql);
++ my $r = $sth->execute or die "cannot check for cd: $DBI::errstr";
++ if ($r == 1) {
++ print "cd already in db\n";
++ if($option{O}) {
++ my $sql = "DELETE FROM $db->{table_cds} WHERE CDDBID = \'$cddbid\'";
++ my $sth = $dbh->prepare($sql);
++ my $r = $sth->execute or die "cannot delete from $db->{table_cds}: $DBI::errstr";
++ $sql = "DELETE FROM $db->{table_tracks} WHERE CDDBID = \'$cddbid\'";
++ $sth = $dbh->prepare($sql);
++ $r = $sth->execute or die "cannot delete from $db->{table_tracks}: $DBI::errstr";
++ } else {
++ exit;
++ }
++ }
++
++ $title =~ s/'/\\'/g;
++ $artist =~ s/'/\\'/g;
++ $category =~ s/'/\\'/g;
++
++ $sql = "INSERT INTO $db->{table_cds} (cddbid, artist, title, category, tracks) VALUES (\'$cddbid\', \'$artist\', \'$title\', \'$category\' , \'$trackno\')";
++ $sth = $dbh->prepare($sql);
++ $r = $sth->execute or die "failed to insert cd: $DBI::errstr";
++
++ my $n=1;
++
++ print "titel: $title\n";
++ print "artist: $artist\n";
++ print "category: $category\n\n";
++
++ for my $t ( @{$cd->{track}} ) {
++ $t =~ s/'/\\'/g;
++ my $dur=($cd->{frames}[$n]-1-$cd->{frames}[$n-1])/75;
++ my $hour=int($dur/3600);
++ my $min=int($dur/60-$hour*60);
++ my $sec=$dur-$hour*3600-$min*60;
++ my $fr=substr(sprintf("%5.2f",$sec-int($sec)),2,3);
++ my $time=sprintf "%.2d:%.2d:%.2d%s",$hour,$min,int($sec),$fr;
++
++ print "track $n: $t [$time]\n";
++
++ my $sql = "INSERT INTO $db->{table_tracks} (cddbid, title, trackno, time)
++ VALUES (\'$cddbid\',\'$t\', \'$n\', \'$time\')";
++ my $sth = $dbh->prepare($sql);
++ my $r = $sth->execute or die "failed to insert track $n: $DBI::errstr";
++ $n++;
++ }
++
++ $dbh->disconnect();
++}
++
++sub print_lame {
++ my $cd=shift;
++
++ print_cd($cd);
++ print "\n";
++
++ my $n=1;
++ for my $i ( @{$cd->{track}} ) {
++ $i =~ s/"/'/g;
++ print 'lame --tl "'.$cd->{title}.'" --ta "'.$cd->{artist}.'" --tt "'.$i.'" ';
++ printf "audio_%02d.wav ",$n;
++ $i =~ s/[^\S]|['"\/]/_/g;
++ $i =~ s/_+-_+/-/g;
++ print " $i.mp3\n";
++ $n++;
++ }
++}
+--
+1.7.11.4
+
diff --git a/perl-CDDB_get.spec b/perl-CDDB_get.spec
new file mode 100644
index 0000000..fa002a9
--- /dev/null
+++ b/perl-CDDB_get.spec
@@ -0,0 +1,58 @@
+Name: perl-CDDB_get
+Version: 2.28
+Release: 1%{?dist}
+Summary: Read the CDDB entry for an audio CD in your drive
+License: GPLv2 or Artistic
+Group: Development/Libraries
+URL: http://search.cpan.org/dist/CDDB_get/
+Source0: http://www.cpan.org/authors/id/F/FO/FONKIE/CDDB_get-%{version}.tar.gz
+# Submitted to upstream, RT #79646
+Patch0: CDDB_get-2.28-Do-not-include-current-directory.patch
+# Submitted to upstream, RT #79647
+Patch1: CDDB_get-2.28-cddb.pl-is-not-a-library.patch
+BuildArch: noarch
+BuildRequires: perl(ExtUtils::MakeMaker)
+# Run-time:
+BuildRequires: perl(AutoLoader)
+BuildRequires: perl(Data::Dumper)
+BuildRequires: perl(Exporter)
+BuildRequires: perl(IO::Socket)
+BuildRequires: perl(MIME::Base64)
+# Tests:
+BuildRequires: perl(Test::More)
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+Requires: perl(DBI)
+
+%description
+This module/script gets the CDDB data for an audio CD. You need a CD-ROM drive
+and an active Internet connection in order to do that.
+
+%prep
+%setup -q -n CDDB_get-%{version}
+%patch0 -p1
+%patch1 -p1
+
+%build
+%{__perl} Makefile.PL INSTALLDIRS=vendor
+make %{?_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make pure_install DESTDIR=$RPM_BUILD_ROOT
+
+find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
+%{_fixperms} $RPM_BUILD_ROOT/*
+
+%check
+make test
+
+%files
+%doc Artistic Changes Copying DATABASE README
+%{_bindir}/*
+%{perl_vendorlib}/*
+%{_mandir}/man3/*
+
+%changelog
+* Fri Sep 14 2012 Petr Pisar <ppisar(a)redhat.com> 2.28-1
+- Specfile autogenerated by cpanspec 1.78.
diff --git a/sources b/sources
index e69de29..569113e 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+e757e5e2f5a4c4aafcce0529310f2c6d CDDB_get-2.28.tar.gz
11 years, 6 months