chiark
/
gitweb
/
~ijackson
/
d.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6ab8ab4
)
allow specifying ADDR as full address
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Wed, 4 Sep 2013 17:31:28 +0000
(18:31 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Wed, 4 Sep 2013 17:31:48 +0000
(18:31 +0100)
service
patch
|
blob
|
history
diff --git
a/service
b/service
index c5dbfe498874e928155fcd3ab1fe3e2ad9419374..7e8eed9ee2ef221f79df272e935515bff257b218 100755
(executable)
--- a/
service
+++ b/
service
@@
-12,8
+12,8
@@
END
our $usage2 = <<'END';
actions
create [REDIRECT] [#COMMENT] (default for REDIRECT is your username)
our $usage2 = <<'END';
actions
create [REDIRECT] [#COMMENT] (default for REDIRECT is your username)
- update
LOCAL-PART
[REDIRECT] [#COMMENT]
- show
LOCAL-PART
+ update
ADDR
[REDIRECT] [#COMMENT]
+ show
ADDR
list
list-actions
empty string for REDIRECT means reject
list
list-actions
empty string for REDIRECT means reject
@@
-21,8
+21,8
@@
END
our $usage3 = <<'END';
privileged actions
list-user USER
our $usage3 = <<'END';
privileged actions
list-user USER
- insert-exact
LOCAL-PART
USER REDIRECT COMMENT
- donate
LOCAL-PART
USER
+ insert-exact
ADDR
USER REDIRECT COMMENT
+ donate
ADDR
USER
enable-user|disable-user USER
END
enable-user|disable-user USER
END
@@
-47,6
+47,13
@@
sub nextarg () {
return $v;
}
return $v;
}
+sub nextarg_addr () {
+ my $addr = nextarg;
+ return $addr if $addr !~ m/\@/;
+ die "address not in correct domain (\@$dom)\n" unless $' eq $dom; #';
+ return $`; #`;
+}
+
sub nomoreargs () {
die "too many arguments\n" if @ARGV;
}
sub nomoreargs () {
die "too many arguments\n" if @ARGV;
}
@@
-182,7
+189,7
@@
sub begin_row ($) {
}
sub action_update {
}
sub action_update {
- my $localpart = nextarg;
+ my $localpart = nextarg
_addr
;
my $updrow = rhsargs({});
nomoreargs;
begin_row($localpart);
my $updrow = rhsargs({});
nomoreargs;
begin_row($localpart);
@@
-198,7
+205,7
@@
sub action_update {
}
sub action_show {
}
sub action_show {
- my $localpart = nextarg;
+ my $localpart = nextarg
_addr
;
nomoreargs;
my $row = begin_row($localpart);
prow($row);
nomoreargs;
my $row = begin_row($localpart);
prow($row);
@@
-238,7
+245,7
@@
sub action_list_all {
sub action_insert_exact {
die unless $priv;
my $row = { };
sub action_insert_exact {
die unless $priv;
my $row = { };
- $row->{'localpart'} = nextarg;
+ $row->{'localpart'} = nextarg
_addr
;
$row->{'user'} = $user = nextarg;
$row->{'redirect'} = nextarg;
$row->{'comment'} = nextarg;
$row->{'user'} = $user = nextarg;
$row->{'redirect'} = nextarg;
$row->{'comment'} = nextarg;
@@
-249,7
+256,7
@@
sub action_insert_exact {
sub action_donate {
die unless $priv;
sub action_donate {
die unless $priv;
- my $localpart = nextarg;
+ my $localpart = nextarg
_addr
;
my $newuser = nextarg;
nomoreargs;
begin_row($localpart);
my $newuser = nextarg;
nomoreargs;
begin_row($localpart);
@@
-313,7
+320,7
@@
if (defined $ENV{'USERV_USER'}) {
$user = ((getpwuid $<)[0]) or die;
}
$user = ((getpwuid $<)[0]) or die;
}
-$usage2 .= "
LOCAL-PART is
implicitly qualified with \@$dom\n"
+$usage2 .= "
ADDR may be a local part,
implicitly qualified with \@$dom\n"
if defined $qualdom;
$usage2 .= "REDIRECT is implicitly qualified with \@$qualdom if it has no \@\n"
if defined $qualdom;
if defined $qualdom;
$usage2 .= "REDIRECT is implicitly qualified with \@$qualdom if it has no \@\n"
if defined $qualdom;