public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: swagiaal@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: swagiaal: root can debug all processes fix for bz 6392.
Date: Thu, 10 Apr 2008 15:48:00 -0000	[thread overview]
Message-ID: <20080410154814.15030.qmail@sourceware.org> (raw)

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 <swagiaal@redhat.com>
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  <swagiaal@redhat.com>
    +
    +	* 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  <swagiaal@redhat.com>
+
+	* GuiProc.java: updated isOwned() to allow all processes
+	for root.
+
 2008-04-01  Andrew Cagney  <cagney@redhat.com>
 
 	* 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


                 reply	other threads:[~2008-04-10 15:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080410154814.15030.qmail@sourceware.org \
    --to=swagiaal@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).