| 1 | #!/usr/bin/perl -w | ||
| 2 | #Copyright 1998-2001, Randall Maas. All rights reserved. This program is free | ||
| 3 | #software; you can redistribute it and/or modify it under the same terms as | ||
| 4 | #PERL itself. | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | C<CfgTie::TieRealm> -- Ties configuration variables to various HTTP servers | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | Makes it easy to manage a variety of web servers thru one. | ||
| 13 | |||
| 14 | =head DESCRIPTION | ||
| 15 | |||
| 16 | |||
| 17 | =head1 Caveats | ||
| 18 | |||
| 19 | It is not able to modify the main realms configuration file. | ||
| 20 | |||
| 21 | =head1 Author | ||
| 22 | |||
| 23 | Randall Maas (L<randym@acm.org>, L<http://www.hamline.edu/~rcmaas/>) | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | package CfgTie::TieRealm; | ||
| 28 | use HTTPD::Realm; | ||
| 29 | |||
| 30 | use vars qw($VERSION @ISA); | ||
| 31 | $VERSION='0.41'; | ||
| 32 | @ISA=qw(HTTPD::Realm); | ||
| 33 | |||
| 34 | sub TIEHASH | ||
| 35 | { | ||
| 36 | #Needs configuration file. | ||
| 37 | return bless [], $_[0]; | ||
| 38 | } | ||
| 39 | |||
| 40 | sub EXISTS | ||
| 41 | { | ||
| 42 | $_[0]->exists($_[1]); | ||
| 43 | } | ||
| 44 | |||
| 45 | sub FIRSTKEY | ||
| 46 | { | ||
| 47 | if (!@{$_[0]->[0]}) | ||
| 48 | { | ||
| 49 | $_[0]->[0] = [$_[0]->list()]; | ||
| 50 | } | ||
| 51 | my $a = @{$_[0]->[0]}; | ||
| 52 | NEXTKEY($_[0]); | ||
| 53 | } | ||
| 54 | |||
| 55 | sub NEXTKEY | ||
| 56 | { | ||
| 57 | return scalar each @{$_[0]->[0]}; | ||
| 58 | } | ||
| 59 | |||
| 60 | sub FETCH | ||
| 61 | { | ||
| 62 | return $_[0]->realm($_[1]); | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | package CfgTie::TieRealm... | ||
| 67 | #Keys => name, users, groups, userdb, groupdb. mode, database, fields, usertype,grouptype,authentication,server,crypt,SQLdata | ||
| 68 | |||
| 69 | |||
| 70 | package CfgTie::TieRealm_groups | ||
| 71 | package CfgTie::TieRealm_users |