1*bd211b85Ssemery /* 2*bd211b85Ssemery * CDDL HEADER START 3*bd211b85Ssemery * 4*bd211b85Ssemery * The contents of this file are subject to the terms of the 5*bd211b85Ssemery * Common Development and Distribution License (the "License"). 6*bd211b85Ssemery * You may not use this file except in compliance with the License. 7*bd211b85Ssemery * 8*bd211b85Ssemery * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*bd211b85Ssemery * or http://www.opensolaris.org/os/licensing. 10*bd211b85Ssemery * See the License for the specific language governing permissions 11*bd211b85Ssemery * and limitations under the License. 12*bd211b85Ssemery * 13*bd211b85Ssemery * When distributing Covered Code, include this CDDL HEADER in each 14*bd211b85Ssemery * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*bd211b85Ssemery * If applicable, add the following below this CDDL HEADER, with the 16*bd211b85Ssemery * fields enclosed by brackets "[]" replaced with your own identifying 17*bd211b85Ssemery * information: Portions Copyright [yyyy] [name of copyright owner] 18*bd211b85Ssemery * 19*bd211b85Ssemery * CDDL HEADER END 20*bd211b85Ssemery */ 21*bd211b85Ssemery 22*bd211b85Ssemery /* 23*bd211b85Ssemery * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24*bd211b85Ssemery * Use is subject to license terms. 25*bd211b85Ssemery */ 26*bd211b85Ssemery 27*bd211b85Ssemery #pragma ident "%Z%%M% %I% %E% SMI" 28*bd211b85Ssemery 29*bd211b85Ssemery #include <stdio.h> 30*bd211b85Ssemery #include <locale.h> 31*bd211b85Ssemery #include <netdb.h> 32*bd211b85Ssemery #include <smbsrv/libsmbns.h> 33*bd211b85Ssemery 34*bd211b85Ssemery char *whoami = NULL; 35*bd211b85Ssemery 36*bd211b85Ssemery static void usage(); 37*bd211b85Ssemery 38*bd211b85Ssemery static 39*bd211b85Ssemery void 40*bd211b85Ssemery usage() 41*bd211b85Ssemery { 42*bd211b85Ssemery fprintf(stderr, gettext("Usage: %s -d fqdn\n"), whoami); 43*bd211b85Ssemery fprintf(stderr, 44*bd211b85Ssemery gettext("\t-d\tThe fully qualified domain of the client\n")); 45*bd211b85Ssemery exit(1); 46*bd211b85Ssemery } 47*bd211b85Ssemery 48*bd211b85Ssemery int 49*bd211b85Ssemery main(int argc, char **argv) 50*bd211b85Ssemery { 51*bd211b85Ssemery char c, fqdn[MAXHOSTNAMELEN]; 52*bd211b85Ssemery int ret = 0; 53*bd211b85Ssemery 54*bd211b85Ssemery (void) setlocale(LC_ALL, ""); 55*bd211b85Ssemery 56*bd211b85Ssemery #if !defined(TEXT_DOMAIN) 57*bd211b85Ssemery #define TEXT_DOMAIN "SYS_TEST" 58*bd211b85Ssemery #endif /* TEXT_DOMAIN */ 59*bd211b85Ssemery 60*bd211b85Ssemery (void) textdomain(TEXT_DOMAIN); 61*bd211b85Ssemery 62*bd211b85Ssemery whoami = argv[0]; 63*bd211b85Ssemery 64*bd211b85Ssemery while ((c = getopt(argc, argv, "d:")) != -1) { 65*bd211b85Ssemery switch (c) { 66*bd211b85Ssemery case 'd': 67*bd211b85Ssemery (void) strncpy(fqdn, optarg, sizeof (fqdn)); 68*bd211b85Ssemery break; 69*bd211b85Ssemery default: 70*bd211b85Ssemery usage(); 71*bd211b85Ssemery break; 72*bd211b85Ssemery } 73*bd211b85Ssemery } 74*bd211b85Ssemery 75*bd211b85Ssemery if (argc != optind) 76*bd211b85Ssemery usage(); 77*bd211b85Ssemery 78*bd211b85Ssemery /* 79*bd211b85Ssemery * Update DNS RR for the client using DynDNS. First it tries the 80*bd211b85Ssemery * unauthed version then it tries the GSS version. 81*bd211b85Ssemery */ 82*bd211b85Ssemery ret = dyndns_update(fqdn); 83*bd211b85Ssemery 84*bd211b85Ssemery return (ret); 85*bd211b85Ssemery } 86