[11805] in Athena Bugs

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

Program to turn off sending of Zgrams from discuss meetings

daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Wed Mar 2 20:42:46 1994

From: epeisach@MIT.EDU
Date: Wed, 2 Mar 1994 20:42:41 -0500
To: op@MIT.EDU, bugs@MIT.EDU, bug-discuss@MIT.EDU
Cc: mhpower@MIT.EDU


Problem:
OLC logs to discuss meetings. As the discuss meetings are set to public
= false, a zephyrgram must be sent to to all persons on the acl (instead
of to class discuss). The acl appears to be 100+ long. This puts an
unecessary load on the zephyr server for messages which in the past were
disabled from being sent out by hacking the disscussd binary (setting
the zephyr flag to false with adb or compiling a special version).

Solution:
When we picked up discuss 1.5, the superblock of a discuss meeting, had
an additional flag which disables sending of zephyrgrams on a per
meeting basis - but there was no utility to toggle the bit.

mhpower wrote a program that did that on a discuss meeting but relied on
knowing magic offsets into the file - which was disgusting and
unportable. In addition, proper locking of the superblock was not in
place which could cause a fatal problem.

So, I wrote dssuper - a program which allows you to examine the
superblock of a discuss meeting and toggle the zephyr and public bits. 
Proper file locking is observed (assuming I understood the discuss code
properly). 

My tests of the code makes me feel satisfied with the performance of the
code but I think someone probably wants to audit it....

The Imakefile change is relative to the one in the op/source tree.
To build you need to rebuild the Imakefile - and compile from the top of
the discuss tree. (cflags are passed down - so you cannot compile in a
subdir alone - stupid).

It would be nice if someone could test this out and run it on all the
discuss meetings on matisse that should not be broadcasting...
(Also then killing zhm on matisse which is currently 2Meg would probably
also help later).

Testing is easy - create a new discuss meeting and then toggle the bits
and watch if zephyrgrams are sent....

Enjoy....


	Ezra


*** 1.1	1994/03/02 08:00:50
--- server/Imakefile	1994/03/02 08:31:58
***************
*** 13,18 ****
--- 13,20 ----
  SimpleProgram(discussd,$(OBJS) rpproc.k.o core.o coreutil.o,$(LIBS),$(ATHETCDIR))
  build_program(disserve,$(OBJS) rpproc.nk.o core.o coreutil.o,,$(LIBS))
  install_program(disserve,-m 4755 -o $(DISCUSS_UID),$(ATHETCDIR))
+ 
+ build_program(dssuper,dssuper.o core.o coreutil.o acl.o glue.o atom.o,,$(LIBS))
  
  servetest: ../client/discuss.o ../client/cmds.o ../client/libss.a \
                  ../client/discuss_utils.o core.o coreutil.o atom.o acl.o \
