diff --git a/0001-Mark-global-variable-as-extern.patch b/0001-Mark-global-variable-as-extern.patch new file mode 100644 index 0000000..99f9c86 --- /dev/null +++ b/0001-Mark-global-variable-as-extern.patch @@ -0,0 +1,85 @@ +From 6b69a534863741734b550daf43b5d06c8d899b9a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= +Date: Thu, 23 Jan 2020 00:25:50 +0100 +Subject: [PATCH] Mark global variable as extern +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GCC now defaults to -fno-common. As a result, global variable accesses +are more efficient on various targets. In C, global variables with +multiple tentative definitions now result in linker errors. + +Fix #532 + +Signed-off-by: Robert-André Mauchin +--- + globals.c | 40 ++++++++++++++++++++++++++++++++++++++++ + process.h | 4 ++-- + 2 files changed, 42 insertions(+), 2 deletions(-) + create mode 100644 globals.c + +diff --git a/globals.c b/globals.c +new file mode 100644 +index 0000000..59e9c30 +--- /dev/null ++++ b/globals.c +@@ -0,0 +1,40 @@ ++/* ++ * ++ * Copyright (C) 2014-2018 LastPass. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * In addition, as a special exception, the copyright holders give ++ * permission to link the code of portions of this program with the ++ * OpenSSL library under certain conditions as described in each ++ * individual source file, and distribute linked combinations ++ * including the two. ++ * ++ * You must obey the GNU General Public License in all respects ++ * for all of the code used other than OpenSSL. If you modify ++ * file(s) with this exception, you may extend this exception to your ++ * version of the file(s), but you are not obligated to do so. If you ++ * do not wish to do so, delete this exception statement from your ++ * version. If you delete this exception statement from all source ++ * files in the program, then also delete it here. ++ * ++ * See LICENSE.OpenSSL for more details regarding this exception. ++ */ ++ ++#include "process.h" ++ ++/* Globals */ ++int ARGC; ++char **ARGV; +diff --git a/process.h b/process.h +index 58c2480..4cc2cf4 100644 +--- a/process.h ++++ b/process.h +@@ -4,8 +4,8 @@ + #include + #include + +-int ARGC; +-char **ARGV; ++extern int ARGC; ++extern char **ARGV; + + void process_set_name(const char *name); + void process_disable_ptrace(void); +-- +2.24.1 + diff --git a/lastpass-cli-1.3.1-remove_reallocarray.patch b/lastpass-cli-1.3.1-remove_reallocarray.patch new file mode 100644 index 0000000..bd610f7 --- /dev/null +++ b/lastpass-cli-1.3.1-remove_reallocarray.patch @@ -0,0 +1,34 @@ +diff -up lastpass-cli-1.3.1/util.c.remove_reallocarray lastpass-cli-1.3.1/util.c +--- lastpass-cli-1.3.1/util.c.remove_reallocarray 2018-05-17 11:42:27.000000000 +0200 ++++ lastpass-cli-1.3.1/util.c 2018-07-03 20:14:34.347554160 +0200 +@@ -196,19 +196,6 @@ void *xrealloc(void *ptr, size_t size) + return ret; + die_errno("realloc(%p, %zu)", ptr, size); + } +-void *reallocarray(void *optr, size_t nmemb, size_t size) +-{ +- if (!size || !nmemb) { +- errno = ENOMEM; +- return NULL; +- } +- if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && +- nmemb > 0 && SIZE_MAX / nmemb < size) { +- errno = ENOMEM; +- return NULL; +- } +- return realloc(optr, size * nmemb); +-} + void *xreallocarray(void *ptr, size_t nmemb, size_t size) + { + void *ret = reallocarray(ptr, nmemb, size); +diff -up lastpass-cli-1.3.1/util.h.remove_reallocarray lastpass-cli-1.3.1/util.h +--- lastpass-cli-1.3.1/util.h.remove_reallocarray 2018-05-17 11:42:27.000000000 +0200 ++++ lastpass-cli-1.3.1/util.h 2018-07-03 20:14:13.644661155 +0200 +@@ -64,7 +64,6 @@ bool ask_yes_no(bool default_yes, const + void *xmalloc(size_t size); + void *xcalloc(size_t nmemb, size_t size); + void *xrealloc(void *ptr, size_t size); +-void *reallocarray(void *ptr, size_t nmemb, size_t size); + void *xreallocarray(void *ptr, size_t nmemb, size_t size); + + void *xstrdup(const char *str); diff --git a/lastpass-cli-1.3.3.tar.gz b/lastpass-cli-1.3.3.tar.gz new file mode 100644 index 0000000..c12bc6e Binary files /dev/null and b/lastpass-cli-1.3.3.tar.gz differ diff --git a/lastpass-cli.spec b/lastpass-cli.spec new file mode 100644 index 0000000..4a1d8f0 --- /dev/null +++ b/lastpass-cli.spec @@ -0,0 +1,48 @@ +Name: lastpass-cli +Version: 1.3.3 +Release: 1 +Summary: Command line interface to LastPass.com +License: GPLv2 +URL: https://github.com/LastPass/lastpass-cli +Source0: %{url}/archive/v%{version}/lastpass-cli-%{version}.tar.gz +Patch0: lastpass-cli-1.3.1-remove_reallocarray.patch +Patch1: 0001-Mark-global-variable-as-extern.patch +BuildRequires: cmake gcc gcc-c++ openssl-devel libxml2-devel libcurl-devel asciidoc +Requires: pinentry xclip +%description +A command line interface to LastPass.com. + +%prep +%autosetup -p1 + +%build +%cmake . +%make_build + +%install +%make_install install-doc +install -Dpm0644 contrib/lpass_bash_completion \ + %{buildroot}%{_datadir}/bash-completion/completions/lpass-completion.bash +install -Dpm0644 contrib/completions-lpass.fish \ + %{buildroot}%{_datadir}/fish/vendor_functions.d/lpass.fish +install -Dpm0644 contrib/lpass_zsh_completion \ + %{buildroot}%{_datadir}/zsh/site-functions/_lpass + +%files +%license COPYING +%license LICENSE.OpenSSL +%doc README.md +%doc CONTRIBUTING +%doc contrib/examples +%{_bindir}/lpass +%{_mandir}/man1/lpass.1.* +%dir %{_datadir}/bash-completion/completions +%{_datadir}/bash-completion/completions/lpass-completion.bash +%dir %{_datadir}/fish/vendor_functions.d +%{_datadir}/fish/vendor_functions.d/lpass.fish +%dir %{_datadir}/zsh/site-functions +%{_datadir}/zsh/site-functions/_lpass + +%changelog +* Tue Sep 7 2021 zhengyaohui - 1.3.3-1 +- package init