ajout des perl suid scripts (desole, j'avais oublie...)

This commit is contained in:
Benjamin Sonntag 2006-05-12 11:17:23 +00:00
parent e1b905c76a
commit f4c3ad85e0
8 changed files with 202 additions and 1 deletions

6
.gitattributes vendored
View File

@ -353,8 +353,14 @@ src/.cvsignore -text
src/Makefile -text
src/basedir_prot.sh -text
src/du.pl -text
src/mail_add -text
src/mail_del -text
src/mem_add -text
src/mem_del -text
src/quota_delete -text
src/quota_edit -text
src/quota_edit.sh -text
src/quota_get -text
src/quota_get.sh -text
src/quota_init -text
src/rawstat.daily -text

2
debian/control vendored
View File

@ -8,7 +8,7 @@ Standards-Version: 3.7.2.0
Package: alternc
Architecture: all
Depends: debianutils (>= 1.13.1), debconf (>= 0.5.00) | debconf-2.0, libapache-mod-php4 | libapache-mod-php5, apache, apache-ssl, courier-ssl, courier-imap-ssl, courier-pop-ssl, mysql-server, php5-mysql | php4-mysql, phpmyadmin, proftpd-mysql, squirrelmail, postfix, postfix-tls, bind9, wget, libapache-mod-gzip, rsync, quota, courier-authmysql, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php4-cli | php5-cli, php4-mysql | php5-mysql, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), pdksh (>= 5.2.14-6), adduser, perl-suid
Depends: debianutils (>= 1.13.1), debconf (>= 0.5.00) | debconf-2.0, libapache-mod-php4 | libapache-mod-php5, apache, apache-ssl, courier-ssl, courier-imap-ssl, courier-pop-ssl, mysql-server, php5-mysql | php4-mysql, phpmyadmin, proftpd-mysql, squirrelmail, postfix, postfix-tls, bind9, wget, libapache-mod-gzip, rsync, quota, courier-authmysql, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php4-cli | php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), pdksh (>= 5.2.14-6), adduser, perl-suid
Conflicts: alternc-admintools, alternc-awstats (<= 0.3.2), alternc-webalizer (<= 0.9.4)
Provides: alternc-admintools
Replaces: alternc-admintools

44
src/mail_add Executable file
View File

@ -0,0 +1,44 @@
#!/usr/bin/perl
use strict;
my ($mailname,$uid) = @ARGV;
if (!$mailname || !$uid) {
print "Usage: mail_add <mailname> <uid>\n";
print " Create the mail <mailname> for the alternc account having uid number <uid>\n";
exit(1);
}
$ENV{PATH} = "";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (!($mailname =~ /^([a-z0-9_\+\.-]+\_[a-z0-9\.-]+)$/)) {
die "Email is incorrect.";
}
$mailname=$1;
if (!($uid =~ /^([0-9]+)$/)) {
die "uid is incorrect.";
}
$uid=$1;
$< = $>;
$( = $);
my $PTH="/var/alternc/mail/".substr($mailname,0,1)."/".$mailname;
my @todo=(
$PTH,
$PTH."/Maildir",
$PTH."/Maildir/cur",
$PTH."/Maildir/new",
$PTH."/Maildir/tmp",
);
foreach(@todo) {
mkdir($_);
system("/bin/chown 33:$uid '".quotemeta($_)."'");
}
0;

27
src/mail_del Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/perl
use strict;
my ($mailname) = @ARGV;
if (!$mailname) {
print "Usage: mail_del <mailname>\n";
print " Destroy pop account <mailname>\n";
exit(1);
}
$ENV{PATH} = "";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (!($mailname =~ /^([a-z0-9_\+\.-]+\_[a-z0-9\.-]+)$/)) {
die "Email is incorrect.";
}
$mailname=$1;
$< = $>;
$( = $);
system("/bin/rm -rf '".quotemeta("/var/alternc/mail/".substr($mailname,0,1)."/".$mailname)."'");
0;

35
src/mem_add Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/perl
use strict;
my ($name,$uid) = @ARGV;
if (!$name || !$uid) {
print "Usage: mem_add <name> <uid>\n";
print " Create the AlternC account <name> having uid number <uid>\n";
exit(1);
}
$ENV{PATH} = "";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (!($name =~ /^([a-z0-9_\+\.-]+)$/)) {
die "Account name is incorrect.";
}
$name=$1;
if (!($uid =~ /^([0-9]+)$/)) {
die "uid is incorrect.";
}
$uid=$1;
$< = $>;
$( = $);
my $PTH="/var/alternc/html/".substr($name,0,1)."/".$name;
mkdir($PTH);
system("/bin/chown 33:$uid '".quotemeta($PTH)."'");
system("/bin/chmod 02770 '".quotemeta($PTH)."'");
0;

28
src/mem_del Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/perl
use strict;
my ($name) = @ARGV;
if (!$name) {
print "Usage: mem_del <name>\n";
print " Delete the AlternC account <name>\n";
exit(1);
}
$ENV{PATH} = "";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (!($name =~ /^([a-z0-9_\+\.-]+)$/)) {
die "Account name is incorrect.";
}
$name=$1;
$< = $>;
$( = $);
my $PTH="/var/alternc/html/".substr($name,0,1)."/".$name;
system("/bin/rm -rf '".quotemeta($PTH)."'");
0;

33
src/quota_edit Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/perl
use strict;
my ($uid,$size) = @ARGV;
if (!$size || !$uid) {
print "Usage: quota_edit <uid> <size>\n";
print " Edit the quota of the AlternC account having uid <uid> the the available space to <size>\n";
exit(1);
}
$ENV{PATH} = "";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (!($uid =~ /^([0-9]+)$/)) {
die "uid is incorrect.";
}
$uid=$1;
if (!($size =~ /^([0-9]+)$/)) {
die "size is incorrect.";
}
$size=$1;
$< = $>;
$( = $);
my $PTH="/usr/lib/alternc/quota_edit.sh '".quotemeta($uid)."' '".quotemeta($size)."'";
system($PTH);
0;

28
src/quota_get Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/perl
use strict;
my ($uid) = @ARGV;
if (!$uid) {
print "Usage: quota_get <uid>\n";
print " Get the quota of the AlternC account having uid <uid>\n";
exit(1);
}
$ENV{PATH} = "";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (!($uid =~ /^([0-9]+)$/)) {
die "uid is incorrect.";
}
$uid=$1;
$< = $>;
$( = $);
my $PTH="/usr/lib/alternc/quota_get.sh '".quotemeta($uid)."'";
system($PTH);
0;