diff options
author | Joffrey Darcq | 2018-06-03 11:08:47 +0200 |
---|---|---|
committer | Joffrey Darcq | 2018-06-03 11:08:47 +0200 |
commit | 44603070bcd87db5304a0550b3b0f60ed4bb8f56 (patch) | |
tree | f6c1a22748e3485945d9104da6adb1da3dee49d1 | |
parent | 0992037d36f3175296d361fbf1acc383bfc1f78c (diff) | |
download | aur-44603070bcd87db5304a0550b3b0f60ed4bb8f56.tar.gz |
updpkg: 6.3.0
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | PKGBUILD | 41 | ||||
-rw-r--r-- | fix_mysql_support.diff | 24 | ||||
-rw-r--r-- | fix_pids-folder-out-of-seafile-data.diff (renamed from 0001-Revert-server-put-pids-folder-out-of-seafile-data.patch) | 2 | ||||
-rw-r--r-- | fix_scripts_upgrade.diff | 12 | ||||
-rw-r--r-- | fix_seafile-admin.diff | 48 | ||||
-rw-r--r-- | libseafile.in.patch | 8 | ||||
-rw-r--r-- | openssl-1.1.diff | 761 |
9 files changed, 104 insertions, 824 deletions
@@ -1,7 +1,7 @@ pkgbase = seafile-server pkgdesc = Seafile server core - pkgver = 6.2.5 - pkgrel = 5 + pkgver = 6.3.0 + pkgrel = 1 url = https://github.com/haiwen/seafile-server changelog = ChangeLog arch = i686 @@ -11,26 +11,24 @@ pkgbase = seafile-server arch = aarch64 license = AGPL3 makedepends = vala - depends = ccnet-server=6.2.5 + depends = ccnet-server>=6.3.0 depends = fuse2 depends = libevhtp-seafile depends = libarchive optdepends = python2-wsgidav-seafile: webdav-support conflicts = seafile - source = seafile-server-6.2.5-server.tar.gz::https://github.com/haiwen/seafile-server/archive/v6.2.5-server.tar.gz + source = seafile-server-6.3.0-server.tar.gz::https://github.com/haiwen/seafile-server/archive/v6.3.0-server.tar.gz + source = fix_pids-folder-out-of-seafile-data.diff source = fix_seafile-admin.diff source = fix_mysql_support.diff + source = fix_scripts_upgrade.diff source = seafile-server@.service - source = 0001-Revert-server-put-pids-folder-out-of-seafile-data.patch - source = libseafile.in.patch - source = openssl-1.1.diff - sha256sums = 8cc17303b3b3949cfb4e914264f6446057bb2eee0b5e6e3a3399294ab566c0e0 - sha256sums = 91f56d852cb4670ce052f1539ebe51c3ec74189150dc24ed34245ca3397d29a7 - sha256sums = c144d93638dfb44d1474c46e427977f4c314def3ca6a31bf495b6b4ce523741f + sha256sums = 056013b496a8b5501a32011288416982609797108ba5a9d3213f9574abb5fd85 + sha256sums = d725bda36aedd424d426d7ce62e19c7036ccfc6a5759df12f139656ba15e425c + sha256sums = 6d456c0795bdf50c64c9f40d0fb725f6d356ff9638ec1b0c7921a11e4dd479d4 + sha256sums = 9e50942e1f9cad21744b4467646e162896705d2c67834b600d78d4aa87b87a39 + sha256sums = bc23410381f380c419d9d5bb0757af136d96cfa8815e9ec7e0caa759d9d3a27d sha256sums = da31d1b61031cbacc42e1ab708c67c83dba933ff391b07677dabab7ab79729f4 - sha256sums = 114920836eec03ac152a88cdfb55de5cd554240ca246dd69d3d9b52b74ec8809 - sha256sums = a2d7f7cf0c59aba97650af62b3cefd0ceb71a1007c34d9369a88e5769c7f6076 - sha256sums = ffa351b22e89a66f80139888e4e7a2c2bde41fd648d57c71dcf10884dc03bbc3 pkgname = seafile-server diff --git a/ChangeLog b/ChangeLog index 85c0c9f6cf4e..36ac2f1e40a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-06-03 Joffrey <j-off@live.fr> + * Version: 6.3.0-1 + + * PKGBUILD: fix future depends '>=' (for now use 'pacman -Udd --asdeps pkg') + fix all python paths + + * *.diff: fix django-1.11 + script upgrade, remove openssl-1.1 and libseafile.in patchs + 2018-02-13 Joffrey <j-off@live.fr> * version: 6.2.5-5 @@ -4,32 +4,31 @@ # Contributor: Aaron Lindsay <aaron@aclindsay.com> pkgname=seafile-server -pkgver=6.2.5 -pkgrel=5 +pkgver=6.3.0 +pkgrel=1 pkgdesc="Seafile server core" arch=('i686' 'x86_64' 'armv7h' 'armv6h' 'aarch64') url="https://github.com/haiwen/${pkgname}" license=('AGPL3') -depends=("ccnet-server=${pkgver}" "fuse2" "libevhtp-seafile" "libarchive") +depends=("ccnet-server>=${pkgver}" "fuse2" "libevhtp-seafile" "libarchive") makedepends=("vala") optdepends=("python2-wsgidav-seafile: webdav-support") conflicts=('seafile') changelog="ChangeLog" source=("${pkgname}-${pkgver}-server.tar.gz::${url}/archive/v${pkgver}-server.tar.gz" + "fix_pids-folder-out-of-seafile-data.diff" "fix_seafile-admin.diff" "fix_mysql_support.diff" + "fix_scripts_upgrade.diff" "seafile-server@.service" - "0001-Revert-server-put-pids-folder-out-of-seafile-data.patch" - "libseafile.in.patch" - "openssl-1.1.diff" ) -sha256sums=('8cc17303b3b3949cfb4e914264f6446057bb2eee0b5e6e3a3399294ab566c0e0' - '91f56d852cb4670ce052f1539ebe51c3ec74189150dc24ed34245ca3397d29a7' - 'c144d93638dfb44d1474c46e427977f4c314def3ca6a31bf495b6b4ce523741f' +sha256sums=('056013b496a8b5501a32011288416982609797108ba5a9d3213f9574abb5fd85' + 'd725bda36aedd424d426d7ce62e19c7036ccfc6a5759df12f139656ba15e425c' + '6d456c0795bdf50c64c9f40d0fb725f6d356ff9638ec1b0c7921a11e4dd479d4' + '9e50942e1f9cad21744b4467646e162896705d2c67834b600d78d4aa87b87a39' + 'bc23410381f380c419d9d5bb0757af136d96cfa8815e9ec7e0caa759d9d3a27d' 'da31d1b61031cbacc42e1ab708c67c83dba933ff391b07677dabab7ab79729f4' - '114920836eec03ac152a88cdfb55de5cd554240ca246dd69d3d9b52b74ec8809' - 'a2d7f7cf0c59aba97650af62b3cefd0ceb71a1007c34d9369a88e5769c7f6076' - 'ffa351b22e89a66f80139888e4e7a2c2bde41fd648d57c71dcf10884dc03bbc3') +) prepare() { cd "${srcdir}/${pkgname}-${pkgver}-server" @@ -37,15 +36,19 @@ prepare() { # Remove scripts for tests and others OS rm -rf "./scripts/"{build,upgrade/win32,*.bat,*.md} "./integration-tests" + sed -i "s|(DESTDIR)@prefix@|@prefix@|" "./lib/libseafile.pc.in" + + patch -p1 -i "${srcdir}/fix_pids-folder-out-of-seafile-data.diff" patch -p1 -i "${srcdir}/fix_seafile-admin.diff" - patch -p1 -i "${srcdir}/fix_mysql_support.diff" - patch -p1 -i "${srcdir}/0001-Revert-server-put-pids-folder-out-of-seafile-data.patch" - patch -p1 -i "${srcdir}/libseafile.in.patch" - patch -p1 -i "${srcdir}/openssl-1.1.diff" + patch -p1 -i "${srcdir}/fix_mysql_support.diff" + patch -p1 -i "${srcdir}/fix_scripts_upgrade.diff" # Use python lib seahub interpreter for all scripts grep -s -l -r '#!/usr/bin/env python' "./" \ | xargs sed -i -e '1 s|#!/usr/bin/env python|#!/usr/lib/seahub/bin/python2|' + + grep -s -l -r -E "PYTHON=python[.0-9]+" "./" \ + | xargs sed -i -E 's|PYTHON=python[.0-9]+|PYTHON=/usr/lib/seahub/bin/python2|g' } build() { @@ -53,10 +56,8 @@ build() { ./autogen.sh ./configure \ - --enable-fuse \ - --enable-python \ - --prefix=/usr \ - PYTHON=/usr/bin/python2 + --enable-fuse --enable-python \ + --prefix=/usr PYTHON=/usr/bin/python2 make } diff --git a/fix_mysql_support.diff b/fix_mysql_support.diff index 8fe520f34511..e9a3aa26a9f1 100644 --- a/fix_mysql_support.diff +++ b/fix_mysql_support.diff @@ -1,21 +1,3 @@ -diff --git a/tools/seafile-admin b/tools/seafile-admin -index 5e3658b..63af448 100755 ---- a/tools/seafile-admin -+++ b/tools/seafile-admin -@@ -861,6 +861,13 @@ def check_necessary_files(): - os.path.join(cwd, 'conf', 'seahub_settings.py'), - ] - -+ # seahub.db isn't create with a MySQL installation and crash the startup -+ with open(files[3], 'r') as f: -+ for line in f: -+ if 'DATABASES' in line: -+ del(files[2]) -+ break -+ - for fpath in files: - if not os.path.exists(fpath): - error('%s not found' % fpath) diff --git a/scripts/setup-seafile-mysql.sh b/scripts/setup-seafile-mysql.sh index cb8b8c5..a8f18df 100755 --- a/scripts/setup-seafile-mysql.sh @@ -32,16 +14,18 @@ diff --git a/scripts/setup-seafile-mysql.py b/scripts/setup-seafile-mysql.py index 596687c..39ed520 100644 --- a/scripts/setup-seafile-mysql.py +++ b/scripts/setup-seafile-mysql.py -@@ -301,7 +301,7 @@ class EnvManager(object): +@@ -301,9 +301,9 @@ class EnvManager(object): def __init__(self): self.install_path = os.path.dirname(os.path.abspath(__file__)) self.top_dir = os.path.dirname(self.install_path) - self.bin_dir = os.path.join(self.install_path, 'seafile', 'bin') + self.bin_dir = '/usr/bin' self.central_config_dir = os.path.join(self.top_dir, 'conf') + self.central_pids_dir = os.path.join(self.top_dir, 'pids') + self.central_logs_dir = os.path.join(self.top_dir, 'logs') Utils.must_mkdir(self.central_config_dir) -@@ -311,7 +311,6 @@ class EnvManager(object): +@@ -313,7 +313,6 @@ class EnvManager(object): Utils.error('"%s" not found' % path) paths = [ diff --git a/0001-Revert-server-put-pids-folder-out-of-seafile-data.patch b/fix_pids-folder-out-of-seafile-data.diff index b4ded4f72adf..05e31cd9c945 100644 --- a/0001-Revert-server-put-pids-folder-out-of-seafile-data.patch +++ b/fix_pids-folder-out-of-seafile-data.diff @@ -2,7 +2,7 @@ diff --git a/controller/seafile-controller.c b/controller/seafile-controller.c index 9439bcd..116c77e 100644 --- a/controller/seafile-controller.c +++ b/controller/seafile-controller.c -@@ -575,7 +575,7 @@ stop_ccnet_server () +@@ -591,7 +591,7 @@ stop_ccnet_server () static void init_pidfile_path (SeafileController *ctl) { diff --git a/fix_scripts_upgrade.diff b/fix_scripts_upgrade.diff new file mode 100644 index 000000000000..f78d7b0f5cdc --- /dev/null +++ b/fix_scripts_upgrade.diff @@ -0,0 +1,12 @@ +diff --git a/scripts/upgrade/upgrade_6.2_6.3.sh b/scripts/upgrade/upgrade_6.2_6.3.sh +index f09d03c..d5951ed 100755 +--- a/scripts/upgrade/upgrade_6.2_6.3.sh ++++ b/scripts/upgrade/upgrade_6.2_6.3.sh +@@ -20,6 +20,8 @@ export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPA + export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH + export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} + ++PYTHON=/usr/lib/seahub/bin/python2.7 ++ + prev_version=6.2 + current_version=6.3 diff --git a/fix_seafile-admin.diff b/fix_seafile-admin.diff index 23b09916c604..42a29646ff72 100644 --- a/fix_seafile-admin.diff +++ b/fix_seafile-admin.diff @@ -1,7 +1,39 @@ diff --git a/tools/seafile-admin b/tools/seafile-admin -index 5e3658b..b767cce 100755 +index 5e3658b..90c68a8 100755 --- a/tools/seafile-admin +++ b/tools/seafile-admin +@@ -44,7 +44,7 @@ SEAHUB_DOWNLOAD_URL = 'https://seafile.com.cn/downloads/seahub-latest.tar.gz' + cwd = os.getcwd() + SCRIPT_NAME = os.path.basename(sys.argv[0]) + +-PYTHON = sys.executable ++PYTHON = '/usr/lib/seahub/bin/python2.7' + + conf = {} + CONF_SERVER_NAME = 'server_name' +@@ -499,7 +499,7 @@ def init_seahub(): + # create seahub_settings.py + create_seahub_settings_py() + +- argv = [PYTHON, 'manage.py', 'syncdb'] ++ argv = [PYTHON, 'manage.py', 'migrate'] + # Set proper PYTHONPATH before run django syncdb command + env = get_seahub_env() + +@@ -518,10 +518,10 @@ def init_seahub(): + + + def check_django_version(): +- '''Requires django 1.8''' ++ '''Requires django 1.11''' + import django +- if django.VERSION[0] != 1 or django.VERSION[1] != 8: +- error('Django 1.8 is required') ++ if django.VERSION[0] != 1 or django.VERSION[1] != 11: ++ error('Django 1.11 is required') + del django + + @@ -683,7 +683,7 @@ def start_controller(): def start_seahub_gunicorn(): @@ -11,3 +43,17 @@ index 5e3658b..b767cce 100755 'seahub.wsgi:application', '-c', conf[CONF_SEAHUB_CONF], +@@ -861,6 +861,13 @@ def check_necessary_files(): + os.path.join(cwd, 'conf', 'seahub_settings.py'), + ] + ++ # seahub.db isn't create with a MySQL installation and crash the startup ++ with open(files[3], 'r') as f: ++ for line in f: ++ if 'DATABASES' in line: ++ del(files[2]) ++ break ++ + for fpath in files: + if not os.path.exists(fpath): + error('%s not found' % fpath) diff --git a/libseafile.in.patch b/libseafile.in.patch deleted file mode 100644 index 558abd6f03e4..000000000000 --- a/libseafile.in.patch +++ /dev/null @@ -1,8 +0,0 @@ ---- seafile-4.3.1/lib/libseafile.pc.in 2015-08-11 05:40:35.000000000 +0300 -+++ seafile-4.3.1/lib/libseafile.pc.in.good 2015-08-18 09:45:24.761932845 +0300 -@@ -1,4 +1,4 @@ --prefix=(DESTDIR)@prefix@ -+prefix=@prefix@ - exec_prefix=@exec_prefix@ - libdir=@libdir@ - includedir=@includedir@ diff --git a/openssl-1.1.diff b/openssl-1.1.diff deleted file mode 100644 index bd400748406f..000000000000 --- a/openssl-1.1.diff +++ /dev/null @@ -1,761 +0,0 @@ -diff -ru seafile-server-v6.0.10/common/block-tx-utils.c seafile-server/common/block-tx-utils.c ---- seafile-server-v6.0.10/common/block-tx-utils.c 2017-05-14 09:17:18.407062644 +0200 -+++ seafile-server/common/block-tx-utils.c 2017-05-14 10:45:01.262461162 +0200 -@@ -24,43 +24,47 @@ - } - - int --blocktx_encrypt_init (EVP_CIPHER_CTX *ctx, -+blocktx_encrypt_init (EVP_CIPHER_CTX **ctx, - const unsigned char *key, - const unsigned char *iv) - { - int ret; - - /* Prepare CTX for encryption. */ -- EVP_CIPHER_CTX_init (ctx); -+ *ctx = EVP_CIPHER_CTX_new (); - -- ret = EVP_EncryptInit_ex (ctx, -+ ret = EVP_EncryptInit_ex (*ctx, - EVP_aes_256_cbc(), /* cipher mode */ - NULL, /* engine, NULL for default */ - key, /* derived key */ - iv); /* initial vector */ -- if (ret == 0) -+ if (ret == 0) { -+ EVP_CIPHER_CTX_free (*ctx); - return -1; -+ } - - return 0; - } - - int --blocktx_decrypt_init (EVP_CIPHER_CTX *ctx, -+blocktx_decrypt_init (EVP_CIPHER_CTX **ctx, - const unsigned char *key, - const unsigned char *iv) - { - int ret; - - /* Prepare CTX for decryption. */ -- EVP_CIPHER_CTX_init (ctx); -+ *ctx = EVP_CIPHER_CTX_new (); - -- ret = EVP_DecryptInit_ex (ctx, -+ ret = EVP_DecryptInit_ex (*ctx, - EVP_aes_256_cbc(), /* cipher mode */ - NULL, /* engine, NULL for default */ - key, /* derived key */ - iv); /* initial vector */ -- if (ret == 0) -+ if (ret == 0) { -+ EVP_CIPHER_CTX_free (*ctx); - return -1; -+ } - - return 0; - } -@@ -138,7 +142,7 @@ - handle_frame_content (struct evbuffer *buf, FrameParser *parser) - { - char *frame; -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - char *out; - int outlen, outlen2; - int ret = 0; -@@ -158,7 +162,7 @@ - - evbuffer_remove (input, frame, parser->enc_frame_len); - -- if (EVP_DecryptUpdate (&ctx, -+ if (EVP_DecryptUpdate (ctx, - (unsigned char *)out, &outlen, - (unsigned char *)frame, - parser->enc_frame_len) == 0) { -@@ -167,7 +171,7 @@ - goto out; - } - -- if (EVP_DecryptFinal_ex (&ctx, (unsigned char *)(out + outlen), &outlen2) == 0) -+ if (EVP_DecryptFinal_ex (ctx, (unsigned char *)(out + outlen), &outlen2) == 0) - { - seaf_warning ("Failed to decrypt frame content.\n"); - ret = -1; -@@ -180,7 +184,7 @@ - g_free (frame); - g_free (out); - parser->enc_frame_len = 0; -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - return ret; - } - -@@ -222,7 +226,7 @@ - - out = g_malloc (fragment_len + ENC_BLOCK_SIZE); - -- if (EVP_DecryptUpdate (&parser->ctx, -+ if (EVP_DecryptUpdate (parser->ctx, - (unsigned char *)out, &outlen, - (unsigned char *)fragment, fragment_len) == 0) { - seaf_warning ("Failed to decrypt frame fragment.\n"); -@@ -237,7 +241,7 @@ - parser->remain -= fragment_len; - - if (parser->remain <= 0) { -- if (EVP_DecryptFinal_ex (&parser->ctx, -+ if (EVP_DecryptFinal_ex (parser->ctx, - (unsigned char *)out, - &outlen) == 0) { - seaf_warning ("Failed to decrypt frame fragment.\n"); -@@ -249,7 +253,7 @@ - if (ret < 0) - goto out; - -- EVP_CIPHER_CTX_cleanup (&parser->ctx); -+ EVP_CIPHER_CTX_free (parser->ctx); - parser->enc_init = FALSE; - parser->enc_frame_len = 0; - } -@@ -258,7 +262,7 @@ - g_free (fragment); - g_free (out); - if (ret < 0) { -- EVP_CIPHER_CTX_cleanup (&parser->ctx); -+ EVP_CIPHER_CTX_free (parser->ctx); - parser->enc_init = FALSE; - parser->enc_frame_len = 0; - } -diff -ru seafile-server-v6.0.10/common/block-tx-utils.h seafile-server/common/block-tx-utils.h ---- seafile-server-v6.0.10/common/block-tx-utils.h 2017-05-14 09:17:18.407062644 +0200 -+++ seafile-server/common/block-tx-utils.h 2017-05-14 10:46:24.554740844 +0200 -@@ -68,12 +68,12 @@ - unsigned char *key, unsigned char *iv); - - int --blocktx_encrypt_init (EVP_CIPHER_CTX *ctx, -+blocktx_encrypt_init (EVP_CIPHER_CTX **ctx, - const unsigned char *key, - const unsigned char *iv); - - int --blocktx_decrypt_init (EVP_CIPHER_CTX *ctx, -+blocktx_decrypt_init (EVP_CIPHER_CTX **ctx, - const unsigned char *key, - const unsigned char *iv); - -@@ -112,7 +112,7 @@ - unsigned char key[ENC_KEY_SIZE]; - unsigned char iv[ENC_BLOCK_SIZE]; - gboolean enc_init; -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - - unsigned char key_v2[ENC_KEY_SIZE]; - unsigned char iv_v2[ENC_BLOCK_SIZE]; -diff -ru seafile-server-v6.0.10/common/seafile-crypt.c seafile-server/common/seafile-crypt.c ---- seafile-server-v6.0.10/common/seafile-crypt.c 2017-05-14 09:17:18.411062662 +0200 -+++ seafile-server/common/seafile-crypt.c 2017-05-14 10:12:35.371896600 +0200 -@@ -254,35 +254,37 @@ - return -1; - } - -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - int ret; - int blks; - - /* Prepare CTX for encryption. */ -- EVP_CIPHER_CTX_init (&ctx); -+ ctx = EVP_CIPHER_CTX_new (); - - if (crypt->version == 2) -- ret = EVP_EncryptInit_ex (&ctx, -+ ret = EVP_EncryptInit_ex (ctx, - EVP_aes_256_cbc(), /* cipher mode */ - NULL, /* engine, NULL for default */ - crypt->key, /* derived key */ - crypt->iv); /* initial vector */ - else if (crypt->version == 1) -- ret = EVP_EncryptInit_ex (&ctx, -+ ret = EVP_EncryptInit_ex (ctx, - EVP_aes_128_cbc(), /* cipher mode */ - NULL, /* engine, NULL for default */ - crypt->key, /* derived key */ - crypt->iv); /* initial vector */ - else -- ret = EVP_EncryptInit_ex (&ctx, -+ ret = EVP_EncryptInit_ex (ctx, - EVP_aes_128_ecb(), /* cipher mode */ - NULL, /* engine, NULL for default */ - crypt->key, /* derived key */ - crypt->iv); /* initial vector */ - -- if (ret == ENC_FAILURE) -+ if (ret == ENC_FAILURE) { -+ EVP_CIPHER_CTX_free (ctx); - return -1; -- -+ } -+ - /* Allocating output buffer. */ - - /* -@@ -303,7 +305,7 @@ - int update_len, final_len; - - /* Do the encryption. */ -- ret = EVP_EncryptUpdate (&ctx, -+ ret = EVP_EncryptUpdate (ctx, - (unsigned char*)*data_out, - &update_len, - (unsigned char*)data_in, -@@ -314,7 +316,7 @@ - - - /* Finish the possible partial block. */ -- ret = EVP_EncryptFinal_ex (&ctx, -+ ret = EVP_EncryptFinal_ex (ctx, - (unsigned char*)*data_out + update_len, - &final_len); - -@@ -324,13 +326,13 @@ - if (ret == ENC_FAILURE || *out_len != (blks * BLK_SIZE)) - goto enc_error; - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - return 0; - - enc_error: - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - *out_len = -1; - -@@ -365,34 +367,35 @@ - return -1; - } - -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - int ret; - - /* Prepare CTX for decryption. */ -- EVP_CIPHER_CTX_init (&ctx); -+ ctx = EVP_CIPHER_CTX_new (); - - if (crypt->version == 2) -- ret = EVP_DecryptInit_ex (&ctx, -+ ret = EVP_DecryptInit_ex (ctx, - EVP_aes_256_cbc(), /* cipher mode */ - NULL, /* engine, NULL for default */ - crypt->key, /* derived key */ - crypt->iv); /* initial vector */ - else if (crypt->version == 1) -- ret = EVP_DecryptInit_ex (&ctx, -+ ret = EVP_DecryptInit_ex (ctx, - EVP_aes_128_cbc(), /* cipher mode */ - NULL, /* engine, NULL for default */ - crypt->key, /* derived key */ - crypt->iv); /* initial vector */ - else -- ret = EVP_DecryptInit_ex (&ctx, -+ ret = EVP_DecryptInit_ex (ctx, - EVP_aes_128_ecb(), /* cipher mode */ - NULL, /* engine, NULL for default */ - crypt->key, /* derived key */ - crypt->iv); /* initial vector */ - -- if (ret == DEC_FAILURE) -+ if (ret == DEC_FAILURE) { -+ EVP_CIPHER_CTX_free (ctx); - return -1; -- -+ } - /* Allocating output buffer. */ - - *data_out = (char *)g_malloc (in_len); -@@ -405,7 +408,7 @@ - int update_len, final_len; - - /* Do the decryption. */ -- ret = EVP_DecryptUpdate (&ctx, -+ ret = EVP_DecryptUpdate (ctx, - (unsigned char*)*data_out, - &update_len, - (unsigned char*)data_in, -@@ -416,7 +419,7 @@ - - - /* Finish the possible partial block. */ -- ret = EVP_DecryptFinal_ex (&ctx, -+ ret = EVP_DecryptFinal_ex (ctx, - (unsigned char*)*data_out + update_len, - &final_len); - -@@ -426,13 +429,13 @@ - if (ret == DEC_FAILURE || *out_len > in_len) - goto dec_error; - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - return 0; - - dec_error: - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - *out_len = -1; - if (*data_out != NULL) -@@ -445,7 +448,7 @@ - } - - int --seafile_decrypt_init (EVP_CIPHER_CTX *ctx, -+seafile_decrypt_init (EVP_CIPHER_CTX **ctx, - int version, - const unsigned char *key, - const unsigned char *iv) -@@ -453,29 +456,31 @@ - int ret; - - /* Prepare CTX for decryption. */ -- EVP_CIPHER_CTX_init (ctx); -+ *ctx = EVP_CIPHER_CTX_new (); - - if (version == 2) -- ret = EVP_DecryptInit_ex (ctx, -+ ret = EVP_DecryptInit_ex (*ctx, - EVP_aes_256_cbc(), /* cipher mode */ - NULL, /* engine, NULL for default */ - key, /* derived key */ - iv); /* initial vector */ - else if (version == 1) -- ret = EVP_DecryptInit_ex (ctx, -+ ret = EVP_DecryptInit_ex (*ctx, - EVP_aes_128_cbc(), /* cipher mode */ - NULL, /* engine, NULL for default */ - key, /* derived key */ - iv); /* initial vector */ - else -- ret = EVP_DecryptInit_ex (ctx, -+ ret = EVP_DecryptInit_ex (*ctx, - EVP_aes_128_ecb(), /* cipher mode */ - NULL, /* engine, NULL for default */ - key, /* derived key */ - iv); /* initial vector */ - -- if (ret == DEC_FAILURE) -+ if (ret == DEC_FAILURE) { -+ EVP_CIPHER_CTX_free (*ctx); - return -1; -+ } - - return 0; - } -diff -ru seafile-server-v6.0.10/common/seafile-crypt.h seafile-server/common/seafile-crypt.h ---- seafile-server-v6.0.10/common/seafile-crypt.h 2017-05-14 09:17:18.411062662 +0200 -+++ seafile-server/common/seafile-crypt.h 2017-05-14 10:01:43.077619942 +0200 -@@ -98,7 +98,7 @@ - SeafileCrypt *crypt); - - int --seafile_decrypt_init (EVP_CIPHER_CTX *ctx, -+seafile_decrypt_init (EVP_CIPHER_CTX **ctx, - int version, - const unsigned char *key, - const unsigned char *iv); -diff -ru seafile-server-v6.0.10/lib/utils.c seafile-server/lib/utils.c ---- seafile-server-v6.0.10/lib/utils.c 2017-05-14 09:17:18.415062679 +0200 -+++ seafile-server/lib/utils.c 2017-05-14 11:04:58.928229443 +0200 -@@ -1526,7 +1526,7 @@ - return -1; - } - -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - int ret, key_len; - unsigned char key[16], iv[16]; - int blks; -@@ -1552,16 +1552,18 @@ - } - - /* Prepare CTX for encryption. */ -- EVP_CIPHER_CTX_init (&ctx); -+ ctx = EVP_CIPHER_CTX_new (); - -- ret = EVP_EncryptInit_ex (&ctx, -+ ret = EVP_EncryptInit_ex (ctx, - EVP_aes_128_ecb(), /* cipher mode */ - NULL, /* engine, NULL for default */ - key, /* derived key */ - iv); /* initial vector */ - -- if (ret == ENC_FAILURE) -+ if (ret == ENC_FAILURE) { -+ EVP_CIPHER_CTX_free (ctx); - return -1; -+ } - - /* Allocating output buffer. */ - -@@ -1583,7 +1585,7 @@ - int update_len, final_len; - - /* Do the encryption. */ -- ret = EVP_EncryptUpdate (&ctx, -+ ret = EVP_EncryptUpdate (ctx, - (unsigned char*)*data_out, - &update_len, - (unsigned char*)data_in, -@@ -1594,7 +1596,7 @@ - - - /* Finish the possible partial block. */ -- ret = EVP_EncryptFinal_ex (&ctx, -+ ret = EVP_EncryptFinal_ex (ctx, - (unsigned char*)*data_out + update_len, - &final_len); - -@@ -1604,13 +1606,13 @@ - if (ret == ENC_FAILURE || *out_len != (blks * BLK_SIZE)) - goto enc_error; - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - return 0; - - enc_error: - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - *out_len = -1; - -@@ -1642,7 +1644,7 @@ - return -1; - } - -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - int ret, key_len; - unsigned char key[16], iv[16]; - -@@ -1668,16 +1670,18 @@ - - - /* Prepare CTX for decryption. */ -- EVP_CIPHER_CTX_init (&ctx); -+ ctx = EVP_CIPHER_CTX_new (); - -- ret = EVP_DecryptInit_ex (&ctx, -+ ret = EVP_DecryptInit_ex (ctx, - EVP_aes_128_ecb(), /* cipher mode */ - NULL, /* engine, NULL for default */ - key, /* derived key */ - iv); /* initial vector */ - -- if (ret == DEC_FAILURE) -+ if (ret == DEC_FAILURE) { -+ EVP_CIPHER_CTX_free (ctx); - return -1; -+ } - - /* Allocating output buffer. */ - -@@ -1691,7 +1695,7 @@ - int update_len, final_len; - - /* Do the decryption. */ -- ret = EVP_DecryptUpdate (&ctx, -+ ret = EVP_DecryptUpdate (ctx, - (unsigned char*)*data_out, - &update_len, - (unsigned char*)data_in, -@@ -1702,7 +1706,7 @@ - - - /* Finish the possible partial block. */ -- ret = EVP_DecryptFinal_ex (&ctx, -+ ret = EVP_DecryptFinal_ex (ctx, - (unsigned char*)*data_out + update_len, - &final_len); - -@@ -1712,13 +1716,13 @@ - if (ret == DEC_FAILURE || *out_len > in_len) - goto dec_error; - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - return 0; - - dec_error: - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - *out_len = -1; - if (*data_out != NULL) -diff -ru seafile-server-v6.0.10/server/access-file.c seafile-server/server/access-file.c ---- seafile-server-v6.0.10/server/access-file.c 2017-05-14 09:17:18.419062697 +0200 -+++ seafile-server/server/access-file.c 2017-05-14 12:43:21.159251856 +0200 -@@ -58,7 +58,7 @@ - Seafile *file; - SeafileCrypt *crypt; - gboolean enc_init; -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - BlockHandle *handle; - size_t remain; - int idx; -@@ -152,7 +152,7 @@ - } - - if (data->enc_init) -- EVP_CIPHER_CTX_cleanup (&data->ctx); -+ EVP_CIPHER_CTX_free (data->ctx); - - seafile_unref (data->file); - g_free (data->crypt); -@@ -299,7 +299,7 @@ - seaf_block_manager_block_handle_free (seaf->block_mgr, handle); - data->handle = NULL; - if (data->crypt != NULL) { -- EVP_CIPHER_CTX_cleanup (&data->ctx); -+ EVP_CIPHER_CTX_free (data->ctx); - data->enc_init = FALSE; - } - -@@ -335,7 +335,7 @@ - goto err; - } - -- int ret = EVP_DecryptUpdate (&data->ctx, -+ int ret = EVP_DecryptUpdate (data->ctx, - (unsigned char *)dec_out, - &dec_out_len, - (unsigned char *)buf, -@@ -353,7 +353,7 @@ - /* If it's the last piece of a block, call decrypt_final() - * to decrypt the possible partial block. */ - if (data->remain == 0) { -- ret = EVP_DecryptFinal_ex (&data->ctx, -+ ret = EVP_DecryptFinal_ex (data->ctx, - (unsigned char *)dec_out, - &dec_out_len); - if (ret == 0) { -diff -ru seafile-server-v6.0.10/server/block-tx-server.c seafile-server/server/block-tx-server.c ---- seafile-server-v6.0.10/server/block-tx-server.c 2017-05-14 09:17:18.419062697 +0200 -+++ seafile-server/server/block-tx-server.c 2017-05-14 12:26:12.186886438 +0200 -@@ -205,7 +205,7 @@ - send_auth_response (BlockTxServer *server, int status) - { - AuthResponse rsp; -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - int ret = 0; - - rsp.status = htonl (status); -@@ -221,21 +221,21 @@ - goto out; - } - -- if (send_encrypted_data (&ctx, server->data_fd, &rsp, sizeof(rsp)) < 0) -+ if (send_encrypted_data (ctx, server->data_fd, &rsp, sizeof(rsp)) < 0) - { - seaf_warning ("Send auth response: failed to send data.\n"); - ret = -1; - goto out; - } - -- if (send_encrypted_data_frame_end (&ctx, server->data_fd) < 0) { -+ if (send_encrypted_data_frame_end (ctx, server->data_fd) < 0) { - seaf_warning ("Send auth response: failed to end.\n"); - ret = -1; - goto out; - } - - out: -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - return ret; - } - -@@ -308,7 +308,7 @@ - send_block_response_header (BlockTxServer *server, int status) - { - ResponseHeader header; -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - int ret = 0; - - header.status = htonl (status); -@@ -325,7 +325,7 @@ - goto out; - } - -- if (send_encrypted_data (&ctx, server->data_fd, -+ if (send_encrypted_data (ctx, server->data_fd, - &header, sizeof(header)) < 0) - { - seaf_warning ("Send block response header %s: failed to send data.\n", -@@ -334,7 +334,7 @@ - goto out; - } - -- if (send_encrypted_data_frame_end (&ctx, server->data_fd) < 0) { -+ if (send_encrypted_data_frame_end (ctx, server->data_fd) < 0) { - seaf_warning ("Send block response header %s: failed to end.\n", - server->curr_block_id); - ret = -1; -@@ -342,7 +342,7 @@ - } - - out: -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - return ret; - } - -@@ -447,7 +447,7 @@ - { - int n, remain; - int ret = 0; -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - char send_buf[SEND_BUFFER_SIZE]; - - if (server->version == 1) -@@ -472,7 +472,7 @@ - goto out; - } - -- if (send_encrypted_data (&ctx, server->data_fd, send_buf, n) < 0) { -+ if (send_encrypted_data (ctx, server->data_fd, send_buf, n) < 0) { - seaf_warning ("Send block %s: failed to send data.\n", block_id); - ret = -1; - goto out; -@@ -481,7 +481,7 @@ - remain -= n; - } - -- if (send_encrypted_data_frame_end (&ctx, server->data_fd) < 0) { -+ if (send_encrypted_data_frame_end (ctx, server->data_fd) < 0) { - seaf_warning ("Send block %s: failed to end.\n", block_id); - ret = -1; - goto out; -@@ -490,7 +490,7 @@ - seaf_debug ("Send block %s done.\n", server->curr_block_id); - - out: -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - return ret; - } - -@@ -661,7 +661,7 @@ - } - - if (server->parser.enc_init) -- EVP_CIPHER_CTX_cleanup (&server->parser.ctx); -+ EVP_CIPHER_CTX_free (server->parser.ctx); - - evbuffer_free (server->recv_buf); - evutil_closesocket (server->data_fd); -diff -ru seafile-server-v6.0.10/server/gc/fsck.c seafile-server/server/gc/fsck.c ---- seafile-server-v6.0.10/server/gc/fsck.c 2017-05-14 09:17:18.419062697 +0200 -+++ seafile-server/server/gc/fsck.c 2017-05-14 11:27:49.779564782 +0200 -@@ -682,7 +682,7 @@ - char buf[64 * 1024]; - int n; - int remain; -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - char *dec_out; - int dec_out_len; - gboolean ret = TRUE; -@@ -704,7 +704,7 @@ - return FALSE; - } - -- if (seafile_decrypt_init (&ctx, crypt->version, -+ if (seafile_decrypt_init (ctx, crypt->version, - crypt->key, crypt->iv) < 0) { - seaf_warning ("Failed to init decrypt.\n"); - ret = FALSE; -@@ -730,7 +730,7 @@ - break; - } - -- if (EVP_DecryptUpdate (&ctx, -+ if (EVP_DecryptUpdate (ctx, - (unsigned char *)dec_out, - &dec_out_len, - (unsigned char *)buf, -@@ -750,7 +750,7 @@ - } - - if (remain == 0) { -- if (EVP_DecryptFinal_ex (&ctx, -+ if (EVP_DecryptFinal_ex (ctx, - (unsigned char *)dec_out, - &dec_out_len) == 0) { - seaf_warning ("Failed to decrypt block %s .\n", block_id); -@@ -772,7 +772,7 @@ - g_free (dec_out); - } - -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - - out: - g_free (bmd); -diff -ru seafile-server-v6.0.10/server/pack-dir.c seafile-server/server/pack-dir.c ---- seafile-server-v6.0.10/server/pack-dir.c 2017-05-14 09:17:18.419062697 +0200 -+++ seafile-server/server/pack-dir.c 2017-05-14 12:47:35.324359677 +0200 -@@ -86,7 +86,7 @@ - BlockMetadata *bmd = NULL; - char *blk_id = NULL; - uint32_t remain = 0; -- EVP_CIPHER_CTX ctx; -+ EVP_CIPHER_CTX *ctx; - gboolean enc_init = FALSE; - char *dec_out = NULL; - int dec_out_len = -1; -@@ -196,7 +196,7 @@ - goto out; - } - -- int r = EVP_DecryptUpdate (&ctx, -+ int r = EVP_DecryptUpdate (ctx, - (unsigned char *)dec_out, - &dec_out_len, - (unsigned char *)buf, -@@ -221,7 +221,7 @@ - /* If it's the last piece of a block, call decrypt_final() - * to decrypt the possible partial block. */ - if (remain == 0) { -- r = EVP_DecryptFinal_ex (&ctx, -+ r = EVP_DecryptFinal_ex (ctx, - (unsigned char *)dec_out, - &dec_out_len); - if (r != 1) { -@@ -264,7 +264,7 @@ - seaf_block_manager_block_handle_free(seaf->block_mgr, handle); - } - if (crypt != NULL && enc_init) -- EVP_CIPHER_CTX_cleanup (&ctx); -+ EVP_CIPHER_CTX_free (ctx); - g_free (dec_out); - - return ret; |