/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley
* under license from the Regents of the University of
* California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This is a user command which issues a "Set domain binding" command to a
* YP binder (ypbind) process
*
* ypset [-h <host>] [-d <domainname>] server_to_use
*
* where host and server_to_use may be either names or internet addresses.
*/
#include <stdio.h>
#include <ctype.h>
#include "yp_b.h"
extern CLIENT *__clnt_create_loopback();
#ifdef NULL
#endif
#define NULL 0
static char *pusage;
static char *server_to_use;
TIMEOUT, /* Seconds */
0 /* Microseconds */
};
static char err_usage_set[] =
"Usage:\n\
ypset [ -h host ] [ -d domainname ] server_to_use\n\n";
static char err_bad_args[] =
"Sorry, the %s argument is bad.\n";
static char err_cant_get_kname[] =
"Sorry, can't get %s back from system call.\n";
static char err_null_kname[] =
"Sorry, the %s hasn't been set on this machine.\n";
static char err_tp_failure[] =
"Sorry, I can't set up a connection to host %s.\n";
static char err_rpc_failure[] =
"Sorry, I couldn't send my rpc message to ypbind on host %s.\n";
static char err_access_failure[] =
"ypset: Sorry, ypbind on host %s has rejected your request.\n";
static void get_command_line_args();
static void send_message();
extern void exit();
extern int getdomainname();
extern int gethostname();
extern struct netconfig *getnetconfigent();
extern unsigned int strlen();
/*
* This is the mainline for the ypset process. It pulls whatever arguments
* have been passed from the command line, and uses defaults for the rest.
*/
int
int argc;
char **argv;
{
if (!domain) {
} else {
exit(1);
}
exit(1);
}
}
send_message();
return (0);
}
/*
* This does the command line argument processing.
*/
static void
int argc;
char **argv;
{
argv++;
while (--argc > 1) {
if ((*argv)[0] == '-') {
switch ((*argv)[1]) {
case 'h': {
if (argc > 1) {
argv++;
argc--;
*argv) != 0) {
exit(1);
}
}
argv++;
} else {
exit(1);
}
break;
}
case 'd': {
if (argc > 1) {
argv++;
argc--;
argv++;
exit(1);
}
} else {
exit(1);
}
break;
}
default: {
exit(1);
}
}
} else {
exit(1);
}
}
if (argc == 1) {
if ((*argv)[0] == '-') {
exit(1);
}
server_to_use = *argv;
exit(1);
}
} else {
exit(1);
}
}
/*
* This takes the name of the YP host of interest, and fires off
* the "set domain binding" message to the ypbind process.
*/
static void
{
int err;
/*
* Open up a path to the server
*/
"datagram_n")) == NULL) {
exit(1);
}
/* get nconf, netbuf structures */
/*
* Open a path to host
*/
if (!host) {
clnt_pcreateerror("ypset: clnt_create");
exit(1);
}
clnt_pcreateerror("ypset: clnt_create");
exit(1);
}
} else {
YPBINDVERS, "datagram_n");
clnt_pcreateerror("ypset: clnt_create");
exit(1);
}
}
/*
* Load up the message structure and fire it off.
*/
timeout);
if (clnt_stat != RPC_SUCCESS) {
if (clnt_stat == RPC_PROGUNAVAIL)
else
exit(1);
}
if (!host)
(void) clnt_destroy(server);
(void) clnt_destroy(client);
}