!63 fix bugfix-Forbidden-non-root-user-to-clear-history.patch
From: @panxh_purple Reviewed-by: @overweight Signed-off-by: @overweight
This commit is contained in:
commit
f7d651b0b0
@ -1,6 +1,6 @@
|
|||||||
Name: bash
|
Name: bash
|
||||||
Version: 5.0
|
Version: 5.0
|
||||||
Release: 17
|
Release: 18
|
||||||
Summary: It is the Bourne Again Shell
|
Summary: It is the Bourne Again Shell
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
URL: https://www.gnu.org/software/bash
|
URL: https://www.gnu.org/software/bash
|
||||||
@ -132,6 +132,9 @@ make check
|
|||||||
%exclude %{_infodir}/dir
|
%exclude %{_infodir}/dir
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Aug 12 2022 panxiaohe <panxh.life@foxmail.com> - 5.0-18
|
||||||
|
- fix bugfix-Forbidden-non-root-user-to-clear-history.patch
|
||||||
|
|
||||||
* Sat May 29 2021 licihua<licihua@huawei.com> - 5.0-17
|
* Sat May 29 2021 licihua<licihua@huawei.com> - 5.0-17
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
@ -4,23 +4,65 @@ Date: Mon, 2 Sep 2019 22:30:32 -0400
|
|||||||
Subject: [PATCH] bugfix-Forbidden-non-root-user-to-clear-history
|
Subject: [PATCH] bugfix-Forbidden-non-root-user-to-clear-history
|
||||||
|
|
||||||
---
|
---
|
||||||
lib/readline/history.c | 4 ++++
|
bashhist.c | 5 +++--
|
||||||
1 file changed, 4 insertions(+)
|
lib/readline/history.c | 7 ++++++-
|
||||||
|
lib/readline/history.h | 2 +-
|
||||||
|
3 files changed, 10 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/bashhist.c b/bashhist.c
|
||||||
|
index d2155dc..e61bde6 100644
|
||||||
|
--- a/bashhist.c
|
||||||
|
+++ b/bashhist.c
|
||||||
|
@@ -345,8 +345,9 @@ load_history ()
|
||||||
|
void
|
||||||
|
bash_clear_history ()
|
||||||
|
{
|
||||||
|
- clear_history ();
|
||||||
|
- history_lines_this_session = 0;
|
||||||
|
+ int ret = clear_history ();
|
||||||
|
+ if (ret == 0)
|
||||||
|
+ history_lines_this_session = 0;
|
||||||
|
/* XXX - reset history_lines_read_from_file? */
|
||||||
|
}
|
||||||
|
|
||||||
diff --git a/lib/readline/history.c b/lib/readline/history.c
|
diff --git a/lib/readline/history.c b/lib/readline/history.c
|
||||||
index 67158b1..8bc6a00 100644
|
index 67158b1..545c675 100644
|
||||||
--- a/lib/readline/history.c
|
--- a/lib/readline/history.c
|
||||||
+++ b/lib/readline/history.c
|
+++ b/lib/readline/history.c
|
||||||
@@ -594,6 +594,10 @@ void
|
@@ -590,9 +590,13 @@ history_is_stifled (void)
|
||||||
|
return (history_stifled);
|
||||||
|
}
|
||||||
|
|
||||||
|
-void
|
||||||
|
+int
|
||||||
clear_history (void)
|
clear_history (void)
|
||||||
{
|
{
|
||||||
register int i;
|
|
||||||
+ uid_t uid = getuid();
|
+ uid_t uid = getuid();
|
||||||
+
|
+
|
||||||
+ if (uid)
|
+ if (uid)
|
||||||
+ return;
|
+ return 1;
|
||||||
|
register int i;
|
||||||
|
|
||||||
/* This loses because we cannot free the data. */
|
/* This loses because we cannot free the data. */
|
||||||
for (i = 0; i < history_length; i++)
|
@@ -604,4 +608,5 @@ clear_history (void)
|
||||||
|
|
||||||
|
history_offset = history_length = 0;
|
||||||
|
history_base = 1; /* reset history base to default */
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
diff --git a/lib/readline/history.h b/lib/readline/history.h
|
||||||
|
index cc3de29..78f8f52 100644
|
||||||
|
--- a/lib/readline/history.h
|
||||||
|
+++ b/lib/readline/history.h
|
||||||
|
@@ -110,7 +110,7 @@ extern histdata_t free_history_entry PARAMS((HIST_ENTRY *));
|
||||||
|
extern HIST_ENTRY *replace_history_entry PARAMS((int, const char *, histdata_t));
|
||||||
|
|
||||||
|
/* Clear the history list and start over. */
|
||||||
|
-extern void clear_history PARAMS((void));
|
||||||
|
+extern int clear_history PARAMS((void));
|
||||||
|
|
||||||
|
/* Stifle the history list, remembering only MAX number of entries. */
|
||||||
|
extern void stifle_history PARAMS((int));
|
||||||
--
|
--
|
||||||
2.19.1
|
2.27.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user