activate control

This commit is contained in:
Mario Fetka
2026-05-21 16:28:10 +02:00
parent 1446e495dc
commit 362be76b7c
2 changed files with 1 additions and 30 deletions

View File

@@ -38,9 +38,6 @@ typedef struct {
char smart_conf[512];
char smart_perl_path[512];
char smart_control_path[512];
char mars_nwe_service[256];
char systemctl_path[512];
} nw_config_t;
static FILE *g_log_fp = NULL;
@@ -448,9 +445,6 @@ static void init_defaults(nw_config_t *cfg, const char *smart_conf_path)
snprintf(cfg->log_file, sizeof(cfg->log_file), "%s", LOG_PATH_DEFAULT);
snprintf(cfg->smart_perl_path, sizeof(cfg->smart_perl_path), "%s", DEFAULT_SMART_PERL);
snprintf(cfg->smart_control_path, sizeof(cfg->smart_control_path), "%s", DEFAULT_CONTROL_PERL);
snprintf(cfg->mars_nwe_service, sizeof(cfg->mars_nwe_service), "%s", DEFAULT_MARS_SERVICE);
snprintf(cfg->systemctl_path, sizeof(cfg->systemctl_path), "%s", DEFAULT_SYSTEMCTL_PATH);
snprintf(cfg->smart_conf, sizeof(cfg->smart_conf), "%s", smart_conf_path);
snprintf(g_log_path, sizeof(g_log_path), "%s", LOG_PATH_DEFAULT);
@@ -496,12 +490,6 @@ static void load_smart_conf(nw_config_t *cfg)
snprintf(cfg->key_file, sizeof(cfg->key_file), "%s", val);
} else if (strcmp(key, "smart_perl_path") == 0) {
snprintf(cfg->smart_perl_path, sizeof(cfg->smart_perl_path), "%s", val);
} else if (strcmp(key, "smart_control_path") == 0) {
snprintf(cfg->smart_control_path, sizeof(cfg->smart_control_path), "%s", val);
} else if (strcmp(key, "mars_nwe_service") == 0) {
snprintf(cfg->mars_nwe_service, sizeof(cfg->mars_nwe_service), "%s", val);
} else if (strcmp(key, "smart_systemctl_path") == 0) {
snprintf(cfg->systemctl_path, sizeof(cfg->systemctl_path), "%s", val);
}
}
@@ -661,10 +649,6 @@ static pid_t spawn_smart_perl(const nw_config_t *cfg, int *child_stdin_fd, int *
close(outpipe[0]);
close(outpipe[1]);
setenv("SMART_CONTROL_PATH", cfg->smart_control_path, 1);
setenv("MARS_NWE_SERVICE", cfg->mars_nwe_service, 1);
setenv("SMART_SYSTEMCTL_PATH", cfg->systemctl_path, 1);
execl(cfg->smart_perl_path, cfg->smart_perl_path, (char *)NULL);
perror("execl smart_perl_path");
@@ -1039,11 +1023,8 @@ int main(int argc, char **argv)
log_msg(LOG_LEVEL_INFO, "%s version %s starting", NWWEBUI_NAME, NWWEBUI_VERSION);
log_msg(LOG_LEVEL_INFO, "Using SMArT Perl path: %s", cfg.smart_perl_path);
log_msg(LOG_LEVEL_INFO, "Using SMArT control path: %s", cfg.smart_control_path);
log_msg(LOG_LEVEL_INFO, "Using MARS_NWE service: %s", cfg.mars_nwe_service);
log_msg(LOG_LEVEL_INFO, "Using systemctl path: %s", cfg.systemctl_path);
log_msg(LOG_LEVEL_INFO,
"%s version %s config loaded: bind=%s log_level=%d ssl_enable=%d http_port=%d https_port=%d daemonize=%d cert=%s key=%s pid_file=%s log_file=%s smart_control=%s mars_service=%s systemctl=%s smart.conf=%s",
"%s version %s config loaded: bind=%s log_level=%d ssl_enable=%d http_port=%d https_port=%d daemonize=%d cert=%s key=%s pid_file=%s log_file=%s smart.conf=%s",
NWWEBUI_NAME,
NWWEBUI_VERSION,
cfg.bind_ip,
@@ -1056,9 +1037,6 @@ int main(int argc, char **argv)
cfg.key_file,
cfg.pid_file,
cfg.log_file,
cfg.smart_control_path,
cfg.mars_nwe_service,
cfg.systemctl_path,
cfg.smart_conf);
if (cfg.daemonize) {

View File

@@ -38,11 +38,8 @@ $ENV{HOME} = '@MARS_NWE_INSTALL_FULL_CONFDIR@';
$smart_libexec_dir = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@';
$smart_libexec_dir =~ s#/*$##;
$smart_control_path = $ENV{SMART_CONTROL_PATH} unless defined $smart_control_path;
$smart_control_path = $smart_libexec_dir . '/control' unless defined $smart_control_path;
$mars_nwe_service = $ENV{MARS_NWE_SERVICE} unless defined $mars_nwe_service;
$mars_nwe_service = '@MARS_NWE_SYSTEMD_SERVICE@' unless defined $mars_nwe_service;
$smart_systemctl_path = $ENV{SMART_SYSTEMCTL_PATH} unless defined $smart_systemctl_path;
$smart_systemctl_path = '@SYSTEMCTL_EXECUTABLE@' unless defined $smart_systemctl_path;
$l = <STDIN>;
@@ -118,10 +115,6 @@ if( ( $c[0] eq 'service' && $c[1] eq 'control' ) ||
{
# Service control must run before drop_root().
# /service/control is the preferred path; /cgi-bin/control is kept as a legacy alias.
$ENV{'QUERY_STRING'} = $cc;
$ENV{'REQUEST_URI'} = $request_uri;
$ENV{'SMART_SYSTEMCTL_PATH'} = $smart_systemctl_path if defined $smart_systemctl_path;
$ENV{'MARS_NWE_SERVICE'} = $mars_nwe_service if defined $mars_nwe_service;
my $rv = do( $smart_control_path );
if( ! defined $rv )
{