Ticket #198: build-without-krb4.2

File build-without-krb4.2, 7.5 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-12 15:19:22.000000000 -0400
4+++ debathena-moira-4.0.0+cvs20090409/configure.in      2009-04-13 11:14:23.000000000 -0400
5@@ -115,14 +115,17 @@
6     [  --with-krb4=PREFIX      Specify location of krb4],
7     [krb4="$withval"], [krb4=no])
8 AC_MSG_RESULT($krb4)
9-if test "$krb4" != yes; then
10-    MR_INCLUDE($krb4/include)
11-    if test -d "$krb4/include/kerberosIV"; then
12-       MR_INCLUDE($krb4/include/kerberosIV)
13+if test "$krb4" != no; then
14+    if test "$krb4" != yes; then
15+       MR_INCLUDE($krb4/include)
16+       if test -d "$krb4/include/kerberosIV"; then
17+           MR_INCLUDE($krb4/include/kerberosIV)
18+       fi
19+       MR_LIBS($krb4/lib)
20+    elif test -d /usr/include/kerberosIV; then
21+       MR_INCLUDE(/usr/include/kerberosIV)
22     fi
23-    MR_LIBS($krb4/lib)
24-elif test -d /usr/include/kerberosIV; then
25-    MR_INCLUDE(/usr/include/kerberosIV)
26+    MR_DEFINE(HAVE_KRB4)
27 fi
28 AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
29              [AC_CHECK_LIB(crypto, main, crypto="crypto")])
30Index: debathena-moira-4.0.0+cvs20090409/lib/mr_et.et
31===================================================================
32--- debathena-moira-4.0.0+cvs20090409.orig/lib/mr_et.et 2008-05-16 12:50:33.000000000 -0400
33+++ debathena-moira-4.0.0+cvs20090409/lib/mr_et.et      2009-04-13 11:14:27.000000000 -0400
34@@ -237,4 +237,7 @@
35 ec     MR_BAD_MAIL_STRING,
36        "Address refers to nonexistent domain or MIT internal mail server"
37 
38+ec     MR_NO_KRB4
39+       "Unable to complete operation using Kerberos v4"
40+
41        end
42Index: debathena-moira-4.0.0+cvs20090409/update/auth_002.c
43===================================================================
44--- debathena-moira-4.0.0+cvs20090409.orig/update/auth_002.c    2009-04-12 15:16:11.000000000 -0400
45+++ debathena-moira-4.0.0+cvs20090409/update/auth_002.c 2009-04-13 11:28:07.000000000 -0400
46@@ -15,14 +15,18 @@
47 #include <stdio.h>
48 #include <string.h>
49 
50+#ifdef HAVE_KRB4
51 #include <krb.h>
52+#endif
53 
54 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 $");
55 
56 static char service[] = "rcmd";
57 static char master[] = "sms";
58 static char qmark[] = "???";
59+#ifdef HAVE_KRB4
60 extern des_cblock session;
61+#endif
62 
63 /*
64  * authentication request auth_002:
65@@ -39,6 +43,7 @@
66 
67 void auth_002(int conn, char *str)
68 {
69+#ifdef HAVE_KRB4
70   char aname[ANAME_SZ], ainst[INST_SZ], arealm[REALM_SZ];
71   AUTH_DAT ad;
72   char *p, *first, *data;
73@@ -126,4 +131,7 @@
74   com_err(whoami, code, "auth for %s.%s@%s failed",
75          ad.pname, ad.pinst, ad.prealm);
76   send_int(conn, code);
77+#else
78+  return MR_NO_KRB4;
79+#endif
80 }
81Index: debathena-moira-4.0.0+cvs20090409/update/client.c
82===================================================================
83--- debathena-moira-4.0.0+cvs20090409.orig/update/client.c      2009-04-12 15:16:11.000000000 -0400
84+++ debathena-moira-4.0.0+cvs20090409/update/client.c   2009-04-13 11:44:48.000000000 -0400
85@@ -17,13 +17,17 @@
86 #include <stdlib.h>
87 #include <string.h>
88 
89+#ifdef HAVE_KRB4
90 #include <des.h>
91 #include <krb.h>
92+#endif
93 #include <krb5.h>
94 
95 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 $");
96 
97+#ifdef HAVE_KRB4
98 extern des_cblock session;
99+#endif
100 extern char *whoami;
101 extern krb5_context context;
102 
103@@ -71,6 +75,7 @@
104 
105 int mr_send_auth(int conn, char *host_name)
106 {
107+#ifdef HAVE_KRB4
108   KTEXT_ST ticket_st;
109   int code, auth_version = 2;
110   long response;
111@@ -129,6 +134,9 @@
112     }
113 
114   return MR_SUCCESS;
115+#else
116+  return MR_NO_KRB4;
117+#endif
118 }
119 
120 int mr_execute(int conn, char *path)
121Index: debathena-moira-4.0.0+cvs20090409/update/ticket.c
122===================================================================
123--- debathena-moira-4.0.0+cvs20090409.orig/update/ticket.c      2009-04-13 11:56:33.000000000 -0400
124+++ debathena-moira-4.0.0+cvs20090409/update/ticket.c   2009-04-13 11:56:08.000000000 -0400
125@@ -13,19 +13,25 @@
126 #include <stdio.h>
127 #include <string.h>
128 
129+#ifdef HAVE_KRB4
130 #include <krb.h>
131+#endif
132 #include <krb5.h>
133 #include <update.h>
134 
135 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 $");
136 
137+#ifdef HAVE_KRB4
138 static char realm[REALM_SZ];
139 static char master[INST_SZ] = "sms";
140 static char service[ANAME_SZ] = "rcmd";
141 des_cblock session;
142+#endif
143 krb5_context context = NULL;
144 
145+#ifdef HAVE_KRB4
146 static int get_mr_tgt(void);
147+#endif
148 
149 int get_mr_krb5_update_ticket(char *host, krb5_data auth)
150 {
151@@ -58,6 +64,7 @@
152 
153 int get_mr_update_ticket(char *host, KTEXT ticket)
154 {
155+#ifdef HAVE_KRB4
156   int code, pass;
157   char phost[BUFSIZ];
158   CREDENTIALS cr;
159@@ -93,8 +100,12 @@
160       memcpy(session, cr.session, sizeof(session));
161     }
162   return code;
163+#else
164+  return MR_NO_KRB4
165+#endif
166 }
167 
168+#ifdef HAVE_KRB4
169 static int get_mr_tgt(void)
170 {
171   int code;
172@@ -109,3 +120,4 @@
173   else
174     return code + ERROR_TABLE_BASE_krb;
175 }
176+#endif
177Index: debathena-moira-4.0.0+cvs20090409/include/update.h
178===================================================================
179--- debathena-moira-4.0.0+cvs20090409.orig/include/update.h     2009-04-12 15:16:12.000000000 -0400
180+++ debathena-moira-4.0.0+cvs20090409/include/update.h  2009-04-13 12:03:31.000000000 -0400
181@@ -15,7 +15,4 @@
182 int mr_execute(int conn, char *path);
183 void mr_send_quit(int conn);
184 
185-#include <krb.h>
186-int get_mr_update_ticket(char *host, KTEXT ticket);
187-
188 extern char *whoami;
189Index: debathena-moira-4.0.0+cvs20090409/clients/lib/utils.c
190===================================================================
191--- debathena-moira-4.0.0+cvs20090409.orig/clients/lib/utils.c  2006-08-23 15:01:05.000000000 -0400
192+++ debathena-moira-4.0.0+cvs20090409/clients/lib/utils.c       2009-04-13 12:08:30.000000000 -0400
193@@ -12,7 +12,6 @@
194 #include <mrclient.h>
195 
196 #include <com_err.h>
197-#include <krb.h>
198 #include <krb5.h>
199 
200 #include <sys/types.h>
201Index: debathena-moira-4.0.0+cvs20090409/clients/lib/member.c
202===================================================================
203--- debathena-moira-4.0.0+cvs20090409.orig/clients/lib/member.c 2002-09-25 16:44:54.000000000 -0400
204+++ debathena-moira-4.0.0+cvs20090409/clients/lib/member.c      2009-04-13 12:15:08.000000000 -0400
205@@ -17,12 +17,10 @@
206 #include <string.h>
207 #include <ctype.h>
208 
209-#include <krb.h>
210+#include <krb5.h>
211 
212 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 $");
213 
214-static char default_realm[REALM_SZ];
215-
216 int mrcl_validate_string_member(char *str)
217 {
218   char *p, *lname, *ret;
219@@ -69,6 +67,9 @@
220 int mrcl_validate_kerberos_member(char *str, char **ret)
221 {
222   char *p;
223+  int code = 0;
224+  krb5_context context = NULL;
225+  char *default_realm = NULL;
226 
227   mrcl_clear_message();
228 
229@@ -97,14 +98,27 @@
230          return MRCL_SUCCESS;
231        }
232 
233-      if (!*default_realm)
234-       krb_get_lrealm(default_realm, 1);
235+      code = krb5_init_context(&context);
236+      if (!code)
237+        goto out;
238+
239+      code = krb5_get_default_realm(context, &default_realm);
240+      if (!code)
241+        goto out;
242 
243       *ret = malloc(strlen(str) + strlen(default_realm) + 2);
244       sprintf(*ret, "%s@%s", str, default_realm);
245 
246       mrcl_set_message("Warning: default realm \"%s\" added to principal "
247                       "\"%s\"", default_realm, str);
248+
249+    out:
250+      if (default_realm)
251+        free(default_realm);
252+      if (context)
253+        krb5_free_context(context);
254+      if (!code)
255+        return code;
256       return MRCL_SUCCESS;
257     }
258