From 7652e731d98e37ecefde6db7a7702cb4d8f63c01 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Wed, 29 May 1996 20:51:09 +0000 Subject: [PATCH] Handle different sizes of returned checksum. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@542 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/krb4.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/appl/ftp/ftp/krb4.c b/appl/ftp/ftp/krb4.c index 1e3cbb445..8429afa31 100644 --- a/appl/ftp/ftp/krb4.c +++ b/appl/ftp/ftp/krb4.c @@ -449,12 +449,17 @@ do_klogin(char *host) verbose = old_verbose; return -1; } - memmove(&tmp, msg_data.app_data, 4); - tmp = ntohl(tmp); - if(tmp - checksum != 1){ - fprintf(stderr, "Bad checksum returned from server."); - verbose = old_verbose; - return -1; + { + /* the draft doesn't tell what size the return has */ + int i; + u_int32_t cs = 0; + for(i = 0; i < msg_data.app_length; i++) + cs = (cs<<8) + msg_data.app_data[i]; + if(cs - checksum != 1){ + fprintf(stderr, "Bad checksum returned from server."); + verbose = old_verbose; + return -1; + } } auth_complete = 1; verbose = old_verbose;