*** /dev/null	Tue Mar  1 07:33:19 1994
--- server/dssuper.c	Wed Mar  2 20:15:34 1994
***************
*** 0 ****
--- 1,155 ----
+ /*
+  * A simple program to examine the superblock of a discuss meeting.
+  * This program must be run by the user discuss 
+  *
+  * You can set or clear the flags for the meeting indicating whether
+  * zephyrgrams should be sent or even if the meeting is public
+  *
+  * Written by Ezra Peisach based on a hack by Matthew H. Power
+  */
+ 
+ #include <stdio.h>
+ 
+ #include <discuss/types.h>
+ #include <discuss/dsc_et.h>
+ #include <discuss/interface.h>
+ #include "atom.h"
+ #include "mtg.h"
+ 
+ extern int has_privs, no_nuke;
+ extern int u_control_f;
+ extern bool nuclear;
+ extern afile a_control_f;
+ extern mtg_super super;
+ 
+ main (argc, argv)
+ int argc;
+ char **argv;
+ {
+ 	int clrzephyr = 0, setzephyr=0, clrpublic=0, setpublic =0;
+ 	char *location = NULL;
+ 	int result;
+ 	mtg_info cur_mtg;
+ 	int i;
+ 	int modified = 0;
+ 	date_times dcreated, dmodified;
+ 	trn_nums low, high, first, last;
+ 	short flags;
+ 
+ 	init_dsc_err_tbl();
+ 
+ 	for (i = 1; i < argc; i++) {
+ 		if (*argv[i] == '-' || *argv[i] == '+') switch (argv[i][1]) {
+ 		case 'z':
+ 			if(*argv[i] == '+') setzephyr++;
+ 			else clrzephyr++;
+ 			continue;
+ 		case 'p':
+ 			if(*argv[i] == '+') setpublic++;
+ 			clrpublic++;
+ 			continue;
+ 
+ 		default:
+ 			goto lusage;
+ 		}
+ 		if(location == NULL)
+ 			location = argv[i];
+ 		else goto lusage;
+ 	}
+ 	if (location == NULL)
+ 		goto lusage;					/* required */
+ 
+ 
+ 	if(clrzephyr + setzephyr > 1) {
+ 		fprintf(stderr, "Only one of +z and -z allowed");
+ 		exit(1);
+ 	}
+ 
+ 	if(clrpublic + setpublic > 1) {
+ 		fprintf(stderr, "Only one of +p and -p allowed");
+ 		exit(1);
+ 	}
+ 
+ 	has_privs = TRUE;		/* Tell discuss we're special */
+ 
+ 
+ 	/* First, we get the mtg info to make sure it exists */
+ 	get_mtg_info (location, &cur_mtg, &result);
+ 	if (result != 0) {
+ 		fprintf(stderr, "%s: %s while getting mtg info\n", location, error_message(result));
+ 		exit (1);
+ 	}
+ 
+ 
+ 	modified = clrzephyr + setzephyr + clrpublic + setpublic;
+ 	/* I wish that the core utilities has an easy way of doing this... 
+ 	   exproting the suberblock info...*/
+ 
+ 	if(modified) {
+ 		if (!no_nuke) {
+ 			a_control_f = aopen (u_control_f);
+ 			nuclear = TRUE;
+ 		}
+ 	} else {
+ 		start_read();
+ 	}
+ 
+ 	result = read_super();
+ 	if (result) { core_abort(); fprintf(stderr, "Unable to read superblock\n");exit(1); }
+ 
+ 	if(!modified) finish_read();
+ 
+ 	low = super.lowest;
+ 	high = super.highest;
+ 	first = super.first;
+ 	last = super.last;
+ 	dcreated = super.date_created;
+ 	dmodified = super.date_modified;
+ 
+ 	if(modified) {
+ 		if(setzephyr) super.flags &= ~(MTG_NOZEPHYR);
+ 		if(clrzephyr) super.flags |= MTG_NOZEPHYR;
+ 		if(setpublic) super.flags |= MTG_PUBLIC;
+ 		if(clrpublic) super.flags &= ~(MTG_PUBLIC);
+ 	}
+ 
+ 	flags = super.flags;
+ 
+ 	if(modified) {
+ 		write_super();
+ 		if (!no_nuke) {
+ 			aclose (a_control_f);
+ 			nuclear = FALSE;
+ 		}
+ 	} else {
+ 		forget_super();
+ 	}
+ 	
+ 	printf("\nMeeting: %s\n", cur_mtg.long_name);
+ 	printf("Locaton: %s\n", cur_mtg.location);
+ 
+ 	printf("\nDate meeting created: %s", ctime(&dcreated));
+ 
+ #if 0
+ /* date modified does not really appear to be interesting unless meeting
+    expunged */
+ 	printf("Date meeting modified: %s", ctime(&modified));
+ #endif
+ 	printf("\nFirst logical trn:\t%d\n", first);
+ 	printf("Last logical trn:\t%d\n", last);
+ 	printf("Lowest phys trn:\t%d\n", low);
+ 	printf("Highest phys trn:\t%d\n", high);
+ 	printf("Meeting flags: %s, %s\n\n", 
+ 	       (flags & MTG_PUBLIC) ? "Public" : "Not Public",
+ 	       (flags & MTG_NOZEPHYR) ? "No zephyrgrams" : "Send zephyrgrams");
+ 	       
+ 
+ 	exit(0);
+ 
+  lusage:
+ 	fprintf(stderr, "usage: dssuper mtg_location [+z] [-z] [+p] [-p]\n");
+ 	fprintf(stderr, "\n\t+z to enable sending of zephyr messages\n");
+ 	fprintf(stderr, "\t+p to mark the meeting as public\n");
+ 	exit (1);
+ }
+ 

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