# # SMArT # # Handle /settings/ requests # # Copyright 2001 Wilmer van der Gaast (lintux@lintux.cx) # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # sub handle_request() { if( $c[1] eq 'general' ) { $server_name = getconfigline( 2 ); $internal_net = getconfigline( 3 ); ( $burst_read, $burst_write ) = split( ' ', getconfigline( 30 ) ); $timing_down = getconfigline( 210 ); $timing_warn = getconfigline( 211 ); eval( '$test_' . getconfigline( 16 ) . ' = " CHECKED";' ); eval( '$version_' . ( split( ' ', getconfigline( 6 ) ) )[0] . ' = " CHECKED";' ); if( ( split( ' ', getconfigline( 6 ) ) )[1] == 1 ) { $burst_enabled_0 = ' CHECKED'; } else { $burst_enabled_0 = ''; } print <
General settings
Server name:
Internal network:
Tests at startup: None
Some
Check/compress bindery
Server version: 2.15
3.11
3.12
Burst mode
Burst mode: Enabled
MAX_BURST_READ_BUF:
MAX_BURST_WRITE_BUF:
Timing
Wait for x seconds before shutdown:
Warn users every x seconds:

EOF } elsif( $c[1] eq 'dirs' ) { $path_cache = getconfigline( 40 ); $share_lock = getconfigline( 41 ); $spool = getconfigline( 42 ); $bindery = getconfigline( 45 ); $attribute = getconfigline( 46 ); $trustee = getconfigline( 47 ); print <
Directories
Path cache directory:
Share and lock files:
Spool directory:
Bindery files:
Attribute handling files:
Trustee handling files:

EOF } elsif( $c[1] eq 'configh' ) { $net_serial = getconfigline( 70 ); $net_app = getconfigline( 71 ); if( getconfigline( 68 ) eq '1' ) { $mmap_0 = ' CHECKED'; } else { $mmap_0 = ''; } eval( '$sap_' . getconfigline( 69 ) . ' = " CHECKED";' ); $max_conn = getconfigline( 60 ); $max_vol = getconfigline( 61 ); $max_dirbase = getconfigline( 63 ); print <
Precompiled settings
Network serial number:
Network application number:
mmap() calls: Enabled
Handle SAP-types: Only type 4
All
Limits
Maximum connection count:
Maximum volume count:
Maximum directory-base entry count:

EOF } elsif( $c[1] eq 'security' ) { $creat_dir = ( split( ' ', getconfigline( 9 ) ) )[0]; $creat_file = ( split( ' ', getconfigline( 9 ) ) )[1]; eval( '$encrypt_' . getconfigline( 7 ) . ' = " CHECKED";' ); print <
Security
creat() mode for directories:
creat() mode for files:
Password encryption: Always encrypt
Except when changing password
Disallow zero-passwords
Allow zero-passwords
Disallow encryption

EOF } elsif( $c[1] eq 'susers' ) { $guest = getconfigline( 11 ); ( $root_name, $root, $root_password ) = split( ' ', getconfigline( 12 ) ); $guest_user_list = ''; $root_list = ''; foreach $u ( unix_userlist() ) { if( $u->{uid} eq $guest ) { $guest_user_list .= "\t\t\t" . '' . "\n"; } else { $guest_user_list .= "\t\t\t" . '' . "\n"; } if( $u->{name} eq $root ) { $root_list .= "\t\t\t" . '' . "\n"; } else { $root_list .= "\t\t\t" . '' . "\n"; } } $guest = getconfigline( 10 ); $guest_group_list = ''; foreach $u ( unix_grouplist() ) { if( $u->{gid} eq $guest ) { $guest_group_list .= "\t\t\t" . '' . "\n"; } else { $guest_group_list .= "\t\t\t" . '' . "\n"; } } eval( '$map_' . ( split( ' ', getconfigline( 15 ) ) )[0] . ' = " CHECKED";' ); $map_password = ( split( ' ', getconfigline( 15 ) ) )[1]; print <
User configuration
Guest user
User:
Group:
Supervisor user
Username:
Unix user:
Password:
User mapping
User mapping: Disabled
Enabled
Enabled, overwrite all users
Default password:

EOF } elsif( $c[1] eq 'logging' ) { eval( '$ipx_' . getconfigline( 100 ) . ' = " SELECTED";' ); eval( '$nwserv_' . getconfigline( 101 ) . ' = " SELECTED";' ); eval( '$ncpserv_' . getconfigline( 102 ) . ' = " SELECTED";' ); eval( '$nwconn_' . getconfigline( 103 ) . ' = " SELECTED";' ); eval( '$nwclient_' . getconfigline( 104 ) . ' = " SELECTED";' ); eval( '$nwbind_' . getconfigline( 105 ) . ' = " SELECTED";' ); eval( '$nwrouted_' . getconfigline( 106 ) . ' = " SELECTED";' ); eval( '$startup_' . getconfigline( 200 ) . ' = " CHECKED";' ); $general_log = getconfigline( 201 ); $routing_interval = getconfigline( 300 ); $routing_log = getconfigline( 301 ); $x = getconfigline( 202 ); eval( '$g_creat_' . ( $x & 1 ) . ' = " CHECKED";' ); eval( '$error_' . ( ( $x - $g_creat ) >> 1 ) . ' = " CHECKED";' ); $x = getconfigline( 302 ); eval( '$r_creat_' . ( $x & 1 ) . ' = " CHECKED";' ); eval( '$r_file_' . ( ( $x - $r_creat ) >> 1 ) . ' = " CHECKED";' ); print <
Logging
Logfiles
General logfile:
Routing logfile:
Parts to log
IPX-kernel:
NWSERV:
NCPSERV:
NWCONN:
NWCLIENT:
NWBIND:
NWROUTED:
General logging flags
NWSERV behaviour: No logging, run in foreground
Run as daemon, enable logging
Logfile creation: Append messages to logfile
Recreate logfile at startup
Log error messages to: Logfile
syslog
Routing logging flags
Write to file every x minutes:
Logfile creation: Append messages to logfile
Recreate logfile every time
File: Keep using the same file
Write to separate files (.1, .2, etc)

EOF } elsif( $c[1] eq 'volumes' ) { if( $c[2] eq '' ) { print < EOF @c = getconfig( 1 ); foreach $c ( @c ) { my @c = split( ' ', $c ); print < EOF } print <
Volumes
$c[1] ($c[2]) Delete
Add new volume
EOF } else { $c = getconfigline( '1 ' . $c[2] ); @c = split( ' ', $c ); $c = ''; $d = $c[2]; $d =~ s/[^ik]//g; eval( '$c' . $d . ' = " CHECKED";' ); $d = $c[2]; $d =~ s/[^Tt]//g; eval( '$t' . $d . ' = " CHECKED";' ); $m = $c[2]; $m =~ s/[^m]//g; if( $m ne '' ) { $m = ' CHECKED'; } $n = $c[2]; $n =~ s/[^n]//g; if( $n ne '' ) { $n = ' CHECKED'; } $o = $c[2]; $o =~ s/[^o]//g; if( $o ne '' ) { $o = ' CHECKED'; } $p = $c[2]; $p =~ s/[^p]//g; if( $p ne '' ) { $p = ' CHECKED'; } $r = $c[2]; $r =~ s/[^r]//g; if( $r ne '' ) { $r = ' CHECKED'; } $O = $c[2]; $O =~ s/[^O]//g; if( $O ne '' ) { $O = ' CHECKED'; } $N = $c[2]; $N =~ s/[^N]//g; if( $N ne '' ) { $N = ' CHECKED'; } print <
Volume: $c[0]
Volume name:
Unix path:
Filename case: All upper case
Ignore case
All lower case
Trustees: Disabled
Enabled
Enabled, unix rights disabled
Additional options
Removable: Enabled
No fixed i-nodes: Enabled
Single filesystem: Enabled
Pipe filesystem: Enabled
Read-only: Enabled
Additional namespaces
OS/2 LFN support: Enabled
NFS support: Enabled

EOF } } elsif( $c[1] eq 'devices' ) { if( $c[2] eq '' ) { print < EOF @c = getconfig( 4 ); foreach $c ( @c ) { my @c = split( ' ', $c ); print < EOF } print <
Devices
$c[1] ($c[2]/$c[3]) Delete
Add new device
EOF } else { $c = getconfigline( '4 ' . $c[2] ); @c = split( ' ', $c ); $c[2] =~ s/\.//g; eval( '$frametype_' . $c[2] . ' = " SELECTED";' ); print <
Device: $c[0]
Network number:
Network interface:
Frame type:
Interface delay:

EOF } } elsif( $c[1] eq 'smart' ) { open( FILE, '<' . $base . '.nwclient' ); $x = ; close( FILE ); chomp( $x ); ( $bind_server, $bind_user, $bind_pass ) = split( '[/ ]', $x ); print <
SMArT settings
nwserv.conf location:
Bindery server
Server name:
Supervisor login name:
Supervisor password:

EOF } elsif( $c[1] eq 'users' ) { $server = get_server(); if( $c[2] eq '' ) { print < EOF @c = sort( split( "\n", `nwbols -t 1 -S $server` ) ); foreach $c ( @c ) { my @c = split( ' ', $c ); print < EOF } print <
Users
$c[0] Delete
Add new user
EOF } else { $unix_user_list = ''; $group_list = ''; @allgroups = sort( split( "\n", `nwbols -S $server -t 2` ) ); if( $c[2] ne 'add_new' ) { $fullname = read_property_string( $c[2], 1, 'IDENTIFICATION' ); $unix_user = read_property_string( $c[2], 1, 'UNIX_USER' ); foreach $u ( unix_userlist() ) { if( $u->{name} eq $unix_user ) { $unix_user_list .= "\t\t\t" . '' . "\n"; } else { $unix_user_list .= "\t\t\t" . '' . "\n"; } } @groups = read_property_list( $c[2], 1, 'GROUPS_I\\\'M_IN' ); foreach $g ( @allgroups ) { $g =~ s/ .*//; if( grep( /^$g$/, @groups ) ) { $group_list .= "\t\t\t" . $g . '
' . "\n"; } else { $group_list .= "\t\t\t" . $g . '
' . "\n"; } } } else { foreach $u ( unix_userlist() ) { $unix_user_list .= "\t\t\t" . '' . "\n"; } foreach $g ( @allgroups ) { $g =~ s/ .*//; $group_list .= "\t\t\t" . $g . '
' . "\n"; } } print <
EOF if( $c[2] eq 'add_new' ) { print < EOF } print <
User: $c[2]
Account name:
Full name:
Password:
UNIX user:
Groups belonged to: $group_list

EOF } } elsif( $c[1] eq 'groups' ) { $server = get_server(); if( $c[2] eq '' ) { print < EOF @c = sort( split( "\n", `nwbols -t 2 -S $server` ) ); foreach $c ( @c ) { my @c = split( ' ', $c ); print < EOF } print <
Groups
$c[0] Delete
Add new group
EOF } else { @all = sort( split( "\n", `nwbols -S $server` ) ); $man_list = ''; if( $c[2] ne 'add_new' ) { $fullname = read_property_string( $c[2], 2, 'IDENTIFICATION' ); @mans = read_property_list( $c[2], 2, 'OBJ_SUPERVISORS' ); foreach $g ( @all ) { my @c = split( ' ', $g ); if( $c[2] == 1 or $c[2] == 2 ) { if( grep( /^$c[0]$/, @mans ) ) { $man_list .= "\t\t\t" . '(' . ( $c[2] == 1 ? 'user' : 'group' ) . ') ' . $c[0] . '
' . "\n"; } else { $man_list .= "\t\t\t" . '(' . ( $c[2] == 1 ? 'user' : 'group' ) . ') ' . $c[0] . '
' . "\n"; } } } } else { foreach $g ( @all ) { my @c = split( ' ', $g ); if( $c[2] == 1 or $c[2] == 2 ) { $man_list .= "\t\t\t" . '(' . ( $c[2] == 1 ? 'user' : 'group' ) . ') ' . $c[0] . '
' . "\n"; } } } print <
EOF if( $c[2] eq 'add_new' ) { print < EOF } print <
Group: $c[2]
Group name:
Full name:
Group managers: $man_list

EOF } } elsif( $c[1] eq 'queues' ) { $server = get_server(); if( $c[2] eq '' ) { print < EOF @c = sort( split( "\n", `nwbols -t 3 -S $server` ) ); foreach $c ( @c ) { my @c = split( ' ', $c ); print < EOF } print <
Print queues
$c[0] Delete
Add new print queue
EOF } else { @all = sort( split( "\n", `nwbols -S $server` ) ); $man_list = ''; if( $c[2] ne 'add_new' ) { $unix_print = read_property_string( $c[2], 3, 'Q_UNIX_PRINT' ); $spool_dir = read_property_string( $c[2], 3, 'Q_DIRECTORY' ); } print <
EOF if( $c[2] eq 'add_new' ) { print < EOF } print <
Print queue: $c[2]
Queue name:
Unix printing command:
Spool directory:

EOF } } else { error( 404 ); } }