/*
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "util/sss_sockets.h"
#include "util/sss_ldap.h"
{
if (IS_SSSD_ERROR(err)) {
return sss_strerror(err);
} else {
return ldap_err2string(err);
}
}
{
int optret;
if (optret != LDAP_SUCCESS) {
return EINVAL;
}
return ENOMEM;
}
return EOK;
}
LDAPControl **ctrlp)
{
#ifdef HAVE_LDAP_CONTROL_CREATE
#else
return LDAP_PARAM_ERROR;
}
return LDAP_NO_MEMORY;
}
return LDAP_NO_MEMORY;
}
if (dupval == 0) {
} else {
return LDAP_NO_MEMORY;
}
}
}
return LDAP_SUCCESS;
#endif
}
#ifdef HAVE_LDAP_INIT_FD
#endif
struct sss_ldap_init_state {
int sd;
const char *uri;
};
{
"calling ldap_unbind_ext for ldap:[%p] sd:[%d]\n",
}
}
return 0;
}
struct tevent_context *ev,
const char *uri,
struct sockaddr_storage *addr,
{
return NULL;
}
#ifdef HAVE_LDAP_INIT_FD
goto fail;
}
return req;
fail:
#else
"will use ldap_initialize with uri [%s].\n", uri);
if (ret == LDAP_SUCCESS) {
} else {
if (ret == LDAP_SERVER_DOWN) {
} else {
}
}
#endif
return req;
}
#ifdef HAVE_LDAP_INIT_FD
{
struct tevent_req);
struct sss_ldap_init_state);
char *tlserr;
int ret;
int lret;
int optret;
"sssd_async_socket_init request failed: [%d]: %s.\n",
goto fail;
}
/* Initialize LDAP handler */
if (lret != LDAP_SUCCESS) {
"ldap_init_fd failed: %s. [%d][%s]\n",
goto fail;
}
if (lret != LDAP_SUCCESS) {
if (lret == LDAP_LOCAL_ERROR) {
} else {
&tlserr);
if (optret == LDAP_SUCCESS) {
"ldap_install_tls failed: [%s] [%s]\n",
"Could not start TLS encryption. %s", tlserr);
} else {
"ldap_install_tls failed: [%s]\n",
"Check for certificate issues.");
}
goto fail;
}
}
}
return;
fail:
}
#endif
{
struct sss_ldap_init_state);
/* Everything went well therefore we do not want to release resources */
return EOK;
}
/*
* _filter will contain combined filters from all possible search bases
* or NULL if it should be empty
*/
const char *dn,
struct sdap_search_base **search_bases,
char **_filter,
int *_match_len)
{
int len_diff;
int i, j;
bool base_confirmed = false;
bool comma_found = false;
bool backslash_found = false;
bool ret = false;
int match_len;
ret = false;
goto done;
}
if (search_bases == NULL) {
ret = false;
goto done;
}
for (i = 0; search_bases[i] != NULL; i++) {
base = search_bases[i];
if (basedn_len > dn_len) {
continue;
}
if (!base_confirmed) {
continue;
}
case LDAP_SCOPE_BASE:
/* dn > base? */
if (len_diff != 0) {
continue;
}
break;
case LDAP_SCOPE_ONELEVEL:
if (len_diff == 0) {
/* Base object doesn't belong to scope=one
* search */
continue;
}
comma_found = false;
if (dn[j] == '\\') {
backslash_found = true;
comma_found = true;
break;
} else {
backslash_found = false;
}
}
/* it has at least one more level */
if (comma_found) {
continue;
}
break;
case LDAP_SCOPE_SUBTREE:
/* dn length >= base dn length && base_confirmed == true */
break;
default:
continue;
}
/*
* If we get here, the dn is valid.
* If no filter is set, than return true immediately.
* Append filter otherwise.
*/
ret = true;
if (_match_len) {
*_match_len = match_len;
}
goto done;
} else {
ret = false;
goto done;
}
}
}
"talloc_asprintf_append() failed\n");
ret = false;
goto done;
}
} else {
}
}
done:
return ret;
}
const char *dn,
struct sdap_search_base **search_bases,
char **_filter)
{
NULL);
}
{
if (ret != 8) {
return NULL;
}
}