summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-03-08 14:31:50 +0000
committerAndrew Tridgell <tridge@samba.org>1998-03-08 14:31:50 +0000
commit6a37b245e3894c5a3a62bf38d4eef27be5f209e8 (patch)
tree2912f89a4cab908e16854fcb88f20143fc7d9647
parent35d67dd80aa3ba72b75683cb1f35c81066e21223 (diff)
downloadsamba-6a37b245e3894c5a3a62bf38d4eef27be5f209e8.tar.gz
samba-6a37b245e3894c5a3a62bf38d4eef27be5f209e8.tar.bz2
samba-6a37b245e3894c5a3a62bf38d4eef27be5f209e8.zip
allow for non-authenticated SWAT for demo purposes
(This used to be commit 6e1237568b559c006ee5429308ac47e97cc4a1c4)
-rw-r--r--source3/cgi.c4
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/swat.c9
-rw-r--r--source3/web/cgi.c4
-rw-r--r--source3/web/swat.c9
5 files changed, 17 insertions, 11 deletions
diff --git a/source3/cgi.c b/source3/cgi.c
index 7c84f47ada..83158fc1a5 100644
--- a/source3/cgi.c
+++ b/source3/cgi.c
@@ -548,7 +548,7 @@ static void cgi_download(char *file)
setup the cgi framework, handling the possability that this program is either
run as a true cgi program by a web browser or is itself a mini web server
***************************************************************************/
-void cgi_setup(char *rootdir)
+void cgi_setup(char *rootdir, int auth_required)
{
int authenticated = 0;
char line[1024];
@@ -586,7 +586,7 @@ void cgi_setup(char *rootdir)
/* ignore all other requests! */
}
- if (!authenticated) {
+ if (auth_required && !authenticated) {
cgi_setup_error("401 Authorization Required",
"WWW-Authenticate: Basic realm=\"root\"\r\n",
"You must be authenticated to use this service");
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 06b2d4ec78..f0591743c0 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -28,7 +28,7 @@ char *quotedup(char *s);
char *urlquote(char *s);
char *quotequotes(char *s);
void quote_spaces(char *buf);
-void cgi_setup(char *rootdir);
+void cgi_setup(char *rootdir, int auth_required);
char *cgi_baseurl(void);
/*The following definitions come from charcnv.c */
diff --git a/source3/swat.c b/source3/swat.c
index 4810d87af3..6a5b4f51f1 100644
--- a/source3/swat.c
+++ b/source3/swat.c
@@ -432,6 +432,7 @@ int main(int argc, char *argv[])
extern FILE *dbf;
int opt;
char *page;
+ int auth_required = 1;
/* just in case it goes wild ... */
alarm(300);
@@ -440,16 +441,18 @@ int main(int argc, char *argv[])
if (!dbf) dbf = stderr;
- cgi_setup(SWATDIR);
-
- while ((opt = getopt(argc, argv,"s:")) != EOF) {
+ while ((opt = getopt(argc, argv,"s:a")) != EOF) {
switch (opt) {
case 's':
pstrcpy(servicesf,optarg);
break;
+ case 'a':
+ auth_required = 0;
+ break;
}
}
+ cgi_setup(SWATDIR, auth_required);
print_header();
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index 7c84f47ada..83158fc1a5 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -548,7 +548,7 @@ static void cgi_download(char *file)
setup the cgi framework, handling the possability that this program is either
run as a true cgi program by a web browser or is itself a mini web server
***************************************************************************/
-void cgi_setup(char *rootdir)
+void cgi_setup(char *rootdir, int auth_required)
{
int authenticated = 0;
char line[1024];
@@ -586,7 +586,7 @@ void cgi_setup(char *rootdir)
/* ignore all other requests! */
}
- if (!authenticated) {
+ if (auth_required && !authenticated) {
cgi_setup_error("401 Authorization Required",
"WWW-Authenticate: Basic realm=\"root\"\r\n",
"You must be authenticated to use this service");
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 4810d87af3..6a5b4f51f1 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -432,6 +432,7 @@ int main(int argc, char *argv[])
extern FILE *dbf;
int opt;
char *page;
+ int auth_required = 1;
/* just in case it goes wild ... */
alarm(300);
@@ -440,16 +441,18 @@ int main(int argc, char *argv[])
if (!dbf) dbf = stderr;
- cgi_setup(SWATDIR);
-
- while ((opt = getopt(argc, argv,"s:")) != EOF) {
+ while ((opt = getopt(argc, argv,"s:a")) != EOF) {
switch (opt) {
case 's':
pstrcpy(servicesf,optarg);
break;
+ case 'a':
+ auth_required = 0;
+ break;
}
}
+ cgi_setup(SWATDIR, auth_required);
print_header();