Last Comment Bug 295329 - autoconfig , prefcalls Ldap queries doesn't work
: autoconfig , prefcalls Ldap queries doesn't work
Status: RESOLVED INCOMPLETE
:
Product: Firefox
Classification: Client Software
Component: Preferences (show other bugs)
: 2.0 Branch
: x86 Linux
: -- critical with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
: Jared Wein [:jaws] (please needinfo? me)
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-24 04:07 PDT by Jehan Procaccia
Modified: 2011-07-28 10:32 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Jehan Procaccia 2005-05-24 04:07:14 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.7.8-1.3.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.7.8-1.3.1

firefox 1.0.3 seems to allow autoconfig to work,
Autoconfig for firefox is VERY well documented on 
http://mit.edu/~firefox/www/maintainers/autoconfig.html
and partialy (for mozilla 1.x) in my doc
http://www.int-evry.fr/s2ia/user/procacci/netscape/en/mozilla-autoconfig-en.html

but I still have lot of problems ... especialy with ldap queries 
the getLDAPAttributes functions fails  :-(
error popup messages is:
"Error: getLDAPAttributes failed: TypeError:
Components.classes[LDAPURLContractID] has no properties" 
Any clues on that (I did removed the --disable-ldap in compile options !) 





Reproducible: Always

Steps to Reproduce:
1. ask for autoconfig:

$ tail -6 /usr/lib/firefox-1.0.4/greprefs/all.js
// autoconfig jehan
pref('general.config.obscure_value', 0);
pref('general.config.filename', 'firefox.cfg');




2.
edit the firefox.cfg file

//put everything in a try/catch
try {

//simple lockpref that do work :-), just to check that autoconfig did something 
//Privacy & Security
defaultPref("signon.rememberSignons", false);

//Get username, for the ldap querie
 var env_user    = getenv("USER");
/* 2) define processLDAPValues() here (because if set after "3)" below it
doesn't work !) processLDAPValues which is eventually called by
getLDAPAttributes() just below,
 check getLDAPAttributes() code from
$MOZILLA_HOME/defaults/autoconfig/prefcalls.js to see the inside call to "user
defined" processLDAPValues
*/
function processLDAPValues (values) {
 if(values) {
      // set the global var with the values returned from the LDAP query
      ldap_values = values;
    var uid = getLDAPValue ( values ,"uid" );
    var cn = getLDAPValue ( values ,"cn" );
    var mail = getLDAPValue ( values ,"mail" );

    }
  }
// 3) Call Ldap servers to get Ldap Attributes (mail & cn) , this will finally
call processLDAPValues , "2)" just above.
  getLDAPAttributes("ldap3.int-evry.fr","ou=people,dc=int-evry,dc=fr","uid=" +
env_user,"uid,cn,mail");

//Debug with popup error messages, that doesn't work anymore :-( !! why ??
var env_mozdebug= getenv("MOZILLA_DEBUG");
if (env_mozdebug) {         displayError("NO ERROR , just a test, cn =" + cn); }
// try a simple lockpref for debuugin, that one is never set :-(, code might
crash before that line ?
lockPref("browser.startup.homepage", "http://www.int-evry.fr/");

// Close the try, and call the catch()
} catch(e) {
  displayError("lockedPref", e);
}



3. start firefox

Actual Results:  
in 1.0.3 
popup messages is:
"Error: getLDAPAttributes failed: TypeError:
Components.classes[LDAPURLContractID] has no properties" 

in 1.0.4 nothing happens :-( , the file seems to start beeing parse as the first
lockpref is set, but not the lastone at the end of the script 

Expected Results:  
ldap values get retrieved so that I can set aother preferences base on the email
address of the user grabbed from ldap ! that will be more usefull in thunderbird
actually ...

Related recents buzilla:

https://bugzilla.mozilla.org/show_bug.cgi?id=222973
https://bugzilla.mozilla.org/show_bug.cgi?id=225288
https://bugzilla.mozilla.org/show_bug.cgi?id=178685
https://bugzilla.mozilla.org/show_bug.cgi?id=272970

source code I suppose ?
http://lxr.mozilla.org/seamonkey/source/extensions/pref/autoconfig/src/

docs
http://mit.edu/~firefox/www/maintainers/autoconfig.html
http://www.alain.knaff.lu/howto/MozillaCustomization/
http://thegoldenear.org/toolbox/windows/docs/mozilla-pre-config.html
http://www.int-evry.fr/s2ia/user/procacci/netscape/en/mozilla-autoconfig-en.html
Comment 1 timeless 2005-05-24 14:29:24 PDT
i bet firefox doesn't build/ship w/ ldap :)
Comment 2 Jehan Procaccia 2005-05-25 03:36:19 PDT
that works :-) 

Indeed I hadn't rebuilt my firefox 1.0.4 with ldap enable (removed
--disable-ldap !). However I did do it in 1.0.3 where I finnaly ened on "Error:
getLDAPAttributes failed: TypeError:" ... ??

