Compare commits

...

16 Commits

Author SHA1 Message Date
Mario Fetka
a4dfee99e2 Add version info adn damon support 2026-04-21 15:19:26 +02:00
Mario Fetka
8e7c97ff7f make config handel the markers 2026-04-21 13:45:04 +02:00
Mario Fetka
b7206fc83a make config handling more user friendly 2026-04-21 12:00:30 +02:00
Mario Fetka
2ee152f543 add more child handling 2026-04-21 11:46:35 +02:00
Mario Fetka
829be767c9 default to http 2026-04-21 10:24:02 +02:00
Mario Fetka
a4d3ded77e more docu and enable loglevel for nwwebui 2026-04-21 09:48:15 +02:00
Mario Fetka
0d3bbdec8e Switch to FindPackage 2026-04-21 08:53:11 +02:00
Mario Fetka
ed3acbe2d4 Correct LIBEXECDIR 2026-04-21 08:34:09 +02:00
Mario Fetka
9670c4e749 add missing #include <string.h> 2026-04-21 06:08:38 +02:00
Mario Fetka
a3f7460150 add missing #include <stdlib.h> 2026-04-21 06:05:45 +02:00
Mario Fetka
476c51ac10 Update typo in cmake file 2026-04-21 05:57:58 +02:00
Mario Fetka
5bbe69ac5f Update cmake 2026-04-21 05:32:04 +02:00
Mario Fetka
331fb1a746 Add smart 2026-04-21 04:52:48 +02:00
Mario Fetka
bb9392b9b0 Add smart 2026-04-21 04:52:41 +02:00
Mario Fetka
24f48e1f96 ad Readme.md 2026-04-21 02:19:48 +02:00
Mario Fetka
0a31d87196 Ignore generated log file 2026-04-21 02:18:56 +02:00
15 changed files with 1670 additions and 91 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
error.log

75
CMakeLists.txt Normal file
View File

