weston-launch logging and security (Re: [PATCH weston] weston-launch: Print explanation of why we failed to open the device)

2013-05-21 Thread Pekka Paalanen
On Mon, 20 May 2013 16:56:47 -0400
Kristian Høgsberg hoegsb...@gmail.com wrote:

 On Mon, May 20, 2013 at 04:55:10PM +0100, Rob Bradford wrote:
  From: Rob Bradford r...@linux.intel.com
 
 That's better, though I wonder if we should instead let weston log the
 error message using weston_log()... committed this for now.

That was my first thought, too. Just send errno from weston-launch,
or/and message string?

Would be nice to have all that in weston's log.

What about syslog in addition? weston-launch is a suid-root program,
so might be useful to log into system log for security purposes, no?
PAM is writing its own stuff to the system log on behalf of
weston-launch already.

Btw. if we have a mechanism for weston to load custom plugins, then
those plugins could ask weston-launch to open any file with root
permissions, right? Do we have any restrictions in opening or plugin
loading yet?


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] weston-launch: Print explanation of why we failed to open the device

2013-05-20 Thread Rob Bradford
From: Rob Bradford r...@linux.intel.com

---
 src/weston-launch.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/weston-launch.c b/src/weston-launch.c
index 89c3c5a..42b2506 100644
--- a/src/weston-launch.c
+++ b/src/weston-launch.c
@@ -320,12 +320,17 @@ handle_open(struct weston_launch *wl, struct msghdr *msg, 
ssize_t len)
goto err0;
 
fd = open(message-path, message-flags);
-   if (fd  0)
+   if (fd  0) {
+   fprintf(stderr, Error opening device %s: %m\n,
+   message-path);
goto err0;
+   }
 
if (major(s.st_rdev) != INPUT_MAJOR) {
close(fd);
fd = -1;
+   fprintf(stderr, Device %s is not an input device\n,
+   message-path);
goto err0;
}
 
-- 
1.8.1.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] weston-launch: Print explanation of why we failed to open the device

2013-05-20 Thread Kristian Høgsberg
On Mon, May 20, 2013 at 04:55:10PM +0100, Rob Bradford wrote:
 From: Rob Bradford r...@linux.intel.com

That's better, though I wonder if we should instead let weston log the
error message using weston_log()... committed this for now.

Kristian

 ---
  src/weston-launch.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/src/weston-launch.c b/src/weston-launch.c
 index 89c3c5a..42b2506 100644
 --- a/src/weston-launch.c
 +++ b/src/weston-launch.c
 @@ -320,12 +320,17 @@ handle_open(struct weston_launch *wl, struct msghdr 
 *msg, ssize_t len)
   goto err0;
  
   fd = open(message-path, message-flags);
 - if (fd  0)
 + if (fd  0) {
 + fprintf(stderr, Error opening device %s: %m\n,
 + message-path);
   goto err0;
 + }
  
   if (major(s.st_rdev) != INPUT_MAJOR) {
   close(fd);
   fd = -1;
 + fprintf(stderr, Device %s is not an input device\n,
 + message-path);
   goto err0;
   }
  
 -- 
 1.8.1.4
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel