update to 9.7.2rc1
[tridge/bind9.git] / bin / named / zoneconf.c
index 5fc316c97cc9a2a51eed898cbee1f735ad004e8a..649eb2f0d0720c69b95791732488284dc3a6ae3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2010  Internet Systems Consortium, Inc. ("ISC")
  * Copyright (C) 1999-2003  Internet Software Consortium.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: zoneconf.c,v 1.161 2009/12/04 21:09:32 marka Exp $ */
+/* $Id: zoneconf.c,v 1.161.4.3 2010/08/11 18:19:55 each Exp $ */
 
 /*% */
 
@@ -135,8 +135,11 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
        }
 
        /* Check for default ACLs that haven't been parsed yet */
-       if (vconfig != NULL)
-               maps[i++] = cfg_tuple_get(vconfig, "options");
+       if (vconfig != NULL) {
+               const cfg_obj_t *options = cfg_tuple_get(vconfig, "options");
+               if (options != NULL)
+                       maps[i++] = options;
+       }
        if (config != NULL) {
                const cfg_obj_t *options = NULL;
                (void)cfg_map_get(config, "options", &options);
@@ -558,6 +561,28 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
        if (result == ISC_R_SUCCESS)
                filename = cfg_obj_asstring(obj);
 
+       /*
+        * Unless we're using some alternative database, a master zone
+        * will be needing a master file.
+        */
+       if (ztype == dns_zone_master && cpval == default_dbtype) {
+               if (filename == NULL) {
+                       isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+                                     NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+                                     "zone '%s': 'file' not specified",
+                                     zname);
+                       return (ISC_R_FAILURE);
+               }
+
+               if (!isc_file_exists(filename)) {
+                       isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+                                     NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+                                     "zone '%s': master file not found",
+                                     zname);
+                       return (ISC_R_NOTFOUND);
+               }
+       }
+
        masterformat = dns_masterformat_text;
        obj = NULL;
        result= ns_config_get(maps, "masterfile-format", &obj);