@@ -0,0 +1,75 @@
#################################
# Project
##############
#################################
# Dependencies
##############
#################################
# Generated files
##############
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
IMMEDIATE @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/smart.conf.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/smart.conf"
IMMEDIATE @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/smart.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/smart"
IMMEDIATE @ONLY)
#################################
# Compiler Switches
##############
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include
)
#################################
# Source Files
##############
add_executable(nwwebui nwwebui.c)
add_executable(check_login check_login.c)
#################################
# Linking
##############
target_link_libraries(nwwebui
OpenSSL::SSL
OpenSSL::Crypto
)
target_link_libraries(check_login
${PAM_LIBRARY}
${DL_LIBRARY}
)
#################################
# Install Files
##############
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/smart.conf DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/smart DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(PROGRAMS apply.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(PROGRAMS readconfig.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(PROGRAMS settings.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(PROGRAMS static.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(DIRECTORY static/ DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}/static)
install(TARGETS check_login DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(TARGETS nwwebui DESTINATION ${CMAKE_INSTALL_SBINDIR})

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# mars-smart
SMArT is a web configuration tool for MARS_NWE, a Novell NetWare 3.x emulator for Linux and FreeBSD.

View File

@@ -138,17 +138,17 @@ sub handle_request()
if( $p{mars_config} ne $mars_config ) if( $p{mars_config} ne $mars_config )
{ {
# Just append the line. Messy but easy. ;) # 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" ); print( FILE "\n" . '$mars_config = \'' . $p{mars_config} . '\';' . "\n" );
close( FILE ); 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" ); print( FILE $p{bind_server} . '/' . $p{bind_user} . ' ' . $p{bind_pass } . "\n" );
close( FILE ); close( FILE );
chown( scalar( getpwnam( $nonroot_user ) ), 0, $base . '.nwclient' ); chown( scalar( getpwnam( $nonroot_user ) ), 0, $smart_nwclient_path );
chmod( 0600, $base . '.nwclient' ); chmod( 0600, $smart_nwclient_path );
} }
elsif( $c[1] eq 'users' ) elsif( $c[1] eq 'users' )
{ {

Binary file not shown.

View File

@@ -23,6 +23,8 @@
#include <security/pam_appl.h> #include <security/pam_appl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int my_conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr); int my_conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr);

31
config.h.cmake Normal file
View File

@@ -0,0 +1,31 @@
#ifndef NWWEBUI_CONFIG_H
#define NWWEBUI_CONFIG_H
#define NWWEBUI_NAME "nwwebui"
#define NWWEBUI_VERSION "@MARS_NWE_VERSION@"
#define DEFAULT_SMART_CONF "@MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf"
#define DEFAULT_SMART_PERL "@MARS_NWE_INSTALL_FULL_LIBEXECDIR@/smart"
#define LOG_PATH_DEFAULT "@MARS_NWE_LOG_DIR@/nwwebui.log"
#define LOG_LEVEL_ERROR 0
#define LOG_LEVEL_INFO 1
#define LOG_LEVEL_DEBUG 2
#define LOG_LEVEL_DEFAULT LOG_LEVEL_INFO
#define DEFAULT_BIND_IP "0.0.0.0"
#define DEFAULT_SSL_ENABLE 1
#define DEFAULT_HTTP_PORT 9080
#define DEFAULT_HTTPS_PORT 9443
#define DEFAULT_CERT_FILE "@MARS_NWE_INSTALL_FULL_CONFDIR@/server.crt"
#define DEFAULT_KEY_FILE "@MARS_NWE_INSTALL_FULL_CONFDIR@/server.key"
#define DEFAULT_PID_FILE "@MARS_NWE_PID_DIR@/nwwebui.pid"
#define DEFAULT_DAEMONIZE 0
#define NW_BACKLOG 64
#define NW_BUF_SZ 16384
#endif

View File

1141
nwwebui.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +1,12 @@
#
# SMArT # SMArT
# #
# Configuration file code # Configuration file code
# #
# Copyright 2001 Wilmer van der Gaast (lintux@lintux.cx) # Copyright 2001 Wilmer van der Gaast (lintux@lintux.cx)
# #
# # Updated for marker-aware config writing.
# 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
#
#
my( @info, @conf, $l ); my( @info, @conf, @rawconf, $l );
$info[1] = 'Volume'; $info[1] = 'Volume';
$info[2] = 'Server name'; $info[2] = 'Server name';
@@ -53,6 +37,7 @@ $info[47] = 'Trustee files';
$info[50] = 'Conversion tables'; $info[50] = 'Conversion tables';
$info[60] = 'MAX_CONNECTIONS'; $info[60] = 'MAX_CONNECTIONS';
$info[61] = 'MAX_NW_VOLS'; $info[61] = 'MAX_NW_VOLS';
$info[62] = 'Reserved';
$info[63] = 'MAX_DIR_BASE_ENTRIES'; $info[63] = 'MAX_DIR_BASE_ENTRIES';
$info[68] = 'USE_MMAP'; $info[68] = 'USE_MMAP';
$info[69] = 'HANDLE_ALL_SAP_TYPS'; $info[69] = 'HANDLE_ALL_SAP_TYPS';
@@ -79,19 +64,25 @@ $info[400] = 'nwserv.stations file';
$info[401] = 'Reply to nearest server requests'; $info[401] = 'Reply to nearest server requests';
$info[402] = 'Reply to connect requests'; $info[402] = 'Reply to connect requests';
open( CONF, '<' . $mars_config ); open( CONF, '<' . $mars_config ) or die "Could not open $mars_config: $!";
@conf = (); @conf = ();
@rawconf = ();
while( $l = <CONF> ) while( $l = <CONF> )
{ {
$l =~ s/[\r\n]//g; push( @rawconf, $l );
$l =~ s/[\t ]+/ /g;
$l =~ s/#.*//; my $x = $l;
$l =~ s/^[\t ]*//; $x =~ s/[\r\n]//g;
$l =~ s/[\t ]*$//; $x =~ s/[\t ]+/ /g;
if( $l ne '' ) $x =~ s/#.*//;
{ $x =~ s/^[\t ]*//;
unshift( @conf, $l ); $x =~ s/[\t ]*$//;
}
if( $x ne '' )
{
push( @conf, $x );
}
} }
close( CONF ); close( CONF );
@@ -99,53 +90,279 @@ sortconfig();
sub sortconfig() sub sortconfig()
{ {
@conf = sort( { $a cmp $b } @conf ); @conf = sort( { $a cmp $b } @conf );
@conf = sort( { ( split( ' ', $a ) )[0] <=> ( split( ' ', $b ) )[0] } @conf ); @conf = sort( { ( split( ' ', $a ) )[0] <=> ( split( ' ', $b ) )[0] } @conf );
} }
sub getconfigline( $ ) sub getconfigline( $ )
{ {
my( @c, $c ); my( @c, $c );
@c = getconfig( @_ ); @c = getconfig( @_ );
$c = $c[0]; $c = $c[0];
$c =~ s/^[0-9]* //; $c =~ s/^[0-9]* //;
return( $c ); return( $c );
} }
sub getconfig( $ ) sub getconfig( $ )
{ {
my( @c ); my( @c );
@c = grep( /^$_[0] /i, @conf ); @c = grep( /^$_[0] /i, @conf );
return( @c ); return( @c );
} }
sub addconfigline( $ ) sub addconfigline( $ )
{ {
unshift( @conf, $_[0] ); unshift( @conf, $_[0] );
} }
sub delconfigline( $ ) sub delconfigline( $ )
{ {
@conf = grep( !/^$_[0] /i, grep( !/^$_[0]$/i, @conf ) ); @conf = grep( !/^$_[0] /i, grep( !/^$_[0]$/i, @conf ) );
}
sub normalize_line( $ )
{
my $x = $_[0];
$x =~ s/[\r\n]//g;
$x =~ s/[\t ]+/ /g;
$x =~ s/#.*//;
$x =~ s/^[\t ]*//;
$x =~ s/[\t ]*$//;
return( $x );
}
sub section_of_line( $ )
{
my $x = normalize_line( $_[0] );
if( $x =~ /^([0-9]+)\b/ )
{
return( $1 );
}
return( '' );
}
sub grouped_section_key( $ )
{
my $sec = $_[0];
if( $sec >= 100 && $sec <= 106 ) { return '100-106'; }
if( $sec >= 200 && $sec <= 202 ) { return '200-202'; }
if( $sec >= 210 && $sec <= 211 ) { return '210-211'; }
if( $sec >= 300 && $sec <= 302 ) { return '300-302'; }
return $sec;
}
sub build_marker_map()
{
my( %map, $line, $sec, $key );
foreach $line ( @conf )
{
$sec = section_of_line( $line );
next if $sec eq '';
$key = grouped_section_key( $sec );
push( @{ $map{$key} }, $line );
}
# Keep SYS as first entry in section 1
if( defined( $map{'1'} ) )
{
my @sys = grep( /^1 SYS /, @{ $map{'1'} } );
my @rest = grep( !/^1 SYS /, @{ $map{'1'} } );
$map{'1'} = [ @sys, @rest ];
}
return %map;
}
sub writeconfig_compact()
{
my( $i, $l );
sortconfig();
open( CONF, '>' . $mars_config ) or die "Could not write $mars_config: $!";
$l = ( getconfig( '1 SYS' ) )[0];
delconfigline( '1 SYS' );
addconfigline( $l );
foreach $i ( @conf )
{
$l = $i;
$l =~ s/ .*//;
printf( CONF "%-50s # %s\n", $i, $info[$l] );
}
close( CONF );
}
sub writeconfig_markers()
{
my( %secmap, %emitted );
my( $line, $active_key, $inside_active );
%secmap = build_marker_map();
$inside_active = '';
open( CONF, '>' . $mars_config ) or die "Could not write $mars_config: $!";
foreach $line ( @rawconf )
{
if( $line =~ /^\s*#\s*>>>\s*SMARTHOOK\s+SECTION\s+([0-9]+(?:-[0-9]+)?)\s+ACTIVE\s+BEGIN/i )
{
$active_key = $1;
$inside_active = $active_key;
print CONF $line;
if( defined( $secmap{$active_key} ) )
{
foreach my $entry ( @{ $secmap{$active_key} } )
{
print CONF $entry . "\n";
}
}
$emitted{$active_key} = 1;
next;
}
if( $line =~ /^\s*#\s*<<<\s*SMARTHOOK\s+SECTION\s+([0-9]+(?:-[0-9]+)?)\s+ACTIVE\s+END/i )
{
$inside_active = '';
print CONF $line;
next;
}
if( $inside_active ne '' )
{
# Skip old content inside ACTIVE blocks completely.
next;
}
print CONF $line;
}
close( CONF );
}
sub writeconfig_preserve_layout()
{
my( %secmap, %written, @sections, $sec, $line, $sysline );
my( $heading_sec );
sortconfig();
$sysline = ( grep( /^1 SYS /, @conf ) )[0];
if( defined( $sysline ) )
{
@conf = grep( $_ ne $sysline, @conf );
unshift( @conf, $sysline );
}
foreach $line ( @conf )
{
$sec = section_of_line( $line );
if( $sec ne '' )
{
push( @{ $secmap{$sec} }, $line );
}
}
open( CONF, '>' . $mars_config ) or die "Could not write $mars_config: $!";
foreach $line ( @rawconf )
{
if( $line =~ /^\s*#.*Section\s+([0-9]+)\b/i )
{
$heading_sec = $1;
foreach $sec ( sort { $a <=> $b } keys( %secmap ) )
{
next if $written{$sec};
next if $sec > $heading_sec;
if( defined( $secmap{$sec} ) )
{
foreach my $entry ( @{ $secmap{$sec} } )
{
print CONF $entry . "\n";
}
}
$written{$sec} = 1;
}
}
$sec = section_of_line( $line );
if( $sec eq '' )
{
print CONF $line;
next;
}
if( ! $written{$sec} )
{
if( defined( $secmap{$sec} ) )
{
foreach my $entry ( @{ $secmap{$sec} } )
{
print CONF $entry . "\n";
}
}
$written{$sec} = 1;
}
}
@sections = sort { $a <=> $b } keys( %secmap );
foreach $sec ( @sections )
{
next if $written{$sec};
print CONF "\n";
foreach my $entry ( @{ $secmap{$sec} } )
{
print CONF $entry . "\n";
}
$written{$sec} = 1;
}
close( CONF );
}
sub config_has_smart_markers()
{
foreach my $line ( @rawconf )
{
if( $line =~ /SMARTHOOK\s+SECTION/i )
{
return 1;
}
}
return 0;
} }
sub writeconfig() sub writeconfig()
{ {
my( $i, $l ); if( defined( $smart_compact_nwservconf ) && $smart_compact_nwservconf )
{
sortconfig(); writeconfig_compact();
}
open( CONF, '>' . $mars_config ); elsif( config_has_smart_markers() )
$l = ( getconfig( '1 SYS' ) )[0]; {
delconfigline( '1 SYS' ); writeconfig_markers();
addconfigline( $l ); }
foreach $i ( @conf ) else
{ {
$l = $i; writeconfig_preserve_layout();
$l =~ s/ .*//; }
printf( CONF "%-50s # %s\n", $i, $info[$l] );
}
close( CONF );
} }

View File

@@ -1167,7 +1167,7 @@ EOF
} }
elsif( $c[1] eq 'smart' ) elsif( $c[1] eq 'smart' )
{ {
open( FILE, '<' . $base . '.nwclient' ); open( FILE, '<' . $smart_nwclient_path ) or die "Could not open $smart_nwclient_path: $!";
$x = <FILE>; $x = <FILE>;
close( FILE ); close( FILE );

View File

@@ -25,16 +25,18 @@
$redirected = 0; $redirected = 0;
$server_id = 'Server: SMArT/Perl/0.99'; $server_id = 'Server: SMArT/Perl/@MARS_NWE_VERSION@';
$base = $0;
$base =~ s/\/[^\/]*$//g;
$base .= '/';
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 ); close( STDERR );
open( STDERR, '>>' . $base . 'error.log' ); open( STDERR, '>>' . $smart_log_path )
$ENV{HOME} = $base; or die "Could not open $smart_log_path: $!";
$ENV{HOME} = '@MARS_NWE_INSTALL_FULL_CONFDIR@';
$smart_libexec_dir = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@';
$smart_libexec_dir =~ s#/*$##;
$l = <STDIN>; $l = <STDIN>;
$l =~ s/[\n\r]//g; $l =~ s/[\n\r]//g;
@@ -75,7 +77,7 @@ else
if( $l[0] ne 'root' ) if( $l[0] ne 'root' )
{ error( 401 ); } { error( 401 ); }
else else
{ if( $x = system( $base . 'check_login', @l ) ) { if( $x = system( $smart_check_login, @l ) )
{ error( 401 ); } } { error( 401 ); } }
} }
} }
@@ -104,14 +106,14 @@ foreach $p ( @p )
if( $c[0] eq 'apply' ) if( $c[0] eq 'apply' )
{ {
do( $base . 'readconfig.pl' ); do( $smart_libexec_dir . '/readconfig.pl' );
do( $base . 'apply.pl' ); do( $smart_libexec_dir . '/apply.pl' );
handle_request(); handle_request();
exit; exit;
} }
elsif( $c[0] eq 'settings' ) elsif( $c[0] eq 'settings' )
{ {
do( $base . 'readconfig.pl' ); do( $smart_libexec_dir . '/readconfig.pl' );
} }
drop_root(); drop_root();
@@ -137,11 +139,11 @@ EOF
} }
elsif( $c[0] eq 'static' ) elsif( $c[0] eq 'static' )
{ {
do( $base . 'static.pl' ); do( $smart_libexec_dir . '/static.pl' );
} }
elsif( $c[0] eq 'settings' ) elsif( $c[0] eq 'settings' )
{ {
do( $base . 'settings.pl' ); do( $smart_libexec_dir . '/settings.pl' );
} }
else else
{ {
@@ -239,7 +241,7 @@ EOF
sub get_server sub get_server
{ {
open( SFILE, '<' . $base . '.nwclient' ); open( SFILE, '<' . $smart_nwclient_path );
chomp( $line = <SFILE> ); chomp( $line = <SFILE> );
close( SFILE ); close( SFILE );
@@ -249,7 +251,7 @@ sub get_server
sub get_bindery_password sub get_bindery_password
{ {
open( SFILE, '<' . $base . '.nwclient' ); open( SFILE, '<' . $smart_nwclient_path );
chomp( $line = <SFILE> ); chomp( $line = <SFILE> );
close( SFILE ); close( SFILE );

View File

@@ -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';

118
smart.conf.cmake Normal file
View File

@@ -0,0 +1,118 @@
# SMArT / nwwebui configuration file
# ------------------------------------------------------------
# UI colors
# ------------------------------------------------------------
# Background color used for the main page body.
$COLOR_BACK = "#F0F0FF";
# Background color used for section headers.
$COLOR_HEAD_BACK = "#C0C0FF";
# Text color used for section headers.
$COLOR_HEAD_FORE = "#000000";
# Background color used for subsection headers.
$COLOR_SUBH_BACK = "#D0D0FF";
# Text color used for subsection headers.
$COLOR_SUBH_FORE = "#000000";
# Background color used for normal content rows.
$COLOR_TEXT_BACK = "#E0E0FF";
# Text color used for normal content rows.
$COLOR_TEXT_FORE = "#000000";
# ------------------------------------------------------------
# Main MARS NWE configuration
# ------------------------------------------------------------
# Path to the main mars_nwe server configuration file.
# This file is read and modified by the SMArT configuration pages.
$mars_config = '@MARS_NWE_INSTALL_FULL_CONFDIR@/nwserv.conf';
# User name used when SMArT drops privileges for non-root operations.
# Keep this set to an unprivileged local account.
$nonroot_user = 'nobody';
# Write the mars_nwe configuration file in compact form.
# 0 = preserve comments, blank lines and the original section layout
# 1 = write a compact configuration file without the original long comments
$smart_compact_nwservconf = 0;
# ------------------------------------------------------------
# SMArT internal file layout
# ------------------------------------------------------------
# Absolute path to the SMArT configuration file itself.
# Used when SMArT needs to append updated settings.
$smart_conf_path = '@MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf';
# File used to store bindery login information for SMArT helper tools.
# This file should remain readable only by the service user or root.
$smart_nwclient_path = '@MARS_NWE_INSTALL_FULL_CONFDIR@/.nwclient';
# Directory containing static HTML and image files served by SMArT.
$smart_static_dir = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@/static';
# Log file used by the Perl SMArT frontend.
# Keep this separate from the nwwebui log file.
$smart_log_path = '@MARS_NWE_LOG_DIR@/smart.log';
# Path to the PAM-based login helper used for root authentication.
$smart_check_login = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@/check_login';
# Optional explicit path to the main SMArT Perl program.
# This is normally not required, because nwwebui already has a built-in default.
# Uncomment and adjust only if a non-standard location must be used.
# $smart_perl_path = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@/smart';
# ------------------------------------------------------------
# nwwebui listener settings
# ------------------------------------------------------------
# IP address used for the HTTP and HTTPS listeners.
# Use 0.0.0.0 to listen on all IPv4 interfaces.
# Use 127.0.0.1 for local-only testing.
$nw_bind_ip = '0.0.0.0';
# Log level used by nwwebui.
# 0 = errors only
# 1 = informational messages
# 2 = debug messages
$nw_log_level = 1;
# Run nwwebui in daemon mode by default.
# 0 = stay in foreground
# 1 = detach into background
$nw_daemonize = 0;
# PID file written by nwwebui.
$nw_pid_file = '@MARS_NWE_PID_DIR@/nwwebui.pid';
# Enable or disable TLS/SSL support.
# 1 = enable HTTPS listener
# 0 = disable HTTPS listener
#
# When disabled, nwwebui can still serve plain HTTP if nw_http_port > 0.
$nw_ssl_enable = 0;
# Plain HTTP listener port.
# Set to 0 to disable plain HTTP completely.
# This is useful for local or isolated-network testing.
$nw_http_port = 9080;
# HTTPS listener port.
# Used only when $nw_ssl_enable is set to 1.
# Set to 0 to disable HTTPS listening.
$nw_https_port = 9443;
# TLS certificate file in PEM format.
# Required only when HTTPS is enabled.
$nw_cert_file = '@MARS_NWE_INSTALL_FULL_CONFDIR@/server.crt';
# TLS private key file in PEM format.
# Required only when HTTPS is enabled.
$nw_key_file = '@MARS_NWE_INSTALL_FULL_CONFDIR@/server.key';

View File

@@ -26,7 +26,7 @@ sub handle_request()
{ {
$f = $c[1]; $f = $c[1];
$f =~ s/[^-_\.A-Za-z0-9]//g; $f =~ s/[^-_\.A-Za-z0-9]//g;
if( ! open( FILE, $base . 'static/' . $f ) ) if( ! open( FILE, $smart_static_dir . '/' . $f ) )
{ {
error( 404 ); error( 404 );
} }