summaryrefslogtreecommitdiffstats
path: root/src/appl/bsd/krshd.c
diff options
context:
space:
mode:
authorSam Hartman <hartmans@mit.edu>1996-01-20 00:55:45 +0000
committerSam Hartman <hartmans@mit.edu>1996-01-20 00:55:45 +0000
commitc5f77d7f244dda724d9c3f4b68973e0aa3fb6de1 (patch)
tree91c230f34b81410ce714b836bc8a9603d1f78c4a /src/appl/bsd/krshd.c
parent358ec4a75edfa70ae585dc53b18db3767f732f8e (diff)
downloadkrb5-c5f77d7f244dda724d9c3f4b68973e0aa3fb6de1.tar.gz
krb5-c5f77d7f244dda724d9c3f4b68973e0aa3fb6de1.tar.xz
krb5-c5f77d7f244dda724d9c3f4b68973e0aa3fb6de1.zip
In the client, construct a checksum from the command line
and remote user and encode them in the authenticator. In the daemon, if a checksum is present, verify it. This change *should* make it possible to use rsh in a secure fassion provided that you always use a client that has checksumming. If you do not use encrypted rsh, then the command line cannot be spoofed, but the standard input and output can still be spoofed. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7341 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl/bsd/krshd.c')
-rw-r--r--src/appl/bsd/krshd.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/appl/bsd/krshd.c b/src/appl/bsd/krshd.c
index eb760fc13f..29fc757544 100644
--- a/src/appl/bsd/krshd.c
+++ b/src/appl/bsd/krshd.c
@@ -1611,6 +1611,7 @@ recvauth(netf, peersin)
krb5_data inbuf;
char v4_instance[INST_SZ]; /* V4 Instance */
char v4_version[9];
+krb5_authenticator *authenticator;
krb5_ticket *ticket;
len = sizeof(laddr);
@@ -1699,7 +1700,32 @@ recvauth(netf, peersin)
if (status = krb5_copy_principal(bsd_context, ticket->enc_part2->client,
&client))
return status;
-
+ if (status = krb5_auth_con_getauthenticator(bsd_context, auth_context, &authenticator))
+ return status;
+
+ if (authenticator->checksum) {
+ char * chksumbuf = (char *) malloc(strlen(cmdbuf)+strlen(remuser)+1);
+ if (chksumbuf == 0)
+ goto error_cleanup;
+
+ strcpy(chksumbuf,cmdbuf);
+ strcat(chksumbuf,remuser);
+
+ if ( status = krb5_verify_checksum(bsd_context,
+ authenticator->checksum->checksum_type,
+ authenticator->checksum,
+ chksumbuf, strlen(chksumbuf),
+ ticket->enc_part2->session->contents,
+ ticket->enc_part2->session->length))
+ goto error_cleanup;
+
+ error_cleanup:
+krb5_free_authenticator(bsd_context, authenticator);
+krb5_xfree(chksumbuf);
+if (status)
+ return status;
+}
+
/* Setup eblock for encrypted sessions. */
krb5_use_enctype(bsd_context, &eblock, ticket->enc_part2->session->enctype);
if (status = krb5_process_key(bsd_context, &eblock, ticket->enc_part2->session))