--- a/bin/dav-htuseradd Fri Jul 15 10:24:44 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2011 Matthias Förste
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Matthias Förste <foerste@schlittermann.de>
-
-use strict;
-use warnings;
-
-use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd usage);
-
-use Getopt::Long;
-use Pod::Usage;
-
-my ($user, $expiry, $pass);
-
-GetOptions(
- 'u|user=s' => \$user,
- 'e|expiry=i' => \$expiry,
- 'h|help' => sub { usage(-exit => 0, -verbose => 1) },
- 'm|man' => sub {
- usage(
- -exit => 0,
-
- # "system('perldoc -V &>/dev/null')" appears shorter, but may not
- # do what you expect ( it still returns 0 on debian squeeze with
- # dash as system shell even if cannot find the command in $PATH)
- -noperldoc => system('perldoc -V >/dev/null 2>&1'),
- -verbose => 2
- );
- },
-) and defined $user or usage;
-
-$pass = useradd readconfig, $user, mkpasswd, $expiry;
-print "[$pass]\n";
--- a/bin/dav-htuserdel Fri Jul 15 10:24:44 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2011 Matthias Förste
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Matthias Förste <foerste@schlittermann.de>
-
-use strict;
-use warnings;
-
-use Getopt::Long;
-use Ius::Dav::Htpasswd qw(readconfig userdel usage);
-
-my $user;
-
-GetOptions(
- 'u|user=s' => \$user,
- "h|help" => sub { usage( -verbose => 0, -exitval => 0 ) },
- "m|man" => sub {
- usage(
- -verbose => 2,
- -exitval => 0,
- -noperldoc => ( `perldoc -V 2>/dev/null`, $? != 0 )[-1]
- );
- },
-) and defined $user or usage();
-
-exit userdel readconfig, $user;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ius-dav-htuseradd Fri Jul 15 10:28:04 2011 +0200
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2011 Matthias Förste
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Matthias Förste <foerste@schlittermann.de>
+
+use strict;
+use warnings;
+
+use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd usage);
+
+use Getopt::Long;
+use Pod::Usage;
+
+my ($user, $expiry, $pass);
+
+GetOptions(
+ 'u|user=s' => \$user,
+ 'e|expiry=i' => \$expiry,
+ 'h|help' => sub { usage(-exit => 0, -verbose => 1) },
+ 'm|man' => sub {
+ usage(
+ -exit => 0,
+
+ # "system('perldoc -V &>/dev/null')" appears shorter, but may not
+ # do what you expect ( it still returns 0 on debian squeeze with
+ # dash as system shell even if cannot find the command in $PATH)
+ -noperldoc => system('perldoc -V >/dev/null 2>&1'),
+ -verbose => 2
+ );
+ },
+) and defined $user or usage;
+
+$pass = useradd readconfig, $user, mkpasswd, $expiry;
+print "[$pass]\n";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ius-dav-htuserdel Fri Jul 15 10:28:04 2011 +0200
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2011 Matthias Förste
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Matthias Förste <foerste@schlittermann.de>
+
+use strict;
+use warnings;
+
+use Getopt::Long;
+use Ius::Dav::Htpasswd qw(readconfig userdel usage);
+
+my $user;
+
+GetOptions(
+ 'u|user=s' => \$user,
+ "h|help" => sub { usage( -verbose => 0, -exitval => 0 ) },
+ "m|man" => sub {
+ usage(
+ -verbose => 2,
+ -exitval => 0,
+ -noperldoc => ( `perldoc -V 2>/dev/null`, $? != 0 )[-1]
+ );
+ },
+) and defined $user or usage();
+
+exit userdel readconfig, $user;
--- a/cgi-bin/admin/dav-htuseradd.cgi Fri Jul 15 10:24:44 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2011 Matthias Förste
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Matthias Förste <foerste@schlittermann.de>
-
-use warnings;
-
-# Using CGI::Fast will result in an Internal Server Error because we are
-# restarting apache when everything else works
-# use CGI::Fast;
-use CGI;
-use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd);
-
-my $q = new CGI;
-
- print $q->header(-charset => 'UTF-8');
- print $q->start_html(
- -title => $0,
- -bgcolor => "white",
- );
-
- my ($user, $pass, $expiry) = (
- $q->param('user'),
- $q->param('pass'),
- $q->param('expiry')
- );
-
- unless (defined $user or defined $pass or defined $expiry) {
-
- print $q->start_form,
- 'New User' => $q->textfield('user'),
- 'Password' => $q->password_field('pass'),
- 'Expiry' => $q->textfield('expiry'),
- $q->submit,
- $q->end_form;
-
- } else {
-
- my @cmd = (qw(sudo dav-htuseradd -u), $user);
- push @cmd, '-e', $expiry if defined $expiry and $expiry ne '';
-
- if (my $pass = qx(@cmd)) {
- chomp $pass;
- print $q->p($pass);
- } else {
- print $q->p('Something went wrong');
- }
-
- }
-
- print $q->end_html;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/admin/ius-dav-htuseradd.cgi Fri Jul 15 10:28:04 2011 +0200
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2011 Matthias Förste
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Matthias Förste <foerste@schlittermann.de>
+
+use warnings;
+
+# Using CGI::Fast will result in an Internal Server Error because we are
+# restarting apache when everything else works
+# use CGI::Fast;
+use CGI;
+use Ius::Dav::Htpasswd qw(mkpasswd readconfig useradd);
+
+my $q = new CGI;
+
+ print $q->header(-charset => 'UTF-8');
+ print $q->start_html(
+ -title => $0,
+ -bgcolor => "white",
+ );
+
+ my ($user, $pass, $expiry) = (
+ $q->param('user'),
+ $q->param('pass'),
+ $q->param('expiry')
+ );
+
+ unless (defined $user or defined $pass or defined $expiry) {
+
+ print $q->start_form,
+ 'New User' => $q->textfield('user'),
+ 'Password' => $q->password_field('pass'),
+ 'Expiry' => $q->textfield('expiry'),
+ $q->submit,
+ $q->end_form;
+
+ } else {
+
+ my @cmd = (qw(sudo ius-dav-htuseradd -u), $user);
+ push @cmd, '-e', $expiry if defined $expiry and $expiry ne '';
+
+ if (my $pass = qx(@cmd)) {
+ chomp $pass;
+ print $q->p($pass);
+ } else {
+ print $q->p('Something went wrong');
+ }
+
+ }
+
+ print $q->end_html;
--- a/lib/Ius/Dav/Htpasswd.pm Fri Jul 15 10:24:44 2011 +0200
+++ b/lib/Ius/Dav/Htpasswd.pm Fri Jul 15 10:28:04 2011 +0200
@@ -99,7 +99,7 @@
my $at_cmd = "at now + " . 24 * 60 * $expiry . " minutes";
open AT, "|$at_cmd"
or die "Can't open AT, '|$at_cmd': $!";
- print AT "dav-htuserdel";
+ print AT "ius-dav-htuserdel";
close AT;
my $user_dir = "$conf->{dav_base}/$user";