X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=debian%2Fpatches%2F26_edit_only_writable.dpatch;h=de751138b7478cb5f583a0f4c4ad739397a90ed5;hp=64d92465e4fe7443455c8d3b9cb37b5f73deaaee;hb=47e9a13bb048883664b6e03d5ce325f36b68783c;hpb=eaf38167c9a21326865db5cbb021b11abdfbc496;ds=sidebyside diff --git a/debian/patches/26_edit_only_writable.dpatch b/debian/patches/26_edit_only_writable.dpatch index 64d92465..de751138 100755 --- a/debian/patches/26_edit_only_writable.dpatch +++ b/debian/patches/26_edit_only_writable.dpatch @@ -1,37 +1,60 @@ #! /bin/sh /usr/share/dpatch/dpatch-run -## 26_edit_only_writable.dpatch by Roland Rosenfeld +## 26_edit_only_writable.dpatch by Fabian Keil ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Hide the edit button on http://p.p/show-status if action file can ## DP: not be written by the privoxy user. +## DP: Extended version action.patch by Fabian Keil which shows a +## DP: message, that the file is write protected. +## DP: http://sf.net/tracker/?func=detail&atid=311118&aid=1564026&group_id=11118 @DPATCH@ diff -urNad privoxy~/cgisimple.c privoxy/cgisimple.c --- privoxy~/cgisimple.c +++ privoxy/cgisimple.c -@@ -244,6 +244,10 @@ +@@ -248,6 +248,10 @@ #include #include -+#if !defined(_WIN32) && !defined(__OS2__) ++#ifdef HAVE_ACCESS +#include -+#endif ++#endif /* def HAVE_ACCESS */ + #ifdef _WIN32 #define snprintf _snprintf #endif /* def _WIN32 */ -@@ -1030,8 +1034,14 @@ +@@ -1040,8 +1044,20 @@ #ifdef FEATURE_CGI_EDIT_ACTIONS if (NULL == strstr(csp->actions_list[i]->filename, "standard.action") && NULL != csp->config->actions_file_short[i]) { -+#if !defined(_WIN32) && !defined(__OS2__) -+ if (access(csp->config->actions_file[i], W_OK) == 0) { -+#endif - snprintf(buf, 100, "  Edit", csp->config->actions_file_short[i]); - if (!err) err = string_append(&s, buf); -+#if !defined(_WIN32) && !defined(__OS2__) +- snprintf(buf, 100, "  Edit", 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, "  Edit", ++ csp->config->actions_file_short[i]); ++ if (!err) err = string_append(&s, buf); ++#ifdef HAVE_ACCESS + } -+#endif ++ else ++ { ++ if (!err) err = string_append(&s, "  File is write protected."); ++ } ++#endif /* def HAVE_ACCESS */ } #endif +diff -urNad privoxy~/configure.in privoxy/configure.in +--- privoxy~/configure.in ++++ privoxy/configure.in +@@ -1129,7 +1129,7 @@ + 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 random regcomp select setlocale socket strchr strdup strerror strftime strptime strstr strtoul timegm]) ++AC_CHECK_FUNCS([access atexit getcwd gethostbyaddr gethostbyaddr_r gethostbyname gethostbyname_r inet_ntoa localtime_r memchr memmove memset random regcomp select setlocale socket strchr strdup strerror strftime strptime strstr strtoul timegm]) + + + dnl =================================================================