dns: treating fully qualified and unqualified zone as identical.
[metze/samba-autobuild/.git] / source4 / rpc_server / dnsserver / dcerpc_dnsserver.c
index edea2b33f2d2fdb0354f6aa6ee2574e467a08b41..ce01c9c258fa08e1b6601477d033a366f9ddbfff 100644 (file)
@@ -1117,6 +1117,7 @@ static WERROR dnsserver_operate_server(struct dnsserver_state *dsstate,
        } else if (strcasecmp(operation, "ZoneCreate") == 0) {
                struct dnsserver_zone *z, *z2;
                WERROR status;
+               int len;
 
                z = talloc_zero(mem_ctx, struct dnsserver_zone);
                W_ERROR_HAVE_NO_MEMORY(z);
@@ -1126,20 +1127,32 @@ static WERROR dnsserver_operate_server(struct dnsserver_state *dsstate,
                W_ERROR_HAVE_NO_MEMORY_AND_FREE(z->zoneinfo, z);
 
                if (typeid == DNSSRV_TYPEID_ZONE_CREATE_W2K) {
-                       z->name = talloc_strdup(z, r->ZoneCreateW2K->pszZoneName);
+                       len = strlen(r->ZoneCreateW2K->pszZoneName);
+                       if (r->ZoneCreateW2K->pszZoneName[len-1] == '.') {
+                               len -= 1;
+                       }
+                       z->name = talloc_strndup(z, r->ZoneCreateW2K->pszZoneName, len);
                        z->zoneinfo->dwZoneType = r->ZoneCreateW2K->dwZoneType;
                        z->zoneinfo->fAllowUpdate = r->ZoneCreateW2K->fAllowUpdate;
                        z->zoneinfo->fAging = r->ZoneCreateW2K->fAging;
                        z->zoneinfo->Flags = r->ZoneCreateW2K->dwFlags;
                } else if (typeid == DNSSRV_TYPEID_ZONE_CREATE_DOTNET) {
-                       z->name = talloc_strdup(z, r->ZoneCreateDotNet->pszZoneName);
+                       len = strlen(r->ZoneCreateDotNet->pszZoneName);
+                       if (r->ZoneCreateDotNet->pszZoneName[len-1] == '.') {
+                               len -= 1;
+                       }
+                       z->name = talloc_strndup(z, r->ZoneCreateDotNet->pszZoneName, len);
                        z->zoneinfo->dwZoneType = r->ZoneCreateDotNet->dwZoneType;
                        z->zoneinfo->fAllowUpdate = r->ZoneCreateDotNet->fAllowUpdate;
                        z->zoneinfo->fAging = r->ZoneCreateDotNet->fAging;
                        z->zoneinfo->Flags = r->ZoneCreateDotNet->dwFlags;
                        z->partition->dwDpFlags = r->ZoneCreateDotNet->dwDpFlags;
                } else if (typeid == DNSSRV_TYPEID_ZONE_CREATE) {
-                       z->name = talloc_strdup(z, r->ZoneCreate->pszZoneName);
+                       len = strlen(r->ZoneCreate->pszZoneName);
+                       if (r->ZoneCreate->pszZoneName[len-1] == '.') {
+                               len -= 1;
+                       }
+                       z->name = talloc_strndup(z, r->ZoneCreate->pszZoneName, len);
                        z->zoneinfo->dwZoneType = r->ZoneCreate->dwZoneType;
                        z->zoneinfo->fAllowUpdate = r->ZoneCreate->fAllowUpdate;
                        z->zoneinfo->fAging = r->ZoneCreate->fAging;