Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sympl
Sympl
Commits
0d567981
Commit
0d567981
authored
Feb 15, 2021
by
Paul Cammish
Browse files
Removed deprecated Apache VHost mod
parent
e77f0bf2
Changes
17
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
0d567981
...
...
@@ -6,6 +6,8 @@ CHANGELOG
* Updated version numbering format
sympl-mysql
* Fixed creating 'sympl' MySQL user
sympl-web
* Removed deprecated Apache VHost mod
2021-02-12
sympl-mail
...
...
web/Makefile
View file @
0d567981
...
...
@@ -20,7 +20,6 @@ obj-$(DEB_BUILD_GNU_TYPE)/bin/%: %.go
test
:
obj-$(DEB_BUILD_GNU_TYPE)/bin/sympl-web-logger
$(MAKE)
-C
vhost-alias
test
RUBYLIB
=
${RUBYLIB}
ruby test.d/t
*
.rb
sbin/sympl-web-logger
:
obj-$(DEB_BUILD_GNU_TYPE)/bin/sympl-web-logger
...
...
@@ -40,12 +39,6 @@ man/%.man: man/%.txt
clean
:
$(RM)
-r
obj-
$(DEB_BUILD_GNU_TYPE)
cd
vhost-alias
&&
make clean
@
find
.
-name
'.*~'
-exec
rm
\{\}
\;
@
find
.
-name
'.#*'
-exec
rm
\{\}
\;
@
find
.
-name
'configure-stamp'
-exec
rm
\{\}
\;
@
find
.
-name
'build-stamp'
-exec
rm
\{\}
\;
$(RM)
-r
man
$(RM)
sbin/sympl-web-logger
.PHONY
:
test clean all docs
web/README
deleted
100644 → 0
View file @
e77f0bf2
mod_vhost_sympl
---------------
This is a minimaly modified copy of mod_vhost_alias from the
Apache 2.x source tree.
There are only two minimal changes from the upstream version included
in Debian:
1. The inclusion of the following patch:
https://issues.apache.org/bugzilla/show_bug.cgi?id=26052
2. Updated handling to make /srv/foo.com & /srv/www.foo.com synonyms.
Steve
--
web/copyright
deleted
100644 → 0
View file @
e77f0bf2
This diff is collapsed.
Click to expand it.
web/debian/changelog
View file @
0d567981
sympl-web (11.20210215.0) stable; urgency=medium
* Updated version numbering format
* Removed deprecated Apache VHost mod
-- Paul Cammish <sympl@kelduum.net> Mon, 15 Feb 2021 12:00:00 +0000
...
...
web/debian/control
View file @
0d567981
...
...
@@ -20,17 +20,3 @@ Description: Tools to manage Apache virtual hosting in Sympl
of only a pair of directories.
.
Adding new websites doesn't even require you to restart your server.
Package: libapache2-mod-vhost-sympl
Architecture: any
Depends: apache2-api-20120211, ${shlibs:Depends}, ${misc:Depends}
Description: Mass-hosting module for Apache 2.4 and Sympl
This module allows you to easily host multiple virtual hosts with
a single simple configuration file.
.
This module is a fork of the official mod_vhost_alias module from
the Apache project with only minor changes:
.
* Allows per vhost document root to be setup.
* Allows domains to be handled with or without a www. prefix.
web/debian/copyright
View file @
0d567981
...
...
@@ -27,25 +27,3 @@ License: GPL-2+
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
Files: src/mod_vhost_sympl.c /usr/lib/apache2/modules/mod_vhost_sympl.so
Comment: Based on mod_vhost_alias in the Apache HTTPD source.
Copyright: 1998-1999, Demon Internet Ltd.
2008-2017, Bytemark Ltd.
Licence: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the complete text of the Apache Licence, Version 2.0
`can be found in /usr/share/common-licenses/Apache-2'.
web/debian/dirs
View file @
0d567981
usr/lib/apache2/modules
etc/apache2/mods-available/
etc/apache2/mod-ifier.d/
usr/share/bug/libapache2-mod-vhost-sympl/
var/lib/sympl/web
web/debian/libapache2-mod-vhost-sympl.apache2
deleted
100644 → 0
View file @
e77f0bf2
mod vhost-alias/.libs/mod_vhost_sympl.so
mod debian/vhost_sympl.load
web/debian/libapache2-mod-vhost-sympl.postinst
deleted
100644 → 0
View file @
e77f0bf2
#!/bin/sh -e
#
# Skip, if we are not in "configure" state
#
if
[
"
$1
"
!=
"configure"
]
;
then
echo
"I: Skipping configuration"
exit
0
fi
#DEBHELPER#
exit
0
web/debian/rules
View file @
0d567981
...
...
@@ -8,7 +8,6 @@ export DH_GOPKG := sympl-web-logger
override_dh_auto_build:
$(MAKE)
cd vhost-alias && $(MAKE) && $(MAKE) test
dh_auto_build
override_dh_auto_clean:
...
...
web/debian/sympl-web.postinst
View file @
0d567981
...
...
@@ -50,11 +50,6 @@ if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
apache2_invoke enmod
$mod
done
#
# Disable legacy module
#
apache2_invoke dismod vhost_sympl
fi
#
...
...
web/debian/vhost_sympl.load
deleted
100644 → 0
View file @
e77f0bf2
LoadModule vhost_sympl_module /usr/lib/apache2/modules/mod_vhost_sympl.so
web/vhost-alias/Makefile
deleted
100644 → 0
View file @
e77f0bf2
#
# Version setup by "make" in parent directory
#
all
:
mod_vhost_sympl
mod_vhost_sympl
:
mod_vhost_sympl.c
apxs2
-Wc
,-Werror
$(DEF)
-ca
mod_vhost_sympl.c
clean
:
@
find
.
-name
'*.o'
-exec
rm
\{\}
\;
@
find
.
-name
'*.la'
-exec
rm
\{\}
\;
@
find
.
-name
'*.lo'
-exec
rm
\{\}
\;
@
find
.
-name
'*.slo'
-exec
rm
\{\}
\;
@
if
[
-d
./.libs
]
;
then
rm
-rf
./.libs
;
fi
@
find
.
-name
'*~'
-exec
rm
\{\}
\;
@
find
.
-name
'.#*'
-exec
rm
\{\}
\;
@
if
[
-e
./test-strip
]
;
then
rm
-f
./test-strip
;
fi
test
:
test-strip.c
gcc
-Wall
-Werror
-o
test-strip test-strip.c
mkdir
-p
/tmp/foo.com
||
true
mkdir
-p
/tmp/blog.foo.com
||
true
./test-strip 2>/dev/null
install
:
apxs2
-cia
-Wc
,-Werror
$(DEF)
mod_vhost_sympl.c
web/vhost-alias/mod_vhost_sympl.c
deleted
100644 → 0
View file @
e77f0bf2
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* mod_vhost_sympl.c: support for dynamically configured mass virtual
* hosting for Sympl.
*
* This software is based upon mod_vhost_alias.c, which was released under the
* Apache licence, version 2.0.
*
* Copyright (c) 2019 The Sympl Project.
* Copyright (c) 2008-2012 Bytemark Computer Consulting Ltd.
* Copyright (c) 1998-1999 Demon Internet Ltd.
*
* mod_vhost_alias.c was submitted by Demon Internet to the Apache Software Foundation
* in May 1999. Future revisions and derivatives of this source code
* must acknowledge Demon Internet as the original contributor of
* this module. All other licensing and usage conditions are those
* of the Apache Software Foundation.
*
* Originally written by Tony Finch <fanf@demon.net> <dot@dotat.at>.
*
* Implementation ideas were taken from mod_alias.c. The overall
* concept is derived from the OVERRIDE_DOC_ROOT/OVERRIDE_CGIDIR
* patch to Apache 1.3b3 and a similar feature in Demon's thttpd,
* both written by James Grinter <jrg@blodwen.demon.co.uk>.
*/
#define CORE_PRIVATE
#include "apr.h"
#include "apr_strings.h"
#include "ap_hooks.h"
#include "apr_lib.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
/* for ap_log_error */
#include "http_request.h"
/* for ap_hook_translate_name */
#include "mod_vhost_sympl.h"
module
AP_MODULE_DECLARE_DATA
vhost_sympl_module
;
/*
* basic configuration things
* we abbreviate "mod_vhost_alias" to "mva" for shorter names
*/
typedef
enum
{
VHOST_ALIAS_UNSET
,
VHOST_ALIAS_NONE
,
VHOST_ALIAS_NAME
,
VHOST_ALIAS_IP
}
mva_mode_e
;
/*
* Per-server module config record.
*/
typedef
struct
mva_sconf_t
{
const
char
*
doc_root
;
const
char
*
cgi_root
;
mva_mode_e
doc_root_mode
;
mva_mode_e
cgi_root_mode
;
}
mva_sconf_t
;
static
void
*
mva_create_server_config
(
apr_pool_t
*
p
,
server_rec
*
s
)
{
mva_sconf_t
*
conf
;
conf
=
(
mva_sconf_t
*
)
apr_pcalloc
(
p
,
sizeof
(
mva_sconf_t
));
conf
->
doc_root
=
NULL
;
conf
->
cgi_root
=
NULL
;
conf
->
doc_root_mode
=
VHOST_ALIAS_UNSET
;
conf
->
cgi_root_mode
=
VHOST_ALIAS_UNSET
;
return
conf
;
}
static
void
*
mva_merge_server_config
(
apr_pool_t
*
p
,
void
*
parentv
,
void
*
childv
)
{
mva_sconf_t
*
parent
=
(
mva_sconf_t
*
)
parentv
;
mva_sconf_t
*
child
=
(
mva_sconf_t
*
)
childv
;
mva_sconf_t
*
conf
;
conf
=
(
mva_sconf_t
*
)
apr_pcalloc
(
p
,
sizeof
(
*
conf
));
if
(
child
->
doc_root_mode
==
VHOST_ALIAS_UNSET
)
{
conf
->
doc_root_mode
=
parent
->
doc_root_mode
;
conf
->
doc_root
=
parent
->
doc_root
;
}
else
{
conf
->
doc_root_mode
=
child
->
doc_root_mode
;
conf
->
doc_root
=
child
->
doc_root
;
}
if
(
child
->
cgi_root_mode
==
VHOST_ALIAS_UNSET
)
{
conf
->
cgi_root_mode
=
parent
->
cgi_root_mode
;
conf
->
cgi_root
=
parent
->
cgi_root
;
}
else
{
conf
->
cgi_root_mode
=
child
->
cgi_root_mode
;
conf
->
cgi_root
=
child
->
cgi_root
;
}
return
conf
;
}
/*
* These are just here to tell us what vhost_alias_set should do.
* We don't put anything into them; we just use the cell addresses.
*/
static
int
vhost_alias_set_doc_root_ip
,
vhost_alias_set_cgi_root_ip
,
vhost_alias_set_doc_root_name
,
vhost_alias_set_cgi_root_name
;
static
const
char
*
vhost_alias_set
(
cmd_parms
*
cmd
,
void
*
dummy
,
const
char
*
map
)
{
mva_sconf_t
*
conf
;
mva_mode_e
mode
,
*
pmode
;
const
char
**
pmap
;
const
char
*
p
;
conf
=
(
mva_sconf_t
*
)
ap_get_module_config
(
cmd
->
server
->
module_config
,
&
vhost_sympl_module
);
/* there ought to be a better way of doing this */
if
(
&
vhost_alias_set_doc_root_ip
==
cmd
->
info
)
{
mode
=
VHOST_ALIAS_IP
;
pmap
=
&
conf
->
doc_root
;
pmode
=
&
conf
->
doc_root_mode
;
}
else
if
(
&
vhost_alias_set_cgi_root_ip
==
cmd
->
info
)
{
mode
=
VHOST_ALIAS_IP
;
pmap
=
&
conf
->
cgi_root
;
pmode
=
&
conf
->
cgi_root_mode
;
}
else
if
(
&
vhost_alias_set_doc_root_name
==
cmd
->
info
)
{
mode
=
VHOST_ALIAS_NAME
;
pmap
=
&
conf
->
doc_root
;
pmode
=
&
conf
->
doc_root_mode
;
}
else
if
(
&
vhost_alias_set_cgi_root_name
==
cmd
->
info
)
{
mode
=
VHOST_ALIAS_NAME
;
pmap
=
&
conf
->
cgi_root
;
pmode
=
&
conf
->
cgi_root_mode
;
}
else
{
return
"INTERNAL ERROR: unknown command info"
;
}
if
(
!
ap_os_is_path_absolute
(
cmd
->
pool
,
map
))
{
if
(
strcasecmp
(
map
,
"none"
))
{
return
"format string must be an absolute path, or 'none'"
;
}
*
pmap
=
NULL
;
*
pmode
=
VHOST_ALIAS_NONE
;
return
NULL
;
}
/* sanity check */
p
=
map
;
while
(
*
p
!=
'\0'
)
{
if
(
*
p
++
!=
'%'
)
{
continue
;
}
/* we just found a '%' */
if
(
*
p
==
'p'
||
*
p
==
'%'
)
{
++
p
;
continue
;
}
/* optional dash */
if
(
*
p
==
'-'
)
{
++
p
;
}
/* digit N */
if
(
apr_isdigit
(
*
p
))
{
++
p
;
}
else
{
return
"syntax error in format string"
;
}
/* optional plus */
if
(
*
p
==
'+'
)
{
++
p
;
}
/* do we end here? */
if
(
*
p
!=
'.'
)
{
continue
;
}
++
p
;
/* optional dash */
if
(
*
p
==
'-'
)
{
++
p
;
}
/* digit M */
if
(
apr_isdigit
(
*
p
))
{
++
p
;
}
else
{
return
"syntax error in format string"
;
}
/* optional plus */
if
(
*
p
==
'+'
)
{
++
p
;
}
}
*
pmap
=
map
;
*
pmode
=
mode
;
return
NULL
;
}
static
const
char
*
vhost_set_docroot
(
cmd_parms
*
cmd
,
void
*
dummy
,
const
char
*
str
)
{
/*
* Log that this setting is deprecated.
*
* FIXME: this doesn't actually work, so it isn't much use at this time.
*
*/
ap_log_error
(
APLOG_MARK
,
APLOG_STARTUP
,
0
,
cmd
->
server
,
"The SetVirtualDocumentRoot directive (%s:%d) is deprecated "
"and can safely be removed from your configuration and any Sympl templates."
,
cmd
->
directive
->
filename
,
cmd
->
directive
->
line_num
);
return
NULL
;
}
static
const
command_rec
mva_commands
[]
=
{
AP_INIT_TAKE1
(
"VirtualScriptAlias"
,
vhost_alias_set
,
&
vhost_alias_set_cgi_root_name
,
RSRC_CONF
,
"how to create a ScriptAlias based on the host"
),
AP_INIT_TAKE1
(
"VirtualDocumentRoot"
,
vhost_alias_set
,
&
vhost_alias_set_doc_root_name
,
RSRC_CONF
,
"how to create the DocumentRoot based on the host"
),
AP_INIT_TAKE1
(
"VirtualScriptAliasIP"
,
vhost_alias_set
,
&
vhost_alias_set_cgi_root_ip
,
RSRC_CONF
,
"how to create a ScriptAlias based on the host"
),
AP_INIT_TAKE1
(
"VirtualDocumentRootIP"
,
vhost_alias_set
,
&
vhost_alias_set_doc_root_ip
,
RSRC_CONF
,
"how to create the DocumentRoot based on the host"
),
AP_INIT_TAKE1
(
"SetVirtualDocumentRoot"
,
vhost_set_docroot
,
NULL
,
RSRC_CONF
,
"SetVirtualDocumentRoot directive is no longer required"
),
{
NULL
}
};
/*
* This really wants to be a nested function
* but C is too feeble to support them.
*/
static
APR_INLINE
void
vhost_alias_checkspace
(
request_rec
*
r
,
char
*
buf
,
char
**
pdest
,
int
size
)
{
/* XXX: what if size > HUGE_STRING_LEN? */
if
(
*
pdest
+
size
>
buf
+
HUGE_STRING_LEN
)
{
**
pdest
=
'\0'
;
if
(
r
->
filename
)
{
r
->
filename
=
apr_pstrcat
(
r
->
pool
,
r
->
filename
,
buf
,
NULL
);
}
else
{
r
->
filename
=
apr_pstrdup
(
r
->
pool
,
buf
);
}
*
pdest
=
buf
;
}
}
static
void
vhost_alias_interpolate
(
request_rec
*
r
,
mva_sconf_t
*
conf
,
const
char
*
name
,
const
char
*
map
,
const
char
*
uri
)
{
/* 0..9 9..0 */
enum
{
MAXDOTS
=
19
};
const
char
*
dots
[
MAXDOTS
+
1
];
int
ndots
;
char
buf
[
HUGE_STRING_LEN
];
char
*
dest
;
const
char
*
docroot
;
int
N
,
M
,
Np
,
Mp
,
Nd
,
Md
;
const
char
*
start
,
*
end
;
const
char
*
p
;
ndots
=
0
;
dots
[
ndots
++
]
=
name
-
1
;
/* slightly naughty */
for
(
p
=
name
;
*
p
;
++
p
){
if
(
*
p
==
'.'
&&
ndots
<
MAXDOTS
)
{
dots
[
ndots
++
]
=
p
;
}
}
dots
[
ndots
]
=
p
;
r
->
filename
=
NULL
;
dest
=
buf
;
while
(
*
map
)
{
if
(
*
map
!=
'%'
)
{
/* normal characters */
vhost_alias_checkspace
(
r
,
buf
,
&
dest
,
1
);
*
dest
++
=
*
map
++
;
continue
;
}
/* we are in a format specifier */
++
map
;
/* %% -> % */
if
(
*
map
==
'%'
)
{
++
map
;
vhost_alias_checkspace
(
r
,
buf
,
&
dest
,
1
);
*
dest
++
=
'%'
;
continue
;
}
/* port number */
if
(
*
map
==
'p'
)
{
++
map
;
/* no. of decimal digits in a short plus one */
vhost_alias_checkspace
(
r
,
buf
,
&
dest
,
7
);
dest
+=
apr_snprintf
(
dest
,
7
,
"%d"
,
ap_get_server_port
(
r
));
continue
;
}
/* deal with %-N+.-M+ -- syntax is already checked */
M
=
0
;
/* value */
Np
=
Mp
=
0
;
/* is there a plus? */
Nd
=
Md
=
0
;
/* is there a dash? */
if
(
*
map
==
'-'
)
++
map
,
Nd
=
1
;
N
=
*
map
++
-
'0'
;
if
(
*
map
==
'+'
)
++
map
,
Np
=
1
;
if
(
*
map
==
'.'
)
{
++
map
;
if
(
*
map
==
'-'
)
{
++
map
,
Md
=
1
;
}
M
=
*
map
++
-
'0'
;
if
(
*
map
==
'+'
)
{
++
map
,
Mp
=
1
;
}
}
/* note that N and M are one-based indices, not zero-based */
start
=
dots
[
0
]
+
1
;
/* ptr to the first character */
end
=
dots
[
ndots
];
/* ptr to the character after the last one */
if
(
N
!=
0
)
{
if
(
N
>
ndots
)
{
start
=
"_"
;
end
=
start
+
1
;
}
else
if
(
!
Nd
)
{
start
=
dots
[
N
-
1
]
+
1
;
if
(
!
Np
)
{
end
=
dots
[
N
];
}
}
else
{
if
(
!
Np
)
{
start
=
dots
[
ndots
-
N
]
+
1
;
}
end
=
dots
[
ndots
-
N
+
1
];
}
}
if
(
M
!=
0
)
{
if
(
M
>
end
-
start
)
{
start
=
"_"
;
end
=
start
+
1
;
}
else
if
(
!
Md
)
{
start
=
start
+
M
-
1
;
if
(
!
Mp
)
{
end
=
start
+
1
;
}
}
else
{
if
(
!
Mp
)
{
start
=
end
-
M
;
}
end
=
end
-
M
+
1
;
}
}
vhost_alias_checkspace
(
r
,
buf
,
&
dest
,
end
-
start
);
for
(
p
=
start
;
p
<
end
;
++
p
)
{
*
dest
++
=
apr_tolower
(
*
p
);
}
}
/* no double slashes */
if
(
dest
-
buf
>
0
&&
dest
[
-
1
]
==
'/'
)
{
--
dest
;
}
*
dest
=
'\0'
;
/*
* A this point we either have a document root which points to something
* on disk - or not.
*
* If the document root doesn't exist on disk we can *attempt* to remap
* that to the real file.
*
* If this remapping fails we don't care as the result will be a 404,
* and that would have happened anyway.
*
*/
{
struct
stat
buffer
;
/**
* If we have:
*
* A document root
* Which doesn't exist.
*
* Then:
*
* Attempt to fix.
*
*/
if
(
(
NULL
!=
buf
)
&&
(
stat
(
buf
,
&
buffer
)
<
0
)
)
{
/**
* Here we strip out the first part of the name
* after the /srv prefix which will result in
* a request being rewritten from (for example)