Suppress edit buttons for action files if Privoxy has
authorFabian Keil <fk@fabiankeil.de>
Sat, 20 Jan 2007 16:29:38 +0000 (16:29 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sat, 20 Jan 2007 16:29:38 +0000 (16:29 +0000)
no write access. Suggested by Roland in PR 1564026.

cgisimple.c
configure.in

index 545bedc..b82dbde 100644 (file)
@@ -1,4 +1,4 @@
-const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.47 2007/01/12 15:07:10 fabiankeil Exp $";
+const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.48 2007/01/20 15:31:31 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
@@ -36,6 +36,10 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.47 2007/01/12 15:07:10 fabian
  *
  * Revisions   :
  *    $Log: cgisimple.c,v $
+ *    Revision 1.48  2007/01/20 15:31:31  fabiankeil
+ *    Display warning if show-url-info CGI page
+ *    is used while Privoxy is toggled off.
+ *
  *    Revision 1.47  2007/01/12 15:07:10  fabiankeil
  *    Use zalloc in cgi_send_user_manual.
  *
@@ -281,6 +285,10 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.47 2007/01/12 15:07:10 fabian
 #include <string.h>
 #include <assert.h>
 
+#ifdef HAVE_ACCESS
+#include <unistd.h>
+#endif /* def HAVE_ACCESS */
+
 #ifdef _WIN32
 #define snprintf _snprintf
 #endif /* def _WIN32 */
@@ -1078,8 +1086,20 @@ jb_err cgi_show_status(struct client_state *csp,
 #ifdef FEATURE_CGI_EDIT_ACTIONS
          if (NULL == strstr(csp->actions_list[i]->filename, "standard.action") && NULL != csp->config->actions_file_short[i])
          {
-            snprintf(buf, 100, "&nbsp;&nbsp;<a href=\"/edit-actions-list?f=%s\">Edit</a>", csp->config->actions_file_short[i]);
-            if (!err) err = string_append(&s, buf);
+#ifdef HAVE_ACCESS
+            if (access(csp->config->actions_file[i], W_OK) == 0)
+            {
+#endif /* def HAVE_ACCESS */
+               snprintf(buf, 100, "&nbsp;&nbsp;<a href=\"/edit-actions-list?f=%s\">Edit</a>",
+                  csp->config->actions_file_short[i]);
+               if (!err) err = string_append(&s, buf);
+#ifdef HAVE_ACCESS
+            }
+            else
+            {
+               if (!err) err = string_append(&s, "&nbsp;&nbsp;<strong>No write access.</strong>");
+            }
+#endif /* def HAVE_ACCESS */
          }
 #endif
 
index 0f9f97e..2669e8e 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl 
-dnl $Id: configure.in,v 1.101 2007/01/12 15:20:17 fabiankeil Exp $
+dnl $Id: configure.in,v 1.102 2007/01/18 14:55:45 fabiankeil Exp $
 dnl 
 dnl Written by and Copyright (C) 2001 - 2004 the SourceForge
 dnl Privoxy team. http://www.privoxy.org/
@@ -28,6 +28,11 @@ dnl or write to the Free Software Foundation, Inc., 59
 dnl Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 dnl 
 dnl $Log: configure.in,v $
+dnl Revision 1.102  2007/01/18 14:55:45  fabiankeil
+dnl Check for tzset() and putenv() to make sure the
+dnl replacement timegm() isn't included on systems
+dnl where it fails to compile.
+dnl
 dnl Revision 1.101  2007/01/12 15:20:17  fabiankeil
 dnl Temporarily ignore external libpcrs to prevent
 dnl problems that are fixed in Privoxy's own version.
@@ -481,7 +486,7 @@ dnl =================================================================
 dnl AutoConf Initialization
 dnl =================================================================
 
-AC_REVISION($Revision: 1.101 $)
+AC_REVISION($Revision: 1.102 $)
 AC_INIT(jcc.c)
 
 if test ! -f config.h.in; then
@@ -1148,7 +1153,7 @@ AC_FUNC_SETPGRP
 AC_TYPE_SIGNAL
 dnl uncommenting does not work for swa. suse linux
 dnl AC_FUNC_STAT
-AC_CHECK_FUNCS([atexit getcwd gethostbyaddr gethostbyaddr_r gethostbyname gethostbyname_r inet_ntoa localtime_r memchr memmove memset putenv random regcomp select setlocale socket strchr strdup strerror strftime strptime strstr strtoul timegm tzset])
+AC_CHECK_FUNCS([access atexit getcwd gethostbyaddr gethostbyaddr_r gethostbyname gethostbyname_r inet_ntoa localtime_r memchr memmove memset putenv random regcomp select setlocale socket strchr strdup strerror strftime strptime strstr strtoul timegm tzset])
 
 
 dnl =================================================================