summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rsh/des_rw.c35
-rw-r--r--usr.bin/rsh/kcmd.c26
-rw-r--r--usr.bin/rsh/krcmd.c80
3 files changed, 37 insertions, 104 deletions
diff --git a/usr.bin/rsh/des_rw.c b/usr.bin/rsh/des_rw.c
index 7da9811260b..dcb3b12a17b 100644
--- a/usr.bin/rsh/des_rw.c
+++ b/usr.bin/rsh/des_rw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: des_rw.c,v 1.2 2002/07/15 22:11:34 deraadt Exp $ */
+/* $OpenBSD: des_rw.c,v 1.3 2002/07/15 22:54:26 deraadt Exp $ */
/* $NetBSD: des_rw.c,v 1.2 1995/03/21 07:58:30 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)des_rw.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: des_rw.c,v 1.2 2002/07/15 22:11:34 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: des_rw.c,v 1.3 2002/07/15 22:54:26 deraadt Exp $";
#endif
#endif /* not lint */
@@ -79,9 +79,7 @@ static des_key_schedule *key_schedule;
static int nstored = 0;
void
-desrw_set_key(inkey, insched)
- des_cblock *inkey;
- des_key_schedule*insched;
+desrw_set_key(des_cblock *inkey, des_key_schedule *insched)
{
key = inkey;
key_schedule = insched;
@@ -89,7 +87,7 @@ desrw_set_key(inkey, insched)
}
void
-desrw_clear_key()
+desrw_clear_key(void)
{
bzero((char *) key, sizeof(C_Block));
bzero((char *) key_schedule, sizeof(Key_schedule));
@@ -97,10 +95,7 @@ desrw_clear_key()
int
-des_read(fd, bp, len)
- int fd;
- void *bp;
- int len;
+des_read(int fd, void *bp, int len)
{
long net_len, rd_len;
int nreturned = 0;
@@ -138,12 +133,8 @@ des_read(fd, bp, len)
/* pipe must have closed, return 0 */
return(0);
}
- (void) des_pcbc_encrypt((des_cblock *)des_inbuf, /* inbuf */
- (des_cblock *)storage, /* outbuf */
- rd_len, /* length */
- *key_schedule, /* DES key */
- key, /* IV */
- DECRYPT); /* direction */
+ (void) des_pcbc_encrypt((des_cblock *)des_inbuf,
+ (des_cblock *)storage, rd_len, *key_schedule, key, DECRYPT);
if(net_len < 8)
store_ptr = storage + 8 - net_len;
@@ -168,10 +159,7 @@ des_read(fd, bp, len)
static unsigned char des_outbuf[10240]; /* > longest write */
int
-des_write(fd, bp, len)
- int fd;
- void *bp;
- int len;
+des_write(int fd, void *bp, int len)
{
static int seeded = 0;
static char garbage_buf[8];
@@ -192,11 +180,8 @@ des_write(fd, bp, len)
/* pcbc_encrypt outputs in 8-byte (64 bit) increments */
(void) des_pcbc_encrypt((des_cblock *)((len < 8) ? garbage_buf : buf),
- (des_cblock *)des_outbuf,
- (len < 8) ? 8 : len,
- *key_schedule, /* DES key */
- key, /* IV */
- ENCRYPT);
+ (des_cblock *)des_outbuf, (len < 8) ? 8 : len,
+ *key_schedule, key, ENCRYPT);
/* tell the other end the real amount, but send an 8-byte padded
packet */
diff --git a/usr.bin/rsh/kcmd.c b/usr.bin/rsh/kcmd.c
index 954b0fc800b..6e0f17f355d 100644
--- a/usr.bin/rsh/kcmd.c
+++ b/usr.bin/rsh/kcmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kcmd.c,v 1.3 2002/06/12 06:07:16 mpech Exp $ */
+/* $OpenBSD: kcmd.c,v 1.4 2002/07/15 22:54:26 deraadt Exp $ */
/* $NetBSD: kcmd.c,v 1.2 1995/03/21 07:58:32 cgd Exp $ */
/*
@@ -39,7 +39,7 @@
static char Xsccsid[] = "derived from @(#)rcmd.c 5.17 (Berkeley) 6/27/88";
static char sccsid[] = "@(#)kcmd.c 8.2 (Berkeley) 8/19/93";
#else
-static char rcsid[] = "$OpenBSD: kcmd.c,v 1.3 2002/06/12 06:07:16 mpech Exp $";
+static char rcsid[] = "$OpenBSD: kcmd.c,v 1.4 2002/07/15 22:54:26 deraadt Exp $";
#endif
#endif /* not lint */
@@ -79,21 +79,10 @@ int kcmd(int *, char **, u_short, char *, char *, char *,
struct sockaddr_in *, long);
int
-kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, ticket, service, realm,
- cred, schedule, msg_data, laddr, faddr, authopts)
- int *sock;
- char **ahost;
- u_short rport;
- char *locuser, *remuser, *cmd;
- int *fd2p;
- KTEXT ticket;
- char *service;
- char *realm;
- CREDENTIALS *cred;
- Key_schedule schedule;
- MSG_DAT *msg_data;
- struct sockaddr_in *laddr, *faddr;
- long authopts;
+kcmd(int *sock, char **ahost, u_short rport, char *locuser, char *remuser,
+ char *cmd, int *fd2p, KTEXT ticket, char *service, char *realm,
+ CREDENTIALS *cred, Key_schedule schedule, MSG_DAT *msg_data,
+ struct sockaddr_in *laddr, struct sockaddr_in *faddr, long authopts)
{
int s, timo = 1;
sigset_t mask, oldmask;
@@ -284,8 +273,7 @@ bad:
}
int
-getport(alport)
- int *alport;
+getport(int *alport)
{
struct sockaddr_in sin;
int s;
diff --git a/usr.bin/rsh/krcmd.c b/usr.bin/rsh/krcmd.c
index ac118546bb9..f655a455e18 100644
--- a/usr.bin/rsh/krcmd.c
+++ b/usr.bin/rsh/krcmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: krcmd.c,v 1.1 2002/05/06 22:23:53 deraadt Exp $ */
+/* $OpenBSD: krcmd.c,v 1.2 2002/07/15 22:54:26 deraadt Exp $ */
/* $NetBSD: krcmd.c,v 1.2 1995/03/21 07:58:36 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)krcmd.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: krcmd.c,v 1.1 2002/05/06 22:23:53 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: krcmd.c,v 1.2 2002/07/15 22:54:26 deraadt Exp $";
#endif
#endif /* not lint */
@@ -72,38 +72,19 @@ int krcmd_mutual(char **, u_short, char *, char *, int *, char *,
* returns a socket attached to the destination, -1 or krb error on error
* if fd2p is non-NULL, another socket is filled in for it
*/
-
int
-krcmd(ahost, rport, remuser, cmd, fd2p, realm)
- char **ahost;
- u_short rport;
- char *remuser, *cmd;
- int *fd2p;
- char *realm;
+krcmd(char **ahost, u_short rport, char *remuser, char *cmd, int *fd2p,
+ char *realm)
{
- int sock = -1, err = 0;
- KTEXT_ST ticket;
- long authopts = 0L;
+ int sock = -1, err = 0;
char myrealm[REALM_SZ];
+ long authopts = 0L;
+ KTEXT_ST ticket;
- err = kcmd(
- &sock,
- ahost,
- rport,
- NULL, /* locuser not used */
- remuser,
- cmd,
- fd2p,
- &ticket,
- SERVICE_NAME,
- realm,
- (CREDENTIALS *) NULL, /* credentials not used */
- (void *) NULL, /* key schedule not used */
- (MSG_DAT *) NULL, /* MSG_DAT not used */
- (struct sockaddr_in *) NULL, /* local addr not used */
- (struct sockaddr_in *) NULL, /* foreign addr not used */
- authopts
- );
+ err = kcmd(&sock, ahost, rport, NULL, remuser, cmd, fd2p,
+ &ticket, SERVICE_NAME, realm, (CREDENTIALS *) NULL,
+ (void *) NULL, (MSG_DAT *) NULL, (struct sockaddr_in *) NULL,
+ (struct sockaddr_in *) NULL, authopts);
if (err > KSUCCESS && err < MAX_KRB_ERRORS) {
if (krb_get_lrealm(myrealm, 0) == KSUCCESS)
@@ -116,40 +97,19 @@ krcmd(ahost, rport, remuser, cmd, fd2p, realm)
}
int
-krcmd_mutual(ahost, rport, remuser, cmd, fd2p, realm, cred, sched)
- char **ahost;
- u_short rport;
- char *remuser, *cmd;
- int *fd2p;
- char *realm;
- CREDENTIALS *cred;
- Key_schedule sched;
+krcmd_mutual(char **ahost, u_short rport, char *remuser, char *cmd, int *fd2p,
+ char *realm, CREDENTIALS *cred, Key_schedule sched)
{
- int sock, err;
- KTEXT_ST ticket;
- MSG_DAT msg_dat;
- struct sockaddr_in laddr, faddr;
+ struct sockaddr_in laddr, faddr;
long authopts = KOPT_DO_MUTUAL;
char myrealm[REALM_SZ];
+ KTEXT_ST ticket;
+ MSG_DAT msg_dat;
+ int sock, err;
- err = kcmd(
- &sock,
- ahost,
- rport,
- NULL, /* locuser not used */
- remuser,
- cmd,
- fd2p,
- &ticket,
- SERVICE_NAME,
- realm,
- cred, /* filled in */
- sched, /* filled in */
- &msg_dat, /* filled in */
- &laddr, /* filled in */
- &faddr, /* filled in */
- authopts
- );
+ err = kcmd(&sock, ahost, rport, NULL, remuser, cmd, fd2p,
+ &ticket, SERVICE_NAME, realm, cred, sched, &msg_dat,
+ &laddr, &faddr, authopts);
if (err > KSUCCESS && err < MAX_KRB_ERRORS) {
if (krb_get_lrealm(myrealm, 0) == KSUCCESS)