From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15105 invoked by alias); 10 Apr 2008 15:48:15 -0000 Received: (qmail 15049 invoked by uid 9561); 10 Apr 2008 15:48:14 -0000 Date: Thu, 10 Apr 2008 15:48:00 -0000 Message-ID: <20080410154814.15030.qmail@sourceware.org> From: swagiaal@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: swagiaal: root can debug all processes fix for bz 6392. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: c0e8255a2478510d01a4031eb8be43a21becfcee X-Git-Newrev: 935aa9bdc30ce8d177ee9439931bf941e30b6d1a Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q2/txt/msg00076.txt.bz2 The branch, master has been updated via 935aa9bdc30ce8d177ee9439931bf941e30b6d1a (commit) from c0e8255a2478510d01a4031eb8be43a21becfcee (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 935aa9bdc30ce8d177ee9439931bf941e30b6d1a Author: Sami Wagiaalla Date: Thu Apr 10 11:46:02 2008 -0400 swagiaal: root can debug all processes fix for bz 6392. frysk-gui/frysk/gui/monitor/ChangeLog +2008-04-10 Sami Wagiaalla + + * GuiProc.java: updated isOwned() to allow all processes + for root. + ----------------------------------------------------------------------- Summary of changes: frysk-gui/frysk/gui/monitor/ChangeLog | 5 ++ frysk-gui/frysk/gui/monitor/GuiProc.java | 76 ++++++++++++++---------------- 2 files changed, 40 insertions(+), 41 deletions(-) First 500 lines of diff: diff --git a/frysk-gui/frysk/gui/monitor/ChangeLog b/frysk-gui/frysk/gui/monitor/ChangeLog index 3670276..a857f69 100644 --- a/frysk-gui/frysk/gui/monitor/ChangeLog +++ b/frysk-gui/frysk/gui/monitor/ChangeLog @@ -1,3 +1,8 @@ +2008-04-10 Sami Wagiaalla + + * GuiProc.java: updated isOwned() to allow all processes + for root. + 2008-04-01 Andrew Cagney * eventviewer/Event.java: Update to match PrintStackOptions. diff --git a/frysk-gui/frysk/gui/monitor/GuiProc.java b/frysk-gui/frysk/gui/monitor/GuiProc.java index 213e1c7..6c54c2a 100644 --- a/frysk-gui/frysk/gui/monitor/GuiProc.java +++ b/frysk-gui/frysk/gui/monitor/GuiProc.java @@ -50,10 +50,7 @@ package frysk.gui.monitor; import java.io.File; import java.util.HashMap; -import java.util.logging.Level; -import java.util.logging.Logger; -import frysk.gui.Gui; import frysk.proc.Manager; import frysk.proc.Proc; @@ -66,7 +63,6 @@ public class GuiProc extends GuiCoreObjectWrapper{ public static final String PATH_NOT_FOUND = "*Could not retrieve path*"; private Proc proc; - private Logger errorLog = Logger.getLogger (Gui.ERROR_LOG_ID); private String executableName; private String executablePath; @@ -153,44 +149,42 @@ public class GuiProc extends GuiCoreObjectWrapper{ } } - /** - * Returns wether this user owns this process - * or not. - * Checks uid and gid. - * Checks if the given process is this frysk process if so - * returns false. - * Also checks that the user has acces to /pro/exe if not - * false is returned. - * Checks if this process is the init process, return false - * if so. - * @return boolean; true of the user owns this - * process, and can debug it false otherwise; - */ - public boolean isOwned(){ - boolean owned = false; - if(this.getProc().getPid() == 1){ - return false; - } - try { - owned = (this.proc.getUID() == Manager.host.getSelf().getUID() || - this.proc.getGID() == Manager.host.getSelf().getGID()); - - if (owned) - if (this.proc.getPid() == Manager.host.getSelf().getPid()) - owned = false; - - try{ - proc.getExeFile().getSysRootedPath(); - }catch(Exception e){ - owned = false; - return owned; - } - } catch (Exception e) { - errorLog.log(Level.WARNING, "GuiProc.isOwned: Error checking host/proc ownership",e); - } - - return owned; + /** + * Returns wether this user owns this process or not. + * + * - Checks uid and * gid. + * - Checks if the given process is this frysk process if so returns false. + * - Also checks that the user has acces to /pro/exe if not false is returned. + * - Checks if this process is the init process, return false if so. + * + * @return boolean; true of the user owns this process, and can debug it + * false otherwise; + */ + public boolean isOwned() { + if (this.getProc().getPid() == 1) { + return false; + } + + if (this.proc.getPid() == Manager.host.getSelf().getPid()) { + return false; } + + if (Manager.host.getSelf().getUID() == 0) { + return true; + } + + try { + proc.getExeFile().getSysRootedPath(); + } catch (Exception e) { + return false; + } + + if ((this.proc.getUID() == Manager.host.getSelf().getUID() || this.proc.getGID() == Manager.host.getSelf().getGID())) { + return true; + } + + return false; + } public String getFullExecutablePath(){ this.setExecutablePath(); hooks/post-receive -- frysk system monitor/debugger