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