summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/providers/ldap/ldap_common.h10
-rw-r--r--src/providers/ldap/ldap_id.c4
-rw-r--r--src/providers/ldap/ldap_id_netgroup.c46
-rw-r--r--src/providers/ldap/sdap.h1
-rw-r--r--src/providers/ldap/sdap_async_netgroups.c14
-rw-r--r--src/providers/ldap/sdap_async_private.h15
6 files changed, 49 insertions, 41 deletions
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
index e64b65c24..770ffc8f5 100644
--- a/src/providers/ldap/ldap_common.h
+++ b/src/providers/ldap/ldap_common.h
@@ -136,11 +136,11 @@ struct tevent_req *groups_get_send(TALLOC_CTX *memctx,
int groups_get_recv(struct tevent_req *req, int *dp_error_out);
-struct tevent_req *netgroup_get_send(TALLOC_CTX *memctx,
- struct tevent_context *ev,
- struct sdap_id_ctx *ctx,
- const char *name);
-int netgroup_get_recv(struct tevent_req *req, int *dp_error_out);
+struct tevent_req *ldap_netgroup_get_send(TALLOC_CTX *memctx,
+ struct tevent_context *ev,
+ struct sdap_id_ctx *ctx,
+ const char *name);
+int ldap_netgroup_get_recv(struct tevent_req *req, int *dp_error_out);
/* setup child logging */
int setup_child(struct sdap_id_ctx *ctx);
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
index d30018488..b8e9563bd 100644
--- a/src/providers/ldap/ldap_id.c
+++ b/src/providers/ldap/ldap_id.c
@@ -815,7 +815,7 @@ void sdap_account_info_handler(struct be_req *breq)
break;
}
- req = netgroup_get_send(breq, breq->be_ctx->ev, ctx, ar->filter_value);
+ req = ldap_netgroup_get_send(breq, breq->be_ctx->ev, ctx, ar->filter_value);
if (!req) {
return sdap_handler_done(breq, DP_ERR_FATAL, ENOMEM, "Out of memory");
}
@@ -893,7 +893,7 @@ static void sdap_account_info_netgroups_done(struct tevent_req *req)
struct be_req *breq = tevent_req_callback_data(req, struct be_req);
int ret, dp_error;
- ret = netgroup_get_recv(req, &dp_error);
+ ret = ldap_netgroup_get_recv(req, &dp_error);
talloc_zfree(req);
sdap_account_info_complete(breq, dp_error, ret, "Netgroup lookup failed");
diff --git a/src/providers/ldap/ldap_id_netgroup.c b/src/providers/ldap/ldap_id_netgroup.c
index e05aaa752..2432f9c4f 100644
--- a/src/providers/ldap/ldap_id_netgroup.c
+++ b/src/providers/ldap/ldap_id_netgroup.c
@@ -30,7 +30,7 @@
#include "providers/ldap/sdap_async.h"
-struct netgroup_get_state {
+struct ldap_netgroup_get_state {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
struct sdap_id_op *op;
@@ -49,21 +49,21 @@ struct netgroup_get_state {
int dp_error;
};
-static int netgroup_get_retry(struct tevent_req *req);
-static void netgroup_get_connect_done(struct tevent_req *subreq);
-static void netgroup_get_done(struct tevent_req *subreq);
+static int ldap_netgroup_get_retry(struct tevent_req *req);
+static void ldap_netgroup_get_connect_done(struct tevent_req *subreq);
+static void ldap_netgroup_get_done(struct tevent_req *subreq);
-struct tevent_req *netgroup_get_send(TALLOC_CTX *memctx,
+struct tevent_req *ldap_netgroup_get_send(TALLOC_CTX *memctx,
struct tevent_context *ev,
struct sdap_id_ctx *ctx,
const char *name)
{
struct tevent_req *req;
- struct netgroup_get_state *state;
+ struct ldap_netgroup_get_state *state;
char *clean_name;
int ret;
- req = tevent_req_create(memctx, &state, struct netgroup_get_state);
+ req = tevent_req_create(memctx, &state, struct ldap_netgroup_get_state);
if (!req) return NULL;
state->ev = ev;
@@ -102,7 +102,7 @@ struct tevent_req *netgroup_get_send(TALLOC_CTX *memctx,
SDAP_OPTS_NETGROUP, &state->attrs);
if (ret != EOK) goto fail;
- ret = netgroup_get_retry(req);
+ ret = ldap_netgroup_get_retry(req);
if (ret != EOK) {
goto fail;
}
@@ -115,10 +115,10 @@ fail:
return req;
}
-static int netgroup_get_retry(struct tevent_req *req)
+static int ldap_netgroup_get_retry(struct tevent_req *req)
{
- struct netgroup_get_state *state = tevent_req_data(req,
- struct netgroup_get_state);
+ struct ldap_netgroup_get_state *state = tevent_req_data(req,
+ struct ldap_netgroup_get_state);
struct tevent_req *subreq;
int ret = EOK;
@@ -127,16 +127,16 @@ static int netgroup_get_retry(struct tevent_req *req)
return ret;
}
- tevent_req_set_callback(subreq, netgroup_get_connect_done, req);
+ tevent_req_set_callback(subreq, ldap_netgroup_get_connect_done, req);
return EOK;
}
-static void netgroup_get_connect_done(struct tevent_req *subreq)
+static void ldap_netgroup_get_connect_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(subreq,
struct tevent_req);
- struct netgroup_get_state *state = tevent_req_data(req,
- struct netgroup_get_state);
+ struct ldap_netgroup_get_state *state = tevent_req_data(req,
+ struct ldap_netgroup_get_state);
int dp_error = DP_ERR_FATAL;
int ret;
@@ -160,17 +160,17 @@ static void netgroup_get_connect_done(struct tevent_req *subreq)
tevent_req_error(req, ENOMEM);
return;
}
- tevent_req_set_callback(subreq, netgroup_get_done, req);
+ tevent_req_set_callback(subreq, ldap_netgroup_get_done, req);
return;
}
-static void netgroup_get_done(struct tevent_req *subreq)
+static void ldap_netgroup_get_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(subreq,
struct tevent_req);
- struct netgroup_get_state *state = tevent_req_data(req,
- struct netgroup_get_state);
+ struct ldap_netgroup_get_state *state = tevent_req_data(req,
+ struct ldap_netgroup_get_state);
int dp_error = DP_ERR_FATAL;
int ret;
@@ -181,7 +181,7 @@ static void netgroup_get_done(struct tevent_req *subreq)
if (dp_error == DP_ERR_OK && ret != EOK) {
/* retry */
- ret = netgroup_get_retry(req);
+ ret = ldap_netgroup_get_retry(req);
if (ret != EOK) {
tevent_req_error(req, ret);
return;
@@ -216,10 +216,10 @@ static void netgroup_get_done(struct tevent_req *subreq)
return;
}
-int netgroup_get_recv(struct tevent_req *req, int *dp_error_out)
+int ldap_netgroup_get_recv(struct tevent_req *req, int *dp_error_out)
{
- struct netgroup_get_state *state = tevent_req_data(req,
- struct netgroup_get_state);
+ struct ldap_netgroup_get_state *state = tevent_req_data(req,
+ struct ldap_netgroup_get_state);
if (dp_error_out) {
*dp_error_out = state->dp_error;
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index c8eb92819..d25e87bdf 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -299,6 +299,7 @@ struct sdap_options {
struct sdap_attr_map *user_map;
struct sdap_attr_map *group_map;
struct sdap_attr_map *netgroup_map;
+ struct sdap_attr_map *host_map;
/* supported schema types */
enum schema_type {
diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c
index e963159c4..bb2e1bb2c 100644
--- a/src/providers/ldap/sdap_async_netgroups.c
+++ b/src/providers/ldap/sdap_async_netgroups.c
@@ -27,7 +27,7 @@
#include "providers/ldap/sdap_async_private.h"
#include "providers/ldap/ldap_common.h"
-static bool is_dn(const char *str)
+bool is_dn(const char *str)
{
int ret;
LDAPDN dn;
@@ -182,16 +182,8 @@ fail:
return ret;
}
-struct dn_item {
- const char *dn;
- struct sysdb_attrs *netgroup;
- char *cn;
- struct dn_item *next;
- struct dn_item *prev;
-};
-
-static errno_t update_dn_list(struct dn_item *dn_list, const size_t count,
- struct ldb_message **res, bool *all_resolved)
+errno_t update_dn_list(struct dn_item *dn_list, const size_t count,
+ struct ldb_message **res, bool *all_resolved)
{
struct dn_item *dn_item;
size_t c;
diff --git a/src/providers/ldap/sdap_async_private.h b/src/providers/ldap/sdap_async_private.h
index fa7844e72..4192a225e 100644
--- a/src/providers/ldap/sdap_async_private.h
+++ b/src/providers/ldap/sdap_async_private.h
@@ -26,6 +26,21 @@
#include "util/sss_krb5.h"
#include "providers/ldap/sdap_async.h"
+struct dn_item {
+ const char *dn;
+ /* Parent netgroup containing this record */
+ struct sysdb_attrs *netgroup;
+ char *cn;
+ struct dn_item *next;
+ struct dn_item *prev;
+};
+
+bool is_dn(const char *str);
+errno_t update_dn_list(struct dn_item *dn_list,
+ const size_t count,
+ struct ldb_message **res,
+ bool *all_resolved);
+
void make_realm_upper_case(const char *upn);
struct sdap_handle *sdap_handle_create(TALLOC_CTX *memctx);