Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.117.151.198
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/augeas/lenses/dist/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/augeas/lenses/dist/tests/test_access.aug
(*
Module: Test_Access
  Provides unit tests and examples for the <Access> lens.
*)

module Test_access =

(* Variable: conf
    A full configuration *)
let conf = "+ : ALL : LOCAL
+ : root : localhost.localdomain
- : root : 127.0.0.1 .localdomain
+ : root alice@server1 @admins (wheel) : cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6
# IP v6 support
+ : john foo : 2001:4ca0:0:101::1 2001:4ca0:0:101::/64
# Except
+ : ALL EXCEPT john @wheel : ALL EXCEPT LOCAL .win.tue.nl
# No spaces
+:root:.example.com
"

(* Test: Access.lns
     Test the full <conf> *)
test Access.lns get conf =
    { "access" = "+"
        { "user" = "ALL" }
        { "origin" = "LOCAL" } }
    { "access" = "+"
        { "user" = "root" }
        { "origin" = "localhost.localdomain" } }
    { "access" = "-"
        { "user" = "root" }
        { "origin" = "127.0.0.1" }
        { "origin" = ".localdomain" } }
    { "access" = "+"
        { "user" = "root" }
        { "user" = "alice"
           { "host" = "server1" } }
        { "netgroup" = "admins" }
        { "group" = "wheel" }
        { "origin" = "cron" }
        { "origin" = "crond" }
        { "origin" = ":0" }
        { "origin" = "tty1" }
        { "origin" = "tty2" }
        { "origin" = "tty3" }
        { "origin" = "tty4" }
        { "origin" = "tty5" }
        { "origin" = "tty6" } }
    { "#comment" = "IP v6 support" }
    { "access" = "+"
        { "user" = "john" }
        { "user" = "foo" }
        { "origin" = "2001:4ca0:0:101::1" }
        { "origin" = "2001:4ca0:0:101::/64" } }
    { "#comment" = "Except" }
    { "access" = "+"
        { "user" = "ALL" }
        { "except"
           { "user" = "john" }
           { "netgroup" = "wheel" } }
        { "origin" = "ALL" }
        { "except"
           { "origin" = "LOCAL" }
           { "origin" = ".win.tue.nl" } } }
    { "#comment" = "No spaces" }
    { "access" = "+"
        { "user" = "root" }
        { "origin" = ".example.com" } }

test Access.lns put conf after
    insa "access" "access[last()]" ;
    set "access[last()]" "-" ;
    set "access[last()]/user" "ALL" ;
    set "access[last()]/origin" "ALL"
 = "+ : ALL : LOCAL
+ : root : localhost.localdomain
- : root : 127.0.0.1 .localdomain
+ : root alice@server1 @admins (wheel) : cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6
# IP v6 support
+ : john foo : 2001:4ca0:0:101::1 2001:4ca0:0:101::/64
# Except
+ : ALL EXCEPT john @wheel : ALL EXCEPT LOCAL .win.tue.nl
# No spaces
+:root:.example.com
- : ALL : ALL
"

(* Test: Access.lns
     - netgroups (starting with '@') are mapped as "netgroup" nodes;
     - nisdomains (starting with '@@') are mapped as "nisdomain" nodes.

 This closes <ticket #190 at https://fedorahosted.org/augeas/ticket/190>.
 *)
test Access.lns get "+ : @group@@domain : ALL \n" =
  { "access" = "+"
    { "netgroup" = "group"
      { "nisdomain" = "domain" } }
    { "origin" = "ALL" } }

(* Test Access.lns
   Put test for netgroup and nisdomain *)
test Access.lns put "+ : @group : ALL \n" after
  set "/access/netgroup[. = 'group']/nisdomain" "domain" =
"+ : @group@@domain : ALL \n"

(* Check DOMAIN\user style entry *)
test Access.lns get "+ : root : foo1.bar.org foo3.bar.org
+ : (DOMAIN\linux_users) : ALL
+ : DOMAIN\linux_user : ALL\n" =
  { "access" = "+"
    { "user" = "root" }
    { "origin" = "foo1.bar.org" }
    { "origin" = "foo3.bar.org" } }
  { "access" = "+"
    { "group" = "DOMAIN\linux_users" }
    { "origin" = "ALL" } }
  { "access" = "+"
    { "user" = "DOMAIN\linux_user" }
    { "origin" = "ALL" } }

Anon7 - 2022
AnonSec Team