Senthil Murugan's Blog

Home » Oracle » Validating email server username and password in oracle (zimbra server)

Validating email server username and password in oracle (zimbra server)

DECLARE
  l_ldap_host    VARCHAR2(256) := ‘mail.emailserver.com’;
  l_ldap_port    VARCHAR2(256) := ‘389’;
  l_ldap_user    VARCHAR2(256) := ‘uid=user,ou=people,dc=domainname,dc=com’;
  l_ldap_passwd  VARCHAR2(256) := ‘password‘;
  l_retval       PLS_INTEGER;
  l_session      DBMS_LDAP.session;
  l_attrs        DBMS_LDAP.string_collection;
  l_message      DBMS_LDAP.message;
  l_entry        DBMS_LDAP.message;
  l_attr_name    VARCHAR2(256);
  l_ber_element  DBMS_LDAP.ber_element;
  l_vals         DBMS_LDAP.string_collection;
BEGIN
  — Choose to raise exceptions.
  DBMS_LDAP.USE_EXCEPTION := TRUE;
  — Connect to the LDAP server.
  l_session := DBMS_LDAP.init(hostname => l_ldap_host,
                              portnum  => l_ldap_port);
  l_retval := DBMS_LDAP.simple_bind_s(ld     => l_session,
                                      dn     => l_ldap_user,
                                      passwd => l_ldap_passwd);
  DBMS_OUTPUT.PUT_LINE(‘bind:L_RETVAL: ‘ || l_retval);
  l_retval := DBMS_LDAP.unbind_s(ld => l_session);
  DBMS_OUTPUT.PUT_LINE(‘unbind:L_RETVAL: ‘ || l_retval);
end;

— replace user with email id without domain name, password with email password

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: