X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/0ea7f4a0e18af1fe2b08865d8472f7b0aab220b5..cb974713c2dde56749592d21c0da2a5ad3092400:/update/send_file.c diff --git a/update/send_file.c b/update/send_file.c index 61c7ed79..49127f41 100644 --- a/update/send_file.c +++ b/update/send_file.c @@ -17,12 +17,16 @@ #include #include +#ifdef HAVE_KRB4 #include +#endif #include RCSID("$Header$"); +#ifdef HAVE_KRB4 extern des_cblock session; +#endif /* * syntax: @@ -47,8 +51,10 @@ int mr_send_file(int conn, char *pathname, char *target_path, int encrypt) char data[UPDATE_BUFSIZ], enc[UPDATE_BUFSIZ]; long response; struct stat statb; +#ifdef HAVE_KRB4 des_key_schedule sched; des_cblock ivec; +#endif /* send file over */ fd = open(pathname, O_RDONLY, 0); @@ -105,8 +111,15 @@ int mr_send_file(int conn, char *pathname, char *target_path, int encrypt) if (encrypt) { +#ifdef HAVE_KRB4 des_key_sched(session, sched); memmove(ivec, session, sizeof(ivec)); +#else + /* The session key only gets stored if auth happens in krb4 to + begin with. If you don't have krb4, you can't possibly be + coming up with a valid session key. */ + return MR_NO_KRB4; +#endif } while (n_to_send > 0) @@ -120,6 +133,7 @@ int mr_send_file(int conn, char *pathname, char *target_path, int encrypt) } if (encrypt) { +#ifdef HAVE_KRB4 memset(data + n, 0, sizeof(data) -n); des_pcbc_encrypt(data, enc, (n + 7) & ~7, sched, ivec, 0); /* save vector to continue chaining */ @@ -128,6 +142,7 @@ int mr_send_file(int conn, char *pathname, char *target_path, int encrypt) /* round up to multiple of 8 */ n = (n + 7) & ~7; code = send_string(conn, enc, n); +#endif } else code = send_string(conn, data, n);