Various tweaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@21421 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-07-07 21:11:04 +00:00
parent 9f7710abc7
commit 2d123b3b54
5 changed files with 62 additions and 24 deletions

View file

@ -1,3 +1,12 @@
2005-07-07 Richard Frith-Macdonald <rfm@gnu.org>
* MySQL.m:
* SQLClient.m:
* WebServer.h:
* WebServer.m:
Tweaks to keep gcc-4 happy (signedness issues) and add support for
using separate ssl conmfig for different IP addresses.
2005-06-21 Richard Frith-Macdonald <rfm@gnu.org> 2005-06-21 Richard Frith-Macdonald <rfm@gnu.org>
* SQLClient.m: Expand tilde in paths searched for backend bundles. * SQLClient.m: Expand tilde in paths searched for backend bundles.

View file

@ -305,7 +305,7 @@ static unsigned int trim(char *str)
for (i = 0; i < fieldCount; i++) for (i = 0; i < fieldCount; i++)
{ {
keys[i] = [NSString stringWithUTF8String: fields[i].name]; keys[i] = [NSString stringWithUTF8String: (char*)fields[i].name];
} }
records = [[NSMutableArray alloc] initWithCapacity: recordCount]; records = [[NSMutableArray alloc] initWithCapacity: recordCount];
@ -320,7 +320,7 @@ static unsigned int trim(char *str)
for (j = 0; j < fieldCount; j++) for (j = 0; j < fieldCount; j++)
{ {
id v = null; id v = null;
unsigned char *p = row[j]; unsigned char *p = (unsigned char*)row[j];
if (p != 0) if (p != 0)
{ {
@ -405,8 +405,8 @@ static unsigned int trim(char *str)
break; break;
default: default:
trim(p); trim((char*)p);
v = [NSString stringWithUTF8String: p]; v = [NSString stringWithUTF8String: (char*)p];
break; break;
} }
} }

View file

