wbinfo: return "NOT MAPPED" instead of "S-0-0" for unmapped id-to-sid
authorRalph Boehme <slow@samba.org>
Mon, 9 Oct 2017 11:25:21 +0000 (13:25 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 10 Oct 2017 00:57:40 +0000 (02:57 +0200)
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

nsswitch/tests/test_idmap_rfc2307.sh
nsswitch/wbinfo.c

index 35daa39a59247e0c134588e0bc114901952c680c..7dc697d67a2c966e39748ffacc595b88980b7abd 100755 (executable)
@@ -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} ||
index 67a97b5bbc04b3e15e049a2ea7bf80f5c2ba9fce..9cd299a2174f9ec9c8e1a8f891dc70eb8fccc1cb 100644 (file)
@@ -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);
        }