Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Powerbuilder 9 and LDAP Authentification

1,915 views
Skip to first unread message

Courtigu

unread,
Sep 21, 2009, 9:25:54 AM9/21/09
to
I work on Client Application developed with Powerbuilder 9?

Before entering in the application, a login and a password
is asked. I would like to authenticate with LDAP annuary
(Active Directory).

I've tried to put library furnitured by Sybase (see link,
http://www.sybase.com/detail?id=1058501#789) in my project
but I fail.

With this link you get a zip file called "pb2ldap.zip" which
contains Powerbuilder Libraries and dll files.

When I launch LDAP authentification : my program fails, it
cannot launch Java virtual machine.

I don't know why, has someone already tested these libraries
?

Thanks for all information you can put in this subject.

Roland Smith [TeamSybase]

unread,
Sep 21, 2009, 3:03:24 PM9/21/09
to
I have an example using the Win API function LogonUser which is a much
easier way of doing it.

http://www.topwizprogramming.com/freecode_validlogon.html

Here is the documentation for LogonUser:

http://msdn.microsoft.com/en-us/library/aa378184(VS.85).aspx

<Courtigu> wrote in message news:4ab77ee2.122...@sybase.com...

Courtigu

unread,
Sep 22, 2009, 3:49:48 AM9/22/09
to
Thanks for your answer.

But I have 2 more questions :
1) If I attempt to log with a user and password which is not
a local account of the PC but which is an active directory
account known in the local network, can I use this function?
2) The function LogonUser doesn't require the IP address of
the named server on which Active Directory is running. How
does it find this server ?

Thanks for all information that could help me.

> I have an example using the Win API function LogonUser
> which is a much easier way of doing it.
>
> http://www.topwizprogramming.com/freecode_validlogon.html
>
> Here is the documentation for LogonUser:
>
>
http://msdn.microsoft.com/en-us/library/aa378184(VS.85).aspx
>
> <Courtigu> wrote in message
> news:4ab77ee2.122...@sybase.com... >I work on
> Client Application developed with Powerbuilder 9? >
> > Before entering in the application, a login and a
> > password is asked. I would like to authenticate with
> > LDAP annuary (Active Directory).
> >
> > I've tried to put library furnitured by Sybase (see link

> > , http://www.sybase.com/detail?id=1058501#789) in my

Roland Smith [TeamSybase]

unread,
Sep 22, 2009, 9:16:47 AM9/22/09
to
If you pass a value in the domain name argument, it will validate the user
against Active Directory on the Domain Controller. If you leave it blank as
in my example, it will validate it against local accounts.

My example Netquery has the function NetWkstaGetInfo which will return the
domain that the computer is a member of.

<Courtigu> wrote in message news:4ab8819b.366...@sybase.com...

dk

unread,
Sep 28, 2009, 3:02:01 PM9/28/09
to
On Sep 22, 9:16 am, "Roland Smith [TeamSybase]"

<rsmith_at_trusthss_dot_com> wrote:
> If you pass a value in the domain name argument, it will validate the user
> against Active Directory on the Domain Controller. If you leave it blank as
> in my example, it will validate it against local accounts.
>
> My example Netquery has the function NetWkstaGetInfo which will return the
> domain that the computer is a member of.
>
>
>
> <Courtigu> wrote in messagenews:4ab8819b.366...@sybase.com...

> > Thanks for your answer.
>
> > But I have 2 more questions :
> > 1) If I attempt to log with a user and password which is not
> > a local account of the PC but which is an active directory
> > account known in the local network, can I use this function?
> > 2) The functionLogonUserdoesn't require the IP address of

> > the named server on which Active Directory is running. How
> > does it find this server ?
>
> > Thanks for all information that could help me.
>
> >> I have an example using the Win API functionLogonUser
> >> which is a much  easier way of doing it.
>
> >>http://www.topwizprogramming.com/freecode_validlogon.html
>
> >> Here is the documentation forLogonUser:
>
> >http://msdn.microsoft.com/en-us/library/aa378184(VS.85).aspx
>
> >> <Courtigu> wrote in message
> >>news:4ab77ee2.122...@sybase.com... >I work on
> >> Client Application developed with Powerbuilder 9? >
> >> > Before entering in the application, a login and a
> >> > password is asked. I would like to authenticate with
> >> > LDAP annuary (Active Directory).
>
> >> > I've tried to put library furnitured by Sybase (see link
> >> > ,http://www.sybase.com/detail?id=1058501#789) in my

> >> > project but I fail.
>
> >> > With this link you get a zip file called "pb2ldap.zip"
> >> > which contains Powerbuilder Libraries and dll files.
>
> >> > When I launch LDAP authentification : my program fails,
> >> > it cannot launch Java virtual machine.
>
> >> > I don't know why, has someone already tested these
> >> > libraries ?
>
> >> > Thanks for all information you can put in this subject.- Hide quoted text -
>
> - Show quoted text -

Excellent code, thanks a lot!!! Believe it or not I am still using PB
7 and this code was not working there. It does work on PB 11.5. Do you
now why ??

dk

unread,
Sep 29, 2009, 11:18:20 AM9/29/09
to
> now why ??- Hide quoted text -

>
> - Show quoted text -

Update to above issue - I used following declerations and it worked on
PB 7 also. The change was to use logonuserA instead on LogonuserW as
the alias. all other declerations were kept as in your (Roland Smith)
post.

Function ulong WNetGetUser( &
string lpname, &
ref string lpusername, &
ref ulong buflen &
) Library "mpr.dll" Alias For "WNetGetUserW"

Function boolean LogonUser ( &
string lpszUsername, &
string lpszDomain, &
string lpszPassword, &
ulong dwLogonType, &
ulong dwLogonProvider, &
ref ulong phToken &
) Library "advapi32.dll" Alias For "LogonUserA"

Function boolean CloseHandle ( &
ulong hObject &
) Library "kernel32.dll"

Courtigu

unread,
Sep 29, 2009, 12:27:05 PM9/29/09
to

Thanks Robert. Your code helps me a lot and it works with my
application in the local network of the customer.

0 new messages