Make a licensing decision: it's all AGPLv3+.
[odin-cgi] / bin / mailredir.userv
index f5acb06..7df86d2 100755 (executable)
@@ -1,4 +1,27 @@
 #! /usr/bin/perl
+###
+### Mail redirection userv interface for Odin
+###
+### (c) 2015 Mark Wooding
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the `odin.gg' service, `odin-cgi'.
+###
+### `odin-cgi' is free software; you can redistribute it and/or modify
+### it under the terms of the GNU Affero General Public License as
+### published by the Free Software Foundation; either version 3 of the
+### License, or (at your option) any later version.
+###
+### `odin-cgi' 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 Affero General Public License for more details.
+###
+### You should have received a copy of the GNU Affero General Public
+### License along with `odin-cgi'; if not, see
+### <http://www.gnu.org/licenses/>.
 
 use lib 'lib';
 
@@ -66,6 +89,7 @@ Commands available:
 
        disable LPART ...
        dormant
+       giveaway LPART OWNER
        help
        list
        new [-n COUNT] [-GENOPTS] [-RECOPTS] [RECIP]
@@ -95,6 +119,13 @@ EOF
     my ($lpart, $expire, $recip, $comment) = @$r;
     Odin::print_columns $lpart => 24, $recip => 32, $comment => 0;
   }
+} elsif ($op eq "giveaway") {
+  @ARGV >= 2 or Odin::fail "usage: giveaway OWNER LPART ...";
+  my $owner = shift @ARGV;
+  my @l = @ARGV;
+  getpwnam $owner or Odin::fail "unknown user `$owner'";
+  my %r = (owner => $owner);
+  Odin::modify_redir $dom, %r, @l;
 } elsif ($op eq "reserved") {
   @ARGV and Odin::fail "usage: reserved";
   for my $r (Odin::redir_query Odin::open_db, $dom, $Odin::WHO,