+2007-07-23 Helge Hess <helge.hess@opengroupware.org>
+
+ * changed API to use NSTimeInterval, added missing getter methods
+ (v4.7.31)
+
+2007-07-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * added methods to specify query time and size limits (OGo bug #1888)
+
2006-07-04 Helge Hess <helge.hess@opengroupware.org>
* use %p for pointer formats, fixed gcc 4.1 warnings, minor code
/*
- Copyright (C) 2000-2005 SKYRIX Software AG
+ Copyright (C) 2000-2007 SKYRIX Software AG
This file is part of SOPE.
void *handle;
NSString *hostName;
int port;
-
+ unsigned int sizeLimit;
+ NSTimeInterval timeLimit;
NSTimeInterval cacheTimeout;
long cacheMaxMemory; /* in bytes */
BOOL isCacheEnabled;
- (BOOL)bindWithMethod:(NSString *)_method
binddn:(NSString *)_login credentials:(NSString *)_cred;
+/* query parameters */
+
+- (void)setQueryTimeLimit:(NSTimeInterval)_timeLimit;
+- (NSTimeInterval)queryTimeLimit;
+
+- (void)setQuerySizeLimit:(unsigned int)_timeLimit;
+- (unsigned int )querySizeLimit;
+
/* running queries */
- (NSEnumerator *)flatSearchAtBaseDN:(NSString *)_base
/*
- Copyright (C) 2000-2005 SKYRIX Software AG
+ Copyright (C) 2000-2007 SKYRIX Software AG
This file is part of SOPE.
[self setCacheTimeout:120.0];
[self setCacheMaxMemoryUsage:16000];
-
+ [self setQueryTimeLimit:0.0];
+ [self setQuerySizeLimit:0];
+
return self;
}
- (id)initWithHostName:(NSString *)_hostName {
/* running queries */
+- (void)setQueryTimeLimit:(NSTimeInterval)_timeLimit {
+ self->timeLimit = _timeLimit;
+}
+- (NSTimeInterval)queryTimeLimit {
+ return self->timeLimit;
+}
+
+- (void)setQuerySizeLimit:(unsigned int)_sizeLimit {
+ self->sizeLimit = _sizeLimit;
+}
+- (unsigned int)querySizeLimit {
+ return self->sizeLimit;
+}
+
- (NSEnumerator *)_searchAtBaseDN:(NSString *)_base
qualifier:(EOQualifier *)_q
attributes:(NSArray *)_attributes
__PRETTY_FUNCTION__, [_base cString], [filter cString],
[[_attributes description] cString]);
}
+
+ /* apply limits */
+
+ if (self->sizeLimit > 0)
+ ldap_set_option(self->handle, LDAP_OPT_SIZELIMIT, &(self->sizeLimit));
+
+ if (self->timeLimit > 0.0) {
+ int tl = self->timeLimit; /* specified in seconds */
+ ldap_set_option(self->handle, LDAP_OPT_TIMELIMIT, &tl);
+ }
+
+ /* trigger search */
msgid = ldap_search(self->handle,
(char *)[_base UTF8String],
/* trouble */
return nil;
}
-
+
e = [[NGLdapSearchResultEnumerator alloc]
initWithConnection:self messageID:msgid];