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];
/* 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");
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 */
extern FILE *dbf;
int opt;
char *page;
+ int auth_required = 1;
/* just in case it goes wild ... */
alarm(300);
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();
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];
/* 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");
extern FILE *dbf;
int opt;
char *page;
+ int auth_required = 1;
/* just in case it goes wild ... */
alarm(300);
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();