/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#include <stdio.h>
#include <libintl.h>
#include <stdlib.h>
#include <strings.h>
#include <err.h>
static void dclist_usage(void);
static int cmd_dclist(char *);
static void dcname_usage(void);
static int cmd_dcname(char *);
static void dsgetdc_usage(void);
static int cmd_dsgetdc(char *);
static void dsgetdcname_usage(void);
static int cmd_dsgetdcname(char *);
static void kick_usage(void);
static int cmd_kick(char *);
static void help(void);
typedef int cmd_fn_t (char *);
typedef void cmd_usage_t (void);
static struct commands {
} commands[] = {
};
/*
* lookupcmd
*/
static struct commands *
{
return (cmd);
}
return (NULL);
}
/*
* dclist
*/
static void
dclist_usage(void)
{
exit(1);
}
/* ARGSUSED */
static int
{
(void) printf("cmd_dclist() \n");
return (0);
}
/*
* dcname
*/
static void
dcname_usage(void)
{
exit(1);
}
/* ARGSUSED */
static int
{
(void) printf("cmd_dcname() \n");
return (0);
}
/*
* dsgetdc
*/
static void
dsgetdc_usage(void)
{
exit(1);
}
/* ARGSUSED */
static int
{
(void) printf("cmd_dsgetdc() \n");
return (0);
}
/*
* dsgetdcname
*/
static void
dsgetdcname_usage(void)
{
exit(1);
}
static int
{
int err = 0;
char *atype;
switch (err) {
case 0:
break;
case ERROR_NO_SUCH_DOMAIN:
(void) printf("Domain controller not found.\n");
(void) printf("See: /var/run/idmap/discovery.log\n");
exit(1);
default:
exit(1);
}
switch (dcinfo->DomainControllerAddressType) {
case DS_INET_ADDRESS:
atype = "inet";
break;
case DS_NETBIOS_ADDRESS:
atype = "netbios";
break;
default:
atype = "?";
break;
}
(void) printf("Data Returned from DsGetDcName() call: \n");
return (0);
}
/*
* kick
*/
static void
kick_usage(void)
{
exit(1);
}
static int
{
int flags = 0;
int result;
return (result);
}
/*
* help functions
*/
static void
help(void) {
(void) printf("\n");
/*
* TODO: We may want to revise this help text. It's basically
* a copy-paste from:
*/
(char *)getexecname());
#if 0 /* not yet */
" dclist Lists all domain controllers in the domain.\n"
" dcname Lists the PDC or PDC emulator.\n"
" dsgetdc Queries DNS server for list of DCs and"
" their IP addresses and contacts each DC to check"
" for connectivity.\n"
#endif
" dsgetdcname returns the name of a domain controller in a"
" specified domain\n"
" help display help on specified subcommand\n"
" kick trigger domain controller re-discovery\n"
"\n"));
exit(1);
}
int
{
int err = 0;
char *arg;
char *p;
char *optname;
int i;
/*
* Parse options.
*/
/* Is this an option? */
if (arg[0] == '/') {
optind++;
/*
* May have /optname:value
*/
*p++ = '\0';
optval = p;
}
optind++;
/*
* May have --optname=value
*/
*p++ = '\0';
optval = p;
}
} else {
/* Not an option. Stop parsing. */
break;
}
/*
* Handle each optname (and maybe its optval)
* Might put this logic in a table of options.
* (including a flag for "optval required",
* so that check could be factored out)
*/
/* cmd->name requires an optval */
"%s: option %s requires a value\n",
return (1);
}
}
}
}
/*
* Handle remaining non-option arguments
*/
}
if (option_cmd == NULL)
help();
err = 1;
else
return (err);
}