rpc.ypupdated.c revision a506a34ceb0e9dcc6c61bf0560202f8538928650
/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* NIS update service
*/
#include <stdio.h>
#include <ctype.h>
#include <rpc/auth_des.h>
#include <strings.h>
#include <netdir.h>
#include <netdb.h>
#include "shim.h"
#include "yptol.h"
#define RPC_INETDSOCK 0 /* socket descriptor if using inetd */
char UPDATEFILE[] = "updaters";
void ypupdate_prog();
void detachfromtty();
static int addr2netname(char *, SVCXPRT *);
int insecure;
extern SVCXPRT *svcudp_create();
int
int argc;
char *argv[];
{
char *cmd;
static int issock();
int connmaxrec = RPC_MAXDATASIZE;
/*
* Check if we are running in N2L mode. If so updated is unsuported.
* This could be done by calling is_yptol_mode(), from libnisdb, but it
* seems over complex to pull in an entire library for one check so
* do it in line. Just pull in the name of file to check.
*/
"transition mode.");
exit(1);
}
switch (argc) {
case 0:
cmd = "ypupdated";
break;
case 1:
break;
case 2:
insecure++;
break;
insecure = 0;
break;
}
default:
break;
}
exit(1);
}
/*
* Set non-blocking mode and maximum record size for
* connection oriented RPC transports.
*/
}
if (issock(RPC_INETDSOCK)) {
int proto = 0;
exit(1);
}
proto)) {
exit(1);
}
} else {
exit(1);
}
}
exit(1);
}
svc_run();
abort();
/* NOTREACHED */
return (1);
}
/*
* Determine if a descriptor belongs to a socket or not
*/
static int
int fd;
{
return (0);
else
}
void
{
int tt;
close(0);
close(1);
close(2);
switch (fork()) {
case -1:
perror("fork");
break;
case 0:
break;
default:
exit(0);
}
if (tt >= 0) {
}
dup(0);
dup(0);
}
void
{
struct ypupdate_args args;
char *netname;
struct authunix_parms *aup;
case NULLPROC:
return;
case YPU_CHANGE:
op = YPOP_CHANGE;
break;
case YPU_DELETE:
op = YPOP_DELETE;
break;
case YPU_INSERT:
op = YPOP_INSERT;
break;
case YPU_STORE:
op = YPOP_STORE;
break;
default:
return;
}
case AUTH_DES:
netname = ((struct authdes_cred *)
break;
case AUTH_UNIX:
if (insecure) {
/*
* addr2netname(namebuf, svc_getcaller(transp));
*/
} else {
}
break;
}
default:
return;
}
return;
}
debug("svc_sendreply failed");
}
debug("svc_freeargs failed");
}
}
/*
* Determine if requester is allowed to update the given map,
* and update it if so. Returns the NIS status, which is zero
* if there is no access violation.
*/
int
char *requester;
char *mapname;
char *key;
char *data;
{
int status;
int yperrno;
int pid;
char default_domain[YPMAXDOMAIN];
int err;
char fake_key[10];
int outval_len;
debug("Couldn't get default domain name");
return (YPERR_YPERR);
}
/* check to see if we have a valid mapname */
switch (err) {
case YPERR_MAP:
return (YPERR_YPERR);
break;
default:
/* do nothing, only worry about above return code */
break;
}
/* valid map - continue */
if (pid < 0) {
debug("openpipes failed");
return (YPERR_YPERR);
}
/*
* Write to child
*/
/*
* Read from child
*/
return (YPERR_YPERR);
}
return (yperrno);
}
#if 0
char *namebuf;
struct sockaddr_in *addr;
{
struct hostent *h;
if (h == NULL) {
NULL);
} else {
}
}
#endif
static int
char *namebuf;
{
return (-1);
return (-1);
(void) freenetconfigent(nconf);
return (-1);
}
(void) freenetconfigent(nconf);
return (0);
}