summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-09 11:07:29 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-09 11:07:29 +0000
commited184bd1510c4cff6a53a7a5bfafaac48eece9e0 (patch)
tree7087917684d9ae7f89e664534dd18c796bdd9472 /src
parenteb0f039d0f66dc2fc920ed49cf0539ca186f6fe2 (diff)
Added security function that removes paths from filenames
Stripped paths from filenames in /rehash and /modules git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@464 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/InspIRCd.layout30
-rw-r--r--src/inspircd.cpp7
-rw-r--r--src/inspircd_util.cpp15
3 files changed, 34 insertions, 18 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 6a8683441..f4a7b0528 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -1,6 +1,6 @@
[Editors]
-Focused=6
-Order=1,2,-1,4,6
+Focused=1
+Order=1,2,-1,4,6,3
[Editor_0]
Open=0
@@ -12,10 +12,10 @@ LeftChar=1
[Editor_1]
Open=1
-Top=0
-CursorCol=24
-CursorRow=1459
-TopLine=1431
+Top=1
+CursorCol=83
+CursorRow=4049
+TopLine=4018
LeftChar=1
[Editor_2]
@@ -27,11 +27,11 @@ TopLine=270
LeftChar=1
[Editor_3]
-Open=0
+Open=1
Top=0
CursorCol=1
-CursorRow=1
-TopLine=1
+CursorRow=69
+TopLine=21
LeftChar=1
[Editor_4]
@@ -52,9 +52,9 @@ LeftChar=1
[Editor_6]
Open=1
-Top=1
-CursorCol=2
-CursorRow=92
+Top=0
+CursorCol=10
+CursorRow=26
TopLine=37
LeftChar=1
@@ -155,10 +155,10 @@ TopLine=1
LeftChar=1
[Editor_19]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=1
+CursorCol=39
+CursorRow=7
TopLine=1
LeftChar=1
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 81dee527e..0b348f529 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -4046,7 +4046,7 @@ void handle_rehash(char **parameters, int pcnt, userrec *user)
WriteServ(user->fd,"382 %s %s :Rehashing",user->nick,CONFIG_FILE);
ReadConfig();
FOREACH_MOD OnRehash();
- WriteOpers("%s is rehashing config file %s",user->nick,CONFIG_FILE);
+ WriteOpers("%s is rehashing config file %s",user->nick,CleanFilename(CONFIG_FILE));
}
@@ -4055,6 +4055,7 @@ int usercnt(void)
return clientlist.size();
}
+
int usercount_invisible(void)
{
int c = 0;
@@ -4344,7 +4345,9 @@ void handle_modules(char **parameters, int pcnt, userrec *user)
for (int i = 0; i < module_names.size(); i++)
{
Version V = modules[i]->GetVersion();
- WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,module_names[i].c_str());
+ char modulename[MAXBUF];
+ strncpy(modulename,module_names[i].c_str(),256);
+ WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename));
}
}
diff --git a/src/inspircd_util.cpp b/src/inspircd_util.cpp
index 0a3d966d3..29011eb9a 100644
--- a/src/inspircd_util.cpp
+++ b/src/inspircd_util.cpp
@@ -66,5 +66,18 @@ char *CleanIpAddr (char *cleanAddr, const char *dirtyAddr)
return (cleanAddr);
}
-
+char* CleanFilename(char* name)
+{
+ char* p = name + strlen(name);
+ while ((p != name) && (*p != '/'))
+ p--;
+ if ( p != name)
+ {
+ return ++p;
+ }
+ else
+ {
+ return p;
+ }
+}