Anyway, it does work now for my fresly built firefox .
demonstration:

for a minimun debug:
$ export NSPR_LOG_MODULES=MCD:5
$ export NSPR_LOG_FILE=~/firefox.log

[root@calaz /usr/lib/firefox-1.0.4]
$ tail -6 greprefs/all.js
// autoconfig jehan
pref('general.config.obscure_value', 0);
pref('general.config.filename', 'firefox.cfg')

firefox.cfg:

try {
var env_user    = getenv("USER");
//ldap values
function processLDAPValues (values) {
 if(values) {
      ldap_values = values;
    var cn = getLDAPValue ( values ,"cn" );
    var mail = getLDAPValue ( values ,"mail" );
    var URL =  getLDAPValue ( values ,"labeledURI" );
//set the firefox home page to the personnal user's page retrived from ldap
lockPref("browser.startup.homepage", URL );
    }
  }
// ldap querie
  getLDAPAttributes("ldap3.int-evry.fr","ou=people,dc=int-evry,dc=fr","uid=" +
env_user,"uid,cn,mail,labeledURI");
} catch(e) {displayError("lockedPref", e);}

openldap log when firefox start, I do see the querie

May 25 12:07:08 babylone slapd[8948]: conn=161 op=1 SRCH
base="ou=people,dc=int-evry,dc=fr" scope=2 filter="(uid=procacci)"
May 25 12:07:08 babylone slapd[8948]: conn=161 op=1 SRCH attr=cn mail labeledURI

when firefox shows up I do start on my homepage as recoreded in ldap :-) 

Just a remark, the firefox.log do show the read of firefox.cfg , but then I get
warnings that I don't really understand ... I suppose I get these because I
recompile firefox with enable debug !

$ cat firefox.log
-1209947296[8067548]: general.config.filename = firefox.cfg
-1209947296[8067548]: evaluating .cfg file firefox.cfg with obscureValue 0
-1209947296[8067548]: WARNING: chrome: failed to get base url for
chrome://autoconfig/locale/autoconfig.properties -- using wacky default, file
nsChromeRegistry.cpp, line 531
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file
nsPermissionManager.cpp, line 623
-1209947296[8067548]: WARNING: the property eo already exists
, file nsPersistentProperties.cpp, line 282
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file
nsSyncLoadService.cpp, line 633
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file
nsXBLService.cpp, line 1236
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file
nsSyncLoadService.cpp, line 633
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file
nsXBLService.cpp, line 1236
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file
nsSyncLoadService.cpp, line 633
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file
nsXBLService.cpp, line 1236
-1209947296[8067548]: WARNING: requested removal of nonexistent window
, file nsWindowWatcher.cpp, line 944
-1209947296[8067548]: WARNING: nsExceptionService ignoring thread destruction
after shutdown, file nsExceptionService.cpp, line 191
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed, file
nsGlobalHistory.cpp, line 2520
-1209947296[8067548]: WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(OpenDB())) failed,
file nsGlobalHistory.cpp, line 1221
-1209947296[8067548]: ###!!! ASSERTION: Component Manager being held past XPCOM
shutdown.: 'cnt == 0', file nsXPComInit.cpp, line 839
-1209947296[8067548]: ###!!! Break: at file nsXPComInit.cpp, line 839

Is this still a problem ?

