gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog doc/C/usermanual/usage/gnashrc....


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog doc/C/usermanual/usage/gnashrc....
Date: Fri, 28 Sep 2007 15:44:03 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   07/09/28 15:44:03

Modified files:
        .              : ChangeLog 
        doc/C/usermanual/usage: gnashrc.xml 
        libbase        : rc.cpp rc.h 
        testsuite/libbase: TCXXRc.cpp gnashrc-local.in 

Log message:
                * libbase/rc.{h,cpp}: move list parsing into a function; enable
                  'set <list> off' for disabling previously parsed lists. Add
                  error message when colons found in a list.
                * testsuite/libbase/TCXXRc.cpp, gnashrc-local.in: add test for
                  whitelist override.
                * docs: update user manual.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4465&r2=1.4466
http://cvs.savannah.gnu.org/viewcvs/gnash/doc/C/usermanual/usage/gnashrc.xml?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.cpp?cvsroot=gnash&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libbase/TCXXRc.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libbase/gnashrc-local.in?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4465
retrieving revision 1.4466
diff -u -b -r1.4465 -r1.4466
--- ChangeLog   28 Sep 2007 15:10:28 -0000      1.4465
+++ ChangeLog   28 Sep 2007 15:44:02 -0000      1.4466
@@ -1,3 +1,12 @@
+2007-09-28 Benjamin Wolsey <address@hidden>
+
+       * libbase/rc.{h,cpp}: move list parsing into a function; enable
+         'set <list> off' for disabling previously parsed lists. Add
+         error message when colons found in a list.
+       * testsuite/libbase/TCXXRc.cpp, gnashrc-local.in: add test for
+         whitelist override.
+       * docs: update user manual.
+
 2007-09-28 Bernhard Rosenkraenzer <address@hidden>
 
        * configure.ac: rework SIZET_FMT detection to stop at first

Index: doc/C/usermanual/usage/gnashrc.xml
===================================================================
RCS file: /sources/gnash/gnash/doc/C/usermanual/usage/gnashrc.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- doc/C/usermanual/usage/gnashrc.xml  28 Sep 2007 09:28:59 -0000      1.12
+++ doc/C/usermanual/usage/gnashrc.xml  28 Sep 2007 15:44:03 -0000      1.13
@@ -59,7 +59,8 @@
 <row>
 <entry>whitelist</entry>
 <entry>hostnames</entry>
