Change "privs" to "users"
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Wed, 29 Aug 2007 21:37:59 +0000 (21:37 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Wed, 29 Aug 2007 21:37:59 +0000 (21:37 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@7 088b83a4-0077-4247-935c-42ec02c2848b

commands.yaml
core.pl
users.yaml.example [moved from privs.yaml.example with 100% similarity]

index 0364d0c..e68d11b 100644 (file)
@@ -18,7 +18,7 @@ LINK: |-
       $kernel->post( $src, $replypath, "You may not grant access exceeding your own.", $dest );
       return;
     }
-    if( exists( $heap->{ 'privs' }->{ uc( $whom ) } ) ) {
+    if( exists( $heap->{ 'users' }->{ uc( $whom ) } ) ) {
        $heap->{ 'useraccess' }->{ uc( $whom ) } = "~".$target;
         DumpFile( "useraccess.yaml", $heap->{ 'useraccess' } );
         $kernel->post( $src, $replypath, "Set.", $dest );
@@ -39,7 +39,7 @@ ACCESS: |-
        $kernel->post( $src, $replypath, "You may not grant access exceeding your own.", $dest );
        return;
     }
-    if( exists( $heap->{ 'privs' }->{ uc( $whom ) } ) ) {
+    if( exists( $heap->{ 'users' }->{ uc( $whom ) } ) ) {
        $heap->{ 'useraccess' }->{ uc( $whom ) } = $level;
         DumpFile( "useraccess.yaml", $heap->{ 'useraccess' } );
         $kernel->post( $src, $replypath, "Set.", $dest );
@@ -145,8 +145,8 @@ IDENTIFY: |-
        ( $whom, $password ) = ( $who, $what );
     }
   
-    if( exists( $heap->{ 'privs' }->{ uc( $whom ) } ) ) {
-      if( $heap->{ 'privs' }->{ uc( $whom ) } eq md5_hex( $password ) ) {
+    if( exists( $heap->{ 'users' }->{ uc( $whom ) } ) ) {
+      if( $heap->{ 'users' }->{ uc( $whom ) } eq md5_hex( $password ) ) {
        $heap->{ 'identified' }->{ $src.uc( $who ) } = 1;
        $kernel->post( $src, $replypath, "Hello, $who.", $dest );
       } else {
@@ -185,8 +185,8 @@ REGISTER: |-
     print( STDERR "register( $whom, $password ) == $nargs\n" );
     
     if( $password ) {
-      $heap->{ 'privs' }->{ uc( $whom ) } = md5_hex( $password );
-      DumpFile( "privs.yaml", $heap->{ 'privs' } );
+      $heap->{ 'users' }->{ uc( $whom ) } = md5_hex( $password );
+      DumpFile( "users.yaml", $heap->{ 'users' } );
       $kernel->post( $src, $replypath, "Done.", $dest );
     } else {
       $kernel->post( $src, $replypath, "Bad password.", $dest );
@@ -198,10 +198,10 @@ PASSWORD: |-
     use Digest::MD5 qw( md5_hex );
     my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
     my( $old, $new ) = split( / /, $what, 2 );
-    if( exists( $heap->{ 'privs' }->{ uc( $who ) } ) ) {
-      if( $heap->{ 'privs' }->{ uc( $who ) } eq md5_hex( $old ) ) {
-        $heap->{ 'privs' }->{ uc( $who ) } = md5_hex( $new );
-           DumpFile( "privs.yaml", $heap->{ 'privs' } );
+    if( exists( $heap->{ 'users' }->{ uc( $who ) } ) ) {
+      if( $heap->{ 'users' }->{ uc( $who ) } eq md5_hex( $old ) ) {
+        $heap->{ 'users' }->{ uc( $who ) } = md5_hex( $new );
+           DumpFile( "users.yaml", $heap->{ 'users' } );
         $kernel->post( $src, $replypath, "Passwords changed.", $dest );
       } else {
         $kernel->post( $src, $replypath, "Old passwords do not match.", $dest );
diff --git a/core.pl b/core.pl
index 3c7a254..1ee7795 100644 (file)
--- a/core.pl
+++ b/core.pl
@@ -72,11 +72,11 @@ sub on_start {
                $heap->{ 'cmdaccess' } = { };
        }
 
-       if( -e "privs.yaml" ) {
-               $heap->{ 'privs' } = \%{ LoadFile( "privs.yaml" ) };
+       if( -e "users.yaml" ) {
+               $heap->{ 'users' } = \%{ LoadFile( "users.yaml" ) };
                print( "CORE: Users loaded.\n" );
        } else {
-               $heap->{ 'privs' } = { };
+               $heap->{ 'users' } = { };
                print( "CORE: No users found.\n" );
        }
        
similarity index 100%
rename from privs.yaml.example
rename to users.yaml.example