summaryrefslogtreecommitdiffstats
path: root/usr.bin/newkey
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-12-02 12:17:20 +0000
committermarkm <markm@FreeBSD.org>2001-12-02 12:17:20 +0000
commit8e33fb69fc45f4bb7cc91a88fc201e074c9eeaf9 (patch)
tree0594b64fc835c9a5bbf6575836f47c0ac1a1051c /usr.bin/newkey
parenta59a3a99ce709ed0944f5b38c6fc98d2be49eb9c (diff)
downloadFreeBSD-src-8e33fb69fc45f4bb7cc91a88fc201e074c9eeaf9.zip
FreeBSD-src-8e33fb69fc45f4bb7cc91a88fc201e074c9eeaf9.tar.gz
WARNS=2 fixup.
Turn on YP (NIS) while I'm about it.
Diffstat (limited to 'usr.bin/newkey')
-rw-r--r--usr.bin/newkey/Makefile5
-rw-r--r--usr.bin/newkey/extern.h46
-rw-r--r--usr.bin/newkey/generic.c21
-rw-r--r--usr.bin/newkey/newkey.c16
-rw-r--r--usr.bin/newkey/update.c27
5 files changed, 81 insertions, 34 deletions
diff --git a/usr.bin/newkey/Makefile b/usr.bin/newkey/Makefile
index fbe8e3b..a083a07 100644
--- a/usr.bin/newkey/Makefile
+++ b/usr.bin/newkey/Makefile
@@ -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
diff --git a/usr.bin/newkey/extern.h b/usr.bin/newkey/extern.h
new file mode 100644
index 0000000..d39baa0
--- /dev/null
+++ b/usr.bin/newkey/extern.h
@@ -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 *);
diff --git a/usr.bin/newkey/generic.c b/usr.bin/newkey/generic.c
index 39e40f0..223dcf4 100644
--- a/usr.bin/newkey/generic.c
+++ b/usr.bin/newkey/generic.c
@@ -39,18 +39,22 @@ static const char rcsid[] =
* Copyright (C) 1986, Sun Microsystems, Inc.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <rpc/rpc.h>
#include <sys/file.h>
-#include <mp.h>
+#include <rpc/rpc.h>
#include <rpc/key_prot.h>
+#include <mp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "extern.h"
+
+static void adjust __P((char[], char *));
+static void getseed __P((char *, int, unsigned char *));
-static int adjust __P(( char[], 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;
diff --git a/usr.bin/newkey/newkey.c b/usr.bin/newkey/newkey.c
index 141614e..6b98709 100644
--- a/usr.bin/newkey/newkey.c
+++ b/usr.bin/newkey/newkey.c
@@ -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;
diff --git a/usr.bin/newkey/update.c b/usr.bin/newkey/update.c
index 23248ef..972c0e3 100644
--- a/usr.bin/newkey/update.c
+++ b/usr.bin/newkey/update.c
@@ -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>
-#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
+#include "extern.h"
#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;
OpenPOWER on IntegriCloud