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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <smbsrv/libsmbns.h>
38 #define VAL2STR(x) QUOTE(x)
49 gettext("Usage: %s [ -d fqdn ] [ -s server ]\n"), whoami
);
51 gettext("\t-d\tThe fully qualified domain of the client\n"));
52 fprintf(stderr
, gettext("\t-s\tThe domain controller to join\n"));
54 gettext("\tstdin is used to read in the password or \n"));
55 fprintf(stderr
, gettext("\tthe password is prompted for.\n"));
61 main(int argc
, char **argv
)
63 char c
, fqdn
[MAXHOSTNAMELEN
], server
[MAXHOSTNAMELEN
];
67 (void) setlocale(LC_ALL
, "");
69 #if !defined(TEXT_DOMAIN)
70 #define TEXT_DOMAIN "SYS_TEST"
71 #endif /* TEXT_DOMAIN */
73 (void) textdomain(TEXT_DOMAIN
);
77 while ((c
= getopt(argc
, argv
, "d:s:")) != -1) {
80 (void) strncpy(fqdn
, optarg
, sizeof (fqdn
));
83 (void) strncpy(server
, optarg
, sizeof (server
));
94 if (!isatty(fileno(stdin
))) {
95 char buf
[PASS_MAX
+ 1];
97 if (scanf("%" VAL2STR(PASS_MAX
) "s", &buf
) != 1) {
99 gettext("Couldn't read new password\n"));
105 fprintf(stderr
, gettext("Couldn't allocate memory\n"));
109 newpw
= getpassphrase(gettext("Enter new password: "));
112 gettext("Couldn't read new password\n"));
116 newpw
= strdup(newpw
);
118 fprintf(stderr
, gettext("Couldn't allocate memory\n"));
124 * Set the SMF properties for smb for later use.
126 ret
= smb_setdomainprops(fqdn
, server
, newpw
);