From 5b1c019340de13d9fece367ec5481ef52b06328a Mon Sep 17 00:00:00 2001 From: znek Date: Wed, 25 Jan 2006 19:18:47 +0000 Subject: [PATCH] stop path traversal as soon as an exception was encountered git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1205 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 3 +++ .../NGObjWeb/SoObjects/SoObject+Traversal.m | 15 ++++++++++++--- sope-appserver/NGObjWeb/Version | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index adfb7394..43e69e98 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,5 +1,8 @@ 2006-01-25 Marcus Mueller + * SoObjects/SoObject+Traversal.m: stop traversal immediately if an + exception was returned (v4.5.218) + * SoObjects/SoObject+Traversal.m: minor code cleanups (v4.5.217) 2005-11-21 Helge Hess diff --git a/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m b/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m index c695ca12..da91676d 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m +++ b/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m @@ -165,13 +165,18 @@ static BOOL _isDebugOn(void) { // which doesn't check permissions. // Note: You can also use SoSubContext to accomplish that, but this is not // very convenient. - register BOOL doDebug = _isDebugOn(); + register BOOL doDebug = _isDebugOn(); + static Class NSExceptionClass = Nil; WORequest *rq; BOOL isCreateIfMissingMethod = NO; BOOL isCreateMethod = NO; unsigned i, count; id root, currentObject, clientObject; - + + if (NSExceptionClass == Nil) { + NSExceptionClass = [NSException class]; + } + if (doDebug) { [self logWithFormat:@"traverse%s: %@", _acquire ? "(acquire)" : "", @@ -311,7 +316,11 @@ static BOOL _isDebugOn(void) { @"is not callable: %@", currentObject]; } - + + /* abort traversal if an exception was returned */ + if ([currentObject isKindOfClass:NSExceptionClass]) + break; + /* found an object */ currentObject = nextObject; [_ctx addObjectToTraversalStack:currentObject]; diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 779d5618..cab29a95 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=217 +SUBMINOR_VERSION:=218 # v4.5.214 requires libNGExtensions v4.5.179 # v4.5.122 requires libNGExtensions v4.5.153 -- 2.39.5