Server IP : 195.201.23.43 / Your IP : 3.133.106.74 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 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, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/nis/ |
Upload File : |
# Functions for parsing nsswitch.conf $nsswitch_config_file = $config{'nsswitch_conf'} || "/etc/nsswitch.conf"; # get_nsswitch_config() # Returns an array ref of information from nsswitch.conf sub get_nsswitch_config { if (!scalar(@get_nsswitch_cache)) { @get_nsswitch_cache = ( ); local $lnum = 0; open(CONF, "<".$nsswitch_config_file); while(<CONF>) { s/\r|\n//g; s/#.*$//; if (/^\s*(\S+)\s*:\s*(.*)/) { # Found a switch config file local $switch = { 'name' => $1, 'line' => $lnum }; local $servs = $2; local @srcs = ( ); while($servs =~ /\S/) { if ($servs =~ /^\s*\[([^\]]*)\](.*)/) { # Actions for some source $servs = $2; foreach $av (split(/\s+/, $1)) { local ($a, $v) = split(/=/,$av); $srcs[$#srcs]->{lc($a)} =lc($v); } } elsif ($servs =~ /^\s*(\S+)(.*)/) { # A source push(@srcs, { 'src' => $1 }); $servs = $2; } } $switch->{'srcs'} = \@srcs; push(@get_nsswitch_cache, $switch); } $lnum++; } close(CONF); } return \@get_nsswitch_cache; } # save_nsswitch_config(&switch) # Update one service sub save_nsswitch_config { local ($switch) = @_; local $lref = &read_file_lines($nsswitch_config_file); local $line = "$switch->{'name'}:"; foreach my $s (@{$switch->{'srcs'}}) { $line .= " ".$s->{'src'}; local @acts; foreach my $st (keys %$s) { if ($st ne "src") { push(@acts, uc($st)."=".$s->{$st}); } } if (@acts) { $line .= " [".join(" ", @acts)."]"; } } $lref->[$switch->{'line'}] = $line; &flush_file_lines($nsswitch_config_file); } # list_switch_sources() # Returns a list of valid nsswitch.conf sources for this OS, and a map from # sources to allowed services sub list_switch_sources { if ($gconfig{'os_type'} =~ /-linux$/) { # All Linux variants return ( [ 'files', 'nisplus', 'nis', 'compat', 'dns', 'db', 'hesiod', 'ldap', 'sss' ], { 'dns' => [ 'hosts' ], 'compat' => [ 'passwd', 'shadow', 'group' ] } ); } elsif ($gconfig{'os_type'} eq 'solaris' && $gconfig{'os_version'} < 8) { # Older Solaris return ( [ 'files', 'nis', 'nisplus', 'compat', 'dns' ], { 'dns' => [ 'hosts' ], 'compat' => [ 'passwd', 'group' ] } ); } elsif ($gconfig{'os_type'} eq 'solaris' && $gconfig{'os_version'} >= 8) { # Newer Solaris return ( [ 'files', 'nis', 'nisplus', 'compat', 'dns', 'ldap', 'user', 'xfn' ], { 'dns' => [ 'hosts' ], 'compat' => [ 'passwd', 'group' ], 'user' => [ 'printers' ], 'xfn' => [ 'printers' ] } ); } elsif ($gconfig{'os_type'} eq 'aix') { # IBM AIX return ( [ 'files', 'nis', 'nisplus', 'compat', 'dns', 'ldap', 'user', 'xfn' ], { 'dns' => [ 'hosts' ], 'compat' => [ 'passwd', 'group' ], 'user' => [ 'printers' ], 'xfn' => [ 'printers' ] } ); } elsif ($gconfig{'os_type'} eq 'unixware') { # All Linux variants return ( [ 'files', 'dns', 'nis', 'nisplus' ], { 'dns' => [ 'hosts' ] } ); } else { # Punt! return ( [ 'files', 'dns', 'nis', 'nisplus' ] ); } } sub list_switch_statuses { return ( 'success', 'notfound', 'unavail', 'tryagain' ); } sub list_switch_actions { return ( 'return', 'continue' ); } 1;Private