diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-10-29 18:16:59 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-11-03 10:16:38 -0500 |
commit | a79b644d178fcfbde0fe0b13a31fb13bbfc80004 (patch) | |
tree | 70ae8086c753ad9c1fa08234afed21727c5b1f8a /server/providers/ldap/ldap_common.c | |
parent | e308325dd002f92d893185f7f655be79afa28be2 (diff) | |
download | sssd-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/ldap_common.c')
-rw-r--r-- | server/providers/ldap/ldap_common.c | 40 |
1 files changed, 34 insertions, 6 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); |