Hi,

I posted this a few days ago on the pgsql-sql list, but got no response. Is
there any way to enable loading tclLDAP from within a pltcl function? I
would like to maintain an openldap directory using an update/insert trigger.

I modified pltcl.c to load a non-safe interpreter and recompiled. This
allowed me to use the "load" command, but the tclLDAP library still would
not load. The error message is:

ERROR: pltcl: couldn't load file "/usr/lib/tclLDAP/Ldap.so":
/usr/lib/tclLDAP/Ldap.so: undefined symbol: Tcl_PkgProvide (#1)

I am not even close to being fluent in c. I would greatly appreciate any
suggestions.

BTW, perhaps in some future release you might consider allowing a non-safe
tcl interpreter (or at least some kind of controlled external library
support) as an option.

Thanks,

Joe Conway


-----Original Message-----
From: Joe Conway <jconway2@home.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Date: Sunday, February 20, 2000 11:55 AM
Subject: pltcl and LDAP


>I'm working on a project right now which involves updating an LDAP
directory
>from a PostgreSQL database. The database includes a table called
>employee_data. I would like to use the tclLDAP library from within a pltcl
>function and create a trigger on the employee_data table to update the LDAP
>directory every time something changes.
>
>I have been able to get the tclLDAP functions to work properly from with
>pgtclsh, but not from within pltcl. The documentation states that pltcl
uses
>a safe interpreter which does not allow a tcl load command.
>
>Has anyone else tried to do this, i.e. synch up a PostgreSQL database with
a
>LDAP directory? If so, how? I have considered just writing a pgtclsh script
>and running it from cron, but I would prefer real time updates via a
trigger
>if possible.
>
>Any help or suggestions would be much appreciated.
>
>Thanks,
>
>Joe
>


Tue, 22 Feb 2000 21:57:00 -0800
"Joe Conway" <jconway2@home.com>
pltcl and LDAP
Joe Conway wrote:

> Hi,
>
> I posted this a few days ago on the pgsql-sql list, but got no response. Is
> there any way to enable loading tclLDAP from within a pltcl function? I
> would like to maintain an openldap directory using an update/insert trigger.
>
> I modified pltcl.c to load a non-safe interpreter and recompiled. This
> allowed me to use the "load" command, but the tclLDAP library still would
> not load. The error message is:
>
> ERROR: pltcl: couldn't load file "/usr/lib/tclLDAP/Ldap.so":
> /usr/lib/tclLDAP/Ldap.so: undefined symbol: Tcl_PkgProvide (#1)

    Um - and that's the only unresolved one?

    Which  version  of Tcl is used from PL/Tcl, and which version
    is the Ldap.so linked against?

> I am not even close to being fluent in c. I would greatly appreciate any
> suggestions.
>
> BTW, perhaps in some future release you might consider allowing a non-safe
> tcl interpreter (or at least some kind of controlled external library
> support) as an option.

    Kinda that is on my personal TODO/wishlist. Splitting  PL/Tcl
    into  two  separate  interpreters  internally,  identified by
    different language names.  The  unsafe  language,  with  full
    access to OS under the postgres userID, would be an untrusted
    language, so  creation  of  functions  is  restricted  to  DB
    superusers.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #



Wed, 23 Feb 2000 11:22:52 +0100 (CET)
wieck@debis.com (Jan Wieck)
Re: [HACKERS] pltcl and LDAP
I wrote:

> Joe Conway wrote:
>
> > I modified pltcl.c to load a non-safe interpreter and recompiled. This
> > allowed me to use the "load" command, but the tclLDAP library still would
> > not load. The error message is:
> >
> > ERROR: pltcl: couldn't load file "/usr/lib/tclLDAP/Ldap.so":
> > /usr/lib/tclLDAP/Ldap.so: undefined symbol: Tcl_PkgProvide (#1)
>
>     Um - and that's the only unresolved one?
>
>     Which  version  of Tcl is used from PL/Tcl, and which version
>     is the Ldap.so linked against?

    I've checked by using a normal (unsafe) interpreter like you.
    And I  had  no  problems  loading  a  shared  extension  that
    definitely calls Tcl_PkgProvide().

    But  this reminds me to some similar dynamic loading problems
    Bruce  had  once  with  PL/pgSQL  on  FreeBSD   with   global
    variables.

    So what's your platform, compiler, Tcl-version?

    I'm using Linux 2.2.x, glibc-2, gcc 2.8.1, Tcl 8.0 here.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #



Wed, 23 Feb 2000 16:34:29 +0100 (CET)
wieck@debis.com (Jan Wieck)
Re: [HACKERS] pltcl and LDAP