#!/usr/bin/perl
+# Main G-RIN CGI script code. Must be invoked with --cgi if
+# as a CGI script - see the example file cam-grin.
+#
+# Copyright (C) 1999 Ian Jackson <ijackson@chiark.greenend.org.uk>
+#
+# This 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 2,
+# or (at your option) any later version.
+#
+# This 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 file; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use POSIX;
#!/bin/sh
+# Sample file for executing Cambridge G-RIN. This is what it actually
+# invoked by the webserver, but of course you must edit it.
+#
+# Written by Ian Jackson <ijackson@chiark.greenend.org.uk>, 1999.
+# I hereby place this file in the public domain.
+
set -e
umask 007
cd /home/ijackson/things/bcp5-registry.cam-grin
+# Configuration file. You should definitely edit this !
+#
+# Written by Ian Jackson <ijackson@chiark.greenend.org.uk>, 1999.
+# I hereby place this file in the public domain.
+
$whose= "Cambridge";
$adminname= 'Ian Jackson';
$adminemail= 'ijackson+cam-grin@chiark.greenend.org.uk';
+# G-RIN database handling.
+# Copyright (C) 1999 Ian Jackson <ijackson@chiark.greenend.org.uk
#
+# This 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 2,
+# or (at your option) any later version.
+#
+# This 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 file; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@db_fields= qw(network prefix name contact email hiddenemail created changed);
+# Routines for actually displaying (parts of) database in CGI output.
#
+# Copyright (C) 1999 Ian Jackson <ijackson@chiark.greenend.org.uk>
+#
+# This 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 2,
+# or (at your option) any later version.
+#
+# This 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 file; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
sub list_database ($) {
my ($instyle) = @_;
+# Network/range syntax and semantics handling.
#
+# Copyright (C) 1999 Ian Jackson <ijackson@chiark.greenend.org.uk>
+#
+# This 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 2,
+# or (at your option) any later version.
+#
+# This 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 file; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
sub parse_netrange ($) {
my ($net) = @_;
+@@@comment: Email notification template. Edit this if you feel like it,
+@@@comment: but take care or the results may be strange.
+@@@comment:
+@@@comment: Written by Ian Jackson <ijackson@chiark.greenend.org.uk>, 1999.
+@@@comment: I hereby place this file in the public domain.
+@@@comment: NB: do not add more copyright restrictions to this file,
+@@@comment: or running the scripts will cause copyright violation !
+
From: "@@@adminname@@@" (@@@whose@@@ G-RIN administrator) <@@@adminemail@@@>
To: "@@@contact@@@" <@@@alwaysemail@@@>
+# Password handling.
#
+# Copyright (C) 1999 Ian Jackson <ijackson@chiark.greenend.org.uk>
+#
+# This 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 2,
+# or (at your option) any later version.
+#
+# This 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 file; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use MD5;
#!/bin/sh
+# Script to allow testing, using the lynxcgi feature.
+#
+# Copyright (C) 1999 Ian Jackson <ijackson@chiark.greenend.org.uk>
+#
+# This 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 2,
+# or (at your option) any later version.
+#
+# This 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 file; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
set -e
exec lynx -cfg=/dev/null -nocolor "$@" lynxcgi:./bcp5-registry.pl
+@@@comment: Web page template. Edit this if you feel like it,
+@@@comment: but take care or the results may be strange.
+@@@comment:
+@@@comment: Written by Ian Jackson <ijackson@chiark.greenend.org.uk>, 1999.
+@@@comment: I hereby place this file in the public domain.
+@@@comment: NB: do not add more copyright restrictions to this file,
+@@@comment: or running the scripts will cause copyright violation !
+
<html><head>
<title>@@@whose@@@ G-RIN -
#!/bin/sh
+# Sample file for installing new Cambridge G-RIN main page. Of course
+# you must edit this.
+#
+# Written by Ian Jackson <ijackson@chiark.greenend.org.uk>, 1999.
+# I hereby place this file in the public domain.
+
set -e
file=/home/ijackson/public-html/cam-grin/index.html
./bcp5-registry.pl >$file.new
+# Various utility functions, including template substitution.
#
+# Copyright (C) 1999 Ian Jackson <ijackson@chiark.greenend.org.uk>
+#
+# This 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 2,
+# or (at your option) any later version.
+#
+# This 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 file; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
open RAND,"/dev/urandom" or die $!;
sub process_file ($) {
- my ($filename) = @_;
+ local ($filename) = @_;
open X, "$filename" or die "$filename: $!";
@x= <X>;
}
}
process(0);
+ } elsif (m/^\@\@\@comment\:(\s.*)?$/) {
} elsif (m/\S/) {
s/^\@\@\@$//;
if ($doing) {
} else {
s/\@\@\@\w+\@\@\@//g;
}
- die "$cl:unknown $_\n" if m/\@\@\@/;
+ die "$filename:$cl:unknown $_\n" if m/\@\@\@/;
}
}
$level--;
sub getvar ($) {
my ($vn) = @_;
- defined $$vn or die "$cl:undefined $vn\n$out";
+ defined $$vn or die "$filename:$cl:undefined $vn\n$out";
return $$vn;
}