/*
* Portions Copyright 1998 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
*
* kbind.c
*/
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#ifdef KERBEROS
#include <stdio.h>
#include <string.h>
#ifdef MACOS
#include <stdlib.h>
#include "macos.h"
#else /* MACOS */
#ifdef DOS
#include "msdos.h"
#endif /* DOS */
#include <krb.h>
#include <stdlib.h>
#endif /* !DOS && !_WIN32 */
#endif /* MACOS */
#include "lber.h"
#include "ldap.h"
#include "ldap-private.h"
#include "ldap-int.h"
/*
* ldap_kerberos_bind1 - initiate a bind to the ldap server using
* kerberos authentication. The dn is supplied. It is assumed the user
* already has a valid ticket granting ticket. The msgid of the
* request is returned on success (suitable for passing to ldap_result()),
* -1 is returned if there's trouble.
*
* Example:
* ldap_kerberos_bind1( ld, "cn=manager, o=university of michigan, c=us" )
*/
int
{
char *cred;
char *get_kerberosv4_credentials();
#ifdef STR_TRANSLATION
int str_translation_on;
#endif /* STR_TRANSLATION */
/*
* The bind request looks like this:
* BindRequest ::= SEQUENCE {
* version INTEGER,
* name DistinguishedName,
* authentication CHOICE {
* krbv42ldap [1] OCTET STRING
* krbv42dsa [2] OCTET STRING
* }
* }
* all wrapped up in an LDAPMessage sequence.
*/
#if defined( SUN ) && defined( _REENTRANT )
int rv;
#endif
dn = "";
#if defined( SUN ) && defined( _REENTRANT )
#endif
return( -1 ); /* ld_errno should already be set */
}
/* create a message to send */
#if defined( SUN ) && defined( _REENTRANT )
#endif
return( -1 );
}
#ifdef STR_TRANSLATION
LBER_TRANSLATE_STRINGS ) != 0 ))) { /* turn translation off */
}
#endif /* STR_TRANSLATION */
/* fill it in */
#ifdef STR_TRANSLATION
if ( str_translation_on ) { /* restore translation */
}
#endif /* STR_TRANSLATION */
if ( rc == -1 ) {
#if defined( SUN ) && defined( _REENTRANT )
#endif
return( -1 );
}
#ifndef NO_CACHE
ldap_flush_cache( ld );
}
#endif /* !NO_CACHE */
/* send the message */
#if defined( SUN ) && defined( _REENTRANT )
return ( rv );
#else
#endif
}
int
{
int msgid;
/* initiate the bind */
/* wait for a result */
== -1 ) {
}
}
/*
* ldap_kerberos_bind2 - initiate a bind to the X.500 server using
* kerberos authentication. The dn is supplied. It is assumed the user
* already has a valid ticket granting ticket. The msgid of the
* request is returned on success (suitable for passing to ldap_result()),
* -1 is returned if there's trouble.
*
* Example:
* ldap_kerberos_bind2( ld, "cn=manager, o=university of michigan, c=us" )
*/
int
{
char *cred;
char *get_kerberosv4_credentials();
#ifdef STR_TRANSLATION
int str_translation_on;
#endif /* STR_TRANSLATION */
#if defined( SUN ) && defined( _REENTRANT )
int rv;
#endif
dn = "";
== NULL ) {
#if defined( SUN ) && defined( _REENTRANT )
#endif
return( -1 ); /* ld_errno should already be set */
}
/* create a message to send */
#if defined( SUN ) && defined( _REENTRANT )
#endif
return( -1 );
}
#ifdef STR_TRANSLATION
LBER_TRANSLATE_STRINGS ) != 0 ))) { /* turn translation off */
}
#endif /* STR_TRANSLATION */
/* fill it in */
#ifdef STR_TRANSLATION
if ( str_translation_on ) { /* restore translation */
}
#endif /* STR_TRANSLATION */
if ( rc == -1 ) {
#if defined( SUN ) && defined( _REENTRANT )
#endif
return( -1 );
}
/* send the message */
#if defined( SUN ) && defined( _REENTRANT )
return ( rv );
#endif
}
/* synchronous bind to DSA using kerberos */
int
{
int msgid;
/* initiate the bind */
/* wait for a result */
== -1 ) {
}
}
/* synchronous bind to ldap and DSA using kerberos */
int
{
int err;
return( err );
}
#ifndef AUTHMAN
/*
* get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
* The dn of the entry to which to bind is supplied. It's assumed the
* user already has a tgt.
*/
char *
{
int err;
#ifndef NO_USERINTERFACE
krb_err_txt[err] );
#endif /* NO_USERINTERFACE */
return( NULL );
}
#ifdef LDAP_REFERRALS
#else /* LDAP_REFERRALS */
#endif /* LDAP_REFERRALS */
!= KSUCCESS ) {
#ifndef NO_USERINTERFACE
#endif /* NO_USERINTERFACE */
return( NULL );
}
return( NULL );
}
return( cred );
}
#endif /* !AUTHMAN */
#endif /* KERBEROS */