Ticket #198: build-without-krb4.5

File build-without-krb4.5, 21.9 KB (added by broder, 15 years ago)
Line 
1Index: debathena-moira-4.0.0+cvs20090409/configure.in
2===================================================================
3--- debathena-moira-4.0.0+cvs20090409.orig/configure.in 2009-04-14 17:55:59.000000000 -0400
4+++ debathena-moira-4.0.0+cvs20090409/configure.in      2009-04-14 18:14:08.000000000 -0400
5@@ -109,30 +109,34 @@
6 AC_SUBST(COM_ERR_SUBDIR)
7 AC_SUBST(COMPILE_ET)
8 
9+AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
10+             [AC_CHECK_LIB(crypto, main, crypto="crypto")])
11+
12 # Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
13 AC_MSG_CHECKING(for Kerberos 4)
14 AC_ARG_WITH(krb4,
15     [  --with-krb4=PREFIX      Specify location of krb4],
16     [krb4="$withval"], [krb4=no])
17 AC_MSG_RESULT($krb4)
18-if test "$krb4" != yes; then
19-    MR_INCLUDE($krb4/include)
20-    if test -d "$krb4/include/kerberosIV"; then
21-       MR_INCLUDE($krb4/include/kerberosIV)
22+if test "$krb4" != no; then
23+    if test "$krb4" != yes; then
24+       MR_INCLUDE($krb4/include)
25+       if test -d "$krb4/include/kerberosIV"; then
26+           MR_INCLUDE($krb4/include/kerberosIV)
27+       fi
28+       MR_LIBS($krb4/lib)
29+    elif test -d /usr/include/kerberosIV; then
30+       MR_INCLUDE(/usr/include/kerberosIV)
31     fi
32-    MR_LIBS($krb4/lib)
33-elif test -d /usr/include/kerberosIV; then
34-    MR_INCLUDE(/usr/include/kerberosIV)
35+    MR_DEFINE(HAVE_KRB4)
36+    AC_CHECK_LIB(krb4, krb_rd_req,
37+                [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"],
38+                [AC_CHECK_LIB(krb, krb_rd_req,
39+                              [KRB4_LIBS="-lkrb -ldes"],
40+                              [AC_MSG_ERROR(Kerberos 4 libraries not found)],
41+                              $LIBPATH -ldes)],
42+                $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err -lresolv)
43 fi
44-AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
45-             [AC_CHECK_LIB(crypto, main, crypto="crypto")])
46-AC_CHECK_LIB(krb4, krb_rd_req,
47-            [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"],
48-            [AC_CHECK_LIB(krb, krb_rd_req,
49-                          [KRB4_LIBS="-lkrb -ldes"],
50-                          [AC_MSG_ERROR(Kerberos 4 libraries not found)],
51-                          $LIBPATH -ldes)],
52-            $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err -lresolv)
53 
54 AC_MSG_CHECKING(for Kerberos 5)
55 AC_ARG_WITH(krb5,
56Index: debathena-moira-4.0.0+cvs20090409/lib/mr_et.et
57===================================================================
58--- debathena-moira-4.0.0+cvs20090409.orig/lib/mr_et.et 2009-04-14 17:55:59.000000000 -0400
59+++ debathena-moira-4.0.0+cvs20090409/lib/mr_et.et      2009-04-14 18:04:03.000000000 -0400
60@@ -237,4 +237,7 @@
61 ec     MR_BAD_MAIL_STRING,
62        "Address refers to nonexistent domain or MIT internal mail server"
63 
64+ec     MR_NO_KRB4,
65+       "Unable to complete operation using Kerberos v4"
66+
67        end
68Index: debathena-moira-4.0.0+cvs20090409/update/auth_002.c
69===================================================================
70--- debathena-moira-4.0.0+cvs20090409.orig/update/auth_002.c    2009-04-14 17:55:59.000000000 -0400
71+++ debathena-moira-4.0.0+cvs20090409/update/auth_002.c 2009-04-14 18:04:03.000000000 -0400
72@@ -15,14 +15,18 @@
73 #include <stdio.h>
74 #include <string.h>
75 
76+#ifdef HAVE_KRB4
77 #include <krb.h>
78+#endif
79 
80 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/auth_002.c,v 1.9 1998-10-21 19:27:29 danw Exp $");
81 
82 static char service[] = "rcmd";
83 static char master[] = "sms";
84 static char qmark[] = "???";
85+#ifdef HAVE_KRB4
86 extern des_cblock session;
87+#endif
88 
89 /*
90  * authentication request auth_002:
91@@ -39,6 +43,7 @@
92 
93 void auth_002(int conn, char *str)
94 {
95+#ifdef HAVE_KRB4
96   char aname[ANAME_SZ], ainst[INST_SZ], arealm[REALM_SZ];
97   AUTH_DAT ad;
98   char *p, *first, *data;
99@@ -126,4 +131,7 @@
100   com_err(whoami, code, "auth for %s.%s@%s failed",
101          ad.pname, ad.pinst, ad.prealm);
102   send_int(conn, code);
103+#else
104+  return MR_NO_KRB4;
105+#endif
106 }
107Index: debathena-moira-4.0.0+cvs20090409/update/client.c
108===================================================================
109--- debathena-moira-4.0.0+cvs20090409.orig/update/client.c      2009-04-14 17:55:59.000000000 -0400
110+++ debathena-moira-4.0.0+cvs20090409/update/client.c   2009-04-14 18:04:03.000000000 -0400
111@@ -17,13 +17,17 @@
112 #include <stdlib.h>
113 #include <string.h>
114 
115+#ifdef HAVE_KRB4
116 #include <des.h>
117 #include <krb.h>
118+#endif
119 #include <krb5.h>
120 
121 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/client.c,v 1.27 2006-08-22 17:36:26 zacheiss Exp $");
122 
123+#ifdef HAVE_KRB4
124 extern des_cblock session;
125+#endif
126 extern char *whoami;
127 extern krb5_context context;
128 
129@@ -71,6 +75,7 @@
130 
131 int mr_send_auth(int conn, char *host_name)
132 {
133+#ifdef HAVE_KRB4
134   KTEXT_ST ticket_st;
135   int code, auth_version = 2;
136   long response;
137@@ -129,6 +134,9 @@
138     }
139 
140   return MR_SUCCESS;
141+#else
142+  return MR_NO_KRB4;
143+#endif
144 }
145 
146 int mr_execute(int conn, char *path)
147Index: debathena-moira-4.0.0+cvs20090409/update/ticket.c
148===================================================================
149--- debathena-moira-4.0.0+cvs20090409.orig/update/ticket.c      2009-04-14 17:55:59.000000000 -0400
150+++ debathena-moira-4.0.0+cvs20090409/update/ticket.c   2009-04-14 18:04:03.000000000 -0400
151@@ -13,19 +13,27 @@
152 #include <stdio.h>
153 #include <string.h>
154 
155+#ifdef HAVE_KRB4
156 #include <krb.h>
157+#else
158+#define KTEXT void*
159+#endif
160 #include <krb5.h>
161 #include <update.h>
162 
163 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/ticket.c,v 1.23 2007-07-25 15:39:01 zacheiss Exp $");
164 
165+#ifdef HAVE_KRB4
166 static char realm[REALM_SZ];
167 static char master[INST_SZ] = "sms";
168 static char service[ANAME_SZ] = "rcmd";
169 des_cblock session;
170+#endif
171 krb5_context context = NULL;
172 
173+#ifdef HAVE_KRB4
174 static int get_mr_tgt(void);
175+#endif
176 
177 int get_mr_krb5_update_ticket(char *host, krb5_data auth)
178 {
179@@ -58,6 +66,7 @@
180 
181 int get_mr_update_ticket(char *host, KTEXT ticket)
182 {
183+#ifdef HAVE_KRB4
184   int code, pass;
185   char phost[BUFSIZ];
186   CREDENTIALS cr;
187@@ -93,8 +102,12 @@
188       memcpy(session, cr.session, sizeof(session));
189     }
190   return code;
191+#else
192+  return MR_NO_KRB4;
193+#endif
194 }
195 
196+#ifdef HAVE_KRB4
197 static int get_mr_tgt(void)
198 {
199   int code;
200@@ -109,3 +122,4 @@
201   else
202     return code + ERROR_TABLE_BASE_krb;
203 }
204+#endif
205Index: debathena-moira-4.0.0+cvs20090409/include/update.h
206===================================================================
207--- debathena-moira-4.0.0+cvs20090409.orig/include/update.h     2009-04-14 17:55:59.000000000 -0400
208+++ debathena-moira-4.0.0+cvs20090409/include/update.h  2009-04-14 18:04:03.000000000 -0400
209@@ -15,7 +15,4 @@
210 int mr_execute(int conn, char *path);
211 void mr_send_quit(int conn);
212 
213-#include <krb.h>
214-int get_mr_update_ticket(char *host, KTEXT ticket);
215-
216 extern char *whoami;
217Index: debathena-moira-4.0.0+cvs20090409/clients/lib/utils.c
218===================================================================
219--- debathena-moira-4.0.0+cvs20090409.orig/clients/lib/utils.c  2009-04-14 17:55:59.000000000 -0400
220+++ debathena-moira-4.0.0+cvs20090409/clients/lib/utils.c       2009-04-14 18:04:03.000000000 -0400
221@@ -12,7 +12,6 @@
222 #include <mrclient.h>
223 
224 #include <com_err.h>
225-#include <krb.h>
226 #include <krb5.h>
227 
228 #include <sys/types.h>
229Index: debathena-moira-4.0.0+cvs20090409/clients/lib/member.c
230===================================================================
231--- debathena-moira-4.0.0+cvs20090409.orig/clients/lib/member.c 2009-04-14 17:55:59.000000000 -0400
232+++ debathena-moira-4.0.0+cvs20090409/clients/lib/member.c      2009-04-14 18:04:03.000000000 -0400
233@@ -17,12 +17,10 @@
234 #include <string.h>
235 #include <ctype.h>
236 
237-#include <krb.h>
238+#include <krb5.h>
239 
240 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/lib/member.c,v 1.5 2002-09-25 20:44:54 zacheiss Exp $");
241 
242-static char default_realm[REALM_SZ];
243-
244 int mrcl_validate_string_member(char *str)
245 {
246   char *p, *lname, *ret;
247@@ -69,6 +67,9 @@
248 int mrcl_validate_kerberos_member(char *str, char **ret)
249 {
250   char *p;
251+  int code = 0;
252+  krb5_context context = NULL;
253+  char *default_realm = NULL;
254 
255   mrcl_clear_message();
256 
257@@ -97,14 +98,27 @@
258          return MRCL_SUCCESS;
259        }
260 
261-      if (!*default_realm)
262-       krb_get_lrealm(default_realm, 1);
263+      code = krb5_init_context(&context);
264+      if (!code)
265+        goto out;
266+
267+      code = krb5_get_default_realm(context, &default_realm);
268+      if (!code)
269+        goto out;
270 
271       *ret = malloc(strlen(str) + strlen(default_realm) + 2);
272       sprintf(*ret, "%s@%s", str, default_realm);
273 
274       mrcl_set_message("Warning: default realm \"%s\" added to principal "
275                       "\"%s\"", default_realm, str);
276+
277+    out:
278+      if (default_realm)
279+        free(default_realm);
280+      if (context)
281+        krb5_free_context(context);
282+      if (!code)
283+        return code;
284       return MRCL_SUCCESS;
285     }
286 
287Index: debathena-moira-4.0.0+cvs20090409/lib/mr_auth.c
288===================================================================
289--- debathena-moira-4.0.0+cvs20090409.orig/lib/mr_auth.c        2009-04-14 17:55:59.000000000 -0400
290+++ debathena-moira-4.0.0+cvs20090409/lib/mr_auth.c     2009-04-14 18:04:03.000000000 -0400
291@@ -15,7 +15,9 @@
292 #include <stdio.h>
293 #include <string.h>
294 
295+#ifdef HAVE_KRB4
296 #include <krb.h>
297+#endif
298 #include <krb5.h>
299 
300 krb5_context context = NULL;
301@@ -29,6 +31,7 @@
302 
303 int mr_auth(char *prog)
304 {
305+#ifdef HAVE_KRB4
306   int status;
307   mr_params params, reply;
308   char *args[2];
309@@ -70,6 +73,9 @@
310   mr_destroy_reply(reply);
311 
312   return status;
313+#else
314+  return MR_NO_KRB4;
315+#endif
316 }
317 
318 int mr_proxy(char *principal, char *orig_authtype)
319Index: debathena-moira-4.0.0+cvs20090409/clients/moira/namespace.c
320===================================================================
321--- debathena-moira-4.0.0+cvs20090409.orig/clients/moira/namespace.c    2009-04-14 17:55:59.000000000 -0400
322+++ debathena-moira-4.0.0+cvs20090409/clients/moira/namespace.c 2009-04-14 18:04:03.000000000 -0400
323@@ -23,8 +23,6 @@
324 #include <stdio.h>
325 #include <string.h>
326 
327-#include <krb.h>
328-
329 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/namespace.c,v 1.16 2006-08-23 19:02:27 zacheiss Exp $");
330 
331 static void ErrorExit(char *buf, int status);
332@@ -176,7 +174,6 @@
333   int status;
334   Menu *menu;
335   char *motd, **arg;
336-  char pname[ANAME_SZ];
337   struct sigaction act;
338 
339   if (!(program_name = strrchr(argv[0], '/')))
340Index: debathena-moira-4.0.0+cvs20090409/update/get_file.c
341===================================================================
342--- debathena-moira-4.0.0+cvs20090409.orig/update/get_file.c    2009-04-14 17:55:59.000000000 -0400
343+++ debathena-moira-4.0.0+cvs20090409/update/get_file.c 2009-04-14 18:04:03.000000000 -0400
344@@ -17,7 +17,9 @@
345 #include <string.h>
346 #include <unistd.h>
347 
348+#ifdef HAVE_KRB4
349 #include <des.h>
350+#endif
351 
352 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/get_file.c,v 1.20 2007-07-11 16:06:31 zacheiss Exp $");
353 
354@@ -25,9 +27,11 @@
355 #define MIN(a, b)    (((a) < (b)) ? (a) : (b))
356 #endif /* MIN */
357 
358+#ifdef HAVE_KRB4
359 static des_key_schedule sched;
360 static des_cblock ivec;
361 extern des_cblock session;
362+#endif
363 
364 static int get_block(int conn, int fd, int max_size, int encrypt);
365 
366@@ -123,8 +127,15 @@
367 
368   if (encrypt)
369     {
370+#ifdef HAVE_KRB4
371       des_key_sched(session, sched);
372       memcpy(ivec, session, sizeof(ivec));
373+#else
374+      /* The session key only gets stored if auth happens in krb4 to
375+         begin with. If you don't have krb4, you can't possibly be
376+         coming up with a valid session key. */
377+      return MR_NO_KRB4;
378+#endif
379     }
380 
381   n_written = 0;
382@@ -173,6 +184,7 @@
383 
384   if (encrypt)
385     {
386+#ifdef HAVE_KRB4
387       char *unenc = malloc(len);
388 
389       if (!unenc)
390@@ -186,6 +198,7 @@
391        ivec[i] = data[len - 8 + i] ^ unenc[len - 8 + i];
392       free(data);
393       data = unenc;
394+#endif
395     }
396 
397   n_read = MIN(len, max_size);
398Index: debathena-moira-4.0.0+cvs20090409/update/send_file.c
399===================================================================
400--- debathena-moira-4.0.0+cvs20090409.orig/update/send_file.c   2009-04-14 17:55:59.000000000 -0400
401+++ debathena-moira-4.0.0+cvs20090409/update/send_file.c        2009-04-14 18:04:03.000000000 -0400
402@@ -17,12 +17,16 @@
403 #include <string.h>
404 #include <unistd.h>
405 
406+#ifdef HAVE_KRB4
407 #include <des.h>
408+#endif
409 #include <update.h>
410 
411 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/send_file.c,v 1.16 2001-09-04 19:46:21 zacheiss Exp $");
412 
413+#ifdef HAVE_KRB4
414 extern des_cblock session;
415+#endif
416 
417 /*
418  * syntax:
419@@ -47,8 +51,10 @@
420   char data[UPDATE_BUFSIZ], enc[UPDATE_BUFSIZ];
421   long response;
422   struct stat statb;
423+#ifdef HAVE_KRB4
424   des_key_schedule sched;
425   des_cblock ivec;
426+#endif
427 
428   /* send file over */
429   fd = open(pathname, O_RDONLY, 0);
430@@ -105,8 +111,15 @@
431 
432   if (encrypt)
433     {
434+#ifdef HAVE_KRB4
435       des_key_sched(session, sched);
436       memmove(ivec, session, sizeof(ivec));
437+#else
438+      /* The session key only gets stored if auth happens in krb4 to
439+         begin with. If you don't have krb4, you can't possibly be
440+         coming up with a valid session key. */
441+      return MR_NO_KRB4;
442+#endif
443     }
444 
445   while (n_to_send > 0)
446@@ -120,6 +133,7 @@
447        }
448       if (encrypt)
449        {
450+#ifdef HAVE_KRB4
451          memset(data + n, 0, sizeof(data) -n);
452          des_pcbc_encrypt(data, enc, (n + 7) & ~7, sched, ivec, 0);
453          /* save vector to continue chaining */
454@@ -128,6 +142,7 @@
455          /* round up to multiple of 8 */
456          n = (n + 7) & ~7;
457          code = send_string(conn, enc, n);
458+#endif
459        }
460       else
461        code = send_string(conn, data, n);
462Index: debathena-moira-4.0.0+cvs20090409/update/update_server.c
463===================================================================
464--- debathena-moira-4.0.0+cvs20090409.orig/update/update_server.c       2009-04-14 17:55:59.000000000 -0400
465+++ debathena-moira-4.0.0+cvs20090409/update/update_server.c    2009-04-14 18:04:03.000000000 -0400
466@@ -25,7 +25,9 @@
467 #include <unistd.h>
468 #include <syslog.h>
469 
470+#ifdef HAVE_KRB4
471 #include <des.h>
472+#endif
473 #include "update.h"
474 
475 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/update_server.c,v 1.26 2006-08-22 17:36:26 zacheiss Exp $");
476@@ -33,7 +35,9 @@
477 char *whoami, *hostname;
478 
479 int have_authorization = 0;
480+#ifdef HAVE_KRB4
481 des_cblock session;
482+#endif
483 int uid = 0;
484 
485 void child_handler(int signal);
486@@ -44,7 +48,9 @@
487   char *str;
488   void (*proc)(int, char *);
489 } dispatch_table[] = {
490+#ifdef HAVE_KRB4
491   { "AUTH_002", auth_002 },
492+#endif
493   { "AUTH_003", auth_003 },
494   { "XFER_002", xfer_002 },
495   { "XFER_003", xfer_003 },
496Index: debathena-moira-4.0.0+cvs20090409/clients/mailmaint/mailmaint.c
497===================================================================
498--- debathena-moira-4.0.0+cvs20090409.orig/clients/mailmaint/mailmaint.c        2009-04-14 17:55:59.000000000 -0400
499+++ debathena-moira-4.0.0+cvs20090409/clients/mailmaint/mailmaint.c     2009-04-14 18:04:03.000000000 -0400
500@@ -31,8 +31,6 @@
501 #include <unistd.h>
502 #endif
503 
504-#include <krb.h>
505-
506 #ifdef _WIN32
507 #define INPUT_MASK 0xff
508 #ifdef getchar
509Index: debathena-moira-4.0.0+cvs20090409/update/auth_003.c
510===================================================================
511--- debathena-moira-4.0.0+cvs20090409.orig/update/auth_003.c    2009-04-14 17:55:59.000000000 -0400
512+++ debathena-moira-4.0.0+cvs20090409/update/auth_003.c 2009-04-14 18:04:03.000000000 -0400
513@@ -15,7 +15,11 @@
514 #include <stdio.h>
515 #include <string.h>
516 
517+#ifdef HAVE_KRB4
518 #include <krb.h>
519+#else
520+#include <mr_krb.h>
521+#endif
522 #include <krb5.h>
523 
524 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/auth_003.c,v 1.2 2006-08-22 17:36:26 zacheiss Exp $");
525@@ -44,6 +48,7 @@
526   char *p, *first, *data;
527   char name[ANAME_SZ], inst[INST_SZ], realm[REALM_SZ];
528   char aname[ANAME_SZ], ainst[INST_SZ], arealm[REALM_SZ];
529+  char *lrealm = NULL;
530   size_t size;
531   long code;
532   struct utsname uts;
533@@ -143,7 +148,11 @@
534     {
535       strcpy(aname, master);
536       strcpy(ainst, "");
537-      if (krb_get_lrealm(arealm, 1))
538+      if (!krb5_get_default_realm(context, &lrealm))
539+        {
540+          strcpy(arealm, lrealm);
541+        }
542+      else
543        strcpy(arealm, KRB_REALM);
544     }
545   code = EPERM;
546@@ -159,6 +168,8 @@
547   have_authorization = 1;
548 
549  out:
550+  if (lrealm)
551+    free(lrealm);
552   if (client)
553     krb5_free_principal(context, client);
554   if (server)
555Index: debathena-moira-4.0.0+cvs20090409/include/moira.h
556===================================================================
557--- debathena-moira-4.0.0+cvs20090409.orig/include/moira.h      2009-04-14 17:55:59.000000000 -0400
558+++ debathena-moira-4.0.0+cvs20090409/include/moira.h   2009-04-14 18:04:03.000000000 -0400
559@@ -115,6 +115,9 @@
560 /* prototypes from kname_unparse.c */
561 char *mr_kname_unparse(char *p, char *i, char *r);
562 
563+/* prototypes from kname_parse.c */
564+int mr_kname_parse(char *np, char *ip, char *rp, char *fullname);
565+
566 /* prototypes from nfsparttype.c */
567 char *parse_filesys_type(char *fs_type_name);
568 char *format_filesys_type(char *fs_status);
569Index: debathena-moira-4.0.0+cvs20090409/include/mr_krb.h
570===================================================================
571--- /dev/null   1970-01-01 00:00:00.000000000 +0000
572+++ debathena-moira-4.0.0+cvs20090409/include/mr_krb.h  2009-04-14 18:04:03.000000000 -0400
573@@ -0,0 +1,20 @@
574+/* $Id$
575+ *
576+ * Copyright (C) 2009 by the Massachusetts Institute of Technology
577+ *
578+ * Define some useful constants that used to be provided by the krb4
579+ * libraries.
580+ *
581+ */
582+
583+#define ANAME_SZ      40
584+#define INST_SZ       40
585+#define REALM_SZ      40
586+/* include space for '.' and '@' */
587+#define MAX_K_NAME_SZ (ANAME_SZ + INST_SZ + REALM_SZ + 2)
588+
589+#define KRB_REALM "ATHENA.MIT.EDU"
590+
591+#define kname_parse mr_kname_parse
592+
593+#define ERROR_TABLE_BASE_krb                     (39525376L)
594Index: debathena-moira-4.0.0+cvs20090409/lib/Makefile.in
595===================================================================
596--- debathena-moira-4.0.0+cvs20090409.orig/lib/Makefile.in      2009-04-14 17:55:59.000000000 -0400
597+++ debathena-moira-4.0.0+cvs20090409/lib/Makefile.in   2009-04-14 18:04:03.000000000 -0400
598@@ -16,7 +16,7 @@
599 BUILDTOP=..
600 
601 OBJS=  critical.o fixhost.o fixname.o \
602-       hash.o kname_unparse.o krb_et.o mr_access.o mr_auth.o \
603+       hash.o kname_unparse.o kname_parse.o krb_et.o mr_access.o mr_auth.o \
604        mr_call.o mr_connect.o mr_et.o mr_init.o mr_ops.o mr_query.o \
605        nfsparttype.o sq.o strs.o ureg_err.o
606 
607Index: debathena-moira-4.0.0+cvs20090409/lib/kname_parse.c
608===================================================================
609--- /dev/null   1970-01-01 00:00:00.000000000 +0000
610+++ debathena-moira-4.0.0+cvs20090409/lib/kname_parse.c 2009-04-14 18:04:03.000000000 -0400
611@@ -0,0 +1,119 @@
612+/* $Id$
613+ *
614+ * Provide a copy of kname_parse() from krb4 for when krb4 is no
615+ * longer available.
616+ *
617+ * Copyright (C) 2009 by the Massachusetts Institute of Technology
618+ * For copying and distribution information, please see the file
619+ * <mit-copyright.h>.
620+ */
621+
622+#include <mit-copyright.h>
623+#include <moira.h>
624+
625+#include <string.h>
626+
627+#ifdef HAVE_KRB4
628+#include <krb.h>
629+#else
630+#include <mr_krb.h>
631+
632+#define KRBET_KNAME_FMT                          (39525457L)
633+#define KNAME_FMT                                (KRBET_KNAME_FMT - ERROR_TABLE_BASE_krb)
634+#endif
635+
636+RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/kname_parse.c,v 1.0 2009-04-14 00:00:00 broder Exp $");
637+
638+#define NAME    0               /* which field are we in? */
639+#define INST    1
640+#define REALM   2
641+
642+int mr_kname_parse(char *np, char *ip, char *rp, char *fullname)
643+{
644+  char buf[MAX_K_NAME_SZ];
645+  char *rnext, *wnext;        /* next char to read, write */
646+  register char c;
647+  int backslash;
648+  int field;
649+
650+  backslash = 0;
651+  rnext = buf;
652+  wnext = np;
653+  field = NAME;
654+
655+  if (strlen(fullname) > MAX_K_NAME_SZ)
656+    return KNAME_FMT;
657+  (void) strcpy(buf, fullname);
658+
659+  while ((c = *rnext++)) {
660+    if (backslash) {
661+      *wnext++ = c;
662+      backslash = 0;
663+      continue;
664+    }
665+    switch (c) {
666+    case '\\':
667+      backslash++;
668+      break;
669+    case '.':
670+      switch (field) {
671+      case NAME:
672+        if (wnext == np)
673+          return KNAME_FMT;
674+        *wnext = '\0';
675+        field = INST;
676+        wnext = ip;
677+        break;
678+      case INST:          /* We now allow period in instance */
679+      case REALM:
680+        *wnext++ = c;
681+        break;
682+      default:
683+        return KNAME_FMT;
684+      }
685+      break;
686+    case '@':
687+      switch (field) {
688+      case NAME:
689+        if (wnext == np)
690+          return KNAME_FMT;
691+        *ip = '\0';
692+        /* fall through */
693+      case INST:
694+        *wnext = '\0';
695+        field = REALM;
696+        wnext = rp;
697+        break;
698+      case REALM:
699+        return KNAME_FMT;
700+      default:
701+        return KNAME_FMT;
702+      }
703+      break;
704+    default:
705+      *wnext++ = c;
706+    }
707+    /*
708+     * Paranoia: check length each time through to ensure that we
709+     * don't overwrite things.
710+     */
711+    switch (field) {
712+    case NAME:
713+      if (wnext - np >= ANAME_SZ)
714+        return KNAME_FMT;
715+      break;
716+    case INST:
717+      if (wnext - ip >= INST_SZ)
718+        return KNAME_FMT;
719+      break;
720+    case REALM:
721+      if (wnext - rp >= REALM_SZ)
722+        return KNAME_FMT;
723+      break;
724+    default:
725+      return KNAME_FMT;
726+    }
727+  }
728+  *wnext = '\0';
729+  return 0;
730+}
731Index: debathena-moira-4.0.0+cvs20090409/lib/kname_unparse.c
732===================================================================
733--- debathena-moira-4.0.0+cvs20090409.orig/lib/kname_unparse.c  2009-04-14 17:55:59.000000000 -0400
734+++ debathena-moira-4.0.0+cvs20090409/lib/kname_unparse.c       2009-04-14 18:04:03.000000000 -0400
735@@ -13,8 +13,11 @@
736 
737 #include <stdio.h>
738 
739-#include <des.h>
740+#ifdef HAVE_KRB5
741 #include <krb.h>
742+#else
743+#include <mr_krb.h>
744+#endif
745 
746 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/kname_unparse.c,v 1.5 2004-07-20 06:47:46 zacheiss Exp $");
747 
748Index: debathena-moira-4.0.0+cvs20090409/clients/moira/user.c
749===================================================================
750--- debathena-moira-4.0.0+cvs20090409.orig/clients/moira/user.c 2009-04-14 17:55:59.000000000 -0400
751+++ debathena-moira-4.0.0+cvs20090409/clients/moira/user.c      2009-04-14 18:04:03.000000000 -0400
752@@ -25,8 +25,6 @@
753 #include <string.h>
754 #include <time.h>
755 
756-#include <krb.h>
757-
758 RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/user.c,v 1.74 2009-03-31 19:13:09 zacheiss Exp $");
759 
760 void CorrectCapitalization(char **name);