#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
*/
/*
* sbind.c
*/
#if 0
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#endif
#include "ldap-int.h"
int unlock_permitted );
/*
* ldap_simple_bind - bind to the ldap server. The dn and
* password of the entry to which to bind are supplied. The message id
* of the request initiated is returned.
*
* Example:
* ldap_simple_bind( ld, "cn=manager, o=university of michigan, c=us",
* "secret" )
*/
int
{
int rc;
if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
return( -1 );
}
return( rc );
}
static int
int unlock_permitted )
{
/*
* The bind request looks like this:
* BindRequest ::= SEQUENCE {
* version INTEGER,
* name DistinguishedName, -- who
* authentication CHOICE {
* simple [0] OCTET STRING -- passwd
* }
* }
* all wrapped up in an LDAPMessage sequence.
*/
dn = "";
passwd = "";
/* if ( unlock_permitted ) LDAP_MUTEX_UNLOCK( ld ); */
/* if ( unlock_permitted ) LDAP_MUTEX_LOCK( ld ); */
if ( rc != 0 ) {
return( rc );
}
}
/* create a message to send */
!= LDAP_SUCCESS ) {
return( -1 );
}
/* fill it in */
return( -1 );
}
return( -1 );
}
/* send the message */
}
/*
* ldap_simple_bind - bind to the ldap server using simple
* authentication. The dn and password of the entry to which to bind are
* supplied. LDAP_SUCCESS is returned upon success, the ldap error code
* otherwise.
*
* Example:
* ldap_simple_bind_s( ld, "cn=manager, o=university of michigan, c=us",
* "secret" )
*/
int
{
int msgid;
if ( NSLDAPI_VALID_LDAP_POINTER( ld ) &&
}
}
/*
* simple_bindifnot_s() is like ldap_simple_bind_s() except that it only does
* a bind if the default connection is not currently bound.
* If a successful bind using the same DN has already taken place we just
* return LDAP_SUCCESS without conversing with the server at all.
*/
static int
{
char *binddn;
if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
return( LDAP_PARAM_ERROR );
}
}
/*
* if we are already bound using the same DN, just return LDAP_SUCCESS.
*/
rc = LDAP_SUCCESS;
return rc;
}
/*
* if the default connection has been lost and is now marked dead,
* dispose of the default connection so it will get re-established.
*
* if not, clear the bind DN and status to ensure that we don't
* report the wrong bind DN to a different thread while waiting
* for our bind result to return from the server.
*/
}
}
/*
* finally, bind (this will open a new connection if necessary)
*
* do everything under the protection of the result lock to
* ensure that only one thread will be in this code at a time.
* XXXmcs: we should use a condition variable instead?
*/
goto unlock_and_return;
}
/*
* Note that at this point the bind request is on its way to the
* server and at any time now we will either be bound as the new
* DN (if the bind succeeded) or we will be bound as anonymous (if
* the bind failed).
*/
/*
* Wait for the bind result. Code inside result.c:read1msg()
* takes care of setting the connection's bind DN and status.
*/
&result ) == -1 ) {
goto unlock_and_return;
}
return( rc );
}