]> andersk Git - moira.git/blobdiff - update/send_file.c
Build without krb4 if it's unavailable.
[moira.git] / update / send_file.c
index 61c7ed794e4376d6d4c268e80c7c2e713727a3db..49127f41b2f02b5c58013f4245e304440d73fa0a 100644 (file)
 #include <string.h>
 #include <unistd.h>
 
+#ifdef HAVE_KRB4
 #include <des.h>
+#endif
 #include <update.h>
 
 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);
This page took 0.151457 seconds and 4 git commands to generate.