/*
* 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 2000 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Administrative tool to add a new user to the publickey database
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <rpc/key_prot.h>
#include <netdb.h>
#include <string.h>
#include <errno.h>
extern char *program_name;
/*
* Determine if requester is allowed to update the given map,
* and update it if so. Returns the yp status, which is zero
* if there is no access violation.
*/
int
{
#ifdef WEXITSTATUS
int status;
#else
#endif
#ifdef DEBUG
#endif
errno = 0;
switch (errno) {
case ENOENT:
"%s: %s not found, please install on the system\n",
program_name, MAKE);
return (1);
default:
"%s: cannot access %s, errno=%d.\n",
return (1);
}
if (pid < 0)
return (YPERR_YPERR);
/*
* Write to child
*/
/*
* Read from child
*/
#ifdef WEXITSTATUS
if (WEXITSTATUS(status) != 0) {
#else
#endif
return (YPERR_YPERR);
}
return (yperrno);
}
/*
* returns pid, or -1 for failure
*/
static int
{
int i;
char *com;
goto error1;
}
goto error2;
}
#ifdef VFORK
#else
#endif
case -1:
goto error3;
case 0:
/*
* child: read from pdto[0], write into pdfrom[1]
*/
(void) close(0);
(void) close(1);
closefrom(3);
_exit(~0);
}
_exit(~0);
default:
/*
* parent: write into pdto[1], read from pdfrom[0]
*/
break;
}
return (pid);
/*
* error cleanup and return
*/
return (-1);
}
static char *
{
char *p;
if (p == NULL)
return (path);
return (p + 1);
}
/*
* Determine if requester is allowed to update the given map,
* and update it if so. Returns the status, which is zero
* if there is no access violation, 1 otherwise.
* This function updates the local file.
*/
int
{
int wfd;
int err;
/*
* Check permission
*/
/* cannot change keys for nobody */
"%s: cannot change key-pair for %s\n",
program_name, name);
return (1);
}
/*
* Open files
*/
return (1);
}
(void) umask(0);
/*
* Create the new file with the correct permissions
*/
if (wfd == -1) {
return (1);
}
return (1);
}
err = -1;
switch (op) {
case YPOP_INSERT:
err = 1;
break;
case YPOP_STORE:
case YPOP_CHANGE:
err = 0;
break;
case YPOP_DELETE:
/* do nothing */
err = 0;
break;
}
} else {
}
}
if (err < 0) {
switch (op) {
case YPOP_CHANGE:
case YPOP_DELETE:
err = 1;
break;
case YPOP_INSERT:
case YPOP_STORE:
err = 0;
break;
}
}
if (err == 0) {
"%s: cannot rename %s to %s\n",
return (1);
}
} else {
"%s: cannot delete %s\n",
return (1);
}
}
return (err);
}
static int
{
int len;
}