• Bug#1109884: marked as done (unblock: sogo/5.12.1-3) (2/2)

    From Debian Bug Tracking System@21:1/5 to All on Fri Jul 25 22:10:02 2025
    [continued from previous message]

    ++ header = [NSString stringWithFormat: @"%@: %@", key, [headers objectForKey: key]];
    ++ headerlist = curl_slist_append(headerlist, [header UTF8String]);
    ++ }
    ++ }
    ++ if(headerlist != NULL)
    ++ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
    ++
    ++
    ++ curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60L);
    ++ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
    ++ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
    ++
    ++ buffer = [NSMutableData data];
    ++ buffHeaders = [NSMutableData data];
    ++ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_body_function);
    ++ curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
    ++ curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curl_body_function);
    ++ curl_easy_setopt(curl, CURLOPT_HEADERDATA, buffHeaders);
    ++ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error);
    ++
    ++ // Perform SOAP request
    ++ rc = curl_easy_perform(curl);
    ++ if (rc == CURLE_OK)
    + {
    +- [self errorWithFormat: @"OpenID endpoint not found (404): %@", endpoint];
    +- return nil;
    ++ curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
    ++
    ++ response = [SimpleOpenIdResponse alloc];
    ++ headerResp = [[NSString alloc] initWithData: buffHeaders
    ++ encoding: NSUTF8StringEncoding];
    ++
    ++ response = [response initWithResponse: nil andHeaders: headerResp andStatus: status];
    ++
    ++ if(status >= 200 && status <500 && status != 404)
    ++ {
    ++ content = [[NSString alloc] initWithData: buffer
    ++ encoding: NSUTF8StringEncoding];
    ++ if (!content)
    ++ content = [[NSString alloc] initWithData: buffer
    ++ encoding: NSISOLatin1StringEncoding];
    ++ [response setContent: content];
    ++
    ++ if(SOGoOpenIDDebugEnabled)
    ++ NSLog(@"OpenId perform request: response is: %@", response);
    ++
    ++ return [response autorelease];
    ++ }
    ++ else if (status == 404)
    ++ {
    ++ [self errorWithFormat: @"OpenID endpoint not found (404): %@", endpoint];
    ++ return nil;
    ++ }
    ++ else
    ++ {
    ++ [self errorWithFormat: @"OpenID server internal error during %@: %@", endpoint, response];
    ++ return nil;
    ++ }
    + }
    + else
    + {
    +- [self errorWithFormat: @"OpenID server internal error during %@: %@", endpoint, response];
    +- return nil;
    ++ [self errorWithFormat: @"CURL error while accessing %@ (%d): %@", endpoint, rc,
    ++ [NSString stringWithCString: strlen(error) ? error : curl_easy_strerror(rc)]];
    + }
    ++ curl_easy_cleanup (curl);
    + }
    + else
    + {
    +- [self errorWithFormat: @"OpenID can't handle endpoint (not a url): '%@'", endpoint];
    +- return nil;
    ++ [self errorWithFormat: @"OpenID error when setting curl request for: %@", endpoint];
    ++ return nil;
    + }
    + }
    +
    + - (NSMutableDictionary *) fecthConfiguration: (NSString*) _domain
    + {
    + NSString *content;
    +- WOResponse * response;
    ++ SimpleOpenIdResponse *response;
    ++ // WOResponse * response;
    + NSUInteger status;
    + NSMutableDictionary *result;
    + NSDictionary *config, *headers;
    +@@ -498,7 +666,8 @@ static BOOL SOGoOpenIDDebugEnabled = YES;
    + - (NSMutableDictionary *) fetchToken: (NSString * ) code redirect: (NSString *) oldLocation
    + {
    + NSString *location, *form, *content;
    +- WOResponse *response;
    ++ SimpleOpenIdResponse *response;
    ++ // WOResponse *response;
    + NSUInteger status;
    + NSMutableDictionary *result;
    + NSDictionary *headers;
    +@@ -523,7 +692,10 @@ static BOOL SOGoOpenIDDebugEnabled = YES;
    + self->forDomain, @"sogo-user-domain", nil];
    + else
    + headers = [NSDictionary dictionaryWithObject: @"application/x-www-form-urlencoded" forKey: @"content-type"];
    +-
    ++
    ++ if(SOGoOpenIDDebugEnabled)
    ++ NSLog(@"OpenId fetch token, form %@", form);
    ++
    + response = [self _performOpenIdRequest: location
    + method: @"POST"
    + headers: headers
    +@@ -566,7 +738,8 @@ static BOOL SOGoOpenIDDebugEnabled = YES;
    + - (NSMutableDictionary *) refreshToken: (NSString * ) userRefreshToken
    + {
    + NSString *location, *form, *content;
    +- WOResponse *response;
    ++ SimpleOpenIdResponse *response;
    ++ // WOResponse *response;
    + NSUInteger status;
    + NSMutableDictionary *result;
    + NSDictionary *headers;
    +@@ -639,7 +812,8 @@ static BOOL SOGoOpenIDDebugEnabled = YES;
    + - (NSMutableDictionary *) fetchUserInfo
    + {
    + NSString *location, *auth, *content;
    +- WOResponse *response;
    ++ SimpleOpenIdResponse *response;
    ++ // WOResponse *response;
    + NSUInteger status;
    + NSMutableDictionary *result;
    + NSDictionary *profile, *headers;
    +@@ -695,7 +869,7 @@ static BOOL SOGoOpenIDDebugEnabled = YES;
    + }
    + else
    + {
    +- [self logWithFormat: @"Error during fetching the token (status %d), response: %@", status, response];
    ++ [self logWithFormat: @"Error fetching userInfo (status %d), response: %@", status, response];
    + [result setObject: @"http-error" forKey: @"error"];
    + }
    + }
    +diff --git a/SoObjects/SOGo/SOGoSystemDefaults.h b/SoObjects/SOGo/SOGoSystemDefaults.h
    +index 3dce05cf6..fc5729ee3 100644
    +--- a/SoObjects/SOGo/SOGoSystemDefaults.h
    ++++ b/SoObjects/SOGo/SOGoSystemDefaults.h
    +@@ -106,6 +106,7 @@ NSComparisonResult languageSort(id el1, id el2, void *context);
    + - (NSString *) openIdClient;
    + - (NSString *) openIdClientSecret;
    + - (NSString *) openIdEmailParam;
    ++- (NSString *) openIdHttpVersion;
    + - (BOOL) openIdEnableRefreshToken;
    + - (BOOL) openIdLogoutEnabled: (NSString *) _domain;
    + - (int) openIdTokenCheckInterval;
    +diff --git a/SoObjects/SOGo/SOGoSystemDefaults.m b/SoObjects/SOGo/SOGoSystemDefaults.m
    +index b47fbf6d6..a64ff76c9 100644
    +--- a/SoObjects/SOGo/SOGoSystemDefaults.m
    ++++ b/SoObjects/SOGo/SOGoSystemDefaults.m
    +@@ -779,6 +779,15 @@ NSComparisonResult languageSort(id el1, id el2, void *context)
    + return emailParam;
    + }
    +
    ++- (NSString *) openIdHttpVersion
    ++{
    ++ NSString *httpVersion;
    ++ httpVersion = [self stringForKey: @"SOGoOpenIdHttpVersion"];
    ++ if(!httpVersion)
    ++ httpVersion = @"HTTP/1.1";
    ++ return httpVersion;
    ++}
    ++
    + - (BOOL) openIdLogoutEnabled: (NSString *) _domain
    + {
    + if(_domain && [self doesLoginTypeByDomain])
    +commit 42f620e56201e17391532507c02ae370f117c574
    +Author: Hivert Quentin <[email protected]>
    +Date: Thu Jul 24 14:46:45 2025 +0200
    +
    + fix(curl): properly close curl connection
    +
    +diff --git a/SoObjects/SOGo/SOGoOpenIdSession.m b/SoObjects/SOGo/SOGoOpenIdSession.m
    +index fda50d85e..b81b26dea 100644
    +--- a/SoObjects/SOGo/SOGoOpenIdSession.m
    ++++ b/SoObjects/SOGo/SOGoOpenIdSession.m
    +@@ -54,7 +54,6 @@ size_t curl_body_function(void *ptr, size_t size, size_t nmemb, void *buffer)
    + return total;
    + }
    +
    +-
    + @implementation SimpleOpenIdResponse
    +
    + - (id)init {
    +@@ -352,16 +351,19 @@ size_t curl_body_function(void *ptr, size_t size, size_t nmemb, void *buffer)
    + if(SOGoOpenIDDebugEnabled)
    + NSLog(@"OpenId perform request: response is: %@", response);
    +
    ++ curl_easy_cleanup(curl);
    + return [response autorelease];
    + }
    + else if (status == 404)
    + {
    + [self errorWithFormat: @"OpenID endpoint not found (404): %@", endpoint];
    ++ curl_easy_cleanup(curl);
    + return nil;
    + }
    + else
    + {
    + [self errorWithFormat: @"OpenID server internal error during %@: %@", endpoint, response];
    ++ curl_easy_cleanup(curl);
    + return nil;
    + }
    + }
    +@@ -370,7 +372,7 @@ size_t curl_body_function(void *ptr, size_t size, size_t nmemb, void *buffer)
    + [self errorWithFormat: @"CURL error while accessing %@ (%d): %@", endpoint, rc,
    + [NSString stringWithCString: strlen(error) ? error : curl_easy_strerror(rc)]];
    + }
    +- curl_easy_cleanup (curl);
    ++ curl_easy_cleanup(curl);
    + }
    + else
    + {

    --===============3575875728971645396==--

    Received: (at 1109884-done) by bugs.debian.org; 25 Jul 2025 20:06:27 +0000 X-Spam-Checker-Version: SpamAssassin 4.0.1-bugs.debian.org_2005_01_02
    (2024-03-25) on buxtehude.debian.org
    X-Spam-Level:
    X-Spam-Status: No, score=-102.1 required=4.0 tests=BAYES_00,DKIM_SIGNED,
    DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ONEWORDBODY,RCVD_IN_DNSWL_MED,
    SPF_HELO_PASS,SPF_NONE,TVD_SPACE_RATIO,USER_IN_DKIM_WELCOMELIST
    autolearn=no autolearn_force=no
    version=4.0.1-bugs.debian.org_2005_01_02
    X-Spam-Bayes: score:0.0000 Tokens: new, 12; hammy, 83; neutral, 12; spammy, 0.
    spammytokens: hammytokens:0.000-+--H*F:U*sramacher,
    0.000-+--H*rp:U*sramacher, 0.000-+--H*r:sk:sramach,
    0.000-+--Hx-spam-relays-external:sk:sramach, 0.000-+--H*Ad:U*sramacher Return-path: <[email protected]>
    Received: from mitropoulos.debian.org ([2001:648:2ffc:deb:216:61ff:fe9d:958d]:47720)
    from C=NA,ST=NA,L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP CA,CN=mitropoulos.debian.org,EMAIL=[email protected] (verified)
    by buxtehude.debian.org with esmtps (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
    (Exim 4.96)
    (envelope-from <[email protected]>)
    id 1ufOgU-00DJD0-2g
    for [email protected];
    Fri, 25 Jul 2025 20:06:26 +0000
    Received: from respighi.debian.org ([2a02:16a8:dc41:100::131]:33076)
    from C=NA,ST=NA,L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP CA,CN=respighi.debian.org,EMAIL=[email protected] (verified)
    by mitropoulos.debian.org with esmtps (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
    (Exim 4.94.2)
    (envelope-from <[email protected]>)
    id 1ufOgS-004T2x-W7
    for [email protected]; Fri, 25 Jul 2025 20:06:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
    d=respighi.debian.org; s=smtpauto.respighi; h=Date:From:Message-Id:
    Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:To:Reply-To:Cc:
    Content-ID:Content-Description:In-Reply-To:References;
    bh=5bRdXg+fubkBz3BaoLY1WsiedlmO1YJGSCj1MJk46IU=; b=O8CiBTaR5eDXOMHM7dMfZReC3S
    6tMK/L+bNNWPKM9zobV9Nas4s7T8GuVTyaE+8cQBG63imT0gzLiT9PrDH1QF9eFFtRKa/EXxBBDjr
    qvcS1Jb4RJ0ld9/7lpLncsN3YzasBq8NvzVy1/wUKlhKT3Ek/pF9k+IYATTiZ6qJlX2/xL7gZHs4U
    uv9fEhtOYkB3CzE0q3sJTa9pbffNauCXDnrUw9w2p0eml2pshj959zWnRaRmaAvXBuFy6LU+BvhFC
    +1CsO+y3suyxRGDq0+mQ/647SDktx3Q5+Gd2qs1AfBgFefMoJlkuY6mVtj46eNDI+s825obs+Z4OV
    IamotQDg==;
    Received: from sramacher by respighi.debian.org with local (Exim 4.96)
    (envelope-from <[email protected]>)
    id 1ufOgS-00F9Qj-1l
    for [email protected];
    Fri, 25 Jul 2025 20:06:24 +0000
    To: [email protected]
    Subject: unblock sogo
    MIME-Version: 1.0
    Content-Type: text/plain; charset="UTF-8"
    Content-Transfer-Encoding: 8bit
    Message-Id: <[email protected]>
    From: Sebastian Ramacher <[email protected]>
    Date: Fri, 25 Jul 2025 20:06:24 +0000
    X-CrossAssassin-Score: 4

    Unblocked.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)