Now I'all have to make the same thing run with thunderbird
follow the thread comming in in: https://bugzilla.mozilla.org/show_bug.cgi?id=225288
thanks.
Comment 3 Gervase Markham [:gerv] 2005-09-27 01:47:02 PDT
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
Comment 4 Gervase Markham [:gerv] 2005-10-13 10:15:48 PDT
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Comment 5 Jehan Procaccia 2006-05-15 04:16:45 PDT
in firefox 1.5.0.3 it ldap calls in autoconfig are still unavailable ! :-( 
I supose it has been compiled with --disable-ldap ?
Comment 6 Jehan Procaccia 2006-05-17 07:06:23 PDT
How can I check the compilation options used ?
there's the URL "about:buildconfig" in firefox, but is there an equivalent in thunderbid ? 
The only way I could try to figure out which options have been used, is to get the source RPM and check spec files:
On my fedora core 5 I took thunderbird-1.5-6.src.rpm
the SOURCE directory contains a thunderbird-mozconfig which is finally converted to .mozconfig in the top source dir (mozilla) , it contains:
. $topsrcdir/mail/config/mozconfig

ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-jpeg
ac_add_options --with-system-zlib
ac_add_options --with-system-png
ac_add_options --with-pthreads
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-installer
ac_add_options --enable-optimize="$RPM_OPT_FLAGS"
ac_add_options --enable-xinerama
ac_add_options --enable-default-toolkit=gtk2
ac_add_options --disable-xprint
ac_add_options --disable-strip
ac_add_options --enable-pango
ac_add_options --enable-system-cairo
ac_add_options --enable-svg
ac_add_options --enable-canvas

export BUILD_OFFICIAL=1
export MOZILLA_OFFICIAL=1

and $topsrcdir/mail/config/mozconfig contains:
$ cat mail/config/mozconfig
# This file specifies the build flags for Thunderbird.  You can use it by adding:
#  . $topsrcdir/mail/config/mozconfig
# to the top of your mozconfig file.

mk_add_options MOZ_CO_PROJECT=mail
ac_add_options --enable-application=mail

ldap options (--disable-ldap) or autoconfig options (--enable-extensions=pref) don't appear anywhere in those files !?
However, I do confirm that autoconfig and autoconfig through ldapcalls (getLDAPAttributes) does work fine in thunderbird (not in firefox :-( ) . The only solution I see that in the defaults, --disable-ldap is not used and --enable-extensions=pref is set .

Please let me know how to check for sure, which compilation options (set and defaults) have been used in thunderbird and in firefox .
thanks.
Comment 7 Wolfgang Rosenauer [:wolfiR] 2006-05-17 23:59:43 PDT
Please check http://landfill.mozilla.org/mxr-test/mozilla1.8.0.x/source/configure.in#4062 and following lines.
For LDAP support to be compiled in you would need MOZ_LDAP_XPCOM=1 which is only set for SeaMonkey and Thunderbird.
Comment 8 Jehan Procaccia 2006-05-18 06:01:40 PDT
indeed ! you might be right .
I patched configure.in to include "MOZ_LDAP_XPCOM=1" in the browser I recompiled firefox for my FC5, unfortunatly autoconfig ldap calls are still unavailable :-(
I checked configure.in and .mozconfig and even after recompilation the about:buildconfig, none of them show the --disable-ldap ! 
what else am I missing ? 

here's the patch i made:
[root@b008-02 SOURCES]# cat firefox-1.5-autoconfig-ldap.patch
diff -ur mozilla.orig/configure.in mozilla/configure.in
--- mozilla.orig/configure.in   2006-05-18 09:30:33.000000000 +0200
+++ mozilla/configure.in        2006-05-18 10:00:36.000000000 +0200
@@ -4094,6 +4094,7 @@
  MOZ_PHOENIX=1
  MOZ_APP_VERSION=$FIREFOX_VERSION
  MOZ_EXTENSIONS_DEFAULT=" cookie xml-rpc xmlextras pref transformiix
universalchardet webservices inspector gnomevfs auth permissions reporter"
+  MOZ_LDAP_XPCOM=1
  AC_DEFINE(MOZ_PHOENIX)
  ;;

Is there a way to check after compilation that MOZ_LDAP_XPCOM=1 has really been taken ? I tried ldd on firefox-bin to look for ldap libraries, none appears, anyway I did the same ldd on thunderbird-bin, none either , but it (ldap calls) does work on thunderbird , how can I check for sure that ldap support is included in the binary .
Thanks 
Comment 9 Dan Mosedale (:dmose) 2006-05-18 15:12:07 PDT
Did you manually re-run autoconf after patching configure.in?  By default, build process won't do this for you automatically.
Comment 10 Jehan Procaccia 2006-05-19 06:05:26 PDT
no, 
in fact I use rpmbuild , which read a firefox.spec and automatically untar, patch, compile, and create an rpm package.
the build section in the firefox.spec file contains:
%build

export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | %{__sed} s/-O2/-Os/`
MAKE="gmake %{?_smp_mflags}" make -f client.mk build

Indeed I don't see any autoconf nor ./configure in here !
I'am lost in all those pre-conf files -> client.mak , client.mk, configure.in, configure etc ...
running autoconf manually generate an error, but maybe running it in the flow of the rpm .spec file will allow it to run ?
what do you recommend ?, remember, I just want to enabled ldap autoconfig calls for firefox .

[root@b008-02 mozilla]# pwd
/usr/src/redhat/BUILD/mozilla
[root@b008-02 mozilla]# autoconf
build/autoconf/altoptions.m4:156: error: m4_defn: undefined macro: _m4_divert_diversion
build/autoconf/altoptions.m4:153: MOZ_READ_MOZCONFIG is expanded from...
build/autoconf/altoptions.m4:156: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
Comment 11 Dan Mosedale (:dmose) 2006-05-19 12:24:09 PDT
(In reply to comment #10)
> no, 
> in fact I use rpmbuild , which read a firefox.spec and automatically untar,
> patch, compile, and create an rpm package.
> the build section in the firefox.spec file contains:
> %build
> 
> export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | %{__sed} s/-O2/-Os/`
> MAKE="gmake %{?_smp_mflags}" make -f client.mk build
> 
> Indeed I don't see any autoconf nor ./configure in here !

That make command eventually causes configure to run.  However, it does not cause autoconf to regenerate configure from configure.in, which would be necessary for the fix you propose to work.  As a workaround, try patching configure directly instead of patching configure.in.
Comment 12 Jehan Procaccia 2006-05-23 10:47:40 PDT
Great , that works, I now patched directly configure script and autoconfig + ldap calls do work now . 
I updated my mozilla family autoconfig doc accordingly :
http://www.int-evry.fr/s2ia/user/procacci/netscape/en/mozilla-autoconfig-en.html#htoc18

Any plans to include by default  MOZ_LDAP_XPCOM=1 in the browser) (firefox !) ?
If not, any clues on how to compile my own packages on the windows platform ?
I tried that a year ago whitout sucess (http://forums.mozillazine.org/viewtopic.php?t=276014)

FYI here's the patch I applied in my RPM firefox.spec file:

[root@b008-02 /usr/src/redhat/SOURCES]
$cat firefox-1.5-configure-ldap.patch
--- mozilla.orig/configure      2006-05-18 09:30:33.000000000 +0200
+++ mozilla/configure   2006-05-22 12:03:42.000000000 +0200
@@ -12689,6 +12689,7 @@
   MOZ_XUL_APP=1
   MOZ_PHOENIX=1
   MOZ_APP_VERSION=$FIREFOX_VERSION
+  MOZ_LDAP_XPCOM=1
   MOZ_EXTENSIONS_DEFAULT=" cookie xml-rpc xmlextras pref transformiix universalchardet webservices inspector gnomevfs auth permissions reporter"
   cat >> confdefs.h <<\EOF
 #define MOZ_PHOENIX 1
Comment 13 Jehan Procaccia 2007-03-21 06:32:17 PDT
 I've recently tested with firefox 2.0.0.2 on fedora core 6 , apparently default configuration options still don't support ldap calls in autoconfig/MCD (MOZ_LDAP_XPCOM=1 in mozilla/configure.in is not set by default I suppose).
I've updated the MCD/autoconfig Doc accordingly:
http://developer.mozilla.org/en/docs/MCD%2C_Mission_Control_Desktop_AKA_AutoConfig#Firefox_2.x

Howerver, and fortunatly,  because it's realy there that ldap calls are needed ! it works fine in thunderbird 2 beta2 :
http://developer.mozilla.org/en/docs/MCD%2C_Mission_Control_Desktop_AKA_AutoConfig#Thunderbird_2.x_beta_2

thanks to developers/packagers, to maintain that unvaluable feature (MCD/autoconfig) for enterprise deployements .
Comment 14 u88484 2009-06-27 12:35:22 PDT
This bug was reported using a version of Firefox that security and stability updates are no longer provided for.  All users are strongly encouraged to upgrade to Firefox 3 by selecting 'Check for Updates' in the Help menu or by going to http://www.mozilla.com/en-US/firefox/firefox.html

If you can no longer reproduce this bug using the latest Firefox 3.0.x version, please change the status of this bug to 'RESOLVED' 'WORKSFORME'.

If you can still reproduce this bug, please provide additional details to help resolve this issue.
Comment 15 Jehan Procaccia 2009-06-29 07:11:51 PDT
this bug is revival in thunderbird 3.x and firefox 3.5 :-( 

default Fedora11 packages needs to be recompiled with MOZ_LDAP_XPCOM=1
 and --enable-extensions=pref in order to beneficiate of that unvaluable feature (autoconfig based on ldap calls) for large enterprise deployements .

for details, check the doc I maintain at
https://developer.mozilla.org/index.php?title=en/MCD%2C_Mission_Control_Desktop_AKA_AutoConfig#Thunderbird

unfortunatly, this time, applying the usual compile options doesn't seem to be enough, although I recompiled thunderbird-3.0-2.3.beta2 with --enable-extensions=pref and MOZ_LDAP_XPCOM=1, when I start it with calls to a thunderbird defaultpref file within greprefs/all.js:
pref("general.config.obscure_value", 0); // for MCD .cfg files
pref('general.config.filename', 'thunderbird.cfg'); // for MCD .cfg files

at start-up, I get the following error message

"Netscape.cfg/AutoConfig failed. Please contact your system administrator.
 Error: getLDAPAttibutes failed: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsILDAPURL.spec]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: file:////usr/lib/thunderbird-3.0b2/defaults/autoconfig/prefcalls.js :: getLDAPAttributes :: line 174"  data: no]"

looks as if the ldap extension for getLDAPAttributes function  prefcalls.js isn't present !? or something else?. MOZ_LDAP_XPCOM=1 wasn't the solution to that ?

Any help, greatly appreciated .
thanks .
Comment 16 Mark Banner (:standard8, limited time in Dec) 2010-03-09 00:24:27 PST
(In reply to comment #15)
> this bug is revival in thunderbird 3.x and firefox 3.5 :-( 

To clarify, bug 502597 fixed this for Thunderbird.

Currently there is no way to easily do this for Firefox as Firefox no longer has the option to build the LDAP XPCOM code. Although the solution would be to "borrow" the code from comm-central and build it into mozilla-central.
Comment 17 Tyler Downer [:Tyler] 2010-05-22 17:12:47 PDT
No reply, INCOMPLETE. Please retest with Firefox 3.6.x or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Comment 18 Jehan Procaccia 2011-07-28 10:32:05 PDT
I confirme that in FF5 LDAP (XPCOM) still doesn't work, although it does in TB5
the error message when ldap calls are enabled in FF5 firefox.cfg file is:

Netscape.cfg/AutoConfig failed. Please contact your system administrator.
 Error: getLDAPAttibutes failed: [Exception... "Could not convert JavaScript argument arg 0 [nsISupports.QueryInterface]"  nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: prefcalls.js :: getLDAPAttributes :: line 177"  data: no]

I detailed my experience in 
https://developer.mozilla.org/index.php?title=en/MCD%2C_Mission_Control_Desktop_AKA_AutoConfig#Firefox5

I don't know if it's a big deal to ""borrow" the code from comm-central and build it into mozilla-central" as Mark told in comment #15, but that would be great .

I am questionning also about the defaults/pref directory that doesn't exist in FF5 packages by default :-(
To make autoconfig (aka MCD) run  I had to manually create it, but it wasn't sufficient, looking at omni.jar in FF5 I noticed that it's not defaults/pref but rather defaults/preferences !
moving the call to firefox.cfg in there made it work though.
Is there any chance to get defaults/preferences created by default and maybe named the same as in TB5 ?

Note You need to log in before you can comment on or make changes to this bug.