Index: src/XMPPConnection.m ================================================================== --- src/XMPPConnection.m +++ src/XMPPConnection.m @@ -57,11 +57,11 @@ - (void)XMPP_handleMessage: (XMPPMessage*)msg; - (void)XMPP_handlePresence: (XMPPPresence*)pres; @end @implementation XMPPConnection -@synthesize username, password, server, resource, JID, port, useTLS, delegate; +@synthesize JID, port, useTLS, delegate; - init { self = [super init]; @@ -107,10 +107,15 @@ free(node); } [old release]; } + +- (OFString*)username +{ + return [[username copy] autorelease]; +} - (void)setResource: (OFString*)resource_ { OFString *old = resource; char *res; @@ -130,10 +135,15 @@ free(res); } [old release]; } + +- (OFString*)resource +{ + return [[resource copy] autorelease]; +} - (void)setServer: (OFString*)server_ { OFString *old = server; char *srv; @@ -153,10 +163,15 @@ free(srv); } [old release]; } + +- (OFString*)server +{ + return [[server copy] autorelease]; +} - (void)setPassword: (OFString*)password_ { OFString *old = password; char *pass; @@ -175,10 +190,15 @@ free(pass); } [old release]; } + +- (OFString*)password +{ + return [[password copy] autorelease]; +} - (void)connect { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; Index: src/XMPPSCRAMAuth.m ================================================================== --- src/XMPPSCRAMAuth.m +++ src/XMPPSCRAMAuth.m @@ -170,10 +170,13 @@ intmax_t iterCount; OFHash *hash; OFDataArray *ret, *authMessage, *tmpArray, *salt, *saltedPassword; OFString *tmpString, *sNonce; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + enum { + GOT_SNONCE, GOT_SALT, GOT_ITERCOUNT + } got = 0; hash = [[[hashType alloc] init] autorelease]; ret = [OFDataArray dataArrayWithItemSize: 1]; authMessage = [OFDataArray dataArrayWithItemSize: 1]; @@ -191,17 +194,24 @@ newWithClass: isa connection: nil reason: @"Received wrong nonce"]; sNonce = entry; - } else if ([comp hasPrefix: @"s="]) + got |= GOT_SNONCE; + } else if ([comp hasPrefix: @"s="]) { salt = [OFDataArray dataArrayWithBase64EncodedString: entry]; - else if ([comp hasPrefix: @"i="]) + got |= GOT_SALT; + } else if ([comp hasPrefix: @"i="]) { iterCount = [entry decimalValue]; + got |= GOT_ITERCOUNT; + } } + if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT)) + @throw [OFInvalidServerReplyException newWithClass: isa]; + // Add c= // XXX: No channel binding for now tmpArray = [OFDataArray dataArrayWithItemSize: 1]; [tmpArray addNItems: [GS2Header cStringLength] fromCArray: [GS2Header cString]];