diff options
author | Nalin Dahyabhai <nalin@dahyabhai.net> | 2013-08-06 17:27:01 -0400 |
---|---|---|
committer | Nalin Dahyabhai <nalin@dahyabhai.net> | 2013-08-12 15:43:32 -0400 |
commit | 7da1f945a317eabf186ef2521f4a1b16db138e1c (patch) | |
tree | 19bca46a38cf62746de63aa82656864935463eb2 | |
parent | 03d8666a9a38811b1422f1e30b5c175028c6a5aa (diff) | |
download | slapi-nis-7da1f945a317eabf186ef2521f4a1b16db138e1c.tar.gz slapi-nis-7da1f945a317eabf186ef2521f4a1b16db138e1c.tar.xz slapi-nis-7da1f945a317eabf186ef2521f4a1b16db138e1c.zip |
Switch to tracking entry sources explicitly
Don't depend on a text attribute in a synthetic entry to tell us where
it came from; just record it in the entry's backend_data and consult it
directly later.
-rw-r--r-- | src/back-sch-nss.c | 5 | ||||
-rw-r--r-- | src/back-sch.c | 10 |
2 files changed, 2 insertions, 13 deletions
diff --git a/src/back-sch-nss.c b/src/back-sch-nss.c index 469e46c..7819513 100644 --- a/src/back-sch-nss.c +++ b/src/back-sch-nss.c @@ -557,9 +557,6 @@ backend_retrieve_from_nsswitch(struct backend_staged_search *staged, cbdata, &staged->count); if (entries != NULL) { staged->entries = entries; - for (i = 0; i < staged->count; i++) { - slapi_entry_add_string(entries[i], "schema-compat-origin", "nsswitch"); - } return TRUE; } return FALSE; @@ -570,7 +567,6 @@ backend_retrieve_from_nsswitch(struct backend_staged_search *staged, staged->container_sdn, cbdata); if (entry != NULL) { - slapi_entry_add_string(entry, "schema-compat-origin", "nsswitch"); staged->entries = malloc(sizeof(staged->entries[0])); if (staged->entries != NULL) { staged->entries[0] = entry; @@ -588,7 +584,6 @@ backend_retrieve_from_nsswitch(struct backend_staged_search *staged, staged->container_sdn, cbdata); if (entry != NULL) { - slapi_entry_add_string(entry, "schema-compat-origin", "nsswitch"); staged->entries = malloc(sizeof(staged->entries[0])); if (staged->entries != NULL) { staged->entries[0] = entry; diff --git a/src/back-sch.c b/src/back-sch.c index 250f6be..0b90ff6 100644 --- a/src/back-sch.c +++ b/src/back-sch.c @@ -239,10 +239,8 @@ backend_set_config_read_config(struct plugin_state *state, Slapi_Entry *e, /* If we're adding nsswitch-based entries to this map, make * sure that we copy the schema-compat-origin and SID * attributes, so that we can read the former during the BIND - * callback. FIXME: store that in the entry's backend_data to - * avoid surprising clients. */ + * callback. */ backend_shr_add_strlist(&ret.attribute_format, "objectClass=extensibleObject"); - backend_shr_add_strlist(&ret.attribute_format, "schema-compat-origin=%{schema-compat-origin}"); backend_shr_add_strlist(&ret.attribute_format, "ipaNTSecurityIdentifier=%{ipaNTSecurityIdentifier}"); } @@ -1619,7 +1617,6 @@ backend_bind_cb(Slapi_PBlock *pb) int ret; Slapi_DN *sdn = NULL; char *ndn; - char *is_nsswitch_origin = NULL; char *username = NULL; char *group = NULL; const char *entry_group = NULL; @@ -1654,7 +1651,6 @@ backend_bind_cb(Slapi_PBlock *pb) } backend_locate(pb, &data, &entry_group, &entry_set); if (data != NULL) { - is_nsswitch_origin = slapi_entry_attr_get_charptr(data->e, "schema-compat-origin"); ndn = slapi_ch_strdup(slapi_sdn_get_ndn(data->original_entry_dn)); username = slapi_entry_attr_get_charptr(data->e, "uid"); group = slapi_ch_strdup(entry_group); @@ -1663,8 +1659,7 @@ backend_bind_cb(Slapi_PBlock *pb) wrap_dec_call_level(); /* If user comes from NSSWITCH, it will get authentication handled by PAM. */ - if ((is_nsswitch_origin != NULL) && - (strcasecmp(is_nsswitch_origin, "nsswitch") == 0)) { + if (data->source == backend_entry_source_nsswitch) { ret = backend_bind_cb_pam(pb, username, ndn); if (ret == LDAP_NO_SUCH_OBJECT) { /* Evict the entry from the cache */ @@ -1695,7 +1690,6 @@ backend_bind_cb(Slapi_PBlock *pb) slapi_ch_free_string(&set); slapi_ch_free_string(&group); slapi_ch_free_string(&username); - slapi_ch_free_string(&is_nsswitch_origin); } else { done_with_lock: map_unlock(); |