Author: dylan
Date: 2005-06-25 19:36:42 -0400 (Sat, 25 Jun 2005)
New Revision: 825

Modified:
   trunk/
   trunk/docs/spec/Haver/Spec/Auth.pod
   trunk/perl/server/lib/Haver/Server/Config.pm
   trunk/perl/server/lib/Haver/Server/Wheel/Auth.pm
   trunk/web/Makefile
Log:
 [EMAIL PROTECTED]:  dylan | 2005-06-25 19:36:38 -0400
 refer to hash as "Digest" in places.



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/havercurs-objc:43089
1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:11166
1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk-merge-10131:11178
27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212
e9404bb1-7af0-0310-a7ff-e22194cd388b:/haver/local:1195
edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238
   + 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/havercurs-objc:43089
1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:11166
1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk-merge-10131:11178
27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212
e9404bb1-7af0-0310-a7ff-e22194cd388b:/haver/local:1197
edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238

Modified: trunk/docs/spec/Haver/Spec/Auth.pod
===================================================================
--- trunk/docs/spec/Haver/Spec/Auth.pod 2005-06-25 23:20:08 UTC (rev 824)
+++ trunk/docs/spec/Haver/Spec/Auth.pod 2005-06-25 23:36:42 UTC (rev 825)
@@ -22,14 +22,14 @@
   S: AUTH:TYPES  basic  foo  bar  baz
   C: AUTH:TYPE  basic
   S: AUTH:BASIC  $nonce  sha1,md5
-  C: AUTH:BASIC  $hash  $response
+  C: AUTH:BASIC  $digest  $response
 
 If the authentication is successful, the server will send HELLO as per normal.
 If not, the server will fail the client with B<auth.fail>.
 
-$hash is one of the names listed in the second argument of S:AUTH:BASIC.
+$digest is one of the names listed in the second argument of S:AUTH:BASIC.
 $response is the result of hashing the concatenation of $nonce and the user's 
passcode
-using the hash function named in $hash. The $response is always base64 encoded.
+using the hash function named in $digest. The $response is always base64 
encoded.
 
 See also L</PASSCODES> for instructions on creating a passcode.
 
@@ -39,10 +39,10 @@
        use Digest::SHA1 'sha1_base64';
        
        sub response {
-               my ($hash, $nonce, $passcode) = @_;
-               if ($hash eq 'sha1') {
+               my ($digest, $nonce, $passcode) = @_;
+               if ($digest eq 'sha1') {
                        return sha1_base64($nonce . $passcode);
-               } elsif ($hash eq 'md5') {
+               } elsif ($digest eq 'md5') {
                        return md5_base64($nonce . $passcode);
                }
        }
@@ -59,9 +59,9 @@
 
 Raised when authentication did not work because the passcode or whatever was 
wrong.
 
-=head2 unknown.hash
+=head2 unknown.digest
 
-Raised when the hashing algorithm requested by the client is unknown to the 
server.
+Raised when the hashing (digest) algorithm requested by the client is unknown 
to the server.
 
 =head1 PASSCODES
 

Modified: trunk/perl/server/lib/Haver/Server/Config.pm
===================================================================
--- trunk/perl/server/lib/Haver/Server/Config.pm        2005-06-25 23:20:08 UTC 
(rev 824)
+++ trunk/perl/server/lib/Haver/Server/Config.pm        2005-06-25 23:36:42 UTC 
(rev 825)
@@ -15,6 +15,10 @@
                },
        ],
        storedir => 'store',
+       digests => {
+               md5  => 'MD5',
+               sha1 => 'SHA-1',
+       },
 };
 
 

Modified: trunk/perl/server/lib/Haver/Server/Wheel/Auth.pm
===================================================================
--- trunk/perl/server/lib/Haver/Server/Wheel/Auth.pm    2005-06-25 23:20:08 UTC 
(rev 824)
+++ trunk/perl/server/lib/Haver/Server/Wheel/Auth.pm    2005-06-25 23:36:42 UTC 
(rev 825)
@@ -5,14 +5,8 @@
 use warnings;
 
 use Haver::Server::Wheel -base;
-use Digest::SHA1 ();
-use Digest::MD5 ();
+use Digest;
 
-my %Algos = (
-       md5  => 'Digest::MD5',
-       sha1 => 'Digest::SHA1',
-);
-
 sub setup {
        my $self = shift;
        $self->msg(
@@ -34,26 +28,32 @@
 
 sub msg_AUTH_TYPE {
        my ($kernel, $heap, $args) = @_[KERNEL, HEAP, ARG0];
+       my $config = $heap->{config};
        my $type = $args->[0];
        if ($type eq 'basic') {
                $heap->{nonce} = rand_word();
-               $heap->{client}->put(['AUTH:BASIC', $heap->{nonce}, join(',', 
keys %Algos)]);
+               $heap->{client}->put([
+                               'AUTH:BASIC',
+                               $heap->{nonce},
+                               join(',', keys %{ $config->digests })
+                       ]
+               );
        }
 }
 
 sub msg_AUTH_BASIC {
        my ($kernel, $heap, $args) = @_[KERNEL, HEAP, ARG0];
-       my ($algo, $resp) = @$args;
+       my ($digest, $resp) = @$args;
+       my $digests = $heap->{config}->digests;
        my $store = $heap->{store};
        my $name = $heap->{name};
        my $user = $store->fetch(user => $name);
 
-       unless (exists $Algos{$algo}) {
-               $kernel->yield('fail', 'unknown.hash');
+       unless (exists $digests->{$digest}) {
+               $kernel->yield('fail', 'unknown.digest');
                return;
        }
-       my $class = $Algos{$algo};
-       my $hasher = $class->new;
+       my $hasher = Digest->new($digests->{$digest});
        $hasher->add($heap->{nonce});
        $hasher->add($user->password);
        my $need = $hasher->b64digest;
@@ -61,7 +61,7 @@
        if ($need eq $resp) {
                $kernel->yield('auth_ok', $user);
        } else {
-               $kernel->yield('fail', 'auth.fail', $name, $algo);
+               $kernel->yield('fail', 'auth.fail', $name, $digest);
        }
 }
 

Modified: trunk/web/Makefile
===================================================================
--- trunk/web/Makefile  2005-06-25 23:20:08 UTC (rev 824)
+++ trunk/web/Makefile  2005-06-25 23:36:42 UTC (rev 825)
@@ -52,13 +52,15 @@
 
 input   := $(patsubst ./%,%,$(shell find -name '*.ttml'))
 html    := $(input:.ttml=.html)
-targets := $(html) $(TARGETS)
+targets := $(html) $(TARGETS) docs
 
 
 build: $(targets)
        find -not -path '*.svn*' -exec chmod -c g+rw,u+rw,o+r {} \;
        find -not -path '*.svn*' -type d -exec chmod -c g+rwxs,u+rwx,o+rx {} \;
 
+docs:
+       svn co http://svn.haverdev.org/repo/trunk/docs
 
 upload: build test
        $(RSYNC) $(RSYNCFLAGS) ./ 
$(SFUSER)@shell.sourceforge.net:/home/groups/h/ha/haver/htdocs/


Reply via email to