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