Locking prefs broken from NS6.2 -> 7.0

644 views
Skip to first unread message

Illtud Daniel

unread,
Sep 4, 2002, 7:38:11 AM9/4/02
to
We've been trying to work out (and we're not alone, by the other posts
here) how to lock prefs in NS 7.0 (or Moz 1.0). NS 6.2 could do this
with changing the pref(...) to lock_pref(...) (or was it
lockPref(...)?). This doesn't work for NS 7.0/Moz 1.0 - anybody know
what's happened - is this a bug? I can't find anything in bugzilla
about it.

Douglas Abbink

unread,
Sep 6, 2002, 2:42:10 PM9/6/02
to
Here is what I got when I reported this as a bug to bugzilla:
----------------
This support was intentionally removed.

The preference locking support was moved to the AutoConfig module in advance
of
the planned movement away from a JavaScript oriented preferences back-end.
lockpref is now a supported function only in the AutoConfig JavaScript
context,
which processes the netscape.cfg and autoconfig.jsc (server based) files.
-------------------

Anyone care to explain what this all means?


"Illtud Daniel" <i...@llgc.org.uk> wrote in message
news:3D75F0A3...@llgc.org.uk...

Illtud Daniel

unread,
Sep 12, 2002, 6:47:44 AM9/12/02
to
Douglas Abbink wrote:

> Here is what I got when I reported this as a bug to bugzilla:
> ----------------
> This support was intentionally removed.

Ah. Great.

> The preference locking support was moved to the AutoConfig module in
advance of
> the planned movement away from a JavaScript oriented preferences
back-end.
> lockpref is now a supported function only in the AutoConfig JavaScript
> context, which processes the netscape.cfg and autoconfig.jsc (server
based) files.

Sounds very correct, architecturally, but...

> Anyone care to explain what this all means?

Exactly!! Does this mean that there's no way to lock the prefs until


"the [planned] movement away from a JavaScript oriented preferences

back-end" has happened??

If it's still possible to lock the prefs, anybody care to jot a quick
dummies' guide?

(ps - Douglas, what was the bug number? I had no joy searching for
lockPrefs or lock_prefs on bugzilla)

--
Illtud Daniel illtud...@llgc.org.uk
Uwch Ddadansoddwr Systemau Senior Systems Analyst
Llyfrgell Genedlaethol Cymru National Library of Wales
Yn siarad drosof fy hun, nid LlGC - Speaking personally, not for NLW

Jonas Jørgensen

unread,
Sep 12, 2002, 9:17:18 AM9/12/02
to
Illtud Daniel wrote:
> (ps - Douglas, what was the bug number? I had no joy searching for
> lockPrefs or lock_prefs on bugzilla)

http://bugzilla.mozilla.org/show_bug.cgi?id=166946

Found by doing an all-words-as-substring search for "lock pref".

/Jonas

--
Telling computer guys that they need to have permission to quote things
is like having to tell little children about Death.
- Ted Nelson

Illtud Daniel

unread,
Sep 12, 2002, 10:11:52 AM9/12/02
to
Jonas Jørgensen wrote:

> http://bugzilla.mozilla.org/show_bug.cgi?id=166946
>
> Found by doing an all-words-as-substring search for "lock pref".

Thanks Jonas.

Douglas Abbink

unread,
Sep 13, 2002, 11:58:30 AM9/13/02
to
Well, after following some of the leads from responses to my bug posting
(and playing with the source code) here is how I think you can lock prefs.
I only know this works with proxy settings (worked for me) but I don't see
any reason it shouldn't work with other settings as well.

From what I can tell, the *correct* way to lock prefs is to generate a
netscape.cfg file and tell netscape/mozilla to look at the file. But this
file is an encoded file and the group to develop the program that generates
this encoded file is no longer doing the project so it is in "limbo." A
encoded/binary file is great for security as it is hard for a "layperson" to
change but is also hard for an admin to generate without a tool.

But I have found a work around. I don't know if this is how things are
intended to work but here goes. This work around is a bit complicated so I
hope you all can follow.

Assume install directory is "c:\program files\netscape" on a windows
machine.

1. In c:\program files\netscape\netscape, create a netscape.cfg file. This
file can be blank.

2. In C:\Program Files\Netscape\Netscape\defaults\pref\all.js, add the line
pref("general.config.filename", "netscape.cfg"); to the end of the file.

