1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the License). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/CDDL.txt 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/CDDL.txt. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets [] replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 * 26 * dns_monitor_check.c - Monitor Check method for highly available DNS 27 */ 28 29 #pragma ident "@(#)dns_monitor_check.c 1.14 07/06/06 SMI" 30 31 #include <string.h> 32 #include "dns.h" 33 34 /* 35 * There is nothing to be done here for HA-DNS 36 */ 37 38 int 39 main(int argc, char *argv[]) 40 { 41 scds_handle_t handle; 42 char *mode; 43 scha_extprop_value_t *mode_used; 44 45 if (scds_initialize(&handle, argc, argv) != SCHA_ERR_NOERR) 46 return (1); 47 48 if (scds_get_ext_property(handle, DNS_MODE_USED, SCHA_PTYPE_STRING, 49 &mode_used) != SCHA_ERR_NOERR) { 50 scds_syslog(LOG_ERR, "Property %s is not set.", DNS_MODE_USED); 51 scds_close(&handle); 52 return (1); /* failed */ 53 } else { 54 /* make a copy of the mode and free the ext property */ 55 mode = strdup(mode_used->val.val_str); 56 scds_free_ext_property(mode_used); 57 if (mode == NULL) { 58 scds_syslog(LOG_ERR, "INTERNAL ERROR: %s.", 59 "Out of memory"); 60 scds_close(&handle); 61 return (1); 62 } 63 } 64 65 if (svc_validate(handle, mode, B_FALSE) != SCHA_ERR_NOERR) { 66 free(mode); 67 scds_syslog(LOG_ERR, "Failed to validate configuration."); 68 scds_close(&handle); 69 return (1); /* Validation failure */ 70 } 71 72 scds_syslog(LOG_INFO, "Completed successfully."); 73 scds_close(&handle); 74 free(mode); 75 76 return (0); 77 } 78