[185] in bug-owl

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

auth var patch

daemon@ATHENA.MIT.EDU (Roman Mitz)
Wed Jun 18 12:33:47 2003

Date: Wed, 18 Jun 2003 12:33:40 -0400
Mime-Version: 1.0 (Apple Message framework v552)
Content-Type: multipart/mixed; boundary=Apple-Mail-4-337409451
From: Roman Mitz <rmitz@cmu.edu>
To: bug-owl@mit.edu
Message-Id: <9E8F7C8A-A1AA-11D7-982F-000393C44284@cmu.edu>


--Apple-Mail-4-337409451
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

This patch uses code from owl_function_info, turning that into a 
function owl_zephyr_get_auth in zephyr.c, and making owl_function_info 
as well as owl_config_getmsg in readconfig.c use it.  Let me know if 
you'd like me to do this differently or something.

Roman.
------
Director of Computing Resources
The Center for the Neural Basis of Cognition


--Apple-Mail-4-337409451
Content-Disposition: attachment;
	filename=owl-auth-export.patch
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0600;
	name="owl-auth-export.patch"

Index: functions.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/ktools/src/owl/repository//owl/functions.c,v
retrieving revision 1.62
diff -u -r1.62 functions.c
--- functions.c	2003/06/07 16:09:48	1.62
+++ functions.c	2003/06/17 21:01:08
@@ -1310,16 +1310,8 @@
       owl_fmtext_append_normal(&fm, buff);
 
       owl_fmtext_append_normal(&fm,    "  Auth      : ");
-      if (n->z_auth == ZAUTH_FAILED) {
-	owl_fmtext_append_normal(&fm, "FAILED\n");
-      } else if (n->z_auth == ZAUTH_NO) {
-	owl_fmtext_append_normal(&fm, "NO\n");
-      } else if (n->z_auth == ZAUTH_YES) {
-	owl_fmtext_append_normal(&fm, "YES\n");
-      } else {
-	sprintf(buff, "Unknown State (%i)\n", n->z_auth);
-	owl_fmtext_append_normal(&fm, buff);
-      }
+      owl_fmtext_append_normal(&fm, owl_zephyr_get_auth(n));
+      owl_fmtext_append_normal(&fm, "\n");
 
       /* fix this */
       sprintf(buff, "  Checkd Ath: %i\n", n->z_checked_auth);
Index: readconfig.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/ktools/src/owl/repository//owl/readconfig.c,v
retrieving revision 1.10
diff -u -r1.10 readconfig.c
--- readconfig.c	2003/06/10 19:15:00	1.10
+++ readconfig.c	2003/06/17 20:59:22
@@ -168,6 +168,9 @@
   /* set owl::type */
   sv_setpv(perl_get_sv("owl::type", TRUE), owl_message_type_to_string(m));
 
+  /* set owl::auth */
+  sv_setpv(perl_get_sv("owl::auth", TRUE), owl_zephyr_get_auth(owl_message_get_notice(m)));
+
   /* set owl::direction */
   if (owl_message_is_direction_in(m)) {
     sv_setpv(perl_get_sv("owl::direction", TRUE), "in");
Index: zephyr.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/ktools/src/owl/repository//owl/zephyr.c,v
retrieving revision 1.17
diff -u -r1.17 zephyr.c
--- zephyr.c	2003/06/04 15:14:41	1.17
+++ zephyr.c	2003/06/18 16:20:12
@@ -255,6 +255,30 @@
 }
 
 
+char *owl_zephyr_get_auth(ZNotice_t *n)
+{
+  /* return auth string */
+
+  /* As far as I can tell the only way a null ZNotice would get passed
+     in is if auth is being checked for a personal message sent by the
+     client, and hence there is no stored ZNotice, and in that case
+     simply returning that the message is authentic is probably OK.  */
+  if (!n) {
+    return "YES";
+  }
+
+  if (n->z_auth == ZAUTH_FAILED) {
+    return ("FAILED");
+  } else if (n->z_auth == ZAUTH_NO) {
+    return ("NO");
+  } else if (n->z_auth == ZAUTH_YES) {
+    return ("YES");
+  } else {
+    return ("UNKNOWN");
+  }           
+}
+
+
 int send_zephyr(char *opcode, char *zsig, char *class, char *instance, char *recipient, char *message)
 {
   int ret;

--Apple-Mail-4-337409451--


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