WARNS=2 fixup.
Turn on YP (NIS) while I'm about it.
This commit is contained in:
parent
c38cc7439c
commit
13ac0cdca3
@ -1,10 +1,9 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= newkey
|
||||
SRCS= generic.c newkey.c update.c
|
||||
SRCS= newkey.c generic.c update.c
|
||||
MAN= newkey.8
|
||||
# For later:
|
||||
#CFLAGS+= -DYP
|
||||
CFLAGS+= -DYP
|
||||
DPADD= ${LIBRPCSVC} ${LIBMP} ${LIBCRYPTO}
|
||||
LDADD= -lrpcsvc -lmp -lcrypto
|
||||
|
||||
|
46
usr.bin/newkey/extern.h
Normal file
46
usr.bin/newkey/extern.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user or with the express written consent of
|
||||
* Sun Microsystems, Inc.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifdef YP
|
||||
#define MAXMAPNAMELEN 256
|
||||
#else
|
||||
#define YPOP_CHANGE 1 /* change, do not add */
|
||||
#define YPOP_INSERT 2 /* add, do not change */
|
||||
#define YPOP_DELETE 3 /* delete this entry */
|
||||
#define YPOP_STORE 4 /* add, or change */
|
||||
#endif
|
||||
|
||||
void genkeys(char *, char *, char *);
|
||||
int setpublicmap(char *, char *, char *);
|
||||
int mapupdate(char *, char *, u_int, u_int, char *, u_int, char *);
|
||||
void xencrypt(char *, char *);
|
||||
void xdecrypt(char *, char *);
|
@ -39,18 +39,22 @@ static const char rcsid[] =
|
||||
* Copyright (C) 1986, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include <sys/file.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/key_prot.h>
|
||||
#include <mp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <sys/file.h>
|
||||
#include <mp.h>
|
||||
#include <rpc/key_prot.h>
|
||||
|
||||
static int adjust __P(( char[], char * ));
|
||||
#include "extern.h"
|
||||
|
||||
static void adjust __P((char[], char *));
|
||||
static void getseed __P((char *, int, unsigned char *));
|
||||
|
||||
/*
|
||||
* Generate a seed
|
||||
*/
|
||||
static
|
||||
static void
|
||||
getseed(seed, seedsize, pass)
|
||||
char *seed;
|
||||
int seedsize;
|
||||
@ -66,12 +70,13 @@ getseed(seed, seedsize, pass)
|
||||
/*
|
||||
* Generate a random public/secret key pair
|
||||
*/
|
||||
void
|
||||
genkeys(public, secret, pass)
|
||||
char *public;
|
||||
char *secret;
|
||||
char *pass;
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
# define BASEBITS (8*sizeof (short) - 1)
|
||||
# define BASE (1 << BASEBITS)
|
||||
@ -112,7 +117,7 @@ genkeys(public, secret, pass)
|
||||
/*
|
||||
* Adjust the input key so that it is 0-filled on the left
|
||||
*/
|
||||
static
|
||||
static void
|
||||
adjust(keyout, keyin)
|
||||
char keyout[HEXKEYBYTES+1];
|
||||
char *keyin;
|
||||
|
@ -42,20 +42,24 @@ static const char rcsid[] =
|
||||
/*
|
||||
* Administrative tool to add a new user to the publickey database
|
||||
*/
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/key_prot.h>
|
||||
#ifdef YP
|
||||
#include <sys/wait.h>
|
||||
#include <rpcsvc/yp_prot.h>
|
||||
#include <rpcsvc/ypclnt.h>
|
||||
#include <sys/wait.h>
|
||||
#include <netdb.h>
|
||||
#endif /* YP */
|
||||
#include <err.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
#ifdef YP
|
||||
#define MAXMAPNAMELEN 256
|
||||
@ -73,11 +77,8 @@ static const char rcsid[] =
|
||||
#endif
|
||||
|
||||
#ifdef YP
|
||||
static char *basename();
|
||||
static char SHELL[] = "/bin/sh";
|
||||
static char YPDBPATH[]="/var/yp";
|
||||
static char PKMAP[] = "publickey.byname";
|
||||
static char UPDATEFILE[] = "updaters";
|
||||
#else
|
||||
static char PKFILE[] = "/etc/publickey";
|
||||
static char *err_string();
|
||||
@ -173,6 +174,7 @@ usage()
|
||||
/*
|
||||
* Set the entry in the public key file
|
||||
*/
|
||||
int
|
||||
setpublicmap(name, public, secret)
|
||||
char *name;
|
||||
char *public;
|
||||
|
@ -42,48 +42,43 @@ static const char rcsid[] =
|
||||
/*
|
||||
* Administrative tool to add a new user to the publickey database
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/key_prot.h>
|
||||
#ifdef YP
|
||||
#include <sys/wait.h>
|
||||
#include <rpcsvc/yp_prot.h>
|
||||
#include <rpcsvc/ypclnt.h>
|
||||
#include <sys/wait.h>
|
||||
#include <netdb.h>
|
||||
#endif /* YP */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
#ifdef YP
|
||||
#define MAXMAPNAMELEN 256
|
||||
#else
|
||||
#define YPOP_CHANGE 1 /* change, do not add */
|
||||
#define YPOP_INSERT 2 /* add, do not change */
|
||||
#define YPOP_DELETE 3 /* delete this entry */
|
||||
#define YPOP_STORE 4 /* add, or change */
|
||||
#endif
|
||||
|
||||
#ifdef YP
|
||||
static char *basename();
|
||||
static char SHELL[] = "/bin/sh";
|
||||
static char YPDBPATH[]="/var/yp"; /* This is defined but not used! */
|
||||
static char PKMAP[] = "publickey.byname";
|
||||
static char UPDATEFILE[] = "updaters";
|
||||
#else
|
||||
static char PKFILE[] = "/etc/publickey";
|
||||
#endif /* YP */
|
||||
|
||||
#ifdef YP
|
||||
static int _openchild __P(( char *, FILE **, FILE ** ));
|
||||
static int _openchild __P((char *, FILE **, FILE **));
|
||||
static char *basename __P((char *path));
|
||||
|
||||
/*
|
||||
* 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
|
||||
mapupdate(requester, mapname, op, keylen, key, datalen, data)
|
||||
char *requester;
|
||||
char *mapname;
|
||||
@ -148,7 +143,7 @@ mapupdate(requester, mapname, op, keylen, key, datalen, data)
|
||||
/*
|
||||
* returns pid, or -1 for failure
|
||||
*/
|
||||
static
|
||||
static pid_t
|
||||
_openchild(command, fto, ffrom)
|
||||
char *command;
|
||||
FILE **fto;
|
||||
|
Loading…
Reference in New Issue
Block a user