Ticket #198: build-without-krb4.3

File build-without-krb4.3, 9.0 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 09:02:00.000000000 -0400
4+++ debathena-moira-4.0.0+cvs20090409/configure.in      2009-04-14 09:02:03.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 2009-04-14 09:02:00.000000000 -0400
33+++ debathena-moira-4.0.0+cvs20090409/lib/mr_et.et      2009-04-14 09:04:58.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-14 09:02:00.000000000 -0400
45+++ debathena-moira-4.0.0+cvs20090409/update/auth_002.c 2009-04-14 09:02:04.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-14 09:02:00.000000000 -0400
84+++ debathena-moira-4.0.0+cvs20090409/update/client.c   2009-04-14 09:02:04.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-14 09:02:01.000000000 -0400
124+++ debathena-moira-4.0.0+cvs20090409/update/ticket.c   2009-04-14 09:07:08.000000000 -0400
125@@ -13,19 +13,27 @@
126 #include <stdio.h>
127 #include <string.h>
128 
129+#ifdef HAVE_KRB4
130 #include <krb.h>
131+#else
132+#define KTEXT void*
133+#endif
134 #include <krb5.h>
135 #include <update.h>
136 
137 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 $");
138 
139+#ifdef HAVE_KRB4
140 static char realm[REALM_SZ];
141 static char master[INST_SZ] = "sms";
142 static char service[ANAME_SZ] = "rcmd";
143 des_cblock session;
144+#endif
145 krb5_context context = NULL;
146 
147+#ifdef HAVE_KRB4
148 static int get_mr_tgt(void);
149+#endif
150 
151 int get_mr_krb5_update_ticket(char *host, krb5_data auth)
152 {
153@@ -58,6 +66,7 @@
154 
155 int get_mr_update_ticket(char *host, KTEXT ticket)
156 {
157+#ifdef HAVE_KRB4
158   int code, pass;
159   char phost[BUFSIZ];
160   CREDENTIALS cr;
161@@ -93,8 +102,12 @@
162       memcpy(session, cr.session, sizeof(session));
163     }
164   return code;
165+#else
166+  return MR_NO_KRB4;
167+#endif
168 }
169 
170+#ifdef HAVE_KRB4
171 static int get_mr_tgt(void)
172 {
173   int code;
174@@ -109,3 +122,4 @@
175   else
176     return code + ERROR_TABLE_BASE_krb;
177 }
178+#endif
179Index: debathena-moira-4.0.0+cvs20090409/include/update.h
180===================================================================
181--- debathena-moira-4.0.0+cvs20090409.orig/include/update.h     2009-04-14 09:02:01.000000000 -0400
182+++ debathena-moira-4.0.0+cvs20090409/include/update.h  2009-04-14 09:02:04.000000000 -0400
183@@ -15,7 +15,4 @@
184 int mr_execute(int conn, char *path);
185 void mr_send_quit(int conn);
186 
187-#include <krb.h>
188-int get_mr_update_ticket(char *host, KTEXT ticket);
189-
190 extern char *whoami;
191Index: debathena-moira-4.0.0+cvs20090409/clients/lib/utils.c
192===================================================================
193--- debathena-moira-4.0.0+cvs20090409.orig/clients/lib/utils.c  2009-04-14 09:02:01.000000000 -0400
194+++ debathena-moira-4.0.0+cvs20090409/clients/lib/utils.c       2009-04-14 09:02:04.000000000 -0400
195@@ -12,7 +12,6 @@
196 #include <mrclient.h>
197 
198 #include <com_err.h>
199-#include <krb.h>
200 #include <krb5.h>
201 
202 #include <sys/types.h>
203Index: debathena-moira-4.0.0+cvs20090409/clients/lib/member.c
204===================================================================
205--- debathena-moira-4.0.0+cvs20090409.orig/clients/lib/member.c 2009-04-14 09:02:01.000000000 -0400
206+++ debathena-moira-4.0.0+cvs20090409/clients/lib/member.c      2009-04-14 09:02:04.000000000 -0400
207@@ -17,12 +17,10 @@
208 #include <string.h>
209 #include <ctype.h>
210 
211-#include <krb.h>
212+#include <krb5.h>
213 
214 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 $");
215 
216-static char default_realm[REALM_SZ];
217-
218 int mrcl_validate_string_member(char *str)
219 {
220   char *p, *lname, *ret;
221@@ -69,6 +67,9 @@
222 int mrcl_validate_kerberos_member(char *str, char **ret)
223 {
224   char *p;
225+  int code = 0;
226+  krb5_context context = NULL;
227+  char *default_realm = NULL;
228 
229   mrcl_clear_message();
230 
231@@ -97,14 +98,27 @@
232          return MRCL_SUCCESS;
233        }
234 
235-      if (!*default_realm)
236-       krb_get_lrealm(default_realm, 1);
237+      code = krb5_init_context(&context);
238+      if (!code)
239+        goto out;
240+
241+      code = krb5_get_default_realm(context, &default_realm);
242+      if (!code)
243+        goto out;
244 
245       *ret = malloc(strlen(str) + strlen(default_realm) + 2);
246       sprintf(*ret, "%s@%s", str, default_realm);
247 
248       mrcl_set_message("Warning: default realm \"%s\" added to principal "
249                       "\"%s\"", default_realm, str);
250+
251+    out:
252+      if (default_realm)
253+        free(default_realm);
254+      if (context)
255+        krb5_free_context(context);
256+      if (!code)
257+        return code;
258       return MRCL_SUCCESS;
259     }
260 
261Index: debathena-moira-4.0.0+cvs20090409/lib/mr_auth.c
262===================================================================
263--- debathena-moira-4.0.0+cvs20090409.orig/lib/mr_auth.c        2009-04-14 09:02:00.000000000 -0400
264+++ debathena-moira-4.0.0+cvs20090409/lib/mr_auth.c     2009-04-14 09:02:04.000000000 -0400
265@@ -15,7 +15,9 @@
266 #include <stdio.h>
267 #include <string.h>
268 
269+#ifdef HAVE_KRB4
270 #include <krb.h>
271+#endif
272 #include <krb5.h>
273 
274 krb5_context context = NULL;
275@@ -29,6 +31,7 @@
276 
277 int mr_auth(char *prog)
278 {
279+#ifdef HAVE_KRB4
280   int status;
281   mr_params params, reply;
282   char *args[2];
283@@ -70,6 +73,9 @@
284   mr_destroy_reply(reply);
285 
286   return status;
287+#else
288+  return MR_NO_KRB4;
289+#endif
290 }
291 
292 int mr_proxy(char *principal, char *orig_authtype)
293Index: debathena-moira-4.0.0+cvs20090409/clients/moira/namespace.c
294===================================================================
295--- debathena-moira-4.0.0+cvs20090409.orig/clients/moira/namespace.c    2009-04-14 09:02:01.000000000 -0400
296+++ debathena-moira-4.0.0+cvs20090409/clients/moira/namespace.c 2009-04-14 09:02:04.000000000 -0400
297@@ -23,8 +23,6 @@
298 #include <stdio.h>
299 #include <string.h>
300 
301-#include <krb.h>
302-
303 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 $");
304 
305 static void ErrorExit(char *buf, int status);
306@@ -176,7 +174,6 @@
307   int status;
308   Menu *menu;
309   char *motd, **arg;
310-  char pname[ANAME_SZ];
311   struct sigaction act;
312 
313   if (!(program_name = strrchr(argv[0], '/')))