diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-06-12 01:58:10 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2012-06-13 21:27:51 +0200 |
commit | 93546d981cc14722e6ab1c00c1fd66908bbe8ba5 (patch) | |
tree | bf84028cc5f0653a012641a5d3135c4c2aa186c2 | |
parent | e7453569450bd440b7331e6519d947fe6665ae0b (diff) | |
download | tdebase-93546d981cc14722e6ab1c00c1fd66908bbe8ba5.tar.gz tdebase-93546d981cc14722e6ab1c00c1fd66908bbe8ba5.zip |
Only request root access in drkonqui if yama ptrace setting requires it
This resolves Bug 1005
(cherry picked from commit 30461576d34ece5d06626f217a034dbfaa353c4d)
-rw-r--r-- | drkonqi/backtrace.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drkonqi/backtrace.cpp b/drkonqi/backtrace.cpp index 36a0fc8ff..7fa052e76 100644 --- a/drkonqi/backtrace.cpp +++ b/drkonqi/backtrace.cpp @@ -107,11 +107,31 @@ void BackTrace::start() ::fsync(handle); m_temp_cmd->close(); + // determine if yama has been used to prevent ptrace as normal user + bool need_root_access = false; + TQFile yamactl("/proc/sys/kernel/yama/ptrace_scope"); + if (yamactl.exists()) { + if (yamactl.open(IO_ReadOnly)) { + TQTextStream stream(&yamactl); + TQString line; + line = stream.readLine(); + if (line.toInt() != 0) { + need_root_access = true; + } + yamactl.close(); + } + } + // start the debugger m_proc = new KProcess; m_proc->setUseShell(true); - *m_proc << "kdesu -t --comment \"" << i18n("Administrative access is required to generate a backtrace") << "\" -c \"" << m_temp_cmd->name() << "\""; + if (need_root_access == false) { + *m_proc << m_temp_cmd->name(); + } + else { + *m_proc << "kdesu -t --comment \"" << i18n("Administrative access is required to generate a backtrace") << "\" -c \"" << m_temp_cmd->name() << "\""; + } connect(m_proc, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), TQT_SLOT(slotReadInput(KProcess*, char*, int))); |