summaryrefslogtreecommitdiff
path: root/server/providers/ldap
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-10-29 18:16:59 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-11-03 10:16:38 -0500
commita79b644d178fcfbde0fe0b13a31fb13bbfc80004 (patch)
tree70ae8086c753ad9c1fa08234afed21727c5b1f8a /server/providers/ldap
parente308325dd002f92d893185f7f655be79afa28be2 (diff)
downloadsssd-a79b644d178fcfbde0fe0b13a31fb13bbfc80004.tar.gz
sssd-a79b644d178fcfbde0fe0b13a31fb13bbfc80004.tar.bz2
sssd-a79b644d178fcfbde0fe0b13a31fb13bbfc80004.zip
Rename sdap_id_map to sdap_attr_map
Also start adding some infrastructure to use the USN counter when available. In particular add a place to add generic attrs mapping, ie attributes that are neither user nor group specific.
Diffstat (limited to 'server/providers/ldap')
-rw-r--r--server/providers/ldap/ldap_common.c40
-rw-r--r--server/providers/ldap/ldap_id.c2
-rw-r--r--server/providers/ldap/sdap.c10
-rw-r--r--server/providers/ldap/sdap.h22
4 files changed, 55 insertions, 19 deletions
diff --git a/server/providers/ldap/ldap_common.c b/server/providers/ldap/ldap_common.c
index b117d022..f7cdf75e 100644
--- a/server/providers/ldap/ldap_common.c
+++ b/server/providers/ldap/ldap_common.c
@@ -56,7 +56,22 @@ struct dp_option default_basic_opts[] = {
{ "krb5_realm", DP_OPT_STRING, NULL_STRING, NULL_STRING }
};
-struct sdap_id_map rfc2307_user_map[] = {
+struct sdap_attr_map generic_attr_map[] = {
+ { "ldap_entry_usn", NULL, SYSDB_USN, NULL },
+ { "ldap_rootdse_last_usn", NULL, SYSDB_USN, NULL }
+};
+
+struct sdap_attr_map gen_ipa_attr_map[] = {
+ { "ldap_entry_usn", "entryUSN", SYSDB_USN, NULL },
+ { "ldap_rootdse_last_usn", "lastUSN", SYSDB_HIGH_USN, NULL }
+};
+
+struct sdap_attr_map gen_ad_attr_map[] = {
+ { "ldap_entry_usn", "uSNChanged", SYSDB_USN, NULL },
+ { "ldap_rootdse_last_usn", "highestCommittedUSN", SYSDB_HIGH_USN, NULL }
+};
+
+struct sdap_attr_map rfc2307_user_map[] = {
{ "ldap_user_object_class", "posixAccount", SYSDB_USER_CLASS, NULL },
{ "ldap_user_name", "uid", SYSDB_NAME, NULL },
{ "ldap_user_pwd", "userPassword", SYSDB_PWD, NULL },
@@ -82,7 +97,7 @@ struct sdap_id_map rfc2307_user_map[] = {
{ "ldap_pwd_attribute", "pwdAttribute", SYSDB_PWD_ATTRIBUTE, NULL }
};
-struct sdap_id_map rfc2307_group_map[] = {
+struct sdap_attr_map rfc2307_group_map[] = {
{ "ldap_group_object_class", "posixGroup", SYSDB_GROUP_CLASS, NULL },
{ "ldap_group_name", "cn", SYSDB_NAME, NULL },
{ "ldap_group_pwd", "userPassword", SYSDB_PWD, NULL },
@@ -92,7 +107,7 @@ struct sdap_id_map rfc2307_group_map[] = {
{ "ldap_group_modify_timestamp", "modifyTimestamp", SYSDB_ORIG_MODSTAMP, NULL }
};
-struct sdap_id_map rfc2307bis_user_map[] = {
+struct sdap_attr_map rfc2307bis_user_map[] = {
{ "ldap_user_object_class", "posixAccount", SYSDB_USER_CLASS, NULL },
{ "ldap_user_name", "uid", SYSDB_NAME, NULL },
{ "ldap_user_pwd", "userPassword", SYSDB_PWD, NULL },
@@ -119,7 +134,7 @@ struct sdap_id_map rfc2307bis_user_map[] = {
{ "ldap_pwd_attribute", "pwdAttribute", SYSDB_PWD_ATTRIBUTE, NULL }
};
-struct sdap_id_map rfc2307bis_group_map[] = {
+struct sdap_attr_map rfc2307bis_group_map[] = {
{ "ldap_group_object_class", "posixGroup", SYSDB_GROUP_CLASS, NULL },
{ "ldap_group_name", "cn", SYSDB_NAME, NULL },
{ "ldap_group_pwd", "userPassword", SYSDB_PWD, NULL },
@@ -135,8 +150,9 @@ int ldap_get_options(TALLOC_CTX *memctx,
const char *conf_path,
struct sdap_options **_opts)
{
- struct sdap_id_map *default_user_map;
- struct sdap_id_map *default_group_map;
+ struct sdap_attr_map *default_attr_map;
+ struct sdap_attr_map *default_user_map;
+ struct sdap_attr_map *default_group_map;
struct sdap_options *opts;
char *schema;
int ret;
@@ -181,21 +197,25 @@ int ldap_get_options(TALLOC_CTX *memctx,
schema = dp_opt_get_string(opts->basic, SDAP_SCHEMA);
if (strcasecmp(schema, "rfc2307") == 0) {
opts->schema_type = SDAP_SCHEMA_RFC2307;
+ default_attr_map = generic_attr_map;
default_user_map = rfc2307_user_map;
default_group_map = rfc2307_group_map;
} else
if (strcasecmp(schema, "rfc2307bis") == 0) {
opts->schema_type = SDAP_SCHEMA_RFC2307BIS;
+ default_attr_map = generic_attr_map;
default_user_map = rfc2307bis_user_map;
default_group_map = rfc2307bis_group_map;
} else
if (strcasecmp(schema, "IPA") == 0) {
opts->schema_type = SDAP_SCHEMA_IPA_V1;
+ default_attr_map = gen_ipa_attr_map;
default_user_map = rfc2307bis_user_map;
default_group_map = rfc2307bis_group_map;
} else
if (strcasecmp(schema, "AD") == 0) {
opts->schema_type = SDAP_SCHEMA_AD;
+ default_attr_map = gen_ad_attr_map;
default_user_map = rfc2307bis_user_map;
default_group_map = rfc2307bis_group_map;
} else {
@@ -205,6 +225,14 @@ int ldap_get_options(TALLOC_CTX *memctx,
}
ret = sdap_get_map(opts, cdb, conf_path,
+ default_attr_map,
+ SDAP_AT_GENERAL,
+ &opts->gen_map);
+ if (ret != EOK) {
+ goto done;
+ }
+
+ ret = sdap_get_map(opts, cdb, conf_path,
default_user_map,
SDAP_OPTS_USER,
&opts->user_map);
diff --git a/server/providers/ldap/ldap_id.c b/server/providers/ldap/ldap_id.c
index 7e69c3dc..b7e29e61 100644
--- a/server/providers/ldap/ldap_id.c
+++ b/server/providers/ldap/ldap_id.c
@@ -33,7 +33,7 @@
#include "providers/ldap/sdap_async.h"
static int build_attrs_from_map(TALLOC_CTX *memctx,
- struct sdap_id_map *map,
+ struct sdap_attr_map *map,
size_t size,
const char ***_attrs)
{
diff --git a/server/providers/ldap/sdap.c b/server/providers/ldap/sdap.c
index 94cea885..5da698a1 100644
--- a/server/providers/ldap/sdap.c
+++ b/server/providers/ldap/sdap.c
@@ -29,14 +29,14 @@
int sdap_get_map(TALLOC_CTX *memctx,
struct confdb_ctx *cdb,
const char *conf_path,
- struct sdap_id_map *def_map,
+ struct sdap_attr_map *def_map,
int num_entries,
- struct sdap_id_map **_map)
+ struct sdap_attr_map **_map)
{
- struct sdap_id_map *map;
+ struct sdap_attr_map *map;
int i, ret;
- map = talloc_array(memctx, struct sdap_id_map, num_entries);
+ map = talloc_array(memctx, struct sdap_attr_map, num_entries);
if (!map) {
return ENOMEM;
}
@@ -70,7 +70,7 @@ int sdap_get_map(TALLOC_CTX *memctx,
static int sdap_parse_entry(TALLOC_CTX *memctx,
struct sdap_handle *sh, struct sdap_msg *sm,
- struct sdap_id_map *map, int attrs_num,
+ struct sdap_attr_map *map, int attrs_num,
struct sysdb_attrs **_attrs, char **_dn)
{
struct sysdb_attrs *attrs;
diff --git a/server/providers/ldap/sdap.h b/server/providers/ldap/sdap.h
index 152d46b9..03dab304 100644
--- a/server/providers/ldap/sdap.h
+++ b/server/providers/ldap/sdap.h
@@ -120,9 +120,16 @@ enum sdap_basic_opt {
SDAP_OPTS_BASIC /* opts counter */
};
+enum sdap_gen_attrs {
+ SDAP_AT_ENTRY_USN = 0,
+ SDAP_AT_LAST_USN,
+
+ SDAP_AT_GENERAL /* attrs counter */
+};
+
/* the objectclass must be the first attribute.
* Functions depend on this */
-enum sdap_user_opt {
+enum sdap_user_attrs {
SDAP_OC_USER = 0,
SDAP_AT_USER_NAME,
SDAP_AT_USER_PWD,
@@ -154,7 +161,7 @@ enum sdap_user_opt {
/* the objectclass must be the first attribute.
* Functions depend on this */
-enum sdap_group_opt {
+enum sdap_group_attrs {
SDAP_OC_GROUP = 0,
SDAP_AT_GROUP_NAME,
SDAP_AT_GROUP_PWD,
@@ -166,7 +173,7 @@ enum sdap_group_opt {
SDAP_OPTS_GROUP /* attrs counter */
};
-struct sdap_id_map {
+struct sdap_attr_map {
const char *opt_name;
const char *def_name;
const char *sys_name;
@@ -175,8 +182,9 @@ struct sdap_id_map {
struct sdap_options {
struct dp_option *basic;
- struct sdap_id_map *user_map;
- struct sdap_id_map *group_map;
+ struct sdap_attr_map *gen_map;
+ struct sdap_attr_map *user_map;
+ struct sdap_attr_map *group_map;
/* supported schema types */
enum schema_type {
@@ -193,9 +201,9 @@ struct sdap_options {
int sdap_get_map(TALLOC_CTX *memctx,
struct confdb_ctx *cdb,
const char *conf_path,
- struct sdap_id_map *def_map,
+ struct sdap_attr_map *def_map,
int num_entries,
- struct sdap_id_map **_map);
+ struct sdap_attr_map **_map);
int sdap_parse_user(TALLOC_CTX *memctx, struct sdap_options *opts,
struct sdap_handle *sh, struct sdap_msg *sm,