/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*/
#include "defs.h"
#include <string.h>
#include <syslog.h>
#include <k5-int.h>
#include <krb5defs.h>
#include <priv_utils.h>
/*
* Remote distribution program.
*/
{ "autologin", &krb5auth_flag, 0 },
};
static int no_krb5auth_flag = 0;
int debug_port = 0;
int retval = 0;
/* Flag set, if -PN / -PO is specified */
{ "encrypt", &encrypt_flag, 0 },
};
{ "rcmd_protocol", &rcmdproto, 0 },
};
static void usage(void);
static char *prtype(int t);
void prnames();
void prcmd();
int
int argc;
char *argv[];
{
register char *arg;
int cmdargs = 0;
exit(1);
}
while (--argc > 0) {
break;
iamremote++;
else while (*++arg) {
if (rcmdoption_done == B_TRUE) {
"Only one of -PN "
"and -PO allowed.\n"));
usage();
}
break;
}
if (rcmdoption_done == B_TRUE) {
"Only one of -PN "
"and -PO allowed.\n"));
usage();
}
break;
}
switch (*arg) {
#ifdef DEBUG
case 'p':
if (--argc <= 0)
usage();
break;
#endif /* DEBUG */
case 'k':
if (--argc <= 0) {
"-k flag must be followed with "
" a realm name.\n"));
exit(1);
}
"Cannot malloc.\n"));
exit(1);
}
break;
case 'K':
break;
case 'a':
break;
case 'x':
encrypt_flag++;
encrypt_done++;
break;
case 'f':
if (--argc <= 0)
usage();
break;
case 'm':
if (--argc <= 0)
usage();
" too many destination"
" hosts\n"));
exit(1);
}
break;
case 'd':
if (--argc <= 0)
usage();
define(*++argv);
break;
case 'D':
debug++;
break;
case 'c':
cmdargs++;
break;
case 'n':
printf("rdist: -n overrides -v\n");
}
nflag++;
break;
case 'q':
qflag++;
break;
case 'b':
break;
case 'R':
break;
case 'v':
if (nflag) {
printf("rdist: -n overrides -v\n");
break;
}
break;
case 'w':
break;
case 'y':
break;
case 'h':
break;
case 'i':
break;
default:
usage();
}
}
}
/*
* if the user disables krb5 on the cmdline (-K), then skip
* all krb5 setup.
*
* if the user does not disable krb5 or enable krb5 on the
* cmdline, check krb5.conf to see if it should be enabled.
*/
if (no_krb5auth_flag) {
krb5auth_flag = 0;
encrypt_flag = 0;
} else if (!krb5auth_flag) {
/* is autologin set in krb5.conf? */
/* don't sweat failure here */
if (!status) {
/*
* note that the call to profile_get_options_boolean
* with autologin_option can affect value of
* krb5auth_flag
*/
}
}
if (krb5auth_flag > 0) {
if (!bsd_context) {
if (status) {
gettext("while initializing krb5"));
exit(1);
}
}
/* Set up des buffers */
/*
* Get our local realm to look up local realm options.
*/
if (status) {
gettext("while getting default realm"));
exit(1);
}
/*
* See if encryption should be done for this realm
*/
option);
/*
* Check the appdefaults section
*/
option);
if ((encrypt_done > 0) || (encrypt_flag > 0)) {
if (krb5_privacy_allowed() == TRUE) {
encrypt_flag++;
} else {
"Encryption not supported.\n"));
exit(1);
}
}
} else {
"KCMD protocol (%s)"), rcmdproto);
exit(1);
}
}
}
if (iamremote) {
server();
}
"rdist needs to run with sufficient privilege\n");
exit(1);
}
if (cmdargs)
else {
} else
exit(1);
}
}
yyparse();
if (nerrs == 0)
}
return (nerrs != 0);
}
static void
usage()
{
#ifdef DEBUG
"[-p port] "
#endif /* DEBUG */
"[-k realm] [-f distfile] [-d var=value] [-m host] [file ...]\n"));
"[-k realm] -c source [...] machine[:dest]\n"));
exit(1);
}
/*
* rcp like interface for distributing files.
*/
static void
int nargs;
char *args[];
{
register char *cp;
char *dest;
int i;
if (nargs < 2)
usage();
for (i = 0; i < nargs - 1; i++) {
else {
}
}
*dest++ = '\0';
if (nerrs)
exit(1);
else {
}
if (debug) {
printf("docmdargs()\nfiles = ");
printf("hosts = ");
}
}
/*
* Print a list of NAME blocks (mostly for debugging).
*/
void
{
printf("( ");
}
printf(")\n");
}
void
prcmd(c)
struct cmd *c;
{
extern char *prtype();
while (c) {
printf("c_type %s, c_name %s, c_label %s, c_files ",
c = c->c_next;
}
}
static void
prsubcmd(s)
struct subcmd *s;
{
extern char *prtype();
extern char *proptions();
while (s) {
printf("sc_type %s, sc_options %d%s, sc_name %s, sc_args ",
s = s->sc_next;
}
}
char *
prtype(t)
int t;
{
switch (t) {
case EQUAL:
return ("EQUAL");
case LP:
return ("LP");
case RP:
return ("RP");
case SM:
return ("SM");
case ARROW:
return ("ARROW");
case COLON:
return ("COLON");
case DCOLON:
return ("DCOLON");
case NAME:
return ("NAME");
case STRING:
return ("STRING");
case INSTALL:
return ("INSTALL");
case NOTIFY:
return ("NOTIFY");
case EXCEPT:
return ("EXCEPT");
case PATTERN:
return ("PATTERN");
case SPECIAL:
return ("SPECIAL");
case OPTION:
return ("OPTION");
}
return (NULL);
}
char *
proptions(o)
int o;
{
}
char *
register char *bits;
register unsigned short v;
{
register int i, any = 0;
register char c;
char *p = buf;
bits++;
if (bits) {
*p++ = '<';
while ((i = *bits++) != 0) {
if (v & (1 << (i-1))) {
if (any)
*p++ = ',';
any = 1;
*p++ = c;
} else
;
}
*p++ = '>';
}
*p = '\0';
return (buf);
}