use /swat/ prefix in both inetd and cgi modes, to enable a static header.html
authorAndrew Tridgell <tridge@samba.org>
Wed, 2 Sep 1998 02:02:30 +0000 (02:02 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 2 Sep 1998 02:02:30 +0000 (02:02 +0000)
(This used to be commit ddb788c24d043b18506138a7759b8128df1673aa)

source3/web/cgi.c
source3/web/swat.c

index 9804f93adf9334cca4e854e0f53dcab7349b3c3e..97dac86668cb2899f71c6479d1fdab2db673dc2f 100644 (file)
@@ -622,8 +622,10 @@ void cgi_setup(char *rootdir, int auth_required)
                *p = 0;
        }
 
                *p = 0;
        }
 
-       if (strstr(url+1,"..")==0 && file_exist(url+1, NULL)) {
-               cgi_download(url+1);
+       string_sub(url, "/swat/", "");
+
+       if (strstr(url,"..")==0 && file_exist(url, NULL)) {
+               cgi_download(url);
        }
 
        printf("HTTP/1.1 200 OK\r\nConnection: close\r\n");
        }
 
        printf("HTTP/1.1 200 OK\r\nConnection: close\r\n");
@@ -644,18 +646,6 @@ char *cgi_baseurl(void)
        return getenv("SCRIPT_NAME");
 }
 
        return getenv("SCRIPT_NAME");
 }
 
-/***************************************************************************
-return the root URL for images etc
-  ***************************************************************************/
-char *cgi_rooturl(void)
-{
-       if (baseurl) {
-               return "/";
-       }
-       return "/swat/";
-}
-
-
 /***************************************************************************
 return the current pages path info
   ***************************************************************************/
 /***************************************************************************
 return the current pages path info
   ***************************************************************************/
index 504552ec402b13821aef56c0ec6902a0ee5bf395..2665df5d1b2fabac5c2a59e4c7f8a79f0e0c3844 100644 (file)
@@ -107,7 +107,7 @@ static void print_header(void)
 
        if (!include_html("include/header.html")) {
                printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
 
        if (!include_html("include/header.html")) {
                printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
-               printf("<HTML>\n<HEAD>\n<TITLE>Samba Web Administration Tool</TITLE>\n</HEAD>\n<BODY background=\"%simages/background.jpg\">\n\n", cgi_rooturl());
+               printf("<HTML>\n<HEAD>\n<TITLE>Samba Web Administration Tool</TITLE>\n</HEAD>\n<BODY background=\"/swat/images/background.jpg\">\n\n");
        }
 }
 
        }
 }
 
@@ -132,8 +132,8 @@ static void show_parameter(int snum, struct parm_struct *parm)
                ptr = lp_local_ptr(snum, ptr);
        }
 
                ptr = lp_local_ptr(snum, ptr);
        }
 
-       printf("<tr><td><A HREF=\"%shelp/parameters.html#%s\">?</A> %s</td><td>", 
-              cgi_rooturl(), parm->label, parm->label);
+       printf("<tr><td><A HREF=\"/swat/help/parameters.html#%s\">?</A> %s</td><td>", 
+              parm->label, parm->label);
 
        switch (parm->type) {
        case P_CHAR:
 
        switch (parm->type) {
        case P_CHAR:
@@ -355,10 +355,9 @@ static void load_config(void)
 /* spit out the html for a link with an image */
 static void image_link(char *name,char *hlink, char *src, int width, int height)
 {
 /* spit out the html for a link with an image */
 static void image_link(char *name,char *hlink, char *src, int width, int height)
 {
-       printf("<A HREF=\"%s/%s\"><img width=%d height=%d src=\"%s%s\" alt=\"%s\"></A>\n", 
+       printf("<A HREF=\"%s/%s\"><img width=%d height=%d src=\"/swat/%s\" alt=\"%s\"></A>\n", 
               cgi_baseurl(),
               hlink, width, height, 
               cgi_baseurl(),
               hlink, width, height, 
-              cgi_rooturl(),
               src, name);
 }
 
               src, name);
 }