summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-12-03 17:51:19 (UTC)
committer Michael Krelin <hacker@klever.net>2006-12-03 17:51:19 (UTC)
commit08868f34ee339540ca392bb19e9c537d6e769464 (patch) (unidiff)
tree8c8e54288f488bd7208f57ddd7f39664be6f3ece
parenta74c677c09774c02d3bc347525fb071f25d25697 (diff)
downloadkonforka-08868f34ee339540ca392bb19e9c537d6e769464.zip
konforka-08868f34ee339540ca392bb19e9c537d6e769464.tar.gz
konforka-08868f34ee339540ca392bb19e9c537d6e769464.tar.bz2
fixed missing include
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/util.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/util.cc b/lib/util.cc
index 74039c6..069590b 100644
--- a/lib/util.cc
+++ b/lib/util.cc
@@ -1,34 +1,35 @@
1#include <sys/types.h> 1#include <sys/types.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <cassert>
3#include <konforka/util.h> 4#include <konforka/util.h>
4 5
5namespace konforka { 6namespace konforka {
6 7
7 /* 8 /*
8 * XXX: this code is borrowed from sitecing as is, although it should be optimized. 9 * XXX: this code is borrowed from sitecing as is, although it should be optimized.
9 */ 10 */
10 11
11 string normalize_path(const string& p,int o) { 12 string normalize_path(const string& p,int o) {
12 const char *s = p.c_str(); 13 const char *s = p.c_str();
13 if( s[0]=='.' && s[1]=='/' ) 14 if( s[0]=='.' && s[1]=='/' )
14 s += 2; // skip leading './' 15 s += 2; // skip leading './'
15 if(o&strip_leading_slash) 16 if(o&strip_leading_slash)
16 for(;(*s)=='/';s++); 17 for(;(*s)=='/';s++);
17 string rv; 18 string rv;
18 string::size_type notslash = 0; 19 string::size_type notslash = 0;
19 for(;*s;s++) { 20 for(;*s;s++) {
20 if(s[0]=='/') { 21 if(s[0]=='/') {
21 if(s[1]=='/') 22 if(s[1]=='/')
22 continue; // skip duplicate slash 23 continue; // skip duplicate slash
23 if(s[1]=='.' && s[2]=='/') { 24 if(s[1]=='.' && s[2]=='/') {
24 // '/./' sequence encountered 25 // '/./' sequence encountered
25 s += 2; 26 s += 2;
26 continue; 27 continue;
27 } 28 }
28 } 29 }
29 if( 30 if(
30 (o&restrict_dotdot) && ( 31 (o&restrict_dotdot) && (
31 ( rv.empty() && s[0]=='.' && s[1]=='.' && s[2]=='/' ) // '^../' 32 ( rv.empty() && s[0]=='.' && s[1]=='.' && s[2]=='/' ) // '^../'
32 || 33 ||
33 ( s[0]=='/' && s[1]=='.' && s[2]=='.' && (s[3]=='/' || s[3]==0) ) // '/../' or '/..$' 34 ( s[0]=='/' && s[1]=='.' && s[2]=='.' && (s[3]=='/' || s[3]==0) ) // '/../' or '/..$'
34 ) 35 )