[24324] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r23922 - in trunk/athena/bin/discuss: debian server

daemon@ATHENA.MIT.EDU (Evan Broder)
Thu Jul 23 21:01:13 2009

Date: Thu, 23 Jul 2009 21:01:01 -0400
From: Evan Broder <broder@MIT.EDU>
Message-Id: <200907240101.n6O111tN017192@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: broder
Date: 2009-07-23 21:01:01 -0400 (Thu, 23 Jul 2009)
New Revision: 23922

Modified:
   trunk/athena/bin/discuss/debian/changelog
   trunk/athena/bin/discuss/server/rpproc.c
Log:
In discuss:
  * Patch discuss server to work without krb4. Patch by Mitch Berger.


Modified: trunk/athena/bin/discuss/debian/changelog
===================================================================
--- trunk/athena/bin/discuss/debian/changelog	2009-07-23 03:15:24 UTC (rev 23921)
+++ trunk/athena/bin/discuss/debian/changelog	2009-07-24 01:01:01 UTC (rev 23922)
@@ -1,3 +1,9 @@
+debathena-discuss (10.0.10-0debathena1) unstable; urgency=low
+
+  * Patch discuss server to work without krb4. Patch by Mitch Berger.
+
+ -- Evan Broder <broder@mit.edu>  Thu, 23 Jul 2009 21:00:55 -0400
+
 debathena-discuss (10.0.9-0debathena1) unstable; urgency=low
 
   * Fix local/dumb authentication needed for mail delivery and local

Modified: trunk/athena/bin/discuss/server/rpproc.c
===================================================================
--- trunk/athena/bin/discuss/server/rpproc.c	2009-07-23 03:15:24 UTC (rev 23921)
+++ trunk/athena/bin/discuss/server/rpproc.c	2009-07-24 01:01:01 UTC (rev 23922)
@@ -64,19 +64,44 @@
 #define ERROR   -1
 #define min(a, b) (a < b ? a : b)
 
+/* When both krb4 and krb5 are available, the server will try to
+ * authenticate clients with krb5 and then fall back to krb4.  To
+ * avoid writing entirely separate code for the case where krb4 is
+ * not available, we fake some of the constants and data structures.
+ */
+#ifndef HAVE_KRB4
+#define ANAME_SZ      40
+#define REALM_SZ      40
+#define INST_SZ       40
+#define MAX_KTXT_LEN  1250
+#define MAX_K_NAME_SZ (ANAME_SZ + INST_SZ + REALM_SZ + 2)
+struct ktext {
+    int length;
+    unsigned char dat[MAX_KTXT_LEN];
+    unsigned long mbz;
+};
+typedef struct ktext KTEXT_ST;
+struct partial_auth_dat { /* Just enough of the struct for our purposes */
+    char pname[ANAME_SZ];
+    char pinst[INST_SZ];
+    char prealm[REALM_SZ];
+};
+typedef struct partial_auth_dat AUTH_DAT;
+#endif /* HAVE_KRB4 */
+
 /* global */
-#ifdef HAVE_KRB4
+#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
 char rpc_caller[MAX_K_NAME_SZ + 1];
 #else
 char rpc_caller[50];
-#endif
+#endif /* HAVE_KRB4 || HAVE_KRB5 */
 static long hostaddr;
 
 extern int numprocs;
 extern struct proc_table procs [];
-#ifdef HAVE_KRB4
+#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
 static char serv_name[20];
-#endif /* HAVE_KRB4 */
+#endif /* HAVE_KRB4 || HAVE_KRB5 */
 short recvshort();
 int rpc_err;
 extern tfile net_tfile ();
@@ -113,13 +138,13 @@
     int s;
 #endif
     
-#ifdef HAVE_KRB4
+#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
     int fromlen,i;
     struct sockaddr_in from;
     char hostname[50];
     struct hostent *hp;
     USPCardinal bt;
-#endif	  
+#endif /* HAVE_KRB4 || HAVE_KRB5 */
 
 #if defined(__APPLE__) && defined(__MACH__)
     add_error_table(&et_rpc_error_table);
@@ -211,7 +236,7 @@
     strcat (rpc_caller, "@");
     strcat (rpc_caller, REALM);
     
-#ifdef HAVE_KRB4
+#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
 
     strcpy(serv_name, service);
     fromlen = sizeof (from);
@@ -235,12 +260,12 @@
     }
     
     handle_kerberos(bt,serv_name,hostaddr);
-#endif
+#endif /* HAVE_KRB4 || HAVE_KRB5 */
     *code = 0;
     return;
 }
 
-#ifdef HAVE_KRB4
+#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
 handle_kerberos(bt,service,haddr)
 USPCardinal bt;
 char *service;
@@ -320,12 +345,14 @@
 	/* First, log the krb5 error. */
 	com_err(service, result, "while reading request");
 #endif /* HAVE_KRB5 */
+#ifdef HAVE_KRB4
         result = krb_rd_req (&ticket, service, instance, haddr, &kdata,
 	                     filename);
 	if (result) {
 	    result += ERROR_TABLE_BASE_krb;
 	    goto punt_kerberos;
 	}
+#endif /* HAVE_KRB4 */
 #ifdef HAVE_KRB5
     }
 #endif /* HAVE_KRB5 */
@@ -346,7 +373,7 @@
 	 USP_end_block(us);
     }
 }
-#endif /* HAVE_KRB4 */
+#endif /* HAVE_KRB4 || HAVE_KRB5 */
 
 /*
  *
@@ -367,13 +394,13 @@
 	return;
     }
 
-#ifdef HAVE_KRB4
+#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
     if (bt == KRB_TICKET || bt == KRB_TICKET2) {
 	 handle_kerberos(bt, serv_name, hostaddr);
 	 *code = 0;
 	 return;
     }
-#endif /* HAVE_KRB4 */
+#endif /* HAVE_KRB4 || HAVE_KRB5 */
 
     procno = bt - PROC_BASE;
 


home help back first fref pref prev next nref lref last post