@@ -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]];