Here's a quick patch to fix a few error codes in swat - return 500 on a
server error, not 400, and return 403 Forbidden instead of 400 Server
Error when attempting to access swat from a host not allowed by "hosts
allow" or "hosts deny"

Also a quick typo in a comment

Vance Lankhaar

Index: web/cgi.c
===================================================================
RCS file: /cvsroot/samba/source/web/cgi.c,v
retrieving revision 1.68
diff -u -r1.68 cgi.c
--- web/cgi.c   19 Feb 2003 00:27:38 -0000      1.68
+++ web/cgi.c   28 Feb 2003 03:18:11 -0000
@@ -455,11 +455,11 @@
        char *lang;
 
        if (chdir(rootdir)) {
-               cgi_setup_error("400 Server Error", "",
+               cgi_setup_error("500 Server Error", "",
                                "chdir failed - the server is not configured 
correctly");
        }
 
-       /* Handle the possability we might be running as non-root */
+       /* Handle the possibility we might be running as non-root */
        sec_init();
 
        if ((lang=getenv("HTTP_ACCEPT_LANGUAGE"))) {
@@ -478,7 +478,7 @@
        inetd_server = True;
 
        if (!check_access(1, lp_hostsallow(-1), lp_hostsdeny(-1))) {
-               cgi_setup_error("400 Server Error", "",
+               cgi_setup_error("403 Forbidden", "",
                                "Samba is configured to deny access from this 
client\n<br>Check
your \"hosts allow\" and \"hosts deny\" options in smb.conf ");
        }
 

Index: web/cgi.c
===================================================================
RCS file: /cvsroot/samba/source/web/cgi.c,v
retrieving revision 1.68
diff -u -r1.68 cgi.c
--- web/cgi.c	19 Feb 2003 00:27:38 -0000	1.68
+++ web/cgi.c	28 Feb 2003 03:22:56 -0000
@@ -455,11 +455,11 @@
 	char *lang;
 
 	if (chdir(rootdir)) {
-		cgi_setup_error("400 Server Error", "",
+		cgi_setup_error("500 Server Error", "",
 				"chdir failed - the server is not configured correctly");
 	}
 
-	/* Handle the possability we might be running as non-root */
+	/* Handle the possibility we might be running as non-root */
 	sec_init();
 
 	if ((lang=getenv("HTTP_ACCEPT_LANGUAGE"))) {
@@ -478,7 +478,7 @@
 	inetd_server = True;
 
 	if (!check_access(1, lp_hostsallow(-1), lp_hostsdeny(-1))) {
-		cgi_setup_error("400 Server Error", "",
+		cgi_setup_error("403 Forbidden", "",
 				"Samba is configured to deny access from this client\n<br>Check your \"hosts allow\" and \"hosts deny\" options in smb.conf ");
 	}
 

Reply via email to