• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# Copyright (c) 2022 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16SRC_DIR="$1"
17CODE_DIR="$2"
18OPEN_EULER_CARES_SOURCE_PATH="c-ares-1.18.1"
19OPEN_EULER_CARES_TAR="c-ares-1.18.1.tar.gz"
20
21set -e
22if [ "$SRC_DIR" == "" ] || [ "$CODE_DIR" == "" ]; then
23    exit 1
24fi
25
26if [ -d "$CODE_DIR" ]; then
27    rm -rf "$CODE_DIR"
28fi
29
30mkdir -p $CODE_DIR
31
32tar zxvf $SRC_DIR/$OPEN_EULER_CARES_TAR -C $CODE_DIR
33
34_all_patchs=(
35    "0000-Use-RPM-compiler-options.patch"
36    "backport-disable-live-tests.patch"
37    "backport-add-str-len-check-in-config_sortlist-to-avoid-stack-overflow.patch"
38    "backport-CVE-2023-32067.patch"
39    "backport-001-CVE-2023-31130.patch"
40    "backport-002-CVE-2023-31130.patch"
41    "backport-003-CVE-2023-31130.patch"
42    "backport-001-CVE-2023-31147.patch"
43    "backport-002-CVE-2023-31124_CVE-2023-31147.patch"
44    "backport-003-CVE-2023-31147.patch"
45    "backport-004-CVE-2023-31147.patch"
46    "backport-005-CVE-2023-31147.patch"
47    "backport-CVE-2023-31124.patch"
48    "0001-ADD-OHOS-DNS-PROXY-BY-NETSYS.patch"
49)
50for filename in "${_all_patchs[@]}"
51  do
52    patch -d $CODE_DIR/$OPEN_EULER_CARES_SOURCE_PATH -p1 < $SRC_DIR/$filename --fuzz=0 --no-backup-if-mismatch
53  done
54exit 0
55