gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15321 - in gauger: . web


From: gnunet
Subject: [GNUnet-SVN] r15321 - in gauger: . web
Date: Fri, 27 May 2011 04:41:30 +0200

Author: bartpolot
Date: 2011-05-27 04:41:30 +0200 (Fri, 27 May 2011)
New Revision: 15321

Modified:
   gauger/gauger
   gauger/web/helper.php
   gauger/web/io.php
Log:
Allow any combination of characters in input strings, including potential 
separators


Modified: gauger/gauger
===================================================================
--- gauger/gauger       2011-05-27 02:29:10 UTC (rev 15320)
+++ gauger/gauger       2011-05-27 02:41:30 UTC (rev 15321)
@@ -32,6 +32,11 @@
 else:
     import argparse as arg_parser
 
+def esc_separators(string):
+    string = string.replace('::', '::-')
+    string = string.replace('__', '__-')
+    return string
+
 def svnversion():
     p = subprocess.Popen("svnversion", shell=True,
       stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -126,6 +131,10 @@
   print >> sys.stderr, "or specify an identifier at runtime with the --id 
option"
   exit(1)
 
+args.category = esc_separators(args.category)
+args.name = esc_separators(args.name)
+args.unit = esc_separators(args.unit)
+
 if(args.unit):
     args.name = args.name + "___" + args.unit
 

Modified: gauger/web/helper.php
===================================================================
--- gauger/web/helper.php       2011-05-27 02:29:10 UTC (rev 15320)
+++ gauger/web/helper.php       2011-05-27 02:41:30 UTC (rev 15321)
@@ -27,6 +27,11 @@
     return str_replace('-SLASH-', '/', $s);
 }
 
+function unesc_separators($s) {
+    $s = str_replace('::-', '::', $s);
+    return str_replace('__-', '__', $s);
+}
+
 function get_counter_name($s) {
     $s = put_slashes($s);
     if(($b = strpos($s, ':::')) !== FALSE)

Modified: gauger/web/io.php
===================================================================
--- gauger/web/io.php   2011-05-27 02:29:10 UTC (rev 15320)
+++ gauger/web/io.php   2011-05-27 02:41:30 UTC (rev 15321)
@@ -501,7 +501,7 @@
     check_permissions($datadir, 'dir');
     $datadir .= '/' . remove_slashes($h);
     check_permissions($datadir, 'dir');
-    $datadir .= '/' . remove_slashes($g);
+    $datadir .= '/' . unesc_separators(remove_slashes($g));
     check_permissions($datadir, 'file');
     check_permissions("$datadir.dat", 'file');
     if(false === ($pos = add_data_to_file($datadir, $rev, $value))) {




reply via email to

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