net_ads: Handle new NBT_SERVER_* flags
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 23 May 2023 21:48:19 +0000 (09:48 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 29 May 2023 22:32:28 +0000 (22:32 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/utils/net_ads.c

index d1b2a25ca927e9c3ab3fa5c5065696f974e6fb99..9a3ee73567e1e8e2ca2eba93fd44ae3e9fb0b41d 100644 (file)
@@ -232,6 +232,36 @@ static int net_ads_cldap_netlogon_json
                goto failure;
        }
 
+       ret = json_add_bool(&flagsobj, "Runs on Windows 2012R2 or later",
+                           reply->server_type & NBT_SERVER_DS_9);
+       if (ret != 0) {
+               goto failure;
+       }
+
+       ret = json_add_bool(&flagsobj, "Runs on Windows 2016 or later",
+                           reply->server_type & NBT_SERVER_DS_10);
+       if (ret != 0) {
+               goto failure;
+       }
+
+       ret = json_add_bool(&flagsobj, "Has a DNS name",
+                           reply->server_type & NBT_SERVER_HAS_DNS_NAME);
+       if (ret != 0) {
+               goto failure;
+       }
+
+       ret = json_add_bool(&flagsobj, "Is a default NC",
+                           reply->server_type & NBT_SERVER_IS_DEFAULT_NC);
+       if (ret != 0) {
+               goto failure;
+       }
+
+       ret = json_add_bool(&flagsobj, "Is the forest root",
+                           reply->server_type & NBT_SERVER_FOREST_ROOT);
+       if (ret != 0) {
+               goto failure;
+       }
+
        ret = json_add_string(&jsobj, "Forest", reply->forest);
        if (ret != 0) {
                goto failure;
@@ -372,7 +402,12 @@ static int net_ads_cldap_netlogon(struct net_context *c, ADS_STRUCT *ads)
                   "\tIs NT6 DC that has some secrets:            %s\n"
                   "\tIs NT6 DC that has all secrets:             %s\n"
                   "\tRuns Active Directory Web Services:         %s\n"
-                  "\tRuns on Windows 2012 or later:              %s\n"),
+                  "\tRuns on Windows 2012 or later:              %s\n"
+                  "\tRuns on Windows 2012R2 or later:            %s\n"
+                  "\tRuns on Windows 2016 or later:              %s\n"
+                  "\tHas a DNS name:                             %s\n"
+                  "\tIs a default NC:                            %s\n"
+                  "\tIs the forest root:                         %s\n"),
                   (reply.server_type & NBT_SERVER_PDC) ? _("yes") : _("no"),
                   (reply.server_type & NBT_SERVER_GC) ? _("yes") : _("no"),
                   (reply.server_type & NBT_SERVER_LDAP) ? _("yes") : _("no"),
@@ -386,7 +421,12 @@ static int net_ads_cldap_netlogon(struct net_context *c, ADS_STRUCT *ads)
                   (reply.server_type & NBT_SERVER_SELECT_SECRET_DOMAIN_6) ? _("yes") : _("no"),
                   (reply.server_type & NBT_SERVER_FULL_SECRET_DOMAIN_6) ? _("yes") : _("no"),
                   (reply.server_type & NBT_SERVER_ADS_WEB_SERVICE) ? _("yes") : _("no"),
-                  (reply.server_type & NBT_SERVER_DS_8) ? _("yes") : _("no"));
+                  (reply.server_type & NBT_SERVER_DS_8) ? _("yes") : _("no"),
+                  (reply.server_type & NBT_SERVER_DS_9) ? _("yes") : _("no"),
+                  (reply.server_type & NBT_SERVER_DS_10) ? _("yes") : _("no"),
+                  (reply.server_type & NBT_SERVER_HAS_DNS_NAME) ? _("yes") : _("no"),
+                  (reply.server_type & NBT_SERVER_IS_DEFAULT_NC) ? _("yes") : _("no"),
+                  (reply.server_type & NBT_SERVER_FOREST_ROOT) ? _("yes") : _("no"));
 
 
        printf(_("Forest: %s\n"), reply.forest);