From 16351af0c4b9d242911dcc70c7a63ef213068453 Mon Sep 17 00:00:00 2001 From: frogcjn Date: Sat, 17 Feb 2024 06:58:41 -0500 Subject: [PATCH 1/4] Update OIDRedirectHTTPHandler.h fix macOS startHTTPListener memory crash if there is an error and return nil URL. --- Source/AppAuth/macOS/OIDRedirectHTTPHandler.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h index 831eb0bb3..1a00b2e41 100644 --- a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h +++ b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN Calling this more than once will result in the previous listener being cancelled (equivalent of @c cancelHTTPListener being called). */ -- (NSURL *)startHTTPListener:(NSError **)returnError withPort:(uint16_t)port; +- (nullable NSURL *)startHTTPListener:(NSError **)returnError withPort:(uint16_t)port; /*! @brief Starts listening on the loopback interface on a random available port, and returns a URL with the base address. Use the returned redirect URI to build a @c OIDExternalUserAgentRequest, @@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN Calling this more than once will result in the previous listener being cancelled (equivalent of @c cancelHTTPListener being called). */ -- (NSURL *)startHTTPListener:(NSError **)returnError; +- (nullable NSURL *)startHTTPListener:(NSError **)returnError; /*! @brief Stops listening the loopback interface and sends an cancellation error (in the domain ::OIDGeneralErrorDomain, with the code ::OIDErrorCodeProgramCanceledAuthorizationFlow) to From 69ec465f45391834c098c41a91741a2a2890b5d6 Mon Sep 17 00:00:00 2001 From: frogcjn Date: Sat, 17 Feb 2024 13:36:23 -0500 Subject: [PATCH 2/4] Update OIDRedirectHTTPHandler.h fix startHTTPListener with port --- Source/AppAuth/macOS/OIDRedirectHTTPHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h index 1a00b2e41..d1193ccc6 100644 --- a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h +++ b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN Calling this more than once will result in the previous listener being cancelled (equivalent of @c cancelHTTPListener being called). */ -- (nullable NSURL *)startHTTPListener:(NSError **)returnError withPort:(uint16_t)port; +- (nullable NSURL *)startHTTPListenerPort:(uint16_t)port error:(NSError **)returnError NS_SWIFT_NAME(startHTTPListener(port:)); /*! @brief Starts listening on the loopback interface on a random available port, and returns a URL with the base address. Use the returned redirect URI to build a @c OIDExternalUserAgentRequest, From c87cda46d437619393d8e7cd142ed9fbc509901b Mon Sep 17 00:00:00 2001 From: frogcjn Date: Sat, 17 Feb 2024 13:37:56 -0500 Subject: [PATCH 3/4] Update OIDRedirectHTTPHandler.m --- Source/AppAuth/macOS/OIDRedirectHTTPHandler.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m index 3d0d765d8..e25f236b4 100644 --- a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m +++ b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.m @@ -68,7 +68,7 @@ - (instancetype)initWithSuccessURL:(nullable NSURL *)successURL { return self; } -- (NSURL *)startHTTPListener:(NSError **)returnError withPort:(uint16_t)port { +- (NSURL *)startHTTPListenerWithPort:(uint16_t)port error:(NSError **)returnError { // Cancels any pending requests. [self cancelHTTPListener]; @@ -98,7 +98,7 @@ - (NSURL *)startHTTPListener:(NSError **)returnError withPort:(uint16_t)port { - (NSURL *)startHTTPListener:(NSError **)returnError { // A port of 0 requests a random available port - return [self startHTTPListener:returnError withPort:0]; + return [self startHTTPListenerWithPort:0 error:returnError]; } - (void)cancelHTTPListener { From 204dca44dec3be407fa3fa1a5d483b55b4d7c4e2 Mon Sep 17 00:00:00 2001 From: frogcjn Date: Sat, 17 Feb 2024 13:38:24 -0500 Subject: [PATCH 4/4] Update OIDRedirectHTTPHandler.h --- Source/AppAuth/macOS/OIDRedirectHTTPHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h index d1193ccc6..db750ca0c 100644 --- a/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h +++ b/Source/AppAuth/macOS/OIDRedirectHTTPHandler.h @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN Calling this more than once will result in the previous listener being cancelled (equivalent of @c cancelHTTPListener being called). */ -- (nullable NSURL *)startHTTPListenerPort:(uint16_t)port error:(NSError **)returnError NS_SWIFT_NAME(startHTTPListener(port:)); +- (nullable NSURL *)startHTTPListenerWithPort:(uint16_t)port error:(NSError **)returnError NS_SWIFT_NAME(startHTTPListener(port:)); /*! @brief Starts listening on the loopback interface on a random available port, and returns a URL with the base address. Use the returned redirect URI to build a @c OIDExternalUserAgentRequest,