diff options
author | Volker Lendecke <vl@samba.org> | 2017-08-03 16:26:04 +0200 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2017-11-29 16:59:16 +0100 |
commit | 19afcd0e816f096fd17cf624f21d2d6f9c5f8d05 (patch) | |
tree | bb95892d6dc4937ed4b7ab3034b78094f822dab0 | |
parent | 3e556bf3703504625f0707f7f87a478c41bafede (diff) | |
download | samba-19afcd0e816f096fd17cf624f21d2d6f9c5f8d05.tar.gz |
net: Parse namemap_cache in "net cache list"
namemap_cache.c saves these as strv lists: An array of 0-terminated strings.
"net cache list" only printfs the values, so they would be cut off.
We might want to do this with other gencache values too in the future.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r-- | source3/utils/net_cache.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c index f43eb0e88c6..8f9f69f8659 100644 --- a/source3/utils/net_cache.c +++ b/source3/utils/net_cache.c @@ -23,6 +23,7 @@ #include "../librpc/gen_ndr/netlogon.h" #include "../librpc/gen_ndr/ndr_netlogon.h" #include "libcli/security/dom_sid.h" +#include "lib/util/strv.h" /** * @file net_cache.c @@ -77,6 +78,24 @@ static void print_cache_entry(const char* keystr, DATA_BLOB value, datastr = (char *)value.data; + if (strnequal(keystr, "NAME2SID/", strlen("NAME2SID/"))) { + const char *strv = (char *)value.data; + size_t strv_len = value.length; + const char *sid = strv_len_next(strv, strv_len, NULL); + const char *type = strv_len_next(strv, strv_len, sid); + datastr = talloc_asprintf(talloc_tos(), "%s (%s)", sid, type); + } + + if (strnequal(keystr, "SID2NAME/", strlen("SID2NAME/"))) { + const char *strv = (char *)value.data; + size_t strv_len = value.length; + const char *domain = strv_len_next(strv, strv_len, NULL); + const char *name = strv_len_next(strv, strv_len, domain); + const char *type = strv_len_next(strv, strv_len, name); + datastr = talloc_asprintf(talloc_tos(), "%s\\%s (%s)", + domain, name, type); + } + if ((value.length > 0) && (value.data[value.length-1] != '\0')) { datastr_free = talloc_asprintf( talloc_tos(), "<binary length %d>", |