This commit is contained in:
20
configure
vendored
20
configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for maacom.pl 0.01.
|
||||
# Generated by GNU Autoconf 2.69 for maacom.pl 0.02.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
@@ -576,8 +576,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='maacom.pl'
|
||||
PACKAGE_TARNAME='maacom-pl'
|
||||
PACKAGE_VERSION='0.01'
|
||||
PACKAGE_STRING='maacom.pl 0.01'
|
||||
PACKAGE_VERSION='0.02'
|
||||
PACKAGE_STRING='maacom.pl 0.02'
|
||||
PACKAGE_BUGREPORT=''
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -1234,7 +1234,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures maacom.pl 0.01 to adapt to many kinds of systems.
|
||||
\`configure' configures maacom.pl 0.02 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1304,7 +1304,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of maacom.pl 0.01:";;
|
||||
short | recursive ) echo "Configuration of maacom.pl 0.02:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1392,7 +1392,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
maacom.pl configure 0.01
|
||||
maacom.pl configure 0.02
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@@ -1409,7 +1409,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by maacom.pl $as_me 0.01, which was
|
||||
It was created by maacom.pl $as_me 0.02, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2272,7 +2272,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='maacom-pl'
|
||||
VERSION='0.01'
|
||||
VERSION='0.02'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -3455,7 +3455,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by maacom.pl $as_me 0.01, which was
|
||||
This file was extended by maacom.pl $as_me 0.02, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -3508,7 +3508,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
maacom.pl config.status 0.01
|
||||
maacom.pl config.status 0.02
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AC_INIT(maacom.pl,0.01)
|
||||
AC_INIT(maacom.pl,0.02)
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_PREFIX_DEFAULT(/usr/local)
|
||||
|
||||
|
||||
33
maacom.pl
33
maacom.pl
@@ -707,9 +707,6 @@ sub trusted_delete {
|
||||
$id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
#--------------
|
||||
@@ -725,19 +722,32 @@ use Cwd qw(cwd getcwd chdir);
|
||||
use Mojo::Util qw(dumper);
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $self = {};
|
||||
my ($class, $user, $group) = @_;
|
||||
my $self = {
|
||||
user => $user,
|
||||
group => $group
|
||||
};
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub fork {
|
||||
my $self = shift;
|
||||
|
||||
my $pid = fork;
|
||||
if ($pid > 0) {
|
||||
exit;
|
||||
}
|
||||
chdir("/");
|
||||
|
||||
my $uid = getpwnam($self->{user}) if $self->{user};
|
||||
my $gid = getgrnam($self->{group}) if $self->{group};
|
||||
|
||||
print $uid, $gid,"\n";
|
||||
|
||||
setuid($uid) if $uid;
|
||||
setgid($gid) if $gid;
|
||||
|
||||
open(my $stdout, '>&', STDOUT);
|
||||
open(my $stderr, '>&', STDERR);
|
||||
open(STDOUT, '>>', '/dev/null');
|
||||
@@ -1169,6 +1179,9 @@ $app->config(dblogin => '');
|
||||
$app->config(dbpassword => '');
|
||||
$app->config(dbengine => 'sqlite3');
|
||||
|
||||
$app->config(group => '@app_group@');
|
||||
$app->config(user => '@app_user@');
|
||||
|
||||
if (-r $app->config('conffile')) {
|
||||
$app->log->debug("Load configuration from ".$app->config('conffile'));
|
||||
# $app->plugin('JSONConfig', { file => $app->config('conffile') });
|
||||
@@ -1317,8 +1330,6 @@ $server->listen(\@listen);
|
||||
$server->heartbeat_interval(3);
|
||||
$server->heartbeat_timeout(60);
|
||||
|
||||
my $d = Daemon->new;
|
||||
$d->fork;
|
||||
|
||||
$server->pid_file($app->config('pidfile'));
|
||||
|
||||
@@ -1327,6 +1338,14 @@ $app->log(Mojo::Log->new(
|
||||
level => $app->config('loglevel')
|
||||
));
|
||||
|
||||
|
||||
my $user = $app->config('user');
|
||||
my $group = $app->config('group');
|
||||
my $d = Daemon->new($user, $group);
|
||||
$d->fork;
|
||||
|
||||
|
||||
|
||||
$app->hook(before_dispatch => sub {
|
||||
my $c = shift;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ CREATE TABLE forwarded (
|
||||
id int unique NOT NULL PRIMARY KEY,
|
||||
name text unique
|
||||
);
|
||||
|
||||
CREATE TABLE unwanted (
|
||||
id int unique NOT NULL PRIMARY KEY,
|
||||
name text unique
|
||||
@@ -33,6 +32,4 @@ CREATE TABLE trusted (
|
||||
id int unique NOT NULL PRIMARY KEY,
|
||||
name text unique
|
||||
);
|
||||
|
||||
|
||||
COMMIT;
|
||||
|
||||
2669
to-wiki.txt
2669
to-wiki.txt
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user