!100 [sync] PR-97: 解决申威架构下编译的问题

From: @openeuler-sync-bot 
Reviewed-by: @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
This commit is contained in:
openeuler-ci-bot 2023-04-13 06:13:53 +00:00 committed by Gitee
commit 793debb6d6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,81 @@
From 46407ca0d2adfa39164ba6cbc7392191b0ec1563 Mon Sep 17 00:00:00 2001
From: zhangzhixin <zhixin.zhang@i-soft.com.cn>
Date: Wed, 12 Apr 2023 12:04:18 +0800
Subject: [PATCH] Fix compilation error on sw64 arch.
---
include/compat/endian.h | 2 +-
plugins/sudoers/auth/secureware.c | 6 +++---
plugins/sudoers/getspwuid.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/compat/endian.h b/include/compat/endian.h
index d3c5ca9..feecbcf 100644
--- a/include/compat/endian.h
+++ b/include/compat/endian.h
@@ -45,7 +45,7 @@
# define BYTE_ORDER LITTLE_ENDIAN
# elif defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
# define BYTE_ORDER BIG_ENDIAN
-# elif defined(__alpha__) || defined(__alpha) || defined(__amd64) || \
+# elif defined(__alpha__) || defined(__alpha) || defined(__sw_64__) || defined(__sw_64) || defined(__amd64) || \
defined(BIT_ZERO_ON_RIGHT) || defined(i386) || defined(__i386) || \
defined(MIPSEL) || defined(_MIPSEL) || defined(ns32000) || \
defined(__ns3200) || defined(sun386) || defined(vax) || \
diff --git a/plugins/sudoers/auth/secureware.c b/plugins/sudoers/auth/secureware.c
index dd7aa42..b5d357d 100644
--- a/plugins/sudoers/auth/secureware.c
+++ b/plugins/sudoers/auth/secureware.c
@@ -46,7 +46,7 @@
#include "sudoers.h"
#include "sudo_auth.h"
-#ifdef __alpha
+#if defined __alpha || defined __sw_64
extern int crypt_type;
#endif
@@ -55,7 +55,7 @@ sudo_secureware_init(struct passwd *pw, sudo_auth *auth)
{
debug_decl(sudo_secureware_init, SUDOERS_DEBUG_AUTH);
-#ifdef __alpha
+#if defined __alpha || defined __sw_64
if (crypt_type == INT_MAX)
debug_return_int(AUTH_FAILURE); /* no shadow */
#endif
@@ -77,7 +77,7 @@ sudo_secureware_verify(struct passwd *pw, char *pass, sudo_auth *auth, struct su
if (pass[0] == '\0')
debug_return_int(pw_epasswd[0] ? AUTH_FAILURE : AUTH_SUCCESS);
-#if defined(__alpha)
+#if defined(__alpha) || defined(__sw_64)
# ifdef HAVE_DISPCRYPT
epass = dispcrypt(pass, pw_epasswd, crypt_type);
# else
diff --git a/plugins/sudoers/getspwuid.c b/plugins/sudoers/getspwuid.c
index 650b3f3..f31dd5f 100644
--- a/plugins/sudoers/getspwuid.c
+++ b/plugins/sudoers/getspwuid.c
@@ -51,7 +51,7 @@
/*
* Exported for auth/secureware.c
*/
-#if defined(HAVE_GETPRPWNAM) && defined(__alpha)
+#if defined(HAVE_GETPRPWNAM) && (defined(__alpha) || defined(__sw_64))
int crypt_type = INT_MAX;
#endif /* HAVE_GETPRPWNAM && __alpha */
@@ -87,7 +87,7 @@ sudo_getepw(const struct passwd *pw)
struct pr_passwd *spw;
if ((spw = getprpwnam(pw->pw_name)) && spw->ufld.fd_encrypt) {
-# ifdef __alpha
+# if defined __alpha || defined __sw_64
crypt_type = spw->ufld.fd_oldcrypt;
# endif /* __alpha */
epw = spw->ufld.fd_encrypt;
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: sudo
Version: 1.9.8p2
Release: 11
Release: 12
Summary: Allows restricted root access for specified users
License: ISC
URL: http://www.courtesan.com/sudo/
@ -31,6 +31,7 @@ Patch17: backport-CVE-2023-22809.patch
Patch18: backport-Fix-a-NOPASSWD-issue-with-a-non-existent-command-whe.patch
Patch19: backport-CVE-2023-27320.patch
Patch20: backport-CVE-2023-28486_CVE-2023-28487.patch
Patch21: Fix-compilation-error-on-sw64-arch.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: pam
@ -181,6 +182,9 @@ install -p -c -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/sudo-i
%exclude %{_pkgdocdir}/ChangeLog
%changelog
* Wed Apr 12 2023 wangyu <wangyu283@huawei.com> - 1.9.8p2-12
- Fix compilation error on sw64 arch.
* Tue Mar 28 2023 wangcheng <wangcheng156@huawei.com> - 1.9.8p2-11
- Fix CVE-2023-28486 and CVE-2023-28487