This version contains the ldap_set_default_rebind function.

This commit is contained in:
clayton 1998-08-13 13:10:24 +00:00
parent 4020aaf47f
commit fb75875e86
2 changed files with 52 additions and 6 deletions

View File

@ -1,5 +1,5 @@
#############################################################################
# $Id: API.pm,v 1.10 1998/08/13 09:13:55 leif Exp $
# $Id: API.pm,v 1.11 1998/08/13 13:10:23 clayton Exp $
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in
@ -218,10 +218,10 @@ require AutoLoader;
ldap_multisort_entries ldap_next_attribute ldap_next_entry
ldap_perror ldap_result ldap_result2error ldap_search ldap_search_s
ldap_search_st ldap_set_filter_additions ldap_set_lderrno
ldap_set_option ldap_set_rebind_proc ldap_simple_bind
ldap_simple_bind_s ldap_sort_entries ldap_unbind ldap_unbind_s
ldap_url_parse ldap_url_search ldap_url_search_s ldap_url_search_st
ldap_version)],
ldap_set_option ldap_set_rebind_proc ldap_set_default_rebind_proc
ldap_simple_bind ldap_simple_bind_s ldap_sort_entries ldap_unbind
ldap_unbind_s ldap_url_parse ldap_url_search ldap_url_search_s
ldap_url_search_st ldap_version)],
apiv3 => [qw(
ldap_abandon_ext ldap_add_ext ldap_add_ext_s ldap_compare_ext
ldap_compare_ext_s ldap_control_free ldap_controls_count

View File

@ -1,5 +1,5 @@
/******************************************************************************
* $Id: API.xs,v 1.13 1998/08/04 02:28:12 clayton Exp $
* $Id: API.xs,v 1.14 1998/08/13 13:10:24 clayton Exp $
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
@ -57,8 +57,15 @@ static LDAPMod **hash2mod(SV *ldap_change_ref,int ldap_add_func,const char *func
static int LDAP_CALL internal_rebind_proc(LDAP *ld,char **dnp,char **pwp,
int *authmethodp,int freeit,void *arg);
static int LDAP_CALL ldap_default_rebind_proc(LDAP *ld, char **dn, char **pswd,
int *auth, int freeit, void *arg);
/* Global Definitions and Variables */
SV *ldap_perl_rebindproc = NULL;
static char *ldap_default_rebind_dn = NULL;
static char *ldap_default_rebind_pwd = NULL;
static int ldap_default_rebind_auth = LDAP_AUTH_SIMPLE;
/* Return a Perl List from a char ** in PPCODE */
#define RET_CPP(cppvar) \
@ -377,6 +384,29 @@ int LDAP_CALL internal_rebind_proc(LDAP *ld, char **dnp, char **pwp,
return(LDAP_SUCCESS);
}
/* NT and internal_rebind_proc hate each other, so they need this... */
static int LDAP_CALL ldap_default_rebind_proc(LDAP *ld, char **dn, char **pwd,
int *auth, int freeit, void *arg)
{
if (!ldap_default_rebind_dn || !ldap_default_rebind_pwd)
{
*dn = NULL;
*pwd = NULL;
*auth = 0;
return LDAP_OPERATIONS_ERROR;
}
*dn = ldap_default_rebind_dn;
*pwd = ldap_default_rebind_pwd;
*auth = ldap_default_rebind_auth;
return LDAP_SUCCESS;
}
MODULE = Mozilla::LDAP::API PACKAGE = Mozilla::LDAP::API
PROTOTYPES: ENABLE
@ -1367,6 +1397,22 @@ ldap_set_rebind_proc(ld,rebindproc)
}
}
void
ldap_set_default_rebind_proc(ld, dn, pwd, auth)
LDAP *ld
char *dn
char *pwd
int auth
CODE:
{
ldap_default_rebind_dn = strdup(dn);
ldap_default_rebind_pwd = strdup(pwd);
ldap_default_rebind_auth = auth;
ldap_set_rebind_proc(ld,
(LDAP_REBINDPROC_CALLBACK *)&ldap_default_rebind_proc,NULL);
}
int
ldap_simple_bind(ld,who,passwd)
LDAP * ld