Author: jerry
Date: 2004-08-16 21:07:01 +0000 (Mon, 16 Aug 2004)
New Revision: 1839

WebSVN: 
http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0_RELEASE/source&rev=1839&nolog=1

Log:
pulling a few more changes from 3.0
Modified:
   branches/SAMBA_3_0_RELEASE/source/lib/debug.c
   branches/SAMBA_3_0_RELEASE/source/web/cgi.c


Changeset:
Modified: branches/SAMBA_3_0_RELEASE/source/lib/debug.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/lib/debug.c       2004-08-16 19:03:22 UTC (rev 
1838)
+++ branches/SAMBA_3_0_RELEASE/source/lib/debug.c       2004-08-16 21:07:01 UTC (rev 
1839)
@@ -572,6 +572,7 @@
        oldumask = umask( 022 );
   
        pstrcpy(fname, debugf );
+       debugf[0] = '\0';
 
        if (lp_loaded()) {
                char *logfname;
@@ -726,7 +727,12 @@
                errno = old_errno;
                return( 0 );
        }
-  
+
+       /* prevent recursion by checking if reopen_logs() has temporaily
+          set the debugf string to "" */
+       if( debugf[0] == '\0')
+               return( 0 );
+
 #ifdef WITH_SYSLOG
        if( !lp_syslog_only() )
 #endif

Modified: branches/SAMBA_3_0_RELEASE/source/web/cgi.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/web/cgi.c 2004-08-16 19:03:22 UTC (rev 1838)
+++ branches/SAMBA_3_0_RELEASE/source/web/cgi.c 2004-08-16 21:07:01 UTC (rev 1839)
@@ -421,18 +421,38 @@
                }
        }
 
-       if (!file_exist(file, &st)) {
+       if (sys_stat(file, &st) != 0) 
+       {
                cgi_setup_error("404 File Not Found","",
                                "The requested file was not found");
        }
 
-       fd = web_open(file,O_RDONLY,0);
+       if (S_ISDIR(st.st_mode))
+       {
+               snprintf(buf, sizeof(buf), "%s/index.html", file);
+               if (!file_exist(buf, &st) || !S_ISREG(st.st_mode))
+               {
+                       cgi_setup_error("404 File Not Found","",
+                                       "The requested file was not found");
+               }
+       }
+       else if (S_ISREG(st.st_mode))
+       {
+               snprintf(buf, sizeof(buf), "%s", file);
+       }
+       else
+       {
+               cgi_setup_error("404 File Not Found","",
+                               "The requested file was not found");
+       }
+
+       fd = web_open(buf,O_RDONLY,0);
        if (fd == -1) {
                cgi_setup_error("404 File Not Found","",
                                "The requested file was not found");
        }
        printf("HTTP/1.0 200 OK\r\n");
-       if ((p=strrchr_m(file,'.'))) {
+       if ((p=strrchr_m(buf, '.'))) {
                if (strcmp(p,".gif")==0) {
                        printf("Content-Type: image/gif\r\n");
                } else if (strcmp(p,".jpg")==0) {
@@ -554,7 +574,7 @@
 
        string_sub(url, "/swat/", "", 0);
 
-       if (url[0] != '/' && strstr(url,"..")==0 && file_exist(url, NULL)) {
+       if (url[0] != '/' && strstr(url,"..")==0) {
                cgi_download(url);
        }
 

Reply via email to