-<entry>This is a list of hostnames, separated by spaces. The hostname must be 
given
+<entry>This is a list of hostnames separated by spaces, or 
<emphasis>off</emphasis>
+           to disable the whitelist. The hostname must be given
             without a protocol (http://, https://). If this list is populated,
            &app; will only load external Flash movies from the specified 
hosts.  The
            whitelist takes precedence over the blacklist. Because several 
files can
@@ -71,7 +72,8 @@
 <row>
 <entry>blacklist</entry>
 <entry>hostnames</entry>
-<entry>This is a list of hostnames, separated by spaces. The hostname must be 
given
+<entry>This is a list of hostnames separated by spaces, or 
<emphasis>off</emphasis>
+           to disable the blacklist. The hostname must be given
             without a protocol (http://, https://).
            External flash movies from these
             domains are never allowed to load. If whitelist is present

Index: libbase/rc.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- libbase/rc.cpp      28 Sep 2007 08:46:49 -0000      1.36
+++ libbase/rc.cpp      28 Sep 2007 15:44:03 -0000      1.37
@@ -162,6 +162,63 @@
     return *num;
 }
 
+/// Takes references to action ('set' or 'append'), items
+/// (list of items separated by spaces), listname (name of list)
+/// and the item array (list).
+//
+/// Returns either empty array ('set <list> off'), array with only
+/// passed items ('set <list> <items>') or array passed with items
+/// appended ('append <list> <items>').
+
+void
+RcInitFile::parseList(std::vector<std::string> &list, string &action,
+                           std::string &listname, string &items)
+{
+//    GNASH_REPORT_FUNCTION;
+
+    if (action == "set") {
+
+       // Clear array of hosts in previously parsed
+       // rc files.
+       list.clear();
+
+       StringNoCaseEqual noCaseCompare;
+
+        if (noCaseCompare(items, "off") || noCaseCompare(items, "no") ||
+            noCaseCompare(items, "false")) {
+           // Return empty array (allows disabling of global
+           // whitelists in favour of a blacklist)
+           return;
+       }
+    }          
+
+    string::size_type pos;
+
+    // This is an ugly way to avoid breaking lists
+    // Lists will work if they worked before, but
+    // combining the two separators will not.
+    // The colon way must be removed before protocols
+    // (http://, https:// can be included in lists).
+    char separator;
+    if (items.find(':') != string::npos) {
+       // Deprecated behaviour
+       separator = ':';
+       log_error(_("The list '%s' in an rcfile contains a colon. This is 
deprecated and may result in "
+               "unexpected behaviour. Please only use spaces as a 
separator."), listname.c_str());
+    } else {
+       // New behaviour
+       separator = ' ';
+    }
+
+    while (items.size()) {
+       pos = items.find(separator, 0);
+       list.push_back(items.substr(0, pos));
+       items.erase(0, pos);
+       if (items.size()) items.erase(0, items.find_first_not_of(separator)); 
+    }
+
+}
+
 void
 RcInitFile::extractDouble(double& out, const char *pattern, string &variable,
                            string &value)
@@ -316,46 +373,12 @@
                 }
                 
                 if (variable == "blacklist") {
-                   // 'set' should override all previous blacklists
-                   // else 'append' should add to the end.
-                   if (action == "set") _blacklist.clear();
-
-                    string::size_type pos;
-                    //This is an ugly way to avoid breaking lists
-                    //Lists will work if they worked before, but
-                    //combining the two separators will not.
-                    //The colon way must be removed before protocols
-                    //(http://, https:// can be included in lists).
-                    char separator;
-                    if (value.find(':') != string::npos) separator = ':';
-                    else separator = ' ';
-                    while (value.size()) {
-                        pos = value.find(separator, 0);
-                        _blacklist.push_back(value.substr(0, pos));
-                        value.erase(0, pos);
-                        if (value.size()) value.erase(0, 
value.find_first_not_of(separator)); 
-                    }
+                   parseList(_blacklist, action, variable, value);
                     continue;
                 }
 
                 if (variable == "whitelist") {
-                   if (action == "set") _whitelist.clear();
-                   
-                    string::size_type pos;
-                    //This is an ugly way to avoid breaking lists
-                    //Lists will work if they worked before, but
-                    //combining the two separators will not.
-                    //The colon way must be removed before protocols
-                    //(http://, https:// can be included in lists).
-                    char separator;
-                    if (value.find(':') != string::npos) separator = ':';
-                    else separator = ' ';
-                    while (value.size()) {
-                        pos = value.find(separator, 0);
-                        _whitelist.push_back(value.substr(0, pos));
-                        value.erase(0, pos);
-                        if (value.size()) value.erase(0, 
value.find_first_not_of(separator)); 
-                    }
+                   parseList(_whitelist, action, variable, value);
                     continue;
                 }
 

Index: libbase/rc.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- libbase/rc.h        25 Sep 2007 14:17:21 -0000      1.26
+++ libbase/rc.h        28 Sep 2007 15:44:03 -0000      1.27
@@ -169,6 +169,9 @@
     static void extractDouble(double& out, const char *pattern,
                         std::string &variable, std::string &value);
 
+    static void parseList(std::vector<std::string>& list, std::string &action,
+                       std::string &listname, std::string &items);
+
 };
 
 //extern DSOEXPORT RcInitFile rcfile;

Index: testsuite/libbase/TCXXRc.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/libbase/TCXXRc.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- testsuite/libbase/TCXXRc.cpp        28 Sep 2007 09:28:59 -0000      1.18
+++ testsuite/libbase/TCXXRc.cpp        28 Sep 2007 15:44:03 -0000      1.19
@@ -217,16 +217,22 @@
         if (blacklist.size()) {
             if ((blacklist[2] == "www.gnashdev.org")
                 && (blacklist[3] == "www.wikipedia.de")) {
-                runtest.pass ("rc.getBlackList() - append");
+                runtest.pass ("rc.getBlackList(): append");
             } else {
-                runtest.fail ("rc.getBlackList() - append");
+                runtest.fail ("rc.getBlackList(): append");
             }
-            runtest.pass ("rc.getBlackList() has elements after append");
+            runtest.pass ("rc.getBlackList(): has appended elements");
         } else {
-            runtest.fail ("rc.getBlackList() doesn't have elements after 
append");        
+            runtest.fail ("rc.getBlackList(): doesn't appended elements");     
   
         }
 
+       // Test local override of previous whitelist 
+        std::vector<std::string> whitelist = rc.getWhiteList();
+       if (whitelist.size()) {
+           runtest.fail ("rc.getWhiteList(): local override failed");
+       } else {
+           runtest.pass ("rc.getWhiteList(): local override succeeded");
+       }
     }
-
 }
 

Index: testsuite/libbase/gnashrc-local.in
===================================================================
RCS file: /sources/gnash/gnash/testsuite/libbase/gnashrc-local.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/libbase/gnashrc-local.in  28 Sep 2007 09:28:59 -0000      1.1
+++ testsuite/libbase/gnashrc-local.in  28 Sep 2007 15:44:03 -0000      1.2
@@ -1,3 +1,6 @@
+# Test for override whitelist
+set whitelist off
+
 # Don't access content from these sites
 # Test for append to list
 append blacklist www.gnashdev.org www.wikipedia.de




reply via email to

[Prev in Thread] Current Thread [Next in Thread]