summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-26 02:06:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:02 -0500
commit7e582319528b674d5f7603409e357138194a0ab1 (patch)
treea5c3c63c60dde9e401f1978197722fabfc10f7a4 /source4
parentd70912a26af49db468af7ec88e9689b8176e0576 (diff)
downloadsamba-7e582319528b674d5f7603409e357138194a0ab1.tar.gz
samba-7e582319528b674d5f7603409e357138194a0ab1.tar.bz2
samba-7e582319528b674d5f7603409e357138194a0ab1.zip
r6982: install the swat pages with 'make installswat'
(This used to be commit 31543e1eae03d22343ea8c970494af36eb07b41f)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/smb_build/check_path.m415
-rw-r--r--source4/build/smb_build/makefile.pm10
-rw-r--r--source4/dynconfig.c1
-rw-r--r--source4/include/dynconfig.h1
-rw-r--r--source4/param/loadparm.c10
-rw-r--r--source4/script/installswat.sh126
-rw-r--r--source4/web_server/http.c6
-rw-r--r--source4/web_server/web_server.c2
8 files changed, 50 insertions, 121 deletions
diff --git a/source4/build/smb_build/check_path.m4 b/source4/build/smb_build/check_path.m4
index bfd15d3d8c..5d3c70049d 100644
--- a/source4/build/smb_build/check_path.m4
+++ b/source4/build/smb_build/check_path.m4
@@ -107,6 +107,20 @@ AC_ARG_WITH(logfilebase,
;;
esac])
+
+#################################################
+# set swat directory location
+AC_ARG_WITH(swatdir,
+[ --with-swatdir=DIR Where to put configuration files (\$swatdir)],
+[ case "$withval" in
+ yes|no)
+ AC_MSG_WARN([--with-swatdir called without argument - will use default])
+ ;;
+ * )
+ swatdir="$withval"
+ ;;
+ esac])
+
AC_SUBST(configdir)
AC_SUBST(lockdir)
AC_SUBST(piddir)
@@ -114,6 +128,7 @@ AC_SUBST(logfilebase)
AC_SUBST(privatedir)
AC_SUBST(bindir)
AC_SUBST(sbindir)
+AC_SUBST(swatdir)
debug=no
AC_ARG_ENABLE(debug,
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 19ed201d81..ab64eff99c 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -41,6 +41,7 @@ SBINDIR = @sbindir@
LIBDIR = @libdir@
CONFIGDIR = @configdir@
VARDIR = @localstatedir@
+SWATDIR = @swatdir@
# The permissions to give the executables
INSTALLPERMS = 0755
@@ -71,7 +72,8 @@ PATH_FLAGS4 = $(PATH_FLAGS3) -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
-DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\"
-PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
+PATH_FLAGS7 = $(PATH_FLAGS6) -DSWATDIR=\"$(SWATDIR)\"
+PATH_FLAGS = $(PATH_FLAGS7) $(PASSWD_FLAGS)
__EOD__
@@ -622,6 +624,7 @@ showlayout:
@echo " privatedir: $(PRIVATEDIR)"
@echo " piddir: $(PIDDIR)"
@echo " lockdir: $(LOCKDIR)"
+ @echo " swatdir: $(SWATDIR)"
showflags:
@echo "Samba will be compiled with flags:"
@@ -655,7 +658,7 @@ REG_PROGS = bin/regpatch \
bin/regpatch \
bin/regdiff
-install: showlayout installbin installtorture installldb installreg installdat
+install: showlayout installbin installtorture installldb installreg installdat installswat
# DESTDIR is used here to prevent packagers wasting their time
# duplicating the Makefile. Remove it and you will have the privelege
@@ -684,6 +687,9 @@ installreg: all installdirs
installdat: installdirs
@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
+installswat: installdirs
+ @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
+
uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg
uninstallbin:
diff --git a/source4/dynconfig.c b/source4/dynconfig.c
index c76d448b8c..50dadee91e 100644
--- a/source4/dynconfig.c
+++ b/source4/dynconfig.c
@@ -72,3 +72,4 @@ const pstring dyn_PIDDIR = PIDDIR;
const pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
const pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
+const pstring dyn_SWATDIR = SWATDIR;
diff --git a/source4/include/dynconfig.h b/source4/include/dynconfig.h
index a95e67a90d..0692f5b932 100644
--- a/source4/include/dynconfig.h
+++ b/source4/include/dynconfig.h
@@ -40,3 +40,4 @@ extern const pstring dyn_LOCKDIR;
extern const pstring dyn_PIDDIR;
extern const pstring dyn_SMB_PASSWD_FILE;
extern const pstring dyn_PRIVATE_DIR;
+extern const pstring dyn_SWATDIR;
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 956c42881b..4b55db8aab 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -239,7 +239,7 @@ typedef struct
int nbt_port;
int dgram_port;
int cldap_port;
- int swat_port;
+ int web_port;
char *socket_options;
BOOL bDNSproxy;
BOOL bWINSsupport;
@@ -623,7 +623,7 @@ static struct parm_struct parm_table[] = {
{"nbt port", P_INTEGER, P_GLOBAL, &Globals.nbt_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"dgram port", P_INTEGER, P_GLOBAL, &Globals.dgram_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"cldap port", P_INTEGER, P_GLOBAL, &Globals.cldap_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"swat port", P_INTEGER, P_GLOBAL, &Globals.swat_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"web port", P_INTEGER, P_GLOBAL, &Globals.web_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"swat directory", P_STRING, P_GLOBAL, &Globals.swat_directory, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"large readwrite", P_BOOL, P_GLOBAL, &Globals.bLargeReadwrite, NULL, NULL, FLAG_DEVELOPER},
{"max protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_DEVELOPER},
@@ -1061,8 +1061,8 @@ static void init_globals(void)
do_parameter("nbt port", "137");
do_parameter("dgram port", "138");
do_parameter("cldap port", "389");
- do_parameter("swat port", "901");
- do_parameter_var("swat directory", "%s%s", dyn_LIBDIR, "/swat");
+ do_parameter("web port", "901");
+ do_parameter("swat directory", dyn_SWATDIR);
do_parameter("nt status support", "True");
@@ -1166,7 +1166,7 @@ FN_GLOBAL_LIST(lp_smb_ports, &Globals.smb_ports)
FN_GLOBAL_INTEGER(lp_nbt_port, &Globals.nbt_port)
FN_GLOBAL_INTEGER(lp_dgram_port, &Globals.dgram_port)
FN_GLOBAL_INTEGER(lp_cldap_port, &Globals.cldap_port)
-FN_GLOBAL_INTEGER(lp_swat_port, &Globals.swat_port)
+FN_GLOBAL_INTEGER(lp_web_port, &Globals.web_port)
FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
FN_GLOBAL_STRING(lp_swat_directory, &Globals.swat_directory)
FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
diff --git a/source4/script/installswat.sh b/source4/script/installswat.sh
index c66604cdb8..dbf0e7351f 100644
--- a/source4/script/installswat.sh
+++ b/source4/script/installswat.sh
@@ -1,125 +1,31 @@
#!/bin/sh
-#fist version March 1998, Andrew Tridgell
SWATDIR=$1
SRCDIR=$2/
-BOOKDIR=$SWATDIR/using_samba
-echo Installing SWAT in $SWATDIR
-echo Installing the Samba Web Administration Tool
+echo Installing swat files in $SWATDIR
-LANGS=". `cd $SRCDIR../swat/; /bin/echo lang/??`"
-echo Installing langs are `cd $SRCDIR../swat/lang/; /bin/echo ??`
+cd $SRCDIR/../swat || exit 1
-for ln in $LANGS; do
- SWATLANGDIR=$SWATDIR/$ln
- for d in $SWATLANGDIR $SWATLANGDIR/help $SWATLANGDIR/images \
- $SWATLANGDIR/include; do
- if [ ! -d $d ]; then
- mkdir -p $d
- if [ ! -d $d ]; then
- echo Failed to make directory $d, does $USER have privileges?
- exit 1
- fi
- fi
- done
-done
-
-# Install images
-for ln in $LANGS; do
-
-for f in $SRCDIR../swat/$ln/images/*.gif; do
- FNAME=$SWATDIR/$ln/images/`basename $f`
- echo $FNAME
- cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
- chmod 0644 $FNAME
-done
-
-# Install html help
-
-for f in $SRCDIR../swat/$ln/help/*.html; do
- FNAME=$SWATDIR/$ln/help/`basename $f`
- echo $FNAME
- if [ "x$BOOKDIR" = "x" ]; then
- cat $f | sed 's/@BOOKDIR@.*$//' > $f.tmp
- else
- cat $f | sed 's/@BOOKDIR@//' > $f.tmp
- fi
- f=$f.tmp
- cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
- rm -f $f
- chmod 0644 $FNAME
-done
-
-# Install html documentation
-
-for f in $SRCDIR../docs/htmldocs/*.html; do
- FNAME=$SWATDIR/help/`basename $f`
- echo $FNAME
- cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
- chmod 0644 $FNAME
-done
-
-# Install "server-side" includes
-
-for f in $SRCDIR../swat/$ln/include/*.html; do
- FNAME=$SWATDIR/$ln/include/`basename $f`
- echo $FNAME
- cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
- chmod 0644 $FNAME
-done
-
-done
-
-# Install Using Samba book
-
-if [ "x$BOOKDIR" != "x" ]; then
-
- # Create directories
-
- for d in $BOOKDIR $BOOKDIR/figs $BOOKDIR/gifs; do
- if [ ! -d $d ]; then
- mkdir $d
- if [ ! -d $d ]; then
- echo Failed to make directory $d, does $USER have privileges?
- exit 1
- fi
- fi
- done
-
- # HTML files
-
- for f in $SRCDIR../docs/htmldocs/using_samba/*.html; do
- FNAME=$BOOKDIR/`basename $f`
- echo $FNAME
- cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
- chmod 0644 $FNAME
- done
-
- # Figures
-
- for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
- FNAME=$BOOKDIR/figs/`basename $f`
- echo $FNAME
- cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
- chmod 0644 $FNAME
- done
-
- # Gifs
-
- for f in $SRCDIR../docs/htmldocs/using_samba/gifs/*.gif; do
- FNAME=$BOOKDIR/gifs/`basename $f`
- echo $FNAME
- cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
- chmod 0644 $FNAME
+installdir() {
+ dir=$1
+ ext=$2
+ mkdir -p $SWATDIR/$dir || exit 1
+ for f in $dir/*.$ext; do
+ echo Installing $f
+ cp $f $SWATDIR/$dir/ || exit 1
+ chmod 0644 $SWATDIR/$f || exit 1
done
+}
-fi
+installdir html html
+installdir html/esptest html
+installdir html/images png
+installdir scripting ejs
cat << EOF
======================================================================
-The SWAT files have been installed. Remember to read the swat/README
-for information on enabling and using SWAT
+The swat files have been installed.
======================================================================
EOF
diff --git a/source4/web_server/http.c b/source4/web_server/http.c
index ad7eaa8ead..61ed685361 100644
--- a/source4/web_server/http.c
+++ b/source4/web_server/http.c
@@ -250,7 +250,7 @@ static const char *http_local_path(struct websrv_context *web, const char *url)
}
}
- path = talloc_asprintf(web, "%s/%s", lp_swat_directory(), url+1);
+ path = talloc_asprintf(web, "%s/html/%s", lp_swat_directory(), url+1);
if (path == NULL) return NULL;
if (directory_exist(path)) {
@@ -275,7 +275,7 @@ static void http_simple_request(struct websrv_context *web)
/* looks ok */
web->output.fd = open(path, O_RDONLY);
if (web->output.fd == -1) {
- http_error_unix(web, url);
+ http_error_unix(web, path);
return;
}
@@ -354,7 +354,7 @@ static void esp_request(struct esp_state *esp)
/* looks ok */
fd = open(path, O_RDONLY);
if (fd == -1) {
- http_error_unix(web, url);
+ http_error_unix(web, path);
return;
}
diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c
index 9d161bdd8a..656e101c11 100644
--- a/source4/web_server/web_server.c
+++ b/source4/web_server/web_server.c
@@ -202,7 +202,7 @@ static const struct stream_server_ops web_stream_ops = {
static void websrv_task_init(struct task_server *task)
{
NTSTATUS status;
- uint16_t port = lp_swat_port();
+ uint16_t port = lp_web_port();
const struct model_ops *model_ops;
/* run the web server as a single process */