@ -634,12 +634,13 @@ static unsigned int maxConnections = 8;
name: (NSString*)reference name: (NSString*)reference
{ {
NSNotification *n; NSNotification *n;
id conf = config; NSDictionary *conf = config;
id existing; id existing;
if (conf == nil) if (conf == nil)
{ {
conf = [NSUserDefaults standardUserDefaults]; // Pretend the defaults object is a dictionary.
conf = (NSDictionary*)[NSUserDefaults standardUserDefaults];
} }
if ([reference isKindOfClass: NSStringClass] == NO) if ([reference isKindOfClass: NSStringClass] == NO)
@ -1239,7 +1240,7 @@ static void quoteString(NSMutableString *s)
*/ */
- (void) _configure: (NSNotification*)n - (void) _configure: (NSNotification*)n
{ {
id o = [n object]; NSDictionary *o = [n object];
NSDictionary *d; NSDictionary *d;
NSString *s; NSString *s;
Class c; Class c;
@ -1292,7 +1293,7 @@ static void quoteString(NSMutableString *s)
/* Try alternative version with more libraries linked in. /* Try alternative version with more libraries linked in.
* In some systems and situations the dynamic linker needs * In some systems and situations the dynamic linker needs
* to haved the SQLClient, gnustep-base, and objc libraries * to haved the SQLClient, gnustep-base, and objc libraries
* explicityly linked into the bundle, but in others it * explicitly linked into the bundle, but in others it
* requires them to not be linked. To handle that, we create * requires them to not be linked. To handle that, we create
* two versions of each bundle, the seond version has _libs * two versions of each bundle, the seond version has _libs
* appended to the bundle name, and has the extra libraries linked. * appended to the bundle name, and has the extra libraries linked.
@ -1456,7 +1457,7 @@ static void quoteString(NSMutableString *s)
NSRange s; NSRange s;
NSString *v; NSString *v;
NSString *alt; NSString *alt;
id o; id o;
unsigned i; unsigned i;
r.length = l - pos; r.length = l - pos;
@ -1527,7 +1528,7 @@ static void quoteString(NSMutableString *s)
if ([k length] > 0) if ([k length] > 0)
{ {
o = [o objectForKey: k]; o = [(NSDictionary*)o objectForKey: k];
} }
} }
if (o == vals) if (o == vals)
@ -1538,7 +1539,7 @@ static void quoteString(NSMutableString *s)
{ {
if ([o isKindOfClass: NSStringClass] == YES) if ([o isKindOfClass: NSStringClass] == YES)
{ {
v = o; v = (NSString*)o;
} }
else else
{ {
@ -1688,9 +1689,9 @@ static void quoteString(NSMutableString *s)
{ {
return [query hash]; return [query hash];
} }
- (BOOL) isEqual: (SQLClientCacheInfo*)other - (BOOL) isEqual: (id)other
{ {
return [query isEqual: other->query]; return [query isEqual: ((SQLClientCacheInfo*)other)->query];
} }
@end @end

View file

@ -419,6 +419,11 @@
* <code>KeyFile</code> and <code>Password</code> then the server will * <code>KeyFile</code> and <code>Password</code> then the server will
* use the specified certificate and key files (which it will access * use the specified certificate and key files (which it will access
* using the password).<br /> * using the password).<br />
* The <em>secure</em> dictionary may also contain other dictionaries
* keyed on IP addresses, and if the address that an incoming connection
* arrived on matches the key of a dictionary, that dictionary is used
* to provide the certificate information, with the top-level values
* being used as a fallback.<br />
* This method returns YES on success, NO on failure ... if it returns NO * This method returns YES on success, NO on failure ... if it returns NO
* then the receiver will <em>not</em> be capable of handling incoming * then the receiver will <em>not</em> be capable of handling incoming
* web requests!<br /> * web requests!<br />

View file

@ -211,7 +211,9 @@
password = [[request headerNamed: @"x-http-password"] value]; password = [[request headerNamed: @"x-http-password"] value];
if ([access objectForKey: @"Users"] != nil) if ([access objectForKey: @"Users"] != nil)
{ {
stored = [[access objectForKey: @"Users"] objectForKey: username]; NSDictionary *users = [access objectForKey: @"Users"];
stored = [users objectForKey: username];
} }
else if ([access objectForKey: @"UserDB"] != nil) else if ([access objectForKey: @"UserDB"] != nil)
{ {
@ -246,7 +248,7 @@
if (sql == nil) if (sql == nil)
{ {
sql = [c alloc]; sql = [c alloc];
sql = [c initWithConfiguration: nil name: name]; sql = [sql initWithConfiguration: nil name: name];
} }
stored = [sql queryString: @"SELECT ", stored = [sql queryString: @"SELECT ",
[info objectForKey: @"Password"], [info objectForKey: @"Password"],
@ -1160,9 +1162,30 @@ escapeData(const unsigned char* bytes, unsigned length, NSMutableData *d)
{ {
if (_sslConfig != nil) if (_sslConfig != nil)
{ {
[hdl sslSetCertificate: [_sslConfig objectForKey: @"CertificateFile"] NSString *address = [hdl socketLocalAddress];
privateKey: [_sslConfig objectForKey: @"KeyFile"] NSDictionary *primary = [_sslConfig objectForKey: address];
PEMpasswd: [_sslConfig objectForKey: @"Password"]]; NSString *certificateFile;
NSString *keyFile;
NSString *password;
certificateFile = [primary objectForKey: @"CertificateFile"];
if (certificateFile == nil)
{
certificateFile = [_sslConfig objectForKey: @"CertificateFile"];
}
keyFile = [primary objectForKey: @"KeyFile"];
if (keyFile == nil)
{
keyFile = [_sslConfig objectForKey: @"KeyFile"];
}
password = [primary objectForKey: @"Password"];
if (password == nil)
{
password = [_sslConfig objectForKey: @"Password"];
}
[hdl sslSetCertificate: certificateFile
privateKey: keyFile
PEMpasswd: password];
} }
if ((h = [NSHost hostWithAddress: a]) == nil) if ((h = [NSHost hostWithAddress: a]) == nil)
@ -1363,10 +1386,10 @@ escapeData(const unsigned char* bytes, unsigned length, NSMutableData *d)
{ {
bytes[back] = '\0'; bytes[back] = '\0';
end = back + 1; end = back + 1;
if (strncmp(bytes + end, "HTTP/", 5) == 0) if (strncmp((char*)bytes + end, "HTTP/", 5) == 0)
{ {
end += 5; end += 5;
version = [NSString stringWithUTF8String: bytes + end]; version = [NSString stringWithUTF8String: (char*)bytes + end];
} }
} }
if ([version floatValue] < 1.1) if ([version floatValue] < 1.1)
@ -1396,7 +1419,7 @@ escapeData(const unsigned char* bytes, unsigned length, NSMutableData *d)
end++; end++;
} }
bytes[end++] = '\0'; bytes[end++] = '\0';
method = [NSString stringWithUTF8String: bytes + start]; method = [NSString stringWithUTF8String: (char*)bytes + start];
/* /*
* Extract path string. * Extract path string.
@ -1417,14 +1440,14 @@ escapeData(const unsigned char* bytes, unsigned length, NSMutableData *d)
* Extract query string. * Extract query string.
*/ */
bytes[end++] = '\0'; bytes[end++] = '\0';
query = [NSString stringWithUTF8String: bytes + end]; query = [NSString stringWithUTF8String: (char*)bytes + end];
} }
else else
{ {
bytes[end] = '\0'; bytes[end] = '\0';
} }
path = [NSString stringWithUTF8String: bytes + start]; path = [NSString stringWithUTF8String: (char*)bytes + start];
if ([method isEqualToString: @"GET"] == NO if ([method isEqualToString: @"GET"] == NO
&& [method isEqualToString: @"POST"] == NO) && [method isEqualToString: @"POST"] == NO)
@ -1673,7 +1696,7 @@ escapeData(const unsigned char* bytes, unsigned length, NSMutableData *d)
for (pos = 4; pos < len; pos++) for (pos = 4; pos < len; pos++)
{ {
if (strncmp(&buf[pos-4], "\r\n\r\n", 4) == 0) if (strncmp((char*)&buf[pos-4], "\r\n\r\n", 4) == 0)
{ {
break; break;
} }