These 2 previous steps get Netscape/Mozilla to trigger the code that is
needed for locking prefs.

3. In C:\Program Files\Netscape\Netscape\defaults\autoconfig\prefcalls.js
add your lockpref statements to the end of the file. For example, the
following would lock the proxy to manual proxies and set the address and
port for HTTP:

lockPref("network.proxy.type", 1);
lockPref("network.proxy.http", "internalproxy.mycompany.com");
lockPref("network.proxy.http_port", 8088);

These statements have to be in the prefcalls.js because that is the only
file I have found that recognizes the lockpref directive.

The prefs should be now locked when you run netscape/mozilla.


In conclusion, I am still working through/playing with the source code in
this area to figure out the netscape.cfg file format to see if I can create
one. It is probably the "correct" way to do this. From what I can tell,
the work around is not what was intended but it currently works on my WinXP
machine with both Netscape 7.0 and the latest Mozilla build I can download
and compile. I do NOT know if it works for other OSs or for other prefs as
stated above.


Douglas Abbink


"Illtud Daniel" <i...@llgc.org.uk> wrote in message

news:alq6vs$so...@ripley.netscape.com...

Douglas Abbink

unread,
Sep 13, 2002, 5:05:57 PM9/13/02
to
Ok, I have now worked out (with help from Brian Nesse) how to use the
lockprefs directive. If you saw my earlier post from today, you will note
one way to do things. What follows here is the more "correct" way of doing
things and makes things a little less easy for a standard user to change.

Follow steps below:

Assume install directory is "c:\program files\netscape" on a windows
machine.

1. Create an ASCII file (for example lockpref.js) and put in the standard
lockpref commands you wish. For example:

lockPref("network.proxy.type", 1);
lockPref("network.proxy.http", "internalproxy.mycompany.com");
lockPref("network.proxy.http_port", 8088);

IMPORTANT NOTE: the first line of this ASCII file should be a comment line
(double forward slash, "//")

2. This file must now be converted to a netscape.cfg file. This file is
encoded with a simple byte shift encoding. It is shifted 13 bytes positive
on every byte. The easiest way to do this is to find a program that will
shift the bytes of the entire file for you. For a GUI Win32 app or
commandline Linux app that does this see http://www.dabbink.com (both
whipped up by me). You will find them under the link for "Byte Shifter"

3. Once converted put the file in your "C:\Program Files\Netscape\Netscape"
directory.

4. In C:\Program Files\Netscape\Netscape\defaults\pref\all.js, add the line


pref("general.config.filename", "netscape.cfg"); to the end of the file.


These steps should lock the selected prefs.

I think that is all. Hope this helps everyone out there with this problem.

Douglas Abbink

Anders Gustafsson

unread,
Nov 4, 2002, 9:17:59 AM11/4/02
to
Is this supposed to worn in Mozilla 1.1 as well? I tried and even if it
*did* read the settings from all.js, it ignored any settings from
netscape.cfg. I used the 4.x CCK to generate a netscape.cfg.


BTW. BAsically what I want to do is what I have always done in Netscape
4.x:

http://developer.novell.com/research/appnotes/1999/february/a2frame.htm
http://developer.novell.com/research/appnotes/1999/december/a5frame.htm

lnrngrj

unread,
Nov 10, 2002, 3:33:20 PM11/10/02
to
Anders Gustafsson <and...@nowhere.com> wrote in message news:<VA.0000000...@nowhere.com>...

Isn't that really what we all want to do, just what we've always done
in 4.7x except with better rendering of new pages. Change, however,
is not always accompanied by improvement.
(';')

Anders Gustafsson

unread,
Nov 12, 2002, 3:57:08 AM11/12/02
to
In article <43406a22.02111...@posting.google.com>, Lnrngrj
wrote:

> Change, however,
> is not always accompanied by improvement.

Well, in this case, I would consider moving the registry file from the
windows directory a very wise choice ;)

Anyway. I have the new AppNote almost completed. I will submit it to
the AppNote people in a few weeks. I know that this only helps people
that run Mozilla on Windows, but I have managed to accomplish:

- Just in time install
- Small local footprint (one or two files)
- Roaming profiles
- Same profile for 9x/me/nt/2000/xp
- Lockdown
- Personalisation


Reply all
Reply to author
Forward
0 new messages