Add smart
This commit is contained in:
8
apply.pl
8
apply.pl
@@ -138,17 +138,17 @@ sub handle_request()
|
||||
if( $p{mars_config} ne $mars_config )
|
||||
{
|
||||
# Just append the line. Messy but easy. ;)
|
||||
open( FILE, '>>' . $base . 'smart.conf' );
|
||||
open( FILE, '>>' . $smart_conf_path ) or die "Could not open $smart_conf_path: $!";
|
||||
print( FILE "\n" . '$mars_config = \'' . $p{mars_config} . '\';' . "\n" );
|
||||
close( FILE );
|
||||
}
|
||||
|
||||
open( FILE, '>' . $base . '.nwclient' );
|
||||
open( FILE, '>' . $smart_nwclient_path ) or die "Could not open $smart_nwclient_path: $!";
|
||||
print( FILE $p{bind_server} . '/' . $p{bind_user} . ' ' . $p{bind_pass } . "\n" );
|
||||
close( FILE );
|
||||
|
||||
chown( scalar( getpwnam( $nonroot_user ) ), 0, $base . '.nwclient' );
|
||||
chmod( 0600, $base . '.nwclient' );
|
||||
chown( scalar( getpwnam( $nonroot_user ) ), 0, $smart_nwclient_path );
|
||||
chmod( 0600, $smart_nwclient_path );
|
||||
}
|
||||
elsif( $c[1] eq 'users' )
|
||||
{
|
||||
|
||||
@@ -1167,7 +1167,7 @@ EOF
|
||||
}
|
||||
elsif( $c[1] eq 'smart' )
|
||||
{
|
||||
open( FILE, '<' . $base . '.nwclient' );
|
||||
open( FILE, '<' . $smart_nwclient_path ) or die "Could not open $smart_nwclient_path: $!";
|
||||
$x = <FILE>;
|
||||
close( FILE );
|
||||
|
||||
|
||||
@@ -25,16 +25,18 @@
|
||||
|
||||
$redirected = 0;
|
||||
|
||||
$server_id = 'Server: SMArT/Perl/0.99';
|
||||
$base = $0;
|
||||
$base =~ s/\/[^\/]*$//g;
|
||||
$base .= '/';
|
||||
$server_id = 'Server: SMArT/Perl/@MARS_NWE_VERSION@';
|
||||
|
||||
do( $base . 'smart.conf' );
|
||||
do( '@MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf' )
|
||||
or die "Could not load @MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf: $@ $!";
|
||||
|
||||
close( STDERR );
|
||||
open( STDERR, '>>' . $base . 'error.log' );
|
||||
$ENV{HOME} = $base;
|
||||
open( STDERR, '>>' . $smart_log_path )
|
||||
or die "Could not open $smart_log_path: $!";
|
||||
|
||||
$ENV{HOME} = '@MARS_NWE_INSTALL_FULL_CONFDIR@';
|
||||
$smart_libexec_dir = '@MARS_NWE_INSTALL_FULL_LIBEXEC@';
|
||||
$smart_libexec_dir =~ s#/*$##;
|
||||
|
||||
$l = <STDIN>;
|
||||
$l =~ s/[\n\r]//g;
|
||||
@@ -75,7 +77,7 @@ else
|
||||
if( $l[0] ne 'root' )
|
||||
{ error( 401 ); }
|
||||
else
|
||||
{ if( $x = system( $base . 'check_login', @l ) )
|
||||
{ if( $x = system( $smart_check_login, @l ) )
|
||||
{ error( 401 ); } }
|
||||
}
|
||||
}
|
||||
@@ -104,14 +106,14 @@ foreach $p ( @p )
|
||||
|
||||
if( $c[0] eq 'apply' )
|
||||
{
|
||||
do( $base . 'readconfig.pl' );
|
||||
do( $base . 'apply.pl' );
|
||||
do( $smart_libexec_dir . '/readconfig.pl' );
|
||||
do( $smart_libexec_dir . '/apply.pl' );
|
||||
handle_request();
|
||||
exit;
|
||||
}
|
||||
elsif( $c[0] eq 'settings' )
|
||||
{
|
||||
do( $base . 'readconfig.pl' );
|
||||
do( $smart_libexec_dir . '/readconfig.pl' );
|
||||
}
|
||||
|
||||
drop_root();
|
||||
@@ -137,11 +139,11 @@ EOF
|
||||
}
|
||||
elsif( $c[0] eq 'static' )
|
||||
{
|
||||
do( $base . 'static.pl' );
|
||||
do( $smart_libexec_dir . '/static.pl' );
|
||||
}
|
||||
elsif( $c[0] eq 'settings' )
|
||||
{
|
||||
do( $base . 'settings.pl' );
|
||||
do( $smart_libexec_dir . '/settings.pl' );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,7 +241,7 @@ EOF
|
||||
|
||||
sub get_server
|
||||
{
|
||||
open( SFILE, '<' . $base . '.nwclient' );
|
||||
open( SFILE, '<' . $smart_nwclient_path );
|
||||
chomp( $line = <SFILE> );
|
||||
close( SFILE );
|
||||
|
||||
@@ -249,7 +251,7 @@ sub get_server
|
||||
|
||||
sub get_bindery_password
|
||||
{
|
||||
open( SFILE, '<' . $base . '.nwclient' );
|
||||
open( SFILE, '<' . $smart_nwclient_path );
|
||||
chomp( $line = <SFILE> );
|
||||
close( SFILE );
|
||||
|
||||
11
smart.conf
11
smart.conf
@@ -1,11 +0,0 @@
|
||||
$COLOR_BACK = "#F0F0FF";
|
||||
$COLOR_HEAD_BACK = "#C0C0FF";
|
||||
$COLOR_HEAD_FORE = "#000000";
|
||||
$COLOR_SUBH_BACK = "#D0D0FF";
|
||||
$COLOR_SUBH_FORE = "#000000";
|
||||
$COLOR_TEXT_BACK = "#E0E0FF";
|
||||
$COLOR_TEXT_FORE = "#000000";
|
||||
|
||||
$mars_config = '/usr/local/etc/nwserv.conf';
|
||||
|
||||
$nonroot_user = 'nobody';
|
||||
24
smart.conf.cmake
Normal file
24
smart.conf.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
$COLOR_BACK = "#F0F0FF";
|
||||
$COLOR_HEAD_BACK = "#C0C0FF";
|
||||
$COLOR_HEAD_FORE = "#000000";
|
||||
$COLOR_SUBH_BACK = "#D0D0FF";
|
||||
$COLOR_SUBH_FORE = "#000000";
|
||||
$COLOR_TEXT_BACK = "#E0E0FF";
|
||||
$COLOR_TEXT_FORE = "#000000";
|
||||
|
||||
$mars_config = '@MARS_NWE_INSTALL_FULL_CONFDIR@/nwserv.conf';
|
||||
|
||||
$nonroot_user = 'nobody';
|
||||
|
||||
$smart_conf_path = '@MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf';
|
||||
$smart_nwclient_path = '@MARS_NWE_INSTALL_FULL_CONFDIR@/.nwclient';
|
||||
$smart_static_dir = '@MARS_NWE_INSTALL_FULL_LIBEXEC@/static';
|
||||
$smart_log_path = '@MARS_NWE_LOG_DIR@/smart.log';
|
||||
|
||||
$smart_check_login = '@MARS_NWE_INSTALL_FULL_LIBEXEC@/check_login';
|
||||
|
||||
$nw_bind_ip = '0.0.0.0';
|
||||
$nw_tls_port = 9443;
|
||||
|
||||
$nw_cert_file = '@MARS_NWE_INSTALL_FULL_CONFDIR@/server.crt';
|
||||
$nw_key_file = '@MARS_NWE_INSTALL_FULL_CONFDIR@/server.key';
|
||||
Reference in New Issue
Block a user