summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2017-08-03 16:26:04 +0200
committerKarolin Seeger <kseeger@samba.org>2018-05-24 12:50:13 +0200
commit7626db2b28b97534afd01753f3da3da9ff5f7ace (patch)
tree3748d32375dc19433892dfcfea6d53566425c41f /source3
parentccad9a3e03678de1181f4cd59b7160b4647fa240 (diff)
downloadsamba-7626db2b28b97534afd01753f3da3da9ff5f7ace.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. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13369 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_cache.c19
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>",