tags 303005 patch
thanks

On Thu, Apr 07, 2005 at 11:17:00PM +0200, Denis Barbier wrote:
> Sure, but I have no clue and do not know of any other similar program
> providing this feature, so help and patches are very welcome.

okay, attached :)

it might be a nice addition to this to add the ability to sign with
a specific key, or base the key off of the "From:" address, but this
works for me and is fairly clean.


        sean

-- 
--- podebconf-report-po.old     2005-04-07 21:28:22.384056631 -0400
+++ podebconf-report-po 2005-04-07 21:28:03.564846466 -0400
@@ -43,6 +43,7 @@
 my $HELP_ARG = 0;
 my $VERSION_ARG = 0;
 my $VERBOSE_ARG = 0;
+my $SIGN_ARG = 0;
 my $SUBMIT_ARG = 0;
 my $FORCE_ARG = 0;
 my $LANGUAGETEAM_ARG = 0;
@@ -123,6 +124,7 @@
  "version"         => \$VERSION_ARG,
  "v|verbose"       => \$VERBOSE_ARG,
  "f|force"         => \$FORCE_ARG,
+ "s|sign"          => \$SIGN_ARG,
  "podir=s"         => \$PODIR_ARG,
  "smtp=s"          => \$SMTP_ARG,
  "template=s"      => \$TEMPLATE_ARG,
@@ -387,6 +389,8 @@
        my $body = shift;
        my $opts = "";
        my $tmpnam = tmpnam();
+       my $gpgnam = tmpnam() if $SIGN_ARG;
+       my $gpgret;
 
        open (OUT, "> $tmpnam")
                or die ("Couldn't write $tmpnam: $!\nExiting!\n");
@@ -397,6 +401,16 @@
        $opts = "-f" if ($editor eq "vim");
        system("$editor $opts $tmpnam");
 
+       if($SIGN_ARG) {
+               $gpgret = system("gpg --clearsign -s -a -o '$gpgnam' 
'$tmpnam'");
+               if($gpgret){
+                       unlink $gpgnam;
+                       unlink $tmpnam;
+                       die("gpg exited with status $gpgret");
+               }
+               rename($gpgnam, $tmpnam);
+       }
+
        $body = &ReadFile($tmpnam) if (-f $tmpnam);
        unlink($tmpnam);
 
@@ -465,6 +479,7 @@
   --version             display version information and exit
   -v, --verbose         display additional information
   -f, --force           send the email without confirmation
+  -s, --sign            use gpg to sign the email
   --podir=DIRECTORY     specify where are located the PO files
   --smtp=SERVER         specify SMTP server for mailing (default localhost)
   --template=TEMPLATE   specify file to use it as template for the emails

Attachment: signature.asc
Description: Digital signature

Reply via email to