diff options
author | Amitay Isaacs <amitay@gmail.com> | 2011-12-14 16:17:31 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2011-12-23 16:17:09 +1100 |
commit | 9f76e076fa2593fdc67c3b82fb262670154bad09 (patch) | |
tree | ccb9f8fc2f287aaf59312122e9cf42916a30aca6 | |
parent | 0120a397a73a8752c8eac4d2046c43beffe14672 (diff) | |
download | samba-9f76e076fa2593fdc67c3b82fb262670154bad09.tar.gz samba-9f76e076fa2593fdc67c3b82fb262670154bad09.tar.bz2 samba-9f76e076fa2593fdc67c3b82fb262670154bad09.zip |
s4:rpc-dnsserver: If a zone is reverse zone, set the fReverse flag
And use fReverse flag in the enumeration of zones.
-rw-r--r-- | source4/rpc_server/dnsserver/dcerpc_dnsserver.c | 4 | ||||
-rw-r--r-- | source4/rpc_server/dnsserver/dnsutils.c | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c index e1966fa6fc..98e935ca99 100644 --- a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c +++ b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c @@ -1165,12 +1165,12 @@ static WERROR dnsserver_complex_operate_server(struct dnsserver_state *dsstate, found2 = false; if (rin->Dword & 0x000000f0) { if (rin->Dword & DNS_ZONE_REQUEST_FORWARD) { - if (!(z->zoneinfo->Flags & DNS_RPC_ZONE_REVERSE)) { + if (!(z->zoneinfo->fReverse)) { found2 = true; } } if (rin->Dword & DNS_ZONE_REQUEST_REVERSE) { - if (z->zoneinfo->Flags & DNS_RPC_ZONE_REVERSE) { + if (z->zoneinfo->fReverse) { found2 = true; } } diff --git a/source4/rpc_server/dnsserver/dnsutils.c b/source4/rpc_server/dnsserver/dnsutils.c index 1f5edae2da..3ae47a8c5f 100644 --- a/source4/rpc_server/dnsserver/dnsutils.c +++ b/source4/rpc_server/dnsserver/dnsutils.c @@ -159,6 +159,9 @@ struct dnsserver_zoneinfo *dnsserver_init_zoneinfo(struct dnsserver_zone *zone, { struct dnsserver_zoneinfo *zoneinfo; uint32_t dp_flags; + uint32_t fReverse; + const char *revzone = "in-addr.arpa"; + int len1, len2; zoneinfo = talloc_zero(zone, struct dnsserver_zoneinfo); if (zoneinfo == NULL) { @@ -172,10 +175,18 @@ struct dnsserver_zoneinfo *dnsserver_init_zoneinfo(struct dnsserver_zone *zone, dp_flags |= DNS_DP_DOMAIN_DEFAULT; } + /* If the zone name ends with in-addr.arpa, it's reverse zone */ + fReverse = 0; + len1 = strlen(zone->name); + len2 = strlen(revzone); + if (len1 > len2 && strcmp(&zone->name[len1-len2], revzone) == 0) { + fReverse = 1; + } + zoneinfo->Version = 0x32; zoneinfo->Flags = DNS_RPC_ZONE_DSINTEGRATED | DNS_RPC_ZONE_UPDATE_SECURE; zoneinfo->dwZoneType = DNS_ZONE_TYPE_PRIMARY; - zoneinfo->fReverse = 0; /* We only support forward zones for now */ + zoneinfo->fReverse = fReverse; zoneinfo->fAllowUpdate = DNS_ZONE_UPDATE_SECURE; zoneinfo->fPaused = 0; zoneinfo->fShutdown = 0; |