X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/0ea7f4a0e18af1fe2b08865d8472f7b0aab220b5..cb974713c2dde56749592d21c0da2a5ad3092400:/update/get_file.c diff --git a/update/get_file.c b/update/get_file.c index f92a5248..337947ac 100644 --- a/update/get_file.c +++ b/update/get_file.c @@ -17,7 +17,9 @@ #include #include +#ifdef HAVE_KRB4 #include +#endif RCSID("$Header$"); @@ -25,9 +27,11 @@ RCSID("$Header$"); #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif /* MIN */ +#ifdef HAVE_KRB4 static des_key_schedule sched; static des_cblock ivec; extern des_cblock session; +#endif static int get_block(int conn, int fd, int max_size, int encrypt); @@ -123,8 +127,15 @@ int get_file(int conn, char *pathname, int file_size, int checksum, if (encrypt) { +#ifdef HAVE_KRB4 des_key_sched(session, sched); memcpy(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 } n_written = 0; @@ -173,6 +184,7 @@ static int get_block(int conn, int fd, int max_size, int encrypt) if (encrypt) { +#ifdef HAVE_KRB4 char *unenc = malloc(len); if (!unenc) @@ -186,6 +198,7 @@ static int get_block(int conn, int fd, int max_size, int encrypt) ivec[i] = data[len - 8 + i] ^ unenc[len - 8 + i]; free(data); data = unenc; +#endif } n_read = MIN(len, max_size);