summaryrefslogtreecommitdiff
path: root/nsswitch
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2017-10-09 13:25:21 +0200
committerJeremy Allison <jra@samba.org>2017-10-10 02:57:40 +0200
commit76a1c5a1625f3593de0feac47741a3405b4c9275 (patch)
treeb10f85509319fb9ac3a5957f351f2b97209bcb3f /nsswitch
parent0666093cb0d820cc27a265c1f0a87bc76cd3c167 (diff)
downloadsamba-76a1c5a1625f3593de0feac47741a3405b4c9275.tar.gz
wbinfo: return "NOT MAPPED" instead of "S-0-0" for unmapped id-to-sid
Currently wbinfo --unix-ids-to-sids prints "S-0-0" for failed mappings. Let it print "NOT MAPPED" instead. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Oct 10 02:57:40 CEST 2017 on sn-devel-144
Diffstat (limited to 'nsswitch')
-rwxr-xr-xnsswitch/tests/test_idmap_rfc2307.sh2
-rw-r--r--nsswitch/wbinfo.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/nsswitch/tests/test_idmap_rfc2307.sh b/nsswitch/tests/test_idmap_rfc2307.sh
index 35daa39a592..7dc697d67a2 100755
--- a/nsswitch/tests/test_idmap_rfc2307.sh
+++ b/nsswitch/tests/test_idmap_rfc2307.sh
@@ -179,7 +179,7 @@ while [ ${i} -lt ${NUMGROUPS} ] ; do
GIDS="$GIDS g$(expr ${i} + ${GID_START})"
i=$(expr "$i" + 1)
done
-NUM_VALID_SIDS=$($wbinfo --unix-ids-to-sids="$GIDS" | grep -v ^S-0-0 | wc -l)
+NUM_VALID_SIDS=$($wbinfo --unix-ids-to-sids="$GIDS" | grep -v ^"NOT MAPPED" | wc -l)
testit "Count number of valid sids found" \
test ${NUM_VALID_SIDS} = ${NUMGROUPS} ||
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 67a97b5bbc0..9cd299a2174 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -1105,6 +1105,12 @@ static bool wbinfo_xids_to_sids(const char *arg)
for (i=0; i<num_xids; i++) {
char str[WBC_SID_STRING_BUFLEN];
+ struct wbcDomainSid null_sid = { 0 };
+
+ if (memcmp(&null_sid, &sids[i], sizeof(struct wbcDomainSid)) == 0) {
+ d_printf("NOT MAPPED\n");
+ continue;
+ }
wbcSidToStringBuf(&sids[i], str, sizeof(str));
d_printf("%s\n", str);
}