From 25ce105aab1b3b3c2ba6f7234c0cdb3d384b9545 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 7 May 2007 12:08:31 +0000 Subject: [PATCH] improved nil handling in session extra vars git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1477 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 5 +++++ .../NGObjWeb/SoObjects/SoHTTPAuthenticator.m | 2 +- sope-appserver/NGObjWeb/Version | 2 +- sope-appserver/NGObjWeb/WOSession.m | 20 ++++++++++++++++--- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index ee373379..706496b7 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,8 @@ +2007-05-07 Helge Hess + + * WOSession.m: do not attempt to process 'nil' keys when working on + extra variables (lead to NSDictionary exceptions) (v4.7.8) + 2007-05-08 Helge Hess * WOApplication.m: properly call +_setupSNS method diff --git a/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.m b/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.m index 4e53c3a9..d29066b7 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.m +++ b/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.m @@ -108,7 +108,7 @@ rng = [login rangeOfString:@"\\"]; if (rng.length > 0) { - [self debugWithFormat:@"splitting of domain in login: '%@'", login]; + [self debugWithFormat:@"splitting off domain in login: '%@'", login]; login = [login substringFromIndex:(rng.location + rng.length)]; } return [NSArray arrayWithObjects:login, pwd, nil]; diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 42cb725a..78e42d46 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=7 +SUBMINOR_VERSION:=8 # v4.5.234 requires libDOM v4.5.21 # v4.5.214 requires libNGExtensions v4.5.179 diff --git a/sope-appserver/NGObjWeb/WOSession.m b/sope-appserver/NGObjWeb/WOSession.m index 692c228c..72e557d6 100644 --- a/sope-appserver/NGObjWeb/WOSession.m +++ b/sope-appserver/NGObjWeb/WOSession.m @@ -1,5 +1,6 @@ /* - Copyright (C) 2000-2005 SKYRIX Software AG + Copyright (C) 2000-2007 SKYRIX Software AG + Copyright (C) 2007 Helge Hess This file is part of SOPE. @@ -587,19 +588,32 @@ static Class NSDateClass = Nil; /* session variables */ - (void)setObject:(id)_obj forKey:(NSString *)_key { + if (_key == nil) { + [self warnWithFormat:@"%s: got no key for extra variable.", + __PRETTY_FUNCTION__]; + return; + } + if (self->wosVariables == nil) self->wosVariables = [[NSMutableDictionary alloc] initWithCapacity:16]; - if (_obj) + if (_obj != nil) [self->wosVariables setObject:_obj forKey:_key]; else [self->wosVariables removeObjectForKey:_key]; } + - (id)objectForKey:(NSString *)_key { - return [self->wosVariables objectForKey:_key]; + return _key != nil ? [self->wosVariables objectForKey:_key] : nil; } - (void)removeObjectForKey:(NSString *)_key { + if (_key == nil) { + [self warnWithFormat:@"%s: got no key of extra variable to be removed.", + __PRETTY_FUNCTION__]; + return; + } + [self->wosVariables removeObjectForKey:_key]; } -- 2.39.5