Re: backends (ldap)



Hi,

>From: monkeyiq dingoblue net au
>X-Accept-Language: en

>    I am toying with some LDAP code making a backend for gconf.

Very cool! LDAP is a very powerful directory service and it's
widely used - I'm sure this backend will be popular.

>I am starting out small, trying to get read/write access going (string
>type only), before doing metadata and other data types etc.

You might like to take a look at some routines that I wrote
for the BDB (BerkeleyDB) backend to encode all of the GConf
data-types as strings - the files are backend/val-encode.[ch].

>I have decided to write it in C++ because C is very bad at string
>handling etc.

The GString routines are actually a big help for string
concatenation, which is something you do a lot when
manipulating keys or constructing string values.

>I have some code at the moment, and it is installed along side the xml
>backend.
>
>-rw-r--r--    1 root     root       354208 Nov 11 03:03
>libgconfbackend-ldap.a
>-rwxr-xr-x    1 root     root          790 Nov 11 03:03
>libgconfbackend-ldap.la
>-rwxr-xr-x    1 root     root       402651 Nov 11 03:03
>libgconfbackend-ldap.so
>-rw-r--r--    1 root     root        47676 Oct 29 16:02
>libgconfbackend-xml.a
>-rwxr-xr-x    1 root     root          779 Oct 29 16:02
>libgconfbackend-xml.la
>-rwxr-xr-x    1 root     root        49528 Oct 29 16:02
>libgconfbackend-xml.so
>
>I also have a data source in my gconf config file /etc/gconf/path
>ldap:readwrite:$(HOME)/.gconf
>xml:readwrite:$(HOME)/.gconf
>(the path specific part is wrong at the moment, but I don't parse that
>at current either).
>
>when I try to use it I get
>Nov 11 03:03:53 kloof gconfd (ben-32522): starting (version 0.10), pid
>32522 user 'ben'
>Nov 11 03:03:53 kloof gconfd (ben-32522): Adding source
>`xml:readonly:/etc/gconf/gconf.xml.mandatory'
>Nov 11 03:03:53 kloof gconfd (ben-32522): Adding source
>`ldap:readwrite:/home/ben/.gconf'
>Nov 11 03:03:53 kloof gconfd (ben-32522): Adding source
>`xml:readwrite:/home/ben/.gconf'
>Nov 11 03:03:53 kloof gconfd (ben-32522): Adding source
>`xml:readonly:/etc/gconf/gconf.xml.defaults'
>Nov 11 03:03:53 kloof gconfd (ben-32522): Initializing XML backend
>module
>Nov 11 03:03:53 kloof gconfd (ben-32522): Unloading XML backend module.
>Nov 11 03:03:53 kloof gconfd (ben-32522): Failed to load source
>`xml:readonly:/etc/gconf/gconf.xml.mandatory': Failed:  Could not make
>directory `/etc/gconf/gconf.xml.mandatory': Permission denied
>Nov 11 03:03:53 kloof gconfd (ben-32522): Failed to load source
>`ldap:readwrite:/home/ben/.gconf': Failed:  Error opening module `ldap':
>undefined symbol: cerr
>Nov 11 03:03:53 kloof gconfd (ben-32522): Initializing XML backend
>module
>Nov 11 03:03:53 kloof gconfd (ben-32522): Directory/file permissions for
>XML source at root /home/ben/.gconf are: 700/600
>Nov 11 03:03:53 kloof gconfd (ben-32522): Failed to load source
>`xml:readonly:/etc/gconf/gconf.xml.defaults': Failed:  Could not make
>directory `/etc/gconf/gconf.xml.defaults': Permission denied

The undefined symbol 'cerr' error suggests that maybe you
didn't link the necessary C++ libraries.

>I presume that the symbol error is due to C++ so the vtable and all
>functions are wrapped in
>extern "c" {
>};

That will definitely help, but the most important symbol
to make extern "C" is the gconf_backend_get_vtable() routine
as this is the only one called by name from C code. The
backend "vtable" functions are accessed by function pointers
so they will work correctly provided they don't reference
C++ methods that require an instance (static methods are
fine).

Colm.

>This doesn't help. I'll prolly keep looking at this but I thought that
>I'd post this incase somebody
>has a fix for it, like a compiler option that must be different for C++
>
>I am using a very similar copy of Makefile.am in a subdir of backends to
>compile the ldap
>backend.
>
>
>_______________________________________________
>gconf-list mailing list
>gconf-list gnome org
>http://mail.gnome.org/mailman/listinfo/gconf-list






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]