#!/usr/local/bin/perl # view_mailq.cgi # Display some message from the mail queue require './sendmail-lib.pl'; require './boxes-lib.pl'; &ReadParse(); $access{'mailq'} || &error($text{'mailq_ecannot'}); $in{'file'} =~ /\.\./ && &error($text{'mailq_ecannot'}); $conf = &get_sendmailcf(); foreach $mqueue (&mailq_dir($conf)) { $ok++ if ($in{'file'} =~ /^$mqueue\//); } $ok || &error($text{'mailq_ecannot'}); $qfile = $in{'file'}; $mail = &mail_from_queue($qfile, "auto"); $mail || &error($text{'view_egone'}); &can_view_qfile($mail) || &error($text{'mailq_ecannot'}); &parse_mail($mail); @sub = split(/\0/, $in{'sub'}); $subs = join("", map { "&sub=$_" } @sub); foreach $s (@sub) { # We are looking at a mail within a mail .. local $amail = &extract_mail($mail->{'attach'}->[$s]->{'data'}); &parse_mail($amail); $mail = $amail; } ($name = $in{'file'}) =~ s/^.*\///; if (!@sub) { $desc = &text('view_qdesc', "$name"); } else { $desc = $text{'view_sub'}; } &ui_print_header($desc, $text{'view_title'}, ""); print "
\n"; &ui_print_footer(!@sub ? ( ) : ( "view_mailq.cgi?file=$qfile", $text{'view_return'} ), "list_mailq.cgi", $text{'mailq_return'}, "", $text{'index_return'});