summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2006-12-31 20:05:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:30:39 -0500
commit43470b5ec3d451aa75acf2cda40cf2dcc019efab (patch)
treeb5050af45bd3c56a33332b6cbb0a5e0ff69ab6b3 /source4
parent4024697a0b7b97acdc5c411ab9fe8c894c66752e (diff)
downloadsamba-43470b5ec3d451aa75acf2cda40cf2dcc019efab.tar.gz
samba-43470b5ec3d451aa75acf2cda40cf2dcc019efab.tar.bz2
samba-43470b5ec3d451aa75acf2cda40cf2dcc019efab.zip
r20444: WEB Application framework / SWAT.
We're now at the stage where the web application framework should build and install automatically. Derrell (This used to be commit 0201baef46c1701007e0a4cdd95edee287939318)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/smb_build/makefile.pm2
-rw-r--r--source4/dynconfig.c4
-rw-r--r--source4/dynconfig.h2
-rw-r--r--source4/dynconfig.mk2
-rw-r--r--source4/lib/appweb/ejs/config.h2
-rw-r--r--source4/main.mk8
-rw-r--r--source4/param/loadparm.c8
-rw-r--r--source4/script/installswat.sh38
-rw-r--r--source4/script/installwebapps.sh52
-rw-r--r--source4/scripting/ejs/smbcalls_config.c2
-rw-r--r--source4/web_server/http.c38
11 files changed, 86 insertions, 72 deletions
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index b52a08712a..e3853e8534 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -85,7 +85,7 @@ MODULESDIR = $self->{config}->{modulesdir}
INCLUDEDIR = $self->{config}->{includedir}
CONFIGDIR = $self->{config}->{sysconfdir}
DATADIR = $self->{config}->{datadir}
-SWATDIR = $self->{config}->{datadir}/swat
+WEBAPPSDIR = $self->{config}->{datadir}/webapps
SERVICESDIR = $self->{config}->{datadir}/services
JSDIR = $self->{config}->{datadir}/js
SETUPDIR = $self->{config}->{datadir}/setup
diff --git a/source4/dynconfig.c b/source4/dynconfig.c
index 4517a4f551..7a95cc59f7 100644
--- a/source4/dynconfig.c
+++ b/source4/dynconfig.c
@@ -74,8 +74,8 @@ _PUBLIC_ const char *dyn_PIDDIR = PIDDIR;
/** Private data directory; holds ldb files and the like */
_PUBLIC_ const char *dyn_PRIVATE_DIR = PRIVATE_DIR;
-/** SWAT data file (images, etc) directory */
-_PUBLIC_ const char *dyn_SWATDIR = SWATDIR;
+/** WEBAPPS directory */
+_PUBLIC_ const char *dyn_WEBAPPSDIR = WEBAPPSDIR;
/** JSON-RPC Services script directory */
_PUBLIC_ const char *dyn_SERVICESDIR = SERVICESDIR;
diff --git a/source4/dynconfig.h b/source4/dynconfig.h
index d3badc73e5..da1fe68467 100644
--- a/source4/dynconfig.h
+++ b/source4/dynconfig.h
@@ -35,7 +35,7 @@ extern const char *dyn_MODULESDIR;
extern const char *dyn_LOCKDIR;
extern const char *dyn_PIDDIR;
extern const char *dyn_PRIVATE_DIR;
-extern const char *dyn_SWATDIR;
+extern const char *dyn_WEBAPPSDIR;
extern const char *dyn_SERVICESDIR;
extern const char *dyn_JSDIR;
extern const char *dyn_SETUPDIR;
diff --git a/source4/dynconfig.mk b/source4/dynconfig.mk
index abbe5077a0..873ea5b45a 100644
--- a/source4/dynconfig.mk
+++ b/source4/dynconfig.mk
@@ -13,7 +13,7 @@ PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" \
-DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DDATADIR=\"$(DATADIR)\" \
-DLOGFILEBASE=\"$(LOGFILEBASE)\" \
-DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
- -DSWATDIR=\"$(SWATDIR)\" -DSERVICESDIR=\"$(SERVICESDIR)\" \
+ -DWEBAPPSDIR=\"$(WEBAPPSDIR)\" -DSERVICESDIR=\"$(SERVICESDIR)\" \
-DPRIVATE_DIR=\"$(PRIVATEDIR)\" \
-DMODULESDIR=\"$(MODULESDIR)\" -DJSDIR=\"$(JSDIR)\" \
-DTORTUREDIR=\"$(TORTUREDIR)\" \
diff --git a/source4/lib/appweb/ejs/config.h b/source4/lib/appweb/ejs/config.h
index feec3c9e5b..8c06d28147 100644
--- a/source4/lib/appweb/ejs/config.h
+++ b/source4/lib/appweb/ejs/config.h
@@ -1,5 +1,5 @@
#define BLD_PRODUCT "Samba4"
-#define BLD_NAME "Samba4 SWAT"
+#define BLD_NAME "Samba4 WEB Applications"
#define BLD_VERSION "4"
#define BLD_NUMBER "1"
#define BLD_TYPE "DEBUG"
diff --git a/source4/main.mk b/source4/main.mk
index 2c15cf8912..e59c280f5e 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -59,7 +59,7 @@ showlayout:
@echo ' logfilebase: $(LOGFILEBASE)'
@echo ' setupdir: $(SETUPDIR)'
@echo ' jsdir: $(JSDIR)'
- @echo ' swatdir: $(SWATDIR)'
+ @echo ' webappsdir: $(WEBAPPSDIR)'
@echo ' servicesdir: $(SERVICESDIR)'
@echo ' mandir: $(MANDIR)'
@echo ' torturedir: $(TORTUREDIR)'
@@ -84,7 +84,7 @@ showflags:
# The permissions to give the executables
INSTALLPERMS = 0755
-install: showlayout installbin installdat installswat installmisc installlib \
+install: showlayout installbin installdat installwebapps installmisc installlib \
installheader installpc installplugins
# DESTDIR is used here to prevent packagers wasting their time
@@ -145,8 +145,8 @@ installheader: headers installdirs
installdat: installdirs
@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
-installswat: installdirs
- @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
+installwebapps: installdirs
+ @$(SHELL) $(srcdir)/script/installwebapps.sh $(DESTDIR)$(WEBAPPSDIR) $(srcdir)
@$(SHELL) $(srcdir)/script/installjsonrpc.sh $(DESTDIR)$(SERVICESDIR) $(srcdir)
installman: manpages installdirs
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 5094a7f565..93d9d79ece 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -132,7 +132,7 @@ typedef struct
char *szWinbindSeparator;
char *szWinbinddSocketDirectory;
int bWinbindSealedPipes;
- char *swat_directory;
+ char *webapps_directory;
int tls_enabled;
char *tls_keyfile;
char *tls_certfile;
@@ -442,7 +442,7 @@ static struct parm_struct parm_table[] = {
{"tls cafile", P_STRING, P_GLOBAL, &Globals.tls_cafile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"tls crlfile", P_STRING, P_GLOBAL, &Globals.tls_crlfile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"tls dh params file", P_STRING, P_GLOBAL, &Globals.tls_dhpfile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"swat directory", P_STRING, P_GLOBAL, &Globals.swat_directory, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"web application directory", P_STRING, P_GLOBAL, &Globals.webapps_directory, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"large readwrite", P_BOOL, P_GLOBAL, &Globals.bLargeReadwrite, NULL, NULL, FLAG_DEVELOPER},
{"server max protocol", P_ENUM, P_GLOBAL, &Globals.srv_maxprotocol, NULL, enum_protocol, FLAG_DEVELOPER},
{"server min protocol", P_ENUM, P_GLOBAL, &Globals.srv_minprotocol, NULL, enum_protocol, FLAG_DEVELOPER},
@@ -694,7 +694,7 @@ static void init_globals(void)
do_parameter("krb5 port", "88", NULL);
do_parameter("kpasswd port", "464", NULL);
do_parameter("web port", "901", NULL);
- do_parameter("swat directory", dyn_SWATDIR, NULL);
+ do_parameter("web application directory", dyn_WEBAPPSDIR, NULL);
do_parameter("jsonrpc services directory", dyn_SERVICESDIR, NULL);
do_parameter("nt status support", "True", NULL);
@@ -821,7 +821,7 @@ _PUBLIC_ FN_GLOBAL_INTEGER(lp_krb5_port, &Globals.krb5_port)
_PUBLIC_ FN_GLOBAL_INTEGER(lp_kpasswd_port, &Globals.kpasswd_port)
_PUBLIC_ FN_GLOBAL_INTEGER(lp_web_port, &Globals.web_port)
_PUBLIC_ FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
-_PUBLIC_ FN_GLOBAL_STRING(lp_swat_directory, &Globals.swat_directory)
+_PUBLIC_ FN_GLOBAL_STRING(lp_webapps_directory, &Globals.webapps_directory)
_PUBLIC_ FN_GLOBAL_BOOL(lp_tls_enabled, &Globals.tls_enabled)
_PUBLIC_ FN_GLOBAL_STRING(lp_tls_keyfile, &Globals.tls_keyfile)
_PUBLIC_ FN_GLOBAL_STRING(lp_tls_certfile, &Globals.tls_certfile)
diff --git a/source4/script/installswat.sh b/source4/script/installswat.sh
deleted file mode 100644
index 549c11da35..0000000000
--- a/source4/script/installswat.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-SWATDIR=$1
-SRCDIR=$2
-
-echo Installing swat files in $SWATDIR
-
-cd $SRCDIR/../swat || exit 1
-
-mkdir -p $SWATDIR || exit 1
-
-installdir() {
- for f in $*; do
- dname=`dirname $f`
- echo "Installing $f in $dname"
- test -d $SWATDIR/$dname || mkdir -p $SWATDIR/$dname || exit 1
- cp $f $SWATDIR/$dname/ || exit 1
- chmod 0644 $SWATDIR/$f || exit 1
- done
-}
-
-installdir `find . -name '*.html'`
-installdir `find . -name '*.js'`
-installdir `find . -name '*.esp'`
-installdir `find . -name '*.css'`
-installdir `find . -name '*.png'`
-installdir `find . -name '*.ico'`
-installdir `find . -name '*.gif'`
-installdir `find . -name '*.ejs'`
-
-cat << EOF
-======================================================================
-The swat files have been installed.
-======================================================================
-EOF
-
-exit 0
-
diff --git a/source4/script/installwebapps.sh b/source4/script/installwebapps.sh
new file mode 100644
index 0000000000..c763d6b089
--- /dev/null
+++ b/source4/script/installwebapps.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+WEBAPPSDIR=$1
+SRCDIR=$2
+
+echo Installing web application files in $WEBAPPSDIR
+
+cd $SRCDIR/../webapps/swat || exit 1
+make build || exit 1
+
+mkdir -p $WEBAPPSDIR || exit 1
+
+installdir() {
+ for f in $*; do
+ dname=`dirname $f`
+ echo "Installing $f in $dname"
+ test -d $WEBAPPSDIR/$dname || mkdir -p $WEBAPPSDIR/$dname || exit 1
+ cp $f $WEBAPPSDIR/$dname/ || exit 1
+ chmod 0644 $WEBAPPSDIR/$f || exit 1
+ done
+}
+
+# install our web application
+cd build
+installdir `find . -type f -print`
+cd ..
+
+# install all .esp files (there are none in the webapp build dir)
+installdir `find . -name '*.esp'`
+
+# install .js and .esp files from the scripting dir
+cd ..
+installdir `find scripting -name '*.js'`
+installdir `find scripting -name '*.esp'`
+
+# install .css files from the style dir
+installdir `find style -name '*.css'`
+
+# install files from the images dir
+installdir `find images -type f -print`
+
+# install the login script, for authentication of static pages
+installdir `find . -name 'login.esp'`
+
+cat << EOF
+======================================================================
+The web application files have been installed.
+======================================================================
+EOF
+
+exit 0
+
diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c
index 5da0dd14f0..6ee9c8305b 100644
--- a/source4/scripting/ejs/smbcalls_config.c
+++ b/source4/scripting/ejs/smbcalls_config.c
@@ -67,7 +67,7 @@ static int ejs_lpCategories(MprVarHandle eid, int argc, char **argv)
/*
- allow access to loadparm variables from inside ejs scripts in swat
+ allow access to loadparm variables from inside ejs scripts in web apps
can be called in 4 ways:
diff --git a/source4/web_server/http.c b/source4/web_server/http.c
index 210151f10f..83bc38dbc0 100644
--- a/source4/web_server/http.c
+++ b/source4/web_server/http.c
@@ -33,10 +33,10 @@
#include "lib/tls/tls.h"
#include "scripting/ejs/smbcalls.h"
-#define SWAT_SESSION_KEY "SwatSessionId"
-#define HTTP_PREAUTH_URI "/scripting/preauth.esp"
-#define JSONRPC_REQUEST "/services"
-#define JSONRPC_SERVER "/request.esp"
+#define SAMBA_SESSION_KEY "SambaSessionId"
+#define HTTP_PREAUTH_URI "/scripting/preauth.esp"
+#define JSONRPC_REQUEST "/services"
+#define JSONRPC_SERVER "/request.esp"
/* state of the esp subsystem for a specific request */
struct esp_state {
@@ -126,7 +126,7 @@ static const char *http_local_path(struct websrv_context *web,
if (path == NULL) return NULL;
if (directory_exist(path)) {
- path = talloc_asprintf_append(path, "/index.esp");
+ path = talloc_asprintf_append(path, "/index.html");
}
return path;
}
@@ -170,12 +170,12 @@ failed:
return -1;
}
-static int http_readFileFromSwatDir(EspHandle handle,
- char **buf,
- int *len,
- const char *path)
+static int http_readFileFromWebappsDir(EspHandle handle,
+ char **buf,
+ int *len,
+ const char *path)
{
- return http_readFile(handle, buf, len, path, lp_swat_directory());
+ return http_readFile(handle, buf, len, path, lp_webapps_directory());
}
@@ -325,7 +325,7 @@ static void http_createSession(EspHandle handle, int timeout)
struct websrv_context *web = talloc_get_type(handle, struct websrv_context);
if (web->session) {
web->session->lifetime = timeout;
- http_setCookie(web, SWAT_SESSION_KEY, web->session->id,
+ http_setCookie(web, SAMBA_SESSION_KEY, web->session->id,
web->session->lifetime, "/", 0);
}
}
@@ -390,7 +390,7 @@ static void http_simple_request(struct websrv_context *web)
const char *path;
struct stat st;
- path = http_local_path(web, url, lp_swat_directory());
+ path = http_local_path(web, url, lp_webapps_directory());
if (path == NULL) goto invalid;
/* looks ok */
@@ -472,9 +472,9 @@ static void http_setup_arrays(struct esp_state *esp)
talloc_asprintf(esp, "%u", socket_address->port));
}
- SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_swat_directory());
+ SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_webapps_directory());
SETVAR(ESP_SERVER_OBJ, "SERVER_PROTOCOL", tls_enabled(web->conn->socket)?"https":"http");
- SETVAR(ESP_SERVER_OBJ, "SERVER_SOFTWARE", "SWAT");
+ SETVAR(ESP_SERVER_OBJ, "SERVER_SOFTWARE", "SAMBA");
SETVAR(ESP_SERVER_OBJ, "GATEWAY_INTERFACE", "CGI/1.1");
SETVAR(ESP_SERVER_OBJ, "TLS_SUPPORT", tls_support(edata->tls_params)?"True":"False");
}
@@ -518,7 +518,7 @@ static void esp_request(struct esp_state *esp, const char *url)
int res;
char *emsg = NULL, *buf;
- if (http_readFile(web, &buf, &size, url, lp_swat_directory()) != 0) {
+ if (http_readFile(web, &buf, &size, url, lp_webapps_directory()) != 0) {
http_error_unix(web, url);
return;
}
@@ -622,7 +622,7 @@ static BOOL http_preauth(struct esp_state *esp)
{
const char *path = http_local_path(esp->web,
HTTP_PREAUTH_URI,
- lp_swat_directory());
+ lp_webapps_directory());
int i;
if (path == NULL) {
http_error(esp->web, 500, "Internal server error");
@@ -674,7 +674,7 @@ static const char *http_unescape(TALLOC_CTX *mem_ctx, const char *p)
*/
static void esp_putvar(struct esp_state *esp, const char *var, const char *value)
{
- if (strcasecmp(var, SWAT_SESSION_KEY) == 0) {
+ if (strcasecmp(var, SAMBA_SESSION_KEY) == 0) {
/* special case support for browsers without cookie
support */
esp->web->input.session_key = talloc_strdup(esp, value);
@@ -773,7 +773,7 @@ static int session_destructor(struct session_data *s)
*/
static void http_setup_session(struct esp_state *esp)
{
- const char *session_key = SWAT_SESSION_KEY;
+ const char *session_key = SAMBA_SESSION_KEY;
char *p;
const char *cookie = esp->web->input.cookie;
const char *key = NULL;
@@ -835,7 +835,7 @@ static const struct Esp esp_control = {
.setHeader = http_setHeader,
.redirect = http_redirect,
.setResponseCode = http_setResponseCode,
- .readFile = http_readFileFromSwatDir,
+ .readFile = http_readFileFromWebappsDir,
.mapToStorage = http_mapToStorage,
.setCookie = http_setCookie,
.createSession = http_createSession,