From nobody Wed Sep 10 01:34:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1757330601; cv=none; d=zohomail.com; s=zohoarc; b=Zj9PyzbWmA4GQ6ajyKZ38jTzzz0annoSRnU6VEQeotRlsa/bd5RuSogcBpwVx7ogICmHcYbVwTAcImXZ9zhAWLwMuBqmrWWPWDmtAMWGHaMGnCnmifxV75B0V7CH9ldaRz3ds97BqDwR9eb7eADWipBGhoIR2uOfSn7DkAqsKac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757330601; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=Fkp+jngouGSNo3fvaGWiev0mvhcLUU7M6yhneyYd+Cg=; b=WNk9gotnUVnceZCC0/2fUB+LjmL8xIYeIXzU0FrYyOD2yv5zUqMcbAd0bQYVbDKcEmFu3E7zxKAt+8FMaUG/VT+i3o8gTKGbeA9N+Z8ZecOnDazCTisue7xRinGtbi01ithjQlLE4TP4EMMbLCsVfl13Rf4ZGTsbQRfQzNm6ZAo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 175733060106542.71683644496636; Mon, 8 Sep 2025 04:23:21 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D8DC94443B; Mon, 8 Sep 2025 07:23:19 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id D6E22444FF; Mon, 8 Sep 2025 07:22:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 97CAA44353; Mon, 8 Sep 2025 07:22:14 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 44EA744327 for ; Mon, 8 Sep 2025 07:22:12 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-59-xfDz1-fVM4GTjmFOwvMREA-1; Mon, 08 Sep 2025 07:22:10 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D302219540EF for ; Mon, 8 Sep 2025 11:22:09 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.3.236]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 30201300018D for ; Mon, 8 Sep 2025 11:22:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757330531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Fkp+jngouGSNo3fvaGWiev0mvhcLUU7M6yhneyYd+Cg=; b=SspBPQojXg+BuRpQ5zYOMrJB09ANdHESpWx0dxrrcmaVHomJCINFGkXIF+JUPxFxQ2b4/W LPB/cV7nCw+MtuaIjLA5h/8wyJorjQEqE72Tplym3IPc55orP3TciO7USKKtSvv4BmEJ/l xmK8qraPQEcXGGlBtUeR8nj3fMJFY1Y= X-MC-Unique: xfDz1-fVM4GTjmFOwvMREA-1 X-Mimecast-MFC-AGG-ID: xfDz1-fVM4GTjmFOwvMREA_1757330529 To: devel@lists.libvirt.org Subject: [PATCH] esx: Satisfy curl type checks Date: Mon, 8 Sep 2025 13:22:07 +0200 Message-ID: <45ba8e298f87439253a61e9982074a956aeafd3d.1757330527.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gstoq_dOZqee0hFe0BaS7-J3Ed-6SO1IGntVDzKL8-k_1757330529 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 652JVJGQLPTIIN5M6M5STXAXY7LPXWF6 X-Message-ID-Hash: 652JVJGQLPTIIN5M6M5STXAXY7LPXWF6 X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1757330604405124100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Since its commit [1] curl now performs type checks on curl_easy_setopt(). Some options expect long but we're passing an int. The fix consists mostly of specifying type of numbers passed to the function. Except for two cases: proxy_type and proxy_port which are stored in a structure of ours (_esxUtil_ParsedUri). These have their types switched from int to long and unsigned long, respectively. 1: https://github.com/curl/curl/commit/79b4e56b3f30dc1ac28a81128a07d27338e5= 219e Signed-off-by: Michal Privoznik --- src/esx/esx_stream.c | 2 +- src/esx/esx_util.c | 4 ++-- src/esx/esx_util.h | 4 ++-- src/esx/esx_vi.c | 18 +++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/esx/esx_stream.c b/src/esx/esx_stream.c index 1439940330..4f3ca09379 100644 --- a/src/esx/esx_stream.c +++ b/src/esx/esx_stream.c @@ -411,7 +411,7 @@ esxStreamOpen(virStreamPtr stream, esxPrivate *priv, co= nst char *url, curl_easy_setopt(streamPriv->curl->handle, CURLOPT_READDATA, strea= mPriv); } else { curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 0); - curl_easy_setopt(streamPriv->curl->handle, CURLOPT_HTTPGET, 1); + curl_easy_setopt(streamPriv->curl->handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(streamPriv->curl->handle, CURLOPT_WRITEFUNCTION, esxVI_CURL_WriteStream); curl_easy_setopt(streamPriv->curl->handle, CURLOPT_WRITEDATA, stre= amPriv); diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c index 7ee0e5f7c0..8e725ed04f 100644 --- a/src/esx/esx_util.c +++ b/src/esx/esx_util.c @@ -125,8 +125,8 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURI = *uri) =20 *tmp++ =3D '\0'; =20 - if (virStrToLong_i(tmp, NULL, 10, - &(*parsedUri)->proxy_port) < 0 || + if (virStrToLong_ul(tmp, NULL, 10, + &(*parsedUri)->proxy_port) < 0 || (*parsedUri)->proxy_port < 1 || (*parsedUri)->proxy_port > 65535) { virReportError(VIR_ERR_INVALID_ARG, diff --git a/src/esx/esx_util.h b/src/esx/esx_util.h index 58bc44e744..51f1151eb7 100644 --- a/src/esx/esx_util.h +++ b/src/esx/esx_util.h @@ -40,9 +40,9 @@ struct _esxUtil_ParsedUri { bool noVerify; bool autoAnswer; bool proxy; - int proxy_type; + long proxy_type; char *proxy_hostname; - int proxy_port; + unsigned long proxy_port; char *path; char *cacert; }; diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index d25f819bc5..65e19e179e 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -315,13 +315,13 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUr= i *parsedUri) } =20 curl_easy_setopt(curl->handle, CURLOPT_USERAGENT, "libvirt-esx"); - curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1); - curl_easy_setopt(curl->handle, CURLOPT_HEADER, 0); - curl_easy_setopt(curl->handle, CURLOPT_FOLLOWLOCATION, 0); + curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1L); + curl_easy_setopt(curl->handle, CURLOPT_HEADER, 0L); + curl_easy_setopt(curl->handle, CURLOPT_FOLLOWLOCATION, 0L); curl_easy_setopt(curl->handle, CURLOPT_SSL_VERIFYPEER, - parsedUri->noVerify ? 0 : 1); + parsedUri->noVerify ? 0L : 1L); curl_easy_setopt(curl->handle, CURLOPT_SSL_VERIFYHOST, - parsedUri->noVerify ? 0 : 2); + parsedUri->noVerify ? 0L : 2L); curl_easy_setopt(curl->handle, CURLOPT_COOKIEFILE, ""); curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->headers); curl_easy_setopt(curl->handle, CURLOPT_READFUNCTION, @@ -386,8 +386,8 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, = char **content, curl_easy_setopt(curl->handle, CURLOPT_URL, url); curl_easy_setopt(curl->handle, CURLOPT_RANGE, range); curl_easy_setopt(curl->handle, CURLOPT_WRITEDATA, &buffer); - curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 0); - curl_easy_setopt(curl->handle, CURLOPT_HTTPGET, 1); + curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(curl->handle, CURLOPT_HTTPGET, 1L); =20 responseCode =3D esxVI_CURL_Perform(curl, url); } @@ -426,7 +426,7 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, co= nst char *content) curl_easy_setopt(curl->handle, CURLOPT_URL, url); curl_easy_setopt(curl->handle, CURLOPT_RANGE, NULL); curl_easy_setopt(curl->handle, CURLOPT_READDATA, &content); - curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 1); + curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 1L); curl_easy_setopt(curl->handle, CURLOPT_INFILESIZE, strlen(content)= ); =20 responseCode =3D esxVI_CURL_Perform(curl, url); @@ -1223,7 +1223,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char = *methodName, curl_easy_setopt(ctx->curl->handle, CURLOPT_URL, ctx->url); curl_easy_setopt(ctx->curl->handle, CURLOPT_RANGE, NULL); curl_easy_setopt(ctx->curl->handle, CURLOPT_WRITEDATA, &buffer); - curl_easy_setopt(ctx->curl->handle, CURLOPT_UPLOAD, 0); + curl_easy_setopt(ctx->curl->handle, CURLOPT_UPLOAD, 0L); curl_easy_setopt(ctx->curl->handle, CURLOPT_POSTFIELDS, request); curl_easy_setopt(ctx->curl->handle, CURLOPT_POSTFIELDSIZE, strlen(= request)); =20 --=20 2.49.1