Merge lp://qastaging/~bratsche/xsplash/setuid into lp://qastaging/xsplash

Proposed by Cody Russell
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~bratsche/xsplash/setuid
Merge into: lp://qastaging/xsplash
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~bratsche/xsplash/setuid
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Martin Pitt Approve
Canonical Desktop Experience Team Pending
Review via email: mp+10748@code.qastaging.launchpad.net

Commit message

setuid fu

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

"NULL" is a little easier to read instead of (struct passwd*)0

+1

review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build/autotools/libtool.m4'
2--- build/autotools/libtool.m4 2009-08-20 09:38:11 +0000
3+++ build/autotools/libtool.m4 2009-08-26 15:11:53 +0000
4@@ -4261,6 +4261,9 @@
5 openbsd*)
6 with_gnu_ld=no
7 ;;
8+ linux* | k*bsd*-gnu)
9+ _LT_TAGVAR(link_all_deplibs, $1)=no
10+ ;;
11 esac
12
13 _LT_TAGVAR(ld_shlibs, $1)=yes
14
15=== modified file 'src/Makefile.am'
16--- src/Makefile.am 2009-08-21 19:20:19 +0000
17+++ src/Makefile.am 2009-08-26 15:11:53 +0000
18@@ -41,6 +41,7 @@
19 -I$(srcdir) \
20 -I$(top_srcdir) \
21 -DDATADIR=\""$(datadir)"\" \
22+ -DXSPLASH_USER=\""$(RUN_AS_USER)"\" \
23 -DG_DISABLE_DEPRECATED \
24 -DGDK_PIXBUF_DISABLE_DEPRECATED \
25 -DGDK_DISABLE_DEPRECATED \
26@@ -71,22 +72,3 @@
27 gtytypebuiltins.h \
28 dbus-xsplash-server.h \
29 stamp-gtytypebuiltins.h
30-
31-install-binPROGRAMS: $(bin_PROGRAMS)
32- @$(NORMAL_INSTALL)
33- test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
34- @list='$(bin_PROGRAMS)'; for p in $$list; do \
35- p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
36- if test -f $$p \
37- || test -f $$p1 \
38- ; then \
39- f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
40- if [ $(RUN_AS_USER) != "root" ] ; then \
41- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) -o $(RUN_AS_USER) -m 4700 '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
42- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) -o $(RUN_AS_USER) -m 4700 "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
43- else \
44- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
45- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
46- fi; \
47- else :; fi; \
48- done
49
50=== modified file 'src/xsplash.c'
51--- src/xsplash.c 2009-08-25 17:28:09 +0000
52+++ src/xsplash.c 2009-08-26 15:11:53 +0000
53@@ -20,6 +20,8 @@
54 #include <stdlib.h>
55 #include <math.h>
56 #include <string.h>
57+#include <unistd.h>
58+#include <pwd.h>
59
60 #include <gtk/gtk.h>
61 #include <gdk/gdkkeysyms.h>
62@@ -639,6 +641,19 @@
63 DBusGConnection *system_bus;
64 DBusGProxy *bus_proxy;
65 guint nameret = 0;
66+ struct passwd *pwd;
67+ uid_t uid;
68+
69+ pwd = getpwnam (XSPLASH_USER);
70+ if (pwd == (struct passwd*)0)
71+ {
72+ g_error ("Unknown user: %s", XSPLASH_USER);
73+ return 1;
74+ }
75+
76+ uid = pwd->pw_uid;
77+
78+ setuid (uid);
79
80 context = g_option_context_new ("xsplash");
81 g_option_context_add_main_entries (context,

Subscribers

People subscribed via source and target branches