Merge to 2.4.2

This commit is contained in:
Francis Lachapelle
2022-04-04 18:47:43 -04:00
69 changed files with 2861 additions and 6212 deletions
@@ -1,5 +1,5 @@
/*
Copyright (C) 2007-2014 Inverse inc.
Copyright (C) 2007-2022 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOGo.
@@ -795,7 +795,7 @@ static Class iCalEventK = nil;
if ([title length])
[baseWhere
addObject: [NSString stringWithFormat: @"c_title isCaseInsensitiveLike: '%%%@%%'",
[title asSafeSQLString]]];
[title asSafeSQLLikeString]]];
if (component)
{
@@ -1532,14 +1532,14 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
if ([filters isEqualToString:@"title_Category_Location"] || [filters isEqualToString:@"entireContent"])
{
[baseWhere addObject: [NSString stringWithFormat: @"(c_title isCaseInsensitiveLike: '%%%@%%' OR c_category isCaseInsensitiveLike: '%%%@%%' OR c_location isCaseInsensitiveLike: '%%%@%%')",
[title asSafeSQLString],
[title asSafeSQLString],
[title asSafeSQLString]]];
[title asSafeSQLLikeString],
[title asSafeSQLLikeString],
[title asSafeSQLLikeString]]];
}
}
else
[baseWhere addObject: [NSString stringWithFormat: @"c_title isCaseInsensitiveLike: '%%%@%%'",
[title asSafeSQLString]]];
[title asSafeSQLLikeString]]];
}
/* prepare mandatory fields */
@@ -2065,9 +2065,8 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
//
else if (scheduling && [event userIsAttendee: ownerUser])
{
[self sendIMIPReplyForEvent: event
from: ownerUser
to: [event organizer]];
[self sendResponseToOrganizer: event
from: ownerUser];
}
[self sendReceiptEmailForObject: event
+3 -3
View File
@@ -1,5 +1,5 @@
/*
Copyright (C) 2006-2013 Inverse inc.
Copyright (C) 2006-2022 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOGo.
@@ -178,7 +178,7 @@ static NSArray *folderListingFields = nil;
if ([filter length] > 0)
{
filter = [filter asSafeSQLString];
filter = [filter asSafeSQLLikeString];
if ([criteria isEqualToString: @"name_or_address"])
qs = [NSString stringWithFormat:
@"(c_sn isCaseInsensitiveLike: '%%%@%%') OR "
@@ -281,7 +281,7 @@ static NSArray *folderListingFields = nil;
if (aName && [aName length] > 0)
{
aName = [aName asSafeSQLString];
qs = [NSString stringWithFormat: @"(c_name='%@')", aName];
qs = [NSString stringWithFormat: @"(c_name = '%@')", aName];
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
dbRecords = [[self ocsFolder] fetchFields: folderListingFields
matchingQualifier: qualifier];
+1 -1
View File
@@ -48,7 +48,7 @@
@class NGImap4Envelope;
@class NGImap4EnvelopeAddress;
NSArray *SOGoMailCoreInfoKeys;
extern NSArray *SOGoMailCoreInfoKeys;
@interface SOGoMailObject : SOGoMailBaseObject
{
+2 -1
View File
@@ -1,6 +1,6 @@
/* NSString+Utilities.h - this file is part of SOGo
*
* Copyright (C) 2006-2015 Inverse inc.
* Copyright (C) 2006-2022 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,6 +51,7 @@
/* SQL safety */
- (NSString *) asSafeSQLString;
- (NSString *) asSafeSQLLikeString;
/* Unicode safety */
- (NSString *) safeString;
+8 -4
View File
@@ -1,6 +1,6 @@
/* NSString+Utilities.m - this file is part of SOGo
*
* Copyright (C) 2006-2015 Inverse inc.
* Copyright (C) 2006-2022 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -688,9 +688,13 @@ static int cssEscapingCount;
- (NSString *) asSafeSQLString
{
return [[[self stringByReplacingString: @"\\" withString: @"\\\\"]
stringByReplacingString: @"'" withString: @"\\'"]
stringByReplacingString: @"\%" withString: @"\\%"];
return [[self stringByReplacingString: @"\\" withString: @"\\\\"]
stringByReplacingString: @"'" withString: @"\\'"];
}
- (NSString *) asSafeSQLLikeString
{
return [[self asSafeSQLString] stringByReplacingString: @"\%" withString: @"\\%"];
}
- (NSUInteger) countOccurrencesOfString: (NSString *) substring
+26 -39
View File
@@ -1,7 +1,7 @@
/* SOGoGCSFolder.m - this file is part of SOGo
*
* Copyright (C) 2004-2005 SKYRIX Software AG
* Copyright (C) 2006-2014 Inverse inc.
* Copyright (C) 2006-2022 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1369,42 +1369,19 @@ static NSArray *childRecordFields = nil;
withToken: (int) syncToken
andBaseURL: (NSString *) baseURL
{
static NSString *status[] = { @"HTTP/1.1 404 Not Found",
@"HTTP/1.1 201 Created",
@"HTTP/1.1 200 OK" };
NSMutableArray *children;
NSString *href;
unsigned int statusIndex;
children = [NSMutableArray arrayWithCapacity: 3];
href = [NSString stringWithFormat: @"%@%@",
baseURL, [record objectForKey: @"c_name"]];
[children addObject: davElementWithContent (@"href", XMLNS_WEBDAV,
href)];
if (syncToken)
{
if ([[record objectForKey: @"c_deleted"] intValue] > 0)
statusIndex = 0;
else
{
if ([[record objectForKey: @"c_creationdate"] intValue]
>= syncToken)
statusIndex = 1;
else
statusIndex = 2;
}
}
else
statusIndex = 1;
href = [NSString stringWithFormat: @"%@%@", baseURL, [record objectForKey: @"c_name"]];
[children addObject: davElementWithContent (@"href", XMLNS_WEBDAV, href)];
// NSLog (@"webdav sync: %@ (%@)", href, status[statusIndex]);
[children addObject: davElementWithContent (@"status", XMLNS_WEBDAV,
status[statusIndex])];
if (statusIndex)
[children
addObjectsFromArray: [self _davPropstatsWithProperties: properties
andMethodSelectors: selectors
fromRecord: record]];
if ([[record objectForKey: @"c_deleted"] intValue] > 0)
[children addObject: davElementWithContent (@"status", XMLNS_WEBDAV, @"HTTP/1.1 404 Not Found")];
else
[children addObjectsFromArray: [self _davPropstatsWithProperties: properties
andMethodSelectors: selectors
fromRecord: record]];
return davElementWithContent (@"response", XMLNS_WEBDAV, children);
}
@@ -1513,6 +1490,10 @@ static NSArray *childRecordFields = nil;
return valid;
}
/**
DAV:sync-collection Report
https://datatracker.ietf.org/doc/html/rfc6578#section-3.2
*/
- (WOResponse *) davSyncCollection: (WOContext *) localContext
{
WOResponse *r;
@@ -1948,8 +1929,8 @@ static NSArray *childRecordFields = nil;
if (sqlFilter)
{
filterString = [NSMutableString stringWithCapacity: 8192];
[filterString appendFormat: @"(c_name='%@')",
[cNames componentsJoinedByString: @"' OR c_name='"]];
[filterString appendFormat: @"(c_name = '%@')",
[cNames componentsJoinedByString: @"' OR c_name = '"]];
if ([sqlFilter length] > 0)
[filterString appendFormat: @" AND (%@)", sqlFilter];
qualifier = [EOQualifier qualifierWithQualifierFormat: filterString];
@@ -1989,10 +1970,9 @@ static NSArray *childRecordFields = nil;
components = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
currentName = [cNames objectAtIndex: count];
currentName = [[cNames objectAtIndex: count] asSafeSQLString];
queryNameLength = idQueryOverhead + [currentName length];
if ((currentSize + queryNameLength)
> maxQuerySize)
if ((currentSize + queryNameLength) > maxQuerySize)
{
records = [self _fetchComponentsWithNames: currentNames fields: fields];
[components addObjectsFromArray: records];
@@ -2003,8 +1983,11 @@ static NSArray *childRecordFields = nil;
currentSize += queryNameLength;
}
records = [self _fetchComponentsWithNames: currentNames fields: fields];
[components addObjectsFromArray: records];
if ([currentNames count])
{
records = [self _fetchComponentsWithNames: currentNames fields: fields];
[components addObjectsFromArray: records];
}
// NSLog (@"/fetching components matching names");
@@ -2304,6 +2287,10 @@ static NSArray *childRecordFields = nil;
NSZoneFree (NULL, propertiesArray);
}
/**
CALDAV:calendar-multiget REPORT
https://datatracker.ietf.org/doc/html/rfc4791#section-7.9
*/
- (WOResponse *) performMultigetInContext: (WOContext *) queryContext
inNamespace: (NSString *) namespace
{
+9 -2
View File
@@ -1,6 +1,6 @@
/* SOGoWebAuthenticator.m - this file is part of SOGo
*
* Copyright (C) 2007-2014 Inverse inc.
* Copyright (C) 2007-2022 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -390,6 +390,7 @@
{
WOCookie *authCookie;
NSString *cookieValue, *cookieString, *appName, *sessionKey, *userKey, *securedPassword;
BOOL isSecure;
//
// We create a new cookie - thus we create a new session
@@ -416,8 +417,14 @@
userKey, sessionKey];
cookieValue = [NSString stringWithFormat: @"basic %@",
[cookieString stringByEncodingBase64]];
isSecure = [[[context serverURL] scheme] isEqualToString: @"https"];
authCookie = [WOCookie cookieWithName: [self cookieNameInContext: context]
value: cookieValue];
value: cookieValue
path: nil
domain: nil
expires: nil
isSecure: isSecure
httpOnly: YES];
appName = [[context request] applicationName];
[authCookie setPath: [NSString stringWithFormat: @"/%@/", appName]];
+1 -1
View File
@@ -776,7 +776,7 @@
if (channel)
{
lowerFilter = [filter lowercaseString];
lowerFilter = [lowerFilter stringByReplacingString: @"'" withString: @"''"];
lowerFilter = [lowerFilter asSafeSQLLikeString];
sql = [NSMutableString stringWithFormat: (@"SELECT *"
@" FROM %@"