author | Wolfgang Rosenauer <wr@rosenauer.org> |
Tue, 23 Jan 2018 22:04:56 +0100 | |
branch | firefox58 |
changeset 1025 | 108497b98e44 |
parent 59 | 604517bb16d8 |
child 174 | b3f909e83302 |
permissions | -rw-r--r-- |
24
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1 |
From: various contributors |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2 |
Subject: replace gconf backend with more complete mapping for lockdown feature |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
4 |
diff --git a/extensions/pref/Makefile.in b/extensions/pref/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
5 |
--- a/extensions/pref/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
6 |
+++ b/extensions/pref/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
7 |
@@ -40,13 +40,13 @@ DEPTH = ../.. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
8 |
topsrcdir = @top_srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
9 |
srcdir = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
10 |
VPATH = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
11 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
12 |
include $(DEPTH)/config/autoconf.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
13 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
14 |
DIRS = autoconfig |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
15 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
16 |
-ifdef MOZ_ENABLE_GTK2 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
17 |
+ifdef MOZ_ENABLE_GCONF |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
18 |
DIRS += system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
19 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
20 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
21 |
include $(topsrcdir)/config/rules.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
22 |
diff --git a/extensions/pref/system-pref/src/Makefile.in b/extensions/pref/system-pref/src/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
23 |
--- a/extensions/pref/system-pref/src/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
24 |
+++ b/extensions/pref/system-pref/src/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
25 |
@@ -38,47 +38,41 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
26 |
DEPTH = ../../../.. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
27 |
topsrcdir = @top_srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
28 |
srcdir = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
29 |
VPATH = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
30 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
31 |
include $(DEPTH)/config/autoconf.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
32 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
33 |
MODULE = system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
34 |
-LIBRARY_NAME = system-pref_s |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
35 |
+LIBRARY_NAME = system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
36 |
ifneq ($(OS_ARCH),WINNT) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
37 |
SHORT_LIBNAME = syspref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
38 |
endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
39 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
40 |
# We want to force the creation of a static lib. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
41 |
-FORCE_STATIC_LIB = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
42 |
-LIBXUL_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
43 |
+#FORCE_STATIC_LIB = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
44 |
+LIBXUL_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
45 |
+MODULE_NAME = nsSystemPrefModule |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
46 |
+IS_COMPONENT = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
47 |
+EXPORT_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
48 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
49 |
REQUIRES = xpcom \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
50 |
string \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
51 |
embedcomponents \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
52 |
pref \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
53 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
54 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
55 |
-ifdef MOZ_ENABLE_GTK2 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
56 |
-DIRS = gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
57 |
-endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
58 |
+CPPSRCS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
59 |
+ nsSystemPref.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
60 |
+ nsSystemPrefFactory.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
61 |
+ $(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
62 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
63 |
EXTRA_DSO_LDOPTS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
64 |
- -L$(DIST)/bin \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
65 |
$(MOZ_COMPONENT_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
66 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
67 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
68 |
-CPPSRCS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
69 |
- nsSystemPref.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
70 |
- $(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
71 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
72 |
EXPORTS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
73 |
- nsSystemPrefLog.h \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
74 |
+ nsISystemPrefService.h \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
75 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
76 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
77 |
include $(topsrcdir)/config/rules.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
78 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
79 |
-ifdef MOZ_ENABLE_GTK2 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
80 |
-INCLUDES += \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
81 |
- -I$(srcdir)/gconf \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
82 |
- $(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
83 |
-endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
84 |
diff --git a/extensions/pref/system-pref/src/gconf/Makefile.in b/extensions/pref/system-pref/src/gconf/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
85 |
--- a/extensions/pref/system-pref/src/gconf/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
86 |
+++ b/extensions/pref/system-pref/src/gconf/Makefile.in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
87 |
@@ -37,50 +37,37 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
88 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
89 |
DEPTH = ../../../../.. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
90 |
topsrcdir = @top_srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
91 |
srcdir = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
92 |
VPATH = @srcdir@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
93 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
94 |
include $(DEPTH)/config/autoconf.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
95 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
96 |
-MODULE = system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
97 |
-LIBRARY_NAME = system-pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
98 |
-LIBXUL_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
99 |
+MODULE = system-pref-gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
100 |
+LIBRARY_NAME = system-pref-gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
101 |
+IS_COMPONENT = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
102 |
+MODULE_NAME = nsSystemPrefServiceModule |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
103 |
+FORCE_SHARED_LIB = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
104 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
105 |
REQUIRES = pref \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
106 |
string \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
107 |
xpcom \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
108 |
- embedcomponents \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
109 |
+ necko \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
110 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
111 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
112 |
CPPSRCS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
113 |
nsSystemPrefService.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
114 |
- nsSystemPrefFactory.cpp \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
115 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
116 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
117 |
-SHARED_LIBRARY_LIBS = ../libsystem-pref_s.a |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
118 |
+OS_INCLUDES += $(MOZ_GCONF_CFLAGS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
119 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
120 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
121 |
EXTRA_DSO_LDOPTS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
122 |
- -L$(DIST)/bin \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
123 |
- $(MOZ_COMPONENT_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
124 |
- $(MOZ_GTK2_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
125 |
+ $(XPCOM_GLUE_LDOPTS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
126 |
+ $(MOZ_GCONF_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
127 |
+ $(NSPR_LIBS) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
128 |
$(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
129 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
130 |
-EXPORT_LIBRARY = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
131 |
-IS_COMPONENT = 1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
132 |
-MODULE_NAME = nsSystemPrefModule |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
133 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
134 |
-EXPORTS = \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
135 |
- nsSystemPrefService.h \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
136 |
- $(NULL) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
137 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
138 |
include $(topsrcdir)/config/rules.mk |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
139 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
140 |
-CFLAGS += $(MOZ_GTK2_CFLAGS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
141 |
-CXXFLAGS += $(MOZ_GTK2_CFLAGS) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
142 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
143 |
-LOCAL_INCLUDES = -I$(srcdir)/.. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
144 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
145 |
-export:: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
146 |
- $(INSTALL) $(srcdir)/../nsSystemPrefFactory.cpp . |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
147 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
148 |
GARBAGE += nsSystemPrefFactory.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
149 |
diff --git a/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp b/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
150 |
--- a/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
151 |
+++ b/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
152 |
@@ -18,17 +18,19 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
153 |
* The Original Code is mozilla.org code. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
154 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
155 |
* The Initial Developer of the Original Code is Sun Microsystems, Inc. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
156 |
* Portions created by Sun Microsystems are Copyright (C) 2003 Sun |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
157 |
* Microsystems, Inc. All Rights Reserved. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
158 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
159 |
* Original Author: Bolian Yin (bolian.yin@sun.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
160 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
161 |
- * Contributor(s): |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
162 |
+ * Contributor(s): Robert O'Callahan/Novell (rocallahan@novell.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
163 |
+ * Hubert Figuiere (hfiguiere@novell.com) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
164 |
+ * Wolfgang Rosenauer (wr@rosenauer.org) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
165 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
166 |
* Alternatively, the contents of this file may be used under the terms of |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
167 |
* either the GNU General Public License Version 2 or later (the "GPL"), or |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
168 |
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
169 |
* in which case the provisions of the GPL or the LGPL are applicable instead |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
170 |
* of those above. If you wish to allow use of your version of this file only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
171 |
* under the terms of either the GPL or the LGPL, and not to allow others to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
172 |
* use your version of this file under the terms of the NPL, indicate your |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
173 |
@@ -36,299 +38,1300 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
174 |
* and other provisions required by the GPL or the LGPL. If you do not delete |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
175 |
* the provisions above, a recipient may use your version of this file under |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
176 |
* the terms of any one of the NPL, the GPL or the LGPL. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
177 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
178 |
* ***** END LICENSE BLOCK ***** */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
179 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
180 |
#include <glib.h> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
181 |
#include <glib-object.h> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
182 |
+#include <gconf/gconf-client.h> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
183 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
184 |
#include "plstr.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
185 |
#include "nsCOMPtr.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
186 |
-#include "nsIPrefBranch.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
187 |
-#include "nsIPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
188 |
+#include "nsIPref.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
189 |
#include "nsIServiceManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
190 |
#include "nsIObserver.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
191 |
#include "nsWeakReference.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
192 |
+#include "nsIPrefBranch2.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
193 |
+#include "nsDataHashtable.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
194 |
+#include "nsHashKeys.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
195 |
+#include "nsICategoryManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
196 |
+#include "nsIGenericFactory.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
197 |
+#include "nsStringAPI.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
198 |
+#include "nsIPermissionManager.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
199 |
+#include "../nsSystemPref.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
200 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
201 |
-#include "nsString.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
202 |
-#include "nsSystemPrefLog.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
203 |
-#include "nsSystemPrefService.h" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
204 |
+#define NS_SYSTEMPREF_SERVICE_CID \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
205 |
+ { /* {3724e748-b088-4bf8-9298-aad426b66293} */ \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
206 |
+ 0x3724e748, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
207 |
+ 0xb088, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
208 |
+ 0x4bf8, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
209 |
+ { 0x92, 0x98, 0xaa, 0xd4, 0x26, 0xb6, 0x62, 0x93 } \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
210 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
211 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
212 |
-/************************************************************************* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
213 |
- * The strange thing here is that we load the gconf library manually and |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
214 |
- * search the function pointers we need. If that process fails, no gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
215 |
- * support is available in mozilla. The aim is to make mozilla independent |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
216 |
- * on gconf, in both compile time and run time. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
217 |
- ************************************************************************/ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
218 |
+#define NS_SYSTEMPREF_SERVICE_CLASSNAME "System Preferences Platform Service" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
219 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
220 |
-//gconf types |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
221 |
-extern "C" { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
222 |
+NS_DEFINE_STATIC_IID_ACCESSOR(nsISystemPrefService, NS_ISYSTEMPREFSERVICE_IID) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
223 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
224 |
- typedef enum { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
225 |
- GCONF_VALUE_INVALID, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
226 |
- GCONF_VALUE_STRING, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
227 |
- GCONF_VALUE_INT, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
228 |
- GCONF_VALUE_FLOAT, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
229 |
- GCONF_VALUE_BOOL, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
230 |
- GCONF_VALUE_SCHEMA, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
231 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
232 |
+ * We can link directly to the gconf library. If it's not available, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
233 |
+ * this component just won't load and no system prefs will be offered. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
234 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
235 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
236 |
- GCONF_VALUE_LIST, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
237 |
- GCONF_VALUE_PAIR |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
238 |
+#define NUM_ELEM(a) (sizeof(a)/sizeof(a[0])) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
239 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
240 |
- }GConfValueType; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
241 |
+class nsSystemPrefService; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
242 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
243 |
- typedef struct { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
244 |
- GConfValueType type; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
245 |
- }GConfValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
246 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
247 |
+ * List the preferences that have a simple mapping between Moz and gconf. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
248 |
+ * These preferences have the same meaning and their values are |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
249 |
+ * automatically converted. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
250 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
251 |
+struct SimplePrefMapping { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
252 |
+ const char *mozPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
253 |
+ const char *gconfPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
254 |
+ /** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
255 |
+ * If this is PR_FALSE, then we never allow Mozilla to change |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
256 |
+ * this setting. The Mozilla pref will always be locked. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
257 |
+ * If this is PR_TRUE then Mozilla will be allowed to change |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
258 |
+ * the setting --- but only if it is writable in gconf. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
259 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
260 |
+ PRBool allowWritesFromMozilla; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
261 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
262 |
+typedef nsresult (* ComplexGConfPrefChanged)(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
263 |
+ GConfClient* aClient); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
264 |
+typedef nsresult (* ComplexMozPrefChanged)(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
265 |
+ GConfClient* aClient); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
266 |
+struct ComplexGConfPrefMapping { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
267 |
+ const char* gconfPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
268 |
+ ComplexGConfPrefChanged callback; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
269 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
270 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
271 |
- typedef void * (*GConfClientGetDefaultType) (void); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
272 |
- typedef PRBool (*GConfClientGetBoolType) (void *client, const gchar *key, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
273 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
274 |
- typedef gchar* (*GConfClientGetStringType) (void *client, const gchar *key, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
275 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
276 |
- typedef PRInt32 (*GConfClientGetIntType) (void *client, const gchar *key, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
277 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
278 |
- typedef GSList* (*GConfClientGetListType) (void *client, const gchar *key, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
279 |
- GConfValueType list_type, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
280 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
281 |
- typedef void (*GConfClientNotifyFuncType) (void* client, guint cnxn_id, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
282 |
- void *entry, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
283 |
- gpointer user_data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
284 |
- typedef guint (*GConfClientNotifyAddType) (void* client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
285 |
- const gchar* namespace_section, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
286 |
- GConfClientNotifyFuncType func, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
287 |
- gpointer user_data, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
288 |
- GFreeFunc destroy_notify, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
289 |
- GError** err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
290 |
- typedef void (*GConfClientNotifyRemoveType) (void *client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
291 |
- guint cnxn); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
292 |
- typedef void (*GConfClientAddDirType) (void *client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
293 |
- const gchar *dir, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
294 |
- guint8 preload, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
295 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
296 |
- typedef void (*GConfClientRemoveDirType) (void *client, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
297 |
- const gchar *dir, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
298 |
- GError **err); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
299 |
+struct ComplexMozPrefMapping { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
300 |
+ const char* mozPrefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
301 |
+ ComplexMozPrefChanged callback; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
302 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
303 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
304 |
- typedef const char* (*GConfEntryGetKeyType) (const void *entry); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
305 |
- typedef GConfValue* (*GConfEntryGetValueType) (const void *entry); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
306 |
+class nsSystemPrefService : public nsISystemPrefService, nsIPrefBranch |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
307 |
+ { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
308 |
+ public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
309 |
+ NS_DECL_ISUPPORTS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
310 |
+ NS_DECL_NSIPREFBRANCH |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
311 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
312 |
- typedef const char* (*GConfValueGetStringType) (const GConfValue *value); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
313 |
- typedef PRInt32 (*GConfValueGetIntType) (const GConfValue *value); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
314 |
- typedef PRBool (*GConfValueGetBoolType) (const GConfValue *value); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
315 |
+ nsresult Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
316 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
317 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
318 |
- static void gconf_key_listener (void* client, guint cnxn_id, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
319 |
- void *entry, gpointer user_data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
320 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
321 |
+ virtual nsresult LoadSystemPreferences(nsISystemPref* aPrefs); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
322 |
+ virtual nsresult NotifyMozillaPrefChanged(const char* aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
323 |
+ virtual nsresult NotifyUnloadSystemPreferences(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
324 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
325 |
-struct GConfCallbackData |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
326 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
327 |
- GConfProxy *proxy; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
328 |
- void * userData; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
329 |
- PRUint32 atom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
330 |
- PRUint32 notifyId; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
331 |
-}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
332 |
-////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
333 |
-// GConPrxoy is a thin wrapper for easy use of gconf funcs. It loads the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
334 |
-// gconf library and initializes the func pointers for later use. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
335 |
-////////////////////////////////////////////////////////////////////// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
336 |
-class GConfProxy |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
337 |
-{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
338 |
-public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
339 |
- GConfProxy(nsSystemPrefService* aSysPrefService); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
340 |
- ~GConfProxy(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
341 |
- PRBool Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
342 |
+ nsSystemPrefService(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
343 |
+ virtual ~nsSystemPrefService(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
344 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
345 |
- nsresult GetBoolPref(const char *aMozKey, PRBool *retval); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
346 |
- nsresult GetCharPref(const char *aMozKey, char **retval); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
347 |
- nsresult GetIntPref(const char *aMozKey, PRInt32 *retval); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
348 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
349 |
- nsresult NotifyAdd (PRUint32 aAtom, void *aUserData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
350 |
- nsresult NotifyRemove (PRUint32 aAtom, const void *aUserData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
351 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
352 |
- nsresult GetAtomForMozKey(const char *aMozKey, PRUint32 *aAtom) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
353 |
- return GetAtom(aMozKey, 0, aAtom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
354 |
+ nsISystemPref* GetPrefs() { return mPref; } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
355 |
+ SimplePrefMapping* GetSimpleCallbackData(PRUint32 aKey) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
356 |
+ SimplePrefMapping* result = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
357 |
+ mGConfSimpleCallbacks.Get(aKey, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
358 |
+ return result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
359 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
360 |
- const char *GetMozKey(PRUint32 aAtom) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
361 |
- return GetKey(aAtom, 0); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
362 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
363 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
364 |
- void OnNotify(void *aClient, void * aEntry, PRUint32 aNotifyId, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
365 |
- GConfCallbackData *aData); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
366 |
+ ComplexGConfPrefMapping* GetComplexCallbackData(PRUint32 aKey) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
367 |
+ ComplexGConfPrefMapping* result = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
368 |
+ mGConfComplexCallbacks.Get(aKey, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
369 |
+ return result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
370 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
371 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
372 |
private: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
373 |
- void *mGConfClient; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
374 |
- PRLibrary *mGConfLib; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
375 |
- PRBool mInitialized; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
376 |
- nsSystemPrefService *mSysPrefService; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
377 |
+ nsISystemPref* mPref; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
378 |
+ nsDataHashtable<nsUint32HashKey, SimplePrefMapping*> mGConfSimpleCallbacks; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
379 |
+ nsDataHashtable<nsUint32HashKey, ComplexGConfPrefMapping*> mGConfComplexCallbacks; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
380 |
+ // This is set to PR_FALSE temporarily to stop listening to gconf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
381 |
+ // change notifications (while we change gconf values) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
382 |
+ PRPackedBool mListenToGConf; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
383 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
384 |
- //listeners |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
385 |
- nsAutoVoidArray *mObservers; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
386 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
387 |
- void InitFuncPtrs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
388 |
- //gconf public func ptrs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
389 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
390 |
- //gconf client funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
391 |
- GConfClientGetDefaultType GConfClientGetDefault; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
392 |
- GConfClientGetBoolType GConfClientGetBool; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
393 |
- GConfClientGetStringType GConfClientGetString; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
394 |
- GConfClientGetIntType GConfClientGetInt; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
395 |
- GConfClientGetListType GConfClientGetList; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
396 |
- GConfClientNotifyAddType GConfClientNotifyAdd; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
397 |
- GConfClientNotifyRemoveType GConfClientNotifyRemove; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
398 |
- GConfClientAddDirType GConfClientAddDir; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
399 |
- GConfClientRemoveDirType GConfClientRemoveDir; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
400 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
401 |
- //gconf entry funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
402 |
- GConfEntryGetValueType GConfEntryGetValue; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
403 |
- GConfEntryGetKeyType GConfEntryGetKey; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
404 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
405 |
- //gconf value funcs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
406 |
- GConfValueGetBoolType GConfValueGetBool; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
407 |
- GConfValueGetStringType GConfValueGetString; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
408 |
- GConfValueGetIntType GConfValueGetInt; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
409 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
410 |
- //pref name translating stuff |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
411 |
- nsresult GetAtom(const char *aKey, PRUint8 aNameType, PRUint32 *aAtom); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
412 |
- nsresult GetAtomForGConfKey(const char *aGConfKey, PRUint32 *aAtom) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
413 |
- {return GetAtom(aGConfKey, 1, aAtom);} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
414 |
- const char *GetKey(PRUint32 aAtom, PRUint8 aNameType); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
415 |
- const char *GetGConfKey(PRUint32 aAtom) \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
416 |
- {return GetKey(aAtom, 1); } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
417 |
- inline const char *MozKey2GConfKey(const char *aMozKey); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
418 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
419 |
- //const strings |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
420 |
- static const char sPrefGConfKey[]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
421 |
- static const char sDefaultLibName1[]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
422 |
- static const char sDefaultLibName2[]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
423 |
+ GConfValue* GConfGet(const char *aPrefName); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
424 |
}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
425 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
426 |
-struct SysPrefCallbackData { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
427 |
- nsISupports *observer; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
428 |
- PRBool bIsWeakRef; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
429 |
- PRUint32 prefAtom; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
430 |
-}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
431 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
432 |
-PRBool |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
433 |
-sysPrefDeleteObserver(void *aElement, void *aData) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
434 |
- SysPrefCallbackData *pElement = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
435 |
- static_cast<SysPrefCallbackData *>(aElement); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
436 |
- NS_RELEASE(pElement->observer); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
437 |
- nsMemory::Free(pElement); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
438 |
- return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
439 |
-} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
440 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
441 |
-NS_IMPL_ISUPPORTS2(nsSystemPrefService, nsIPrefBranch, nsIPrefBranch2) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
442 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
443 |
-/* public */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
444 |
nsSystemPrefService::nsSystemPrefService() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
445 |
- :mInitialized(PR_FALSE), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
446 |
- mGConf(nsnull), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
447 |
- mObservers(nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
448 |
+ : mPref(nsnull), mListenToGConf(PR_TRUE) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
449 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
450 |
+ mGConfSimpleCallbacks.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
451 |
+ mGConfComplexCallbacks.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
452 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
453 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
454 |
nsSystemPrefService::~nsSystemPrefService() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
455 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
456 |
- mInitialized = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
457 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
458 |
- if (mGConf) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
459 |
- delete mGConf; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
460 |
- if (mObservers) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
461 |
- (void)mObservers->EnumerateForwards(sysPrefDeleteObserver, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
462 |
- delete mObservers; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
463 |
- } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
464 |
+ NotifyUnloadSystemPreferences(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
465 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
466 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
467 |
nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
468 |
nsSystemPrefService::Init() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
469 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
470 |
- if (!gSysPrefLog) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
471 |
- gSysPrefLog = PR_NewLogModule("Syspref"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
472 |
- if (!gSysPrefLog) return NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
473 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
474 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
475 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
476 |
+NS_IMPL_ISUPPORTS2(nsSystemPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
477 |
+ nsISystemPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
478 |
+ nsIPrefBranch) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
479 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
480 |
+static GConfClient* GetGConf() { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
481 |
+ return gconf_client_get_default(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
482 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
483 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
484 |
+static PRBool VerifyMatchingTypes(nsISystemPref* aPrefs, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
485 |
+ const char* aMozPref, GConfValue* aVal) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
486 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
487 |
+ nsCOMPtr<nsIPrefBranch2> prefBranch = aPrefs->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
488 |
+ PRInt32 type; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
489 |
+ nsresult rv = prefBranch->GetPrefType(aMozPref, &type); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
490 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
491 |
+ // pref probably doesn't exist. Let gconf set it. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
492 |
+ return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
493 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
494 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
495 |
- SYSPREF_LOG(("Init SystemPref Service\n")); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
496 |
- if (mInitialized) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
497 |
+ PRBool ok; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
498 |
+ switch (aVal->type) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
499 |
+ case GCONF_VALUE_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
500 |
+ ok = type == nsIPrefBranch2::PREF_STRING; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
501 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
502 |
+ case GCONF_VALUE_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
503 |
+ ok = type == nsIPrefBranch2::PREF_INT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
504 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
505 |
+ case GCONF_VALUE_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
506 |
+ ok = type == nsIPrefBranch2::PREF_BOOL; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
507 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
508 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
509 |
+ NS_ERROR("Unhandled gconf preference type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
510 |
+ return PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
511 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
512 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
513 |
+ NS_ASSERTION(ok, "Mismatched gconf/Mozilla pref types"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
514 |
+ return ok; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
515 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
516 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
517 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
518 |
+ * Map a gconf pref value into the corresponding Mozilla pref. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
519 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
520 |
+static nsresult ApplySimpleMapping(SimplePrefMapping* aMap, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
521 |
+ nsISystemPref* aPrefs, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
522 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
523 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
524 |
+ GConfValue* val = gconf_client_get(aClient, aMap->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
525 |
+ if (!val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
526 |
+ // No gconf key, so there's really nothing to do |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
527 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
528 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
529 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
530 |
+ VerifyMatchingTypes(aPrefs, aMap->mozPrefName, val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
531 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
532 |
+ PRBool locked = !aMap->allowWritesFromMozilla || |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
533 |
+ !gconf_client_key_is_writable(aClient, aMap->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
534 |
+ nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
535 |
+ switch (val->type) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
536 |
+ case GCONF_VALUE_STRING: { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
537 |
+ const char* str = gconf_value_get_string(val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
538 |
+ rv = aPrefs->SetOverridingMozillaStringPref(aMap->mozPrefName, str, locked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
539 |
+ // XXX do we need to free 'str' here? |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
540 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
541 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
542 |
+ case GCONF_VALUE_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
543 |
+ rv = aPrefs->SetOverridingMozillaIntPref(aMap->mozPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
544 |
+ gconf_value_get_int(val), locked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
545 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
546 |
+ case GCONF_VALUE_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
547 |
+ rv = aPrefs->SetOverridingMozillaBoolPref(aMap->mozPrefName, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
548 |
+ gconf_value_get_bool(val), locked); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
549 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
550 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
551 |
+ NS_ERROR("Unusable gconf value type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
552 |
+ rv = NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
553 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
554 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
555 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
556 |
+ gconf_value_free(val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
557 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
558 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
559 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
560 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
561 |
+ * Map a Mozilla pref into the corresponding gconf pref, if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
562 |
+ * that's allowed. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
563 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
564 |
+static nsresult ReverseApplySimpleMapping(SimplePrefMapping* aMap, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
565 |
+ nsISystemPref* aPrefs, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
566 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
567 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
568 |
+ // Verify that the gconf key has the right type, if it exists |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
569 |
+ GConfValue* val = gconf_client_get(aClient, aMap->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
570 |
+ if (val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
571 |
+ VerifyMatchingTypes(aPrefs, aMap->mozPrefName, val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
572 |
+ gconf_value_free(val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
573 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
574 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
575 |
+ PRBool writable = aMap->allowWritesFromMozilla && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
576 |
+ gconf_client_key_is_writable(aClient, aMap->gconfPrefName, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
577 |
+ if (!writable) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
578 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
579 |
return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
580 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
581 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
582 |
- if (!mGConf) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
583 |
- mGConf = new GConfProxy(this); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
584 |
- if (!mGConf->Init()) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
585 |
- delete mGConf; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
586 |
- mGConf = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
587 |
+ nsCOMPtr<nsIPrefBranch2> prefBranch = aPrefs->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
588 |
+ PRInt32 type; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
589 |
+ nsresult rv = prefBranch->GetPrefType(aMap->mozPrefName, &type); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
590 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
591 |
+ NS_ERROR("Writing back a pref that doesn't exist?"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
592 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
593 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
594 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
595 |
+ switch (type) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
596 |
+ case nsIPrefBranch2::PREF_STRING: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
597 |
+ { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
598 |
+ char* result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
599 |
+ rv = prefBranch->GetCharPref(aMap->mozPrefName, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
600 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
601 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
602 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
603 |
+ gconf_client_set_string(aClient, aMap->gconfPrefName, result, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
604 |
+ nsMemory::Free(result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
605 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
606 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
607 |
+ case nsIPrefBranch2::PREF_INT: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
608 |
+ { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
609 |
+ PRInt32 result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
610 |
+ rv = prefBranch->GetIntPref(aMap->mozPrefName, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
611 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
612 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
613 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
614 |
+ gconf_client_set_int(aClient, aMap->gconfPrefName, result, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
615 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
616 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
617 |
+ case nsIPrefBranch2::PREF_BOOL: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
618 |
+ { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
619 |
+ PRBool result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
620 |
+ rv = prefBranch->GetBoolPref(aMap->mozPrefName, &result); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
621 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
622 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
623 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
624 |
+ gconf_client_set_bool(aClient, aMap->gconfPrefName, result, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
625 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
626 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
627 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
628 |
+ NS_ERROR("Unhandled gconf preference type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
629 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
630 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
631 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
632 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
633 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
634 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
635 |
+/* BEGIN preference mapping definition area |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
636 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
637 |
+ * There are a few rules that our preference maps have to obey: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
638 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
639 |
+ * 1) Each mapping defines a relationship R between a set of GConf preferences and |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
640 |
+ * a set of Mozilla preferences that must *always* be true. Thus, when a Mozilla |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
641 |
+ * pref changes or a gconf pref changes, we may need to change something on the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
642 |
+ * other side to preserve R. If a GConf preference is read-only, then we may |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
643 |
+ * need to lock one or more Mozilla preferences to avoid a situation where the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
644 |
+ * Mozilla preference changes and we can't update the GConf preference to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
645 |
+ * ensure R continues to hold. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
646 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
647 |
+ * 2) If an unlocked Mozilla preference is changed, then we can only |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
648 |
+ * preserve R by changing GConf preferences; we are not allowed to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
649 |
+ * change Mozilla preferences. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
650 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
651 |
+ * 3) If a GConf preference is changed, then we can only preserve R by |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
652 |
+ * changing Moozilla preferences; we are nt allowed to change GConf |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
653 |
+ * preferences. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
654 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
655 |
+ * For "simple" mappings, the relationship R is just of the form |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
656 |
+ * "GConf preference 'A' is equal to Mozilla preference 'B'". R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
657 |
+ * preserved by setting A to B when B changes, and by setting B to A |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
658 |
+ * when A changes. If A is read-only then we lock B (or we may just |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
659 |
+ * decide to lock B for other reasons). Thus rules 1-3 are satisfied. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
660 |
+ * |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
661 |
+ * For "complex" mappings we have more complicated |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
662 |
+ * relationships. These are documented below. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
663 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
664 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
665 |
+static SimplePrefMapping sSimplePrefMappings[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
666 |
+ // GNOME accessibility setting; never allow this to be set by Firefox |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
667 |
+ {"config.use_system_prefs.accessibility", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
668 |
+ "/desktop/gnome/interface/accessibility", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
669 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
670 |
+ // GConf Firefox preferences; allow these to be set through the Firefox UI |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
671 |
+ {"security.enable_java", "/apps/firefox/web/java_enabled", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
672 |
+ {"javascript.enabled", "/apps/firefox/web/javascript_enabled", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
673 |
+ {"browser.startup.homepage", "/apps/firefox/general/homepage_url", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
674 |
+ {"browser.cache.disk.capacity", "/apps/firefox/web/cache_size", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
675 |
+ {"network.cookie.lifetimePolicy", "/apps/firefox/web/cookie_accept", PR_TRUE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
676 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
677 |
+ // UI lockdown settings; never allow these to be set by Firefox. There is no |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
678 |
+ // Firefox UI for these but they could otherwise be set via about:config. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
679 |
+ {"config.lockdown.printing", "/desktop/gnome/lockdown/disable_printing", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
680 |
+ {"config.lockdown.printsetup", "/desktop/gnome/lockdown/disable_print_setup", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
681 |
+ {"config.lockdown.savepage", "/desktop/gnome/lockdown/disable_save_to_disk", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
682 |
+ {"config.lockdown.history", "/apps/firefox/lockdown/disable_history", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
683 |
+ {"config.lockdown.toolbarediting", "/apps/firefox/lockdown/disable_toolbar_editing", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
684 |
+ {"config.lockdown.urlbar", "/apps/firefox/lockdown/disable_url_bar", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
685 |
+ {"config.lockdown.bookmark", "/apps/firefox/lockdown/disable_bookmark_editing", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
686 |
+ {"config.lockdown.disable_themes", "/apps/firefox/lockdown/disable_themes", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
687 |
+ {"config.lockdown.disable_extensions", "/apps/firefox/lockdown/disable_extensions", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
688 |
+ {"config.lockdown.searchbar", "/apps/firefox/lockdown/disable_searchbar", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
689 |
+ {"config.lockdown.hidebookmark", "/apps/firefox/lockdown/hide_bookmark", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
690 |
+ {"config.lockdown.showsavedpasswords", "/apps/firefox/lockdown/disable_show_passwords", PR_FALSE}, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
691 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
692 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
693 |
+static nsresult ApplyListPref(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
694 |
+ GConfClient* aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
695 |
+ const char* aGConfKey, const char* aMozKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
696 |
+ char aSeparator) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
697 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
698 |
+ GSList* list = gconf_client_get_list(aClient, aGConfKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
699 |
+ GCONF_VALUE_STRING, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
700 |
+ nsCAutoString str; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
701 |
+ for (GSList* l = list; l; l = l->next) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
702 |
+ str.Append((const char*)l->data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
703 |
+ if (l->next) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
704 |
+ str.Append(aSeparator); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
705 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
706 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
707 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, aGConfKey, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
708 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
709 |
+ SetOverridingMozillaStringPref(aMozKey, str.get(), lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
710 |
+ // XXX does this free the strings? Should it? |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
711 |
+ g_slist_free(list); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
712 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
713 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
714 |
+static nsresult ReverseApplyListPref(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
715 |
+ GConfClient* aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
716 |
+ const char* aGConfKey, const char* aMozKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
717 |
+ char aSeparator) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
718 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
719 |
+ char* data = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
720 |
+ nsCOMPtr<nsIPrefBranch2> prefs = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
721 |
+ aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
722 |
+ prefs->GetCharPref(aMozKey, &data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
723 |
+ if (!data) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
724 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
725 |
+ nsresult rv = NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
726 |
+ GSList* list = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
727 |
+ PRInt32 i = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
728 |
+ while (data[i]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
729 |
+ const char* nextComma = strchr(data+i, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
730 |
+ PRInt32 tokLen = nextComma ? nextComma - (data+i) : strlen(data+i); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
731 |
+ char* tok = strndup(data+i, tokLen); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
732 |
+ if (!tok) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
733 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
734 |
+ GSList* newList = g_slist_append(list, tok); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
735 |
+ if (!newList) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
736 |
+ rv = NS_ERROR_OUT_OF_MEMORY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
737 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
738 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
739 |
+ list = newList; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
740 |
+ if (!nextComma) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
741 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
742 |
+ i = nextComma + 1 - data; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
743 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
744 |
+ nsMemory::Free(data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
745 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
746 |
+ if (gconf_client_key_is_writable(aClient, aGConfKey, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
747 |
+ gconf_client_set_list(aClient, aGConfKey, GCONF_VALUE_STRING, list, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
748 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
749 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
750 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
751 |
+ for (GSList* l = list; l; l = l->next) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
752 |
+ free(l->data); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
753 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
754 |
+ g_slist_free(list); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
755 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
756 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
757 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
758 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
759 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
760 |
+ * "network.negotiate-auth.trusted-uris" is the comma-separated concatenation |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
761 |
+ * of the elements of the list "/apps/firefox/general/trusted_URIs" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
762 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
763 |
+static const char GConfKey_TrustedURIs[] = "/apps/firefox/general/trusted_URIs"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
764 |
+static const char MozKey_TrustedURIs[] = "network.negotiate-auth.trusted-uris"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
765 |
+static nsresult ApplyTrustedURIs(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
766 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
767 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
768 |
+ return ApplyListPref(aPrefService, aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
769 |
+ GConfKey_TrustedURIs, MozKey_TrustedURIs, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
770 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
771 |
+static nsresult ReverseApplyTrustedURIs(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
772 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
773 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
774 |
+ return ReverseApplyListPref(aPrefService, aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
775 |
+ GConfKey_TrustedURIs, MozKey_TrustedURIs, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
776 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
777 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
778 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
779 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
780 |
+ * "network.negotiate-auth.delegation-uris" is the comma-separated concatenation |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
781 |
+ * of the elements of the list "/apps/firefox/general/delegation_URIs" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
782 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
783 |
+static const char GConfKey_DelegationURIs[] = "/apps/firefox/general/delegation_URIs"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
784 |
+static const char MozKey_DelegationURIs[] = "network.negotiate-auth.delegation-uris"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
785 |
+static nsresult ApplyDelegationURIs(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
786 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
787 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
788 |
+ return ApplyListPref(aPrefService, aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
789 |
+ GConfKey_DelegationURIs, MozKey_DelegationURIs, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
790 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
791 |
+static nsresult ReverseApplyDelegationURIs(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
792 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
793 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
794 |
+ return ReverseApplyListPref(aPrefService, aClient, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
795 |
+ GConfKey_DelegationURIs, MozKey_DelegationURIs, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
796 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
797 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
798 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
799 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
800 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
801 |
+ * If "/apps/firefox/web/download_defaultfolder" is the empty string, then |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
802 |
+ * "browser.download.useDownloadDir" is false; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
803 |
+ * otherwise "browser.download.useDownloadDir" is true and "browser.download.folderList" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
804 |
+ * is (0 if "/apps/firefox/web/download_defaultfolder" is "Desktop"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
805 |
+ * 1 if "/apps/firefox/web/download_defaultfolder" is "My Downloads"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
806 |
+ * 3 if "/apps/firefox/web/download_defaultfolder" is "Home"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
807 |
+ * otherwise 2 and "browser.download.dir" = "/apps/firefox/web/download_defaultfolder") |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
808 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
809 |
+static const char GConfKey_DownloadFolder[] = "/apps/firefox/web/download_defaultfolder"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
810 |
+static const char MozKey_UseDownloadDir[] = "browser.download.useDownloadDir"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
811 |
+static const char MozKey_DownloadDirType[] = "browser.download.folderList"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
812 |
+static const char MozKey_DownloadDirExplicit[] = "browser.download.dir"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
813 |
+static nsresult ApplyDownloadFolder(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
814 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
815 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
816 |
+ char* str = gconf_client_get_string(aClient, GConfKey_DownloadFolder, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
817 |
+ if (!str) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
818 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
819 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DownloadFolder, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
820 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
821 |
+ SetOverridingMozillaBoolPref(MozKey_UseDownloadDir, *str != 0, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
822 |
+ if (NS_FAILED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
823 |
+ g_free(str); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
824 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
825 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
826 |
+ PRInt32 dirType = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
827 |
+ if (!strcmp(str, "Desktop")) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
828 |
+ dirType = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
829 |
+ } else if (!strcmp(str, "My Downloads")) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
830 |
+ dirType = 1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
831 |
+ } else if (!strcmp(str, "Home")) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
832 |
+ dirType = 3; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
833 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
834 |
+ dirType = 2; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
835 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
836 |
+ // Always set all three Mozilla preferences. This is simpler and avoids |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
837 |
+ // problems; e.g., if the gconf value changes from "/home/rocallahan" to "Desktop" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
838 |
+ // we might leave MozKey_DownloadDirType accidentally locked. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
839 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
840 |
+ SetOverridingMozillaIntPref(MozKey_DownloadDirType, dirType, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
841 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
842 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
843 |
+ SetOverridingMozillaStringPref(MozKey_DownloadDirExplicit, str, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
844 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
845 |
+ g_free(str); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
846 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
847 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
848 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
849 |
+static nsresult ReverseApplyDownloadFolder(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
850 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
851 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
852 |
+ PRBool useDownloadDir = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
853 |
+ const char* result; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
854 |
+ char* explicitStr = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
855 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
856 |
+ prefs->GetBoolPref(MozKey_UseDownloadDir, &useDownloadDir); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
857 |
+ if (!useDownloadDir) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
858 |
+ result = ""; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
859 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
860 |
+ PRInt32 type = -1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
861 |
+ prefs->GetIntPref(MozKey_DownloadDirType, &type); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
862 |
+ if (type < 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
863 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
864 |
+ switch (type) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
865 |
+ case 0: result = "Desktop"; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
866 |
+ case 1: result = "Downloads"; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
867 |
+ case 2: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
868 |
+ prefs->GetCharPref(MozKey_DownloadDirExplicit, &explicitStr); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
869 |
+ result = explicitStr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
870 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
871 |
+ case 3: result = "Home"; break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
872 |
+ default: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
873 |
+ NS_ERROR("Unknown download dir type"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
874 |
return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
875 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
876 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
877 |
+ if (!result) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
878 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
879 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DownloadFolder, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
880 |
+ gconf_client_set_string(aClient, GConfKey_DownloadFolder, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
881 |
+ result, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
882 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
883 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
884 |
+ nsMemory::Free(explicitStr); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
885 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
886 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
887 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
888 |
- mInitialized = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
889 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
890 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
891 |
+ * "/apps/firefox/web/disable_cookies" is true if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
892 |
+ * "network.cookie.cookieBehavior" is 2 ('dontUse') |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
893 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
894 |
+static const char GConfKey_DisableCookies[] = "/apps/firefox/web/disable_cookies"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
895 |
+static const char MozKey_CookieBehavior[] = "network.cookie.cookieBehavior"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
896 |
+static const char MozKey_CookieExceptions[] = "network.cookie.honorExceptions"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
897 |
+static const char MozKey_CookieViewExceptions[] = "pref.privacy.disable_button.cookie_exceptions"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
898 |
+static nsresult ApplyDisableCookies(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
899 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
900 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
901 |
+ gboolean disable = gconf_client_get_bool(aClient, GConfKey_DisableCookies, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
902 |
+ PRInt32 behavior = -1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
903 |
+ nsCOMPtr<nsIPrefBranch2> prefs = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
904 |
+ aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
905 |
+ prefs->GetIntPref(MozKey_CookieBehavior, &behavior); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
906 |
+ if (behavior < 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
907 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
908 |
+ if (disable) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
909 |
+ behavior = 2; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
910 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
911 |
+ if (behavior == 2) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
912 |
+ behavior = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
913 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
914 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
915 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DisableCookies, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
916 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
917 |
+ SetOverridingMozillaBoolPref(MozKey_CookieExceptions, !lock, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
918 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
919 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
920 |
+ rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
921 |
+ SetOverridingMozillaBoolPref(MozKey_CookieViewExceptions, lock, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
922 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
923 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
924 |
+ return aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
925 |
+ SetOverridingMozillaIntPref(MozKey_CookieBehavior, behavior, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
926 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
927 |
+static nsresult ReverseApplyDisableCookies(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
928 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
929 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
930 |
+ PRInt32 behavior = -1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
931 |
+ nsCOMPtr<nsIPrefBranch2> prefs = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
932 |
+ aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
933 |
+ prefs->GetIntPref(MozKey_CookieBehavior, &behavior); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
934 |
+ if (behavior < 0) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
935 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
936 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DisableCookies, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
937 |
+ gconf_client_set_bool(aClient, GConfKey_DisableCookies, behavior == 2, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
938 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
939 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
940 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
941 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
942 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
943 |
+static char const* windowOpenFeatures[] = { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
944 |
+ "dom.disable_window_open_feature.close", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
945 |
+ "dom.disable_window_open_feature.directories", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
946 |
+ "dom.disable_window_open_feature.location", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
947 |
+ "dom.disable_window_open_feature.menubar", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
948 |
+ "dom.disable_window_open_feature.minimizable", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
949 |
+ "dom.disable_window_open_feature.personalbar", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
950 |
+ "dom.disable_window_open_feature.resizable", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
951 |
+ "dom.disable_window_open_feature.scrollbars", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
952 |
+ "dom.disable_window_open_feature.status", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
953 |
+ "dom.disable_window_open_feature.titlebar", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
954 |
+ "dom.disable_window_open_feature.toolbar" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
955 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
956 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
957 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
958 |
+ * "/apps/firefox/lockdown/disable_javascript_chrome" is true if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
959 |
+ * all of windowOpenFeatures are true |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
960 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
961 |
+static const char GConfKey_DisableJSChrome[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
962 |
+ "/apps/firefox/lockdown/disable_javascript_chrome"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
963 |
+static nsresult ApplyWindowOpen(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
964 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
965 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
966 |
+ gboolean disable = gconf_client_get_bool(aClient, GConfKey_DisableJSChrome, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
967 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DisableJSChrome, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
968 |
+ PRBool curValues[NUM_ELEM(windowOpenFeatures)]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
969 |
+ PRUint32 i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
970 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
971 |
+ PRBool allDisabled = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
972 |
+ for (i = 0; i < NUM_ELEM(windowOpenFeatures); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
973 |
+ nsresult rv = prefs->GetBoolPref(windowOpenFeatures[i], &curValues[i]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
974 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
975 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
976 |
+ if (!curValues[i]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
977 |
+ allDisabled = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
978 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
979 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
980 |
+ for (i = 0; i < NUM_ELEM(windowOpenFeatures); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
981 |
+ PRBool newVal = curValues[i]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
982 |
+ if (disable) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
983 |
+ newVal = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
984 |
+ } else if (allDisabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
985 |
+ // If all disable-window-open-feature prefs are currently |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
986 |
+ // PR_TRUE, then we need to set at least one of them to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
987 |
+ // PR_FALSE. Set all of them to PR_FALSE. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
988 |
+ newVal = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
989 |
+ } // If at least one disable-window-open-feature pref is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
990 |
+ // currently PR_FALSE, then we don't need to change anything |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
991 |
+ // when the gconf pref says don't disable |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
992 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
993 |
+ SetOverridingMozillaBoolPref(windowOpenFeatures[i], newVal, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
994 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
995 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
996 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
997 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
998 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
999 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1000 |
+static nsresult ReverseApplyWindowOpen(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1001 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1002 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1003 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1004 |
+ PRBool allDisabled = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1005 |
+ PRBool curValues[NUM_ELEM(windowOpenFeatures)]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1006 |
+ for (PRUint32 i = 0; i < NUM_ELEM(windowOpenFeatures); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1007 |
+ nsresult rv = prefs->GetBoolPref(windowOpenFeatures[i], &curValues[i]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1008 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1009 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1010 |
+ if (!curValues[i]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1011 |
+ allDisabled = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1012 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1013 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1014 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DisableJSChrome, nsnull)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1015 |
+ gconf_client_set_bool(aClient, GConfKey_DisableJSChrome, allDisabled, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1016 |
+ else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1017 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1018 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1019 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1020 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1021 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1022 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1023 |
+ * If "/apps/firefox/lockdown/disable_unsafe_protocol" is true then |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1024 |
+ * -- "network.protocol-handler.blocked-default" is true |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1025 |
+ * -- "network.protocol-handler.blocked.XYZ" is false if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1026 |
+ * XYZ is a builtin non-disablable protocol or in |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1027 |
+ * "/apps/firefox/lockdown/additional_safe_protocols" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1028 |
+ * AND if "/apps/firefox/lockdown/disable_unsafe_protocol" is false then |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1029 |
+ * -- "network.protocol-handler.blocked-default" is false |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1030 |
+ * -- if "network.protocol-handler.blocked.XYZ" exists then it is false |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1031 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1032 |
+static const char GConfKey_DisableUnsafeProtocols[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1033 |
+ "/apps/firefox/lockdown/disable_unsafe_protocol"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1034 |
+static const char GConfKey_AdditionalSafeProtocols[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1035 |
+ "/apps/firefox/lockdown/additional_safe_protocols"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1036 |
+static const char MozKey_BlockedDefault[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1037 |
+ "network.protocol-handler.blocked-default"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1038 |
+static const char MozKey_BlockedPrefix[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1039 |
+ "network.protocol-handler.blocked."; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1040 |
+static const char* nonDisablableBuiltinProtocols[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1041 |
+ { "about", "data", "jar", "keyword", "resource", "viewsource", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1042 |
+ "chrome", "moz-icon", "javascript", "file" }; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1043 |
+static PRBool FindString(const char** aList, PRInt32 aCount, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1044 |
+ const char* aStr) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1045 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1046 |
+ for (PRInt32 i = 0; i < aCount; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1047 |
+ if (!strcmp(aStr, aList[i])) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1048 |
+ return PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1049 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1050 |
+ return PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1051 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1052 |
+typedef nsDataHashtable<nsCStringHashKey,int> StringSet; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1053 |
+/** Collect the set of protocol names that we want to set preferences for */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1054 |
+static nsresult AddAllProtocols(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1055 |
+ const char* aSafeProtocols, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1056 |
+ StringSet* aProtocolSet, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1057 |
+ StringSet* aSafeSet) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1058 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1059 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1060 |
+ PRUint32 childCount; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1061 |
+ char **childArray = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1062 |
+ nsresult rv = prefs->GetChildList(MozKey_BlockedPrefix, &childCount, &childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1063 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1064 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1065 |
+ PRUint32 i; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1066 |
+ for (i = 0; i < childCount; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1067 |
+ nsDependentCString tmp(childArray[i] + NUM_ELEM(MozKey_BlockedPrefix)-1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1068 |
+ aProtocolSet->Put(tmp, 1); // copies |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1069 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1070 |
+ for (i = 0; i < NUM_ELEM(nonDisablableBuiltinProtocols); ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1071 |
+ nsDependentCString tmp(nonDisablableBuiltinProtocols[i]); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1072 |
+ aProtocolSet->Put(tmp, 1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1073 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1074 |
+ i = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1075 |
+ while (aSafeProtocols[i]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1076 |
+ const char* nextComma = strchr(aSafeProtocols+i, ','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1077 |
+ PRUint32 tokLen = nextComma ? nextComma - (aSafeProtocols+i) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1078 |
+ : strlen(aSafeProtocols+i); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1079 |
+ nsCAutoString tok(aSafeProtocols+i, tokLen); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1080 |
+ aProtocolSet->Put(tok, 1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1081 |
+ aSafeSet->Put(tok, 1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1082 |
+ if (nextComma) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1083 |
+ i = nextComma - aSafeProtocols + 1; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1084 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1085 |
+ break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1086 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1087 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1088 |
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(childCount, childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1089 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1090 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1091 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1092 |
+struct ProtocolPrefClosure { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1093 |
+ StringSet safeProtocolSet; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1094 |
+ nsIPrefBranch2* prefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1095 |
+ nsISystemPref* prefSetter; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1096 |
+ PRPackedBool disableUnsafe; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1097 |
+ PRPackedBool lock; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1098 |
+}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1099 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1100 |
+static PLDHashOperator PR_CALLBACK SetProtocolPref(const nsACString& aKey, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1101 |
+ int aItem, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1102 |
+ void* aClosure) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1103 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1104 |
+ ProtocolPrefClosure* closure = static_cast<ProtocolPrefClosure*>(aClosure); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1105 |
+ const nsCString& protocol = PromiseFlatCString(aKey); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1106 |
+ PRBool blockProtocol = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1107 |
+ if (closure->disableUnsafe && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1108 |
+ !FindString(nonDisablableBuiltinProtocols, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1109 |
+ NUM_ELEM(nonDisablableBuiltinProtocols), protocol.get()) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1110 |
+ !closure->safeProtocolSet.Get(aKey, nsnull)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1111 |
+ blockProtocol = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1112 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1113 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1114 |
+ nsCAutoString prefName; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1115 |
+ prefName.Append(MozKey_BlockedPrefix); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1116 |
+ prefName.Append(protocol); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1117 |
+ closure->prefSetter->SetOverridingMozillaBoolPref(prefName.get(), blockProtocol, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1118 |
+ closure->lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1119 |
+ return PL_DHASH_NEXT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1120 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1121 |
+static nsresult ApplyUnsafeProtocols(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1122 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1123 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1124 |
+ PRBool lock = !gconf_client_key_is_writable(aClient, GConfKey_DisableUnsafeProtocols, nsnull) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1125 |
+ || !gconf_client_key_is_writable(aClient, GConfKey_AdditionalSafeProtocols, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1126 |
+ gboolean disable = gconf_client_get_bool(aClient, GConfKey_DisableUnsafeProtocols, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1127 |
+ char* protocols = gconf_client_get_string(aClient, GConfKey_AdditionalSafeProtocols, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1128 |
+ if (!protocols) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1129 |
+ return NS_ERROR_FAILURE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1130 |
+ nsresult rv = aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1131 |
+ SetOverridingMozillaBoolPref(MozKey_BlockedDefault, disable, lock); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1132 |
+ StringSet protocolSet; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1133 |
+ ProtocolPrefClosure closure; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1134 |
+ protocolSet.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1135 |
+ closure.safeProtocolSet.Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1136 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1137 |
+ rv = AddAllProtocols(aPrefService, protocols, &protocolSet, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1138 |
+ &closure.safeProtocolSet); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1139 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1140 |
+ if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1141 |
+ closure.disableUnsafe = disable; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1142 |
+ closure.lock = lock; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1143 |
+ closure.prefSetter = aPrefService->GetPrefs(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1144 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1145 |
+ closure.prefs = prefs; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1146 |
+ protocolSet.EnumerateRead(SetProtocolPref, &closure); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1147 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1148 |
+ g_free(protocols); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1149 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1150 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1151 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1152 |
+static nsresult ReverseApplyUnsafeProtocols(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1153 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1154 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1155 |
+ nsCOMPtr<nsIPrefBranch2> prefs = aPrefService->GetPrefs()->GetPrefUserBranch(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1156 |
+ PRBool blockedDefault; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1157 |
+ nsresult rv = prefs->GetBoolPref(MozKey_BlockedDefault, &blockedDefault); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1158 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1159 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1160 |
+ nsCAutoString enabledProtocols; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1161 |
+ PRUint32 childCount; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1162 |
+ char **childArray = nsnull; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1163 |
+ rv = prefs->GetChildList(MozKey_BlockedPrefix, &childCount, &childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1164 |
+ if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1165 |
+ return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1166 |
+ for (PRUint32 i = 0; i < childCount; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1167 |
+ PRBool val = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1168 |
+ prefs->GetBoolPref(childArray[i], &val); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1169 |
+ if (val) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1170 |
+ if (enabledProtocols.Length() > 0) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1171 |
+ enabledProtocols.Append(','); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1172 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1173 |
+ enabledProtocols.Append(childArray[i] + NUM_ELEM(MozKey_BlockedPrefix)-1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1174 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1175 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1176 |
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(childCount, childArray); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1177 |
+ if (gconf_client_key_is_writable(aClient, GConfKey_DisableUnsafeProtocols, nsnull) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1178 |
+ gconf_client_key_is_writable(aClient, GConfKey_AdditionalSafeProtocols, nsnull)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1179 |
+ gconf_client_set_bool(aClient, GConfKey_DisableUnsafeProtocols, blockedDefault, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1180 |
+ gconf_client_set_string(aClient, GConfKey_AdditionalSafeProtocols, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1181 |
+ enabledProtocols.get(), nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1182 |
+ } else { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1183 |
+ NS_ERROR("Gconf key is not writable"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1184 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1185 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1186 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1187 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1188 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1189 |
+ * Set config.lockdown.setwallpaper if and only if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1190 |
+ * /desktop/gnome/background/picture_filename is write-only. Always |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1191 |
+ * lock it. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1192 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1193 |
+static const char MozKey_LockdownWallpaper[] = "config.lockdown.setwallpaper"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1194 |
+static const char GConfKey_WallpaperSetting[] = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1195 |
+ "/desktop/gnome/background/picture_filename"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1196 |
+static nsresult ApplyWallpaper(nsSystemPrefService* aPrefService, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1197 |
+ GConfClient* aClient) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1198 |
+{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1199 |
+ PRBool canSetWallpaper = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1200 |
+ gconf_client_key_is_writable(aClient, GConfKey_WallpaperSetting, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1201 |
+ return aPrefService->GetPrefs()-> |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1202 |
+ SetOverridingMozillaBoolPref(MozKey_LockdownWallpaper, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1203 |
+ !canSetWallpaper, PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1204 |
+} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1205 |
+// No ReverseApplyWallpaper because this Mozilla pref can never be |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1206 |
+// modified |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1207 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1208 |
+/** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1209 |
+ * The relationship R is |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1210 |
+ * "signon.rememberSignons" is true if and only if "/apps/firefox/web/disable_save_password" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1211 |
+ * is false. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1212 |
+ */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1213 |
+static const char MozKey_RememberSignons[] = "signon.rememberSignons"; |
ca988be0905b
Update and integrate new lockdown patches.
W |