-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathshowpass.cgi
executable file
·47 lines (43 loc) · 1.46 KB
/
showpass.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/local/bin/perl
# Show a domain's or user's password
require './virtual-server-lib.pl';
&ReadParse();
$d = &get_domain($in{'dom'});
$d || &error($text{'edit_egone'});
&can_show_pass() || &error($text{'showpass_ecannot'});
&can_edit_domain($d) || &error($text{'edit_ecannot'});
if ($in{'user'}) {
# Showing for mailbox user
&can_edit_users() || &error($text{'users_ecannot'});
@users = &list_domain_users($d, 0, 1, 1, 1);
($user) = grep { $_->{'user'} eq $in{'user'} } @users;
$user || &error($text{'showpass_egone'});
$username = $user->{'user'};
$pass = $user->{'plainpass'};
$msg1 = $text{'showpass_useru'};
$msg2 = $text{'showpass_passu'};
}
elsif (&indexof($in{'mode'}, @database_features) >= 0) {
# For a DB
$ufunc = $in{'mode'}."_user";
$username = &$ufunc($d);
$pfunc = $in{'mode'}."_pass";
$pass = &$pfunc($d, 1);
$msg1 = &text('showpass_dbuser', $text{'feature_'.$in{'mode'}});
$msg2 = &text('showpass_dbpass', $text{'feature_'.$in{'mode'}});
}
else {
# For a domain
$username = $d->{'user'};
$pass = $d->{'pass'};
$msg1 = $text{'showpass_user'};
$msg2 = $text{'showpass_pass'};
}
&popup_header($text{'showpass_title'});
print "<center><table>\n";
print "<tr> <td style=\"padding-right: 10px\"><b>$msg1</b></td> ",
"<td><tt>",&html_escape($username),"</tt></td> </tr>\n";
print "<tr> <td style=\"padding-right: 10px\"><b>$msg2</b></td> ",
"<td><tt>",&html_escape($pass),"</tt></td> </tr>\n";
print "</table></center>\n";
&popup_footer();