summaryrefslogtreecommitdiffstats
path: root/drkonqi
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-12 01:58:10 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-12 01:58:10 -0500
commit30461576d34ece5d06626f217a034dbfaa353c4d (patch)
tree424f77819fa68e22c3e40273cb24e3500a7e51fb /drkonqi
parent59ee4f6630e6ed6b2712600a88d3ba9ce383620b (diff)
downloadtdebase-30461576d34ece5d06626f217a034dbfaa353c4d.tar.gz
tdebase-30461576d34ece5d06626f217a034dbfaa353c4d.zip
Only request root access in drkonqui if yama ptrace setting requires it
This resolves Bug 1005
Diffstat (limited to 'drkonqi')
-rw-r--r--drkonqi/backtrace.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/drkonqi/backtrace.cpp b/drkonqi/backtrace.cpp
index e6a4de578..2688dec5f 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 << "tdesu -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 << "tdesu -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)));