-/*
+/*
Unix SMB/CIFS implementation.
LDAP protocol helper functions for SAMBA
Copyright (C) Jean François Micouleau 1998
}
if (!convert_string(CH_UTF8, CH_UNIX,values[0], -1, value, max_len, &size)) {
- DEBUG(1, ("smbldap_get_single_attribute: string conversion of [%s] = [%s] failed!\n",
+ DEBUG(1, ("smbldap_get_single_attribute: string conversion of [%s] = [%s] failed!\n",
attribute, values[0]));
ldap_value_free(values);
return False;
ldap_value_free(values);
#ifdef DEBUG_PASSWORDS
DEBUG (100, ("smbldap_get_single_attribute: [%s] = [%s]\n", attribute, value));
-#endif
+#endif
return True;
}
#ifdef DEBUG_PASSWORDS
DEBUG (100, ("smbldap_get_single_attribute: [%s] = [%s]\n",
attribute, result));
-#endif
+#endif
return result;
}
/* sanity checks on the mod values */
if (attribute == NULL || *attribute == '\0') {
- return;
+ return;
}
#if 0 /* commented out after discussion with abartlet. Do not re-enable.
* should be race-free in the sense that the LDAP-Server will
* deny the complete operation if somebody changed the
* attribute behind our back. */
- /* This will also allow modifying single valued attributes
+ /* This will also allow modifying single valued attributes
* in Novell NDS. In NDS you have to first remove attribute and then
* you could add new value */
}
/**********************************************************************
- Some varients of the LDAP rebind code do not pass in the third 'arg'
- pointer to a void*, so we try and work around it by assuming that the
+ Some varients of the LDAP rebind code do not pass in the third 'arg'
+ pointer to a void*, so we try and work around it by assuming that the
value of the 'LDAP *' pointer is the same as the one we had passed in
**********************************************************************/
static struct smbldap_state_lookup *smbldap_state_lookup_list;
-static struct smbldap_state *smbldap_find_state(LDAP *ld)
+static struct smbldap_state *smbldap_find_state(LDAP *ld)
{
struct smbldap_state_lookup *t;
return NULL;
}
-static void smbldap_delete_state(struct smbldap_state *smbldap_state)
+static void smbldap_delete_state(struct smbldap_state *smbldap_state)
{
struct smbldap_state_lookup *t;
}
}
-static void smbldap_store_state(LDAP *ld, struct smbldap_state *smbldap_state)
+static void smbldap_store_state(LDAP *ld, struct smbldap_state *smbldap_state)
{
struct smbldap_state *tmp_ldap_state;
struct smbldap_state_lookup *t;
}
return LDAP_SUCCESS;
-#else
+#else
/* Parse the string manually */
/********************************************************************
try to upgrade to Version 3 LDAP if not already, in either case return current
- version
+ version
*******************************************************************/
static int smb_ldap_upgrade_conn(LDAP *ldap_struct, int *new_version)
******************************************************************/
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && (LDAP_API_VERSION > 2000)
#else
-static int rebindproc_with_state (LDAP * ld, char **whop, char **credp,
+static int rebindproc_with_state (LDAP * ld, char **whop, char **credp,
int *methodp, int freeit, void *arg)
{
struct smbldap_state *ldap_state = arg;
}
SAFE_FREE(*credp);
} else {
- DEBUG(5,("rebind_proc_with_state: Rebinding as \"%s\"\n",
+ DEBUG(5,("rebind_proc_with_state: Rebinding as \"%s\"\n",
ldap_state->bind_dn?ldap_state->bind_dn:"[Anonymous bind]"));
if (ldap_state->anonymous) {
and actually does the connection.
******************************************************************/
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && (LDAP_API_VERSION > 2000)
-static int rebindproc_connect_with_state (LDAP *ldap_struct,
- LDAP_CONST char *url,
+static int rebindproc_connect_with_state (LDAP *ldap_struct,
+ LDAP_CONST char *url,
ber_tag_t request,
ber_int_t msgid, void *arg)
{
struct timespec ts;
int version;
- DEBUG(5,("rebindproc_connect_with_state: Rebinding to %s as \"%s\"\n",
+ DEBUG(5,("rebindproc_connect_with_state: Rebinding to %s as \"%s\"\n",
url, ldap_state->bind_dn?ldap_state->bind_dn:"[Anonymous bind]"));
/* call START_TLS again (ldaps:// is handled by the OpenLDAP library
{
struct smbldap_state *ldap_state = smbldap_find_state(ld);
- return rebindproc_connect_with_state(ld, url, (ber_tag_t)request, msgid,
+ return rebindproc_connect_with_state(ld, url, (ber_tag_t)request, msgid,
ldap_state);
}
# endif /*LDAP_SET_REBIND_PROC_ARGS == 2*/
int rc;
int version;
- /* removed the sasl_bind_s "EXTERNAL" stuff, as my testsuite
+ /* removed the sasl_bind_s "EXTERNAL" stuff, as my testsuite
(OpenLDAP) doesn't seem to support it */
DEBUG(10,("ldap_connect_system: Binding to ldap server %s as \"%s\"\n",
#ifdef HAVE_LDAP_SET_REBIND_PROC
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && (LDAP_API_VERSION > 2000)
-# if LDAP_SET_REBIND_PROC_ARGS == 2
- ldap_set_rebind_proc(ldap_struct, &rebindproc_connect);
+# if LDAP_SET_REBIND_PROC_ARGS == 2
+ ldap_set_rebind_proc(ldap_struct, &rebindproc_connect);
# endif
-# if LDAP_SET_REBIND_PROC_ARGS == 3
- ldap_set_rebind_proc(ldap_struct, &rebindproc_connect_with_state, (void *)ldap_state);
+# if LDAP_SET_REBIND_PROC_ARGS == 3
+ ldap_set_rebind_proc(ldap_struct, &rebindproc_connect_with_state, (void *)ldap_state);
# endif
#else /*defined(LDAP_API_FEATURE_X_OPENLDAP) && (LDAP_API_VERSION > 2000)*/
-# if LDAP_SET_REBIND_PROC_ARGS == 2
- ldap_set_rebind_proc(ldap_struct, &rebindproc);
+# if LDAP_SET_REBIND_PROC_ARGS == 2
+ ldap_set_rebind_proc(ldap_struct, &rebindproc);
# endif
-# if LDAP_SET_REBIND_PROC_ARGS == 3
- ldap_set_rebind_proc(ldap_struct, &rebindproc_with_state, (void *)ldap_state);
+# if LDAP_SET_REBIND_PROC_ARGS == 3
+ ldap_set_rebind_proc(ldap_struct, &rebindproc_with_state, (void *)ldap_state);
# endif
#endif /*defined(LDAP_API_FEATURE_X_OPENLDAP) && (LDAP_API_VERSION > 2000)*/
#endif
}
DEBUG(3, ("ldap_connect_system: successful connection to the LDAP server\n"));
- DEBUGADD(10, ("ldap_connect_system: LDAP server %s support paged results\n",
+ DEBUGADD(10, ("ldap_connect_system: LDAP server %s support paged results\n",
ldap_state->paged_results ? "does" : "does not"));
done:
if (rc != 0) {
ldap_state->last_ping = (time_t)0;
} else {
ldap_state->last_ping = time_mono(NULL);
- }
+ }
}
if (smbldap_get_ldap(ldap_state) != NULL) {
}
/**********************************************************************
-Disconnect from LDAP server
+Disconnect from LDAP server
*********************************************************************/
static NTSTATUS smbldap_close(struct smbldap_state *ldap_state)
{
********************************************************************/
static int smbldap_search_ext(struct smbldap_state *ldap_state,
- const char *base, int scope, const char *filter,
+ const char *base, int scope, const char *filter,
const char *attrs[], int attrsonly,
- LDAPControl **sctrls, LDAPControl **cctrls,
+ LDAPControl **sctrls, LDAPControl **cctrls,
int sizelimit, LDAPMessage **res)
{
int rc = LDAP_SERVER_DOWN;
return end_ldap_local_alarm(abs_endtime, rc);
}
-int smbldap_search(struct smbldap_state *ldap_state,
- const char *base, int scope, const char *filter,
- const char *attrs[], int attrsonly,
+int smbldap_search(struct smbldap_state *ldap_state,
+ const char *base, int scope, const char *filter,
+ const char *attrs[], int attrsonly,
LDAPMessage **res)
{
return smbldap_search_ext(ldap_state, base, scope, filter, attrs,
attrsonly, NULL, NULL, LDAP_NO_LIMIT, res);
}
-int smbldap_search_paged(struct smbldap_state *ldap_state,
- const char *base, int scope, const char *filter,
+int smbldap_search_paged(struct smbldap_state *ldap_state,
+ const char *base, int scope, const char *filter,
const char **attrs, int attrsonly, int pagesize,
LDAPMessage **res, void **cookie)
{
controls[0] = ≺
controls[1] = NULL;
- rc = smbldap_search_ext(ldap_state, base, scope, filter, attrs,
+ rc = smbldap_search_ext(ldap_state, base, scope, filter, attrs,
0, controls, NULL, LDAP_NO_LIMIT, res);
ber_free(cookie_be, 1);
break;
}
ldap_controls_free(rcontrols);
-done:
+done:
return rc;
}
return end_ldap_local_alarm(abs_endtime, rc);
}
-int smbldap_extended_operation(struct smbldap_state *ldap_state,
- LDAP_CONST char *reqoid, struct berval *reqdata,
- LDAPControl **serverctrls, LDAPControl **clientctrls,
+int smbldap_extended_operation(struct smbldap_state *ldap_state,
+ LDAP_CONST char *reqoid, struct berval *reqdata,
+ LDAPControl **serverctrls, LDAPControl **clientctrls,
char **retoidp, struct berval **retdatap)
{
int rc = LDAP_SERVER_DOWN;
Housekeeping
*********************************************************************/
-void smbldap_free_struct(struct smbldap_state **ldap_state)
+void smbldap_free_struct(struct smbldap_state **ldap_state)
{
smbldap_close(*ldap_state);
Check if root-dse has a certain Control or Extension
********************************************************************/
-static bool smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *value)
+static bool smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *value)
{
LDAPMessage *msg = NULL;
LDAPMessage *entry = NULL;
return False;
}
- if (!strequal(attrs[0], "supportedExtension") &&
- !strequal(attrs[0], "supportedControl") &&
+ if (!strequal(attrs[0], "supportedExtension") &&
+ !strequal(attrs[0], "supportedControl") &&
!strequal(attrs[0], "namingContexts")) {
DEBUG(3,("smbldap_check_root_dse: no idea what to query root-dse for: %s ?\n", attrs[0]));
return False;
}
- rc = ldap_search_s(ld, "", LDAP_SCOPE_BASE,
+ rc = ldap_search_s(ld, "", LDAP_SCOPE_BASE,
"(objectclass=*)", discard_const_p(char *, attrs), 0 , &msg);
if (rc != LDAP_SUCCESS) {