diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2012-03-19 08:03:32 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-03-21 11:22:43 -0400 |
commit | 5d7831167ccc418f2dec5d6621ea6f5a20874613 (patch) | |
tree | cf6f049145105a1b40db2c47e2543f9e3a663c2b /src/responder | |
parent | 2b4332767d299263a288e0a74bbfbc9de674de95 (diff) | |
download | sssd-5d7831167ccc418f2dec5d6621ea6f5a20874613.tar.gz sssd-5d7831167ccc418f2dec5d6621ea6f5a20874613.tar.bz2 sssd-5d7831167ccc418f2dec5d6621ea6f5a20874613.zip |
Save alias of the primary name, too
Diffstat (limited to 'src/responder')
-rw-r--r-- | src/responder/nss/nsssrv_services.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c index a3ac8576..3e8546b8 100644 --- a/src/responder/nss/nsssrv_services.c +++ b/src/responder/nss/nsssrv_services.c @@ -596,9 +596,9 @@ fill_service(struct sss_packet *packet, { errno_t ret; unsigned int msg_count = *count; - size_t rzero, rsize; + size_t rzero, rsize, aptr; unsigned int num, i, j; - uint32_t num_aliases; + uint32_t num_aliases, written_aliases; struct ldb_message *msg; struct ldb_message_element *el; TALLOC_CTX *tmp_ctx = NULL; @@ -710,8 +710,9 @@ fill_service(struct sss_packet *packet, num_aliases = el->num_values; } - /* Store the alias count */ - SAFEALIGN_SET_UINT32(&body[rzero + rsize], num_aliases, &rsize); + /* We'll store the alias count here */ + aptr = rzero+rsize; + rsize += sizeof(uint32_t); /* Store the primary name */ safealign_memcpy(&body[rzero + rsize], @@ -725,11 +726,14 @@ fill_service(struct sss_packet *packet, cased_proto.len, &rsize); + written_aliases = 0; for (j = 0; j < num_aliases; j++) { - tmpstr = sss_get_cased_name(tmp_ctx, - (const char *)el->values[j].data, - dom->case_sensitive); - to_sized_string(&alias, tmpstr); + if (sss_string_equal(dom->case_sensitive, + (const char *)el->values[j].data, + cased_name.str)) { + continue; + } + to_sized_string(&alias, (const char *)el->values[j].data); ret = sss_packet_grow(packet, alias.len); if (ret != EOK) { @@ -744,8 +748,10 @@ fill_service(struct sss_packet *packet, alias.len, &rsize); + written_aliases++; talloc_zfree(tmpstr); } + SAFEALIGN_SET_UINT32(&body[aptr], written_aliases, &rsize); num++; } |