[23536] in Source-Commits

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

/svn/athena r23178 - in trunk/third/moira: . afssync backup clients clients/addusr clients/blanche clients/chfn clients/chpobox clients/chsh clients/lib clients/mailmaint clients/mitch clients/moira clients/moira/Doc clients/mrcheck clients/mrtest clients/regapplet clients/regapplet/mit/cipher clients/regapplet/mit/random clients/stanley clients/stella db dbck dcm debian debian/patches g

daemon@ATHENA.MIT.EDU (broder@MIT.EDU)
Wed Sep 17 18:26:09 2008

Date: Wed, 17 Sep 2008 18:25:14 -0400 (EDT)
From: broder@MIT.EDU
Message-Id: <200809172225.SAA08766@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: broder
Date: 2008-09-17 18:23:57 -0400 (Wed, 17 Sep 2008)
New Revision: 23178

Added:
   trunk/third/moira/debian/debathena-moira-update-server.init
   trunk/third/moira/debian/debathena-moira-update-server.install
   trunk/third/moira/debian/patches/install-sample-moira-conf.patch
Modified:
   trunk/third/moira/Makefile.in
   trunk/third/moira/afssync/Makefile.in
   trunk/third/moira/afssync/sync.pc
   trunk/third/moira/afssync/ubik.c
   trunk/third/moira/afssync/utils.c
   trunk/third/moira/afssync/vis.c
   trunk/third/moira/afssync/vis.h
   trunk/third/moira/backup/Makefile.in
   trunk/third/moira/backup/db2bkup.awk
   trunk/third/moira/backup/db2rest.awk
   trunk/third/moira/backup/dump_db.h
   trunk/third/moira/backup/dump_db.pc
   trunk/third/moira/backup/dumprest.pc
   trunk/third/moira/backup/report.pl
   trunk/third/moira/backup/rest_db.pc
   trunk/third/moira/clients/Makefile.in
   trunk/third/moira/clients/addusr/Makefile.in
   trunk/third/moira/clients/addusr/addusr.c
   trunk/third/moira/clients/blanche/Makefile.in
   trunk/third/moira/clients/blanche/blanche.c
   trunk/third/moira/clients/chfn/Makefile.in
   trunk/third/moira/clients/chfn/chfn.c
   trunk/third/moira/clients/chpobox/Makefile.in
   trunk/third/moira/clients/chpobox/chpobox.c
   trunk/third/moira/clients/chsh/Makefile.in
   trunk/third/moira/clients/chsh/chsh.c
   trunk/third/moira/clients/lib/Makefile.in
   trunk/third/moira/clients/lib/error.c
   trunk/third/moira/clients/lib/mail.c
   trunk/third/moira/clients/lib/member.c
   trunk/third/moira/clients/lib/mrclient-internal.h
   trunk/third/moira/clients/lib/pobox.c
   trunk/third/moira/clients/lib/utils.c
   trunk/third/moira/clients/mailmaint/Makefile.in
   trunk/third/moira/clients/mailmaint/mailmaint.c
   trunk/third/moira/clients/mitch/Makefile.in
   trunk/third/moira/clients/mitch/mitch.c
   trunk/third/moira/clients/moira/Doc/Makefile
   trunk/third/moira/clients/moira/Doc/internal.mss
   trunk/third/moira/clients/moira/Makefile.in
   trunk/third/moira/clients/moira/acl.c
   trunk/third/moira/clients/moira/attach.c
   trunk/third/moira/clients/moira/cluster.c
   trunk/third/moira/clients/moira/dcmmaint.c
   trunk/third/moira/clients/moira/defs.h
   trunk/third/moira/clients/moira/delete.c
   trunk/third/moira/clients/moira/f_defs.h
   trunk/third/moira/clients/moira/globals.c
   trunk/third/moira/clients/moira/globals.h
   trunk/third/moira/clients/moira/lists.c
   trunk/third/moira/clients/moira/main.c
   trunk/third/moira/clients/moira/menu.c
   trunk/third/moira/clients/moira/menu.h
   trunk/third/moira/clients/moira/menus.c
   trunk/third/moira/clients/moira/misc.c
   trunk/third/moira/clients/moira/namespace.c
   trunk/third/moira/clients/moira/nfs.c
   trunk/third/moira/clients/moira/pobox.c
   trunk/third/moira/clients/moira/printer.c
   trunk/third/moira/clients/moira/quota.c
   trunk/third/moira/clients/moira/user.c
   trunk/third/moira/clients/moira/utils.c
   trunk/third/moira/clients/moira/zephyr.c
   trunk/third/moira/clients/mrcheck/Makefile.in
   trunk/third/moira/clients/mrcheck/mrcheck.c
   trunk/third/moira/clients/mrtest/Makefile.in
   trunk/third/moira/clients/mrtest/mrtest.c
   trunk/third/moira/clients/regapplet/Makefile
   trunk/third/moira/clients/regapplet/mit/cipher/ArrayUtil.java
   trunk/third/moira/clients/regapplet/mit/cipher/BI.java
   trunk/third/moira/clients/regapplet/mit/cipher/DES.java
   trunk/third/moira/clients/regapplet/mit/cipher/Hex.java
   trunk/third/moira/clients/regapplet/mit/cipher/RSAAlgorithm.java
   trunk/third/moira/clients/regapplet/mit/random/SHA1.java
   trunk/third/moira/clients/stanley/Makefile.in
   trunk/third/moira/clients/stanley/stanley.c
   trunk/third/moira/clients/stella/Makefile.in
   trunk/third/moira/clients/stella/stella.c
   trunk/third/moira/config.guess
   trunk/third/moira/config.sub
   trunk/third/moira/configure
   trunk/third/moira/configure.in
   trunk/third/moira/db/Makefile.in
   trunk/third/moira/db/dbopt.sql
   trunk/third/moira/db/doschema.awk
   trunk/third/moira/db/schema.sql
   trunk/third/moira/dbck/Makefile.in
   trunk/third/moira/dbck/dbck.h
   trunk/third/moira/dbck/dbck.pc
   trunk/third/moira/dbck/fix.pc
   trunk/third/moira/dbck/members.pc
   trunk/third/moira/dbck/phase1.pc
   trunk/third/moira/dbck/phase2.pc
   trunk/third/moira/dbck/phase3.pc
   trunk/third/moira/dbck/phase4.pc
   trunk/third/moira/dcm/Makefile.in
   trunk/third/moira/dcm/dcm.pc
   trunk/third/moira/dcm/startdcm.c
   trunk/third/moira/debian/changelog
   trunk/third/moira/debian/control
   trunk/third/moira/debian/control.in
   trunk/third/moira/debian/patches/series
   trunk/third/moira/gen/Makefile.in
   trunk/third/moira/gen/access.gen
   trunk/third/moira/gen/access.sh
   trunk/third/moira/gen/acl.pc
   trunk/third/moira/gen/acl.sh
   trunk/third/moira/gen/aliases.sh
   trunk/third/moira/gen/boot.pc
   trunk/third/moira/gen/boot.sh
   trunk/third/moira/gen/ca.gen
   trunk/third/moira/gen/calendar.gen
   trunk/third/moira/gen/confluence.pc
   trunk/third/moira/gen/dhcp.pc
   trunk/third/moira/gen/dhcp.sh
   trunk/third/moira/gen/directory.pc
   trunk/third/moira/gen/events.pc
   trunk/third/moira/gen/events.sh
   trunk/third/moira/gen/genacl.pc
   trunk/third/moira/gen/hesiod.pc
   trunk/third/moira/gen/hesiod.sh
   trunk/third/moira/gen/hosts.pc
   trunk/third/moira/gen/install_dirs
   trunk/third/moira/gen/install_quotas
   trunk/third/moira/gen/ip-billing.gen
   trunk/third/moira/gen/ip-billing.sh
   trunk/third/moira/gen/ldap.gen
   trunk/third/moira/gen/longjobs.gen
   trunk/third/moira/gen/longjobs.sh
   trunk/third/moira/gen/mailhosts.gen
   trunk/third/moira/gen/mailhub.pc
   trunk/third/moira/gen/mailhub.sh
   trunk/third/moira/gen/mailman.gen
   trunk/third/moira/gen/mailman.sh
   trunk/third/moira/gen/nagios-colo.gen
   trunk/third/moira/gen/nagios-colo.sh
   trunk/third/moira/gen/nagios-printers.gen
   trunk/third/moira/gen/nagios-printers.sh
   trunk/third/moira/gen/nagios-wsh.gen
   trunk/third/moira/gen/nagios-wsh.sh
   trunk/third/moira/gen/ndb.pc
   trunk/third/moira/gen/ndb.sh
   trunk/third/moira/gen/network.pc
   trunk/third/moira/gen/nfs.pc
   trunk/third/moira/gen/nfs.sh
   trunk/third/moira/gen/pobox.pc
   trunk/third/moira/gen/postoffice.pc
   trunk/third/moira/gen/postoffice.sh
   trunk/third/moira/gen/print.pc
   trunk/third/moira/gen/print.sh
   trunk/third/moira/gen/rt.sh
   trunk/third/moira/gen/sapprint.gen
   trunk/third/moira/gen/sapprint.sh
   trunk/third/moira/gen/setquota.c
   trunk/third/moira/gen/spwatch.gen
   trunk/third/moira/gen/tar.c
   trunk/third/moira/gen/tsm.gen
   trunk/third/moira/gen/tsm.sh
   trunk/third/moira/gen/util.c
   trunk/third/moira/gen/warehouse.gen
   trunk/third/moira/gen/warehouse.sh
   trunk/third/moira/gen/winad.pc
   trunk/third/moira/gen/winstats.gen
   trunk/third/moira/gen/winstats.sh
   trunk/third/moira/gen/www.pc
   trunk/third/moira/gen/www.sh
   trunk/third/moira/gen/zephyr.pc
   trunk/third/moira/gen/zephyr.sh
   trunk/third/moira/gen/zero_quotas
   trunk/third/moira/include/Makefile.in
   trunk/third/moira/include/mit-copyright.h
   trunk/third/moira/include/moira.h
   trunk/third/moira/include/moira_site.h
   trunk/third/moira/include/mrclient.h
   trunk/third/moira/include/ureg_proto.h
   trunk/third/moira/incremental/Makefile.in
   trunk/third/moira/incremental/afs/Makefile.in
   trunk/third/moira/incremental/afs/afs.c
   trunk/third/moira/incremental/afs/afs_utils.pl
   trunk/third/moira/incremental/ksrvtgt.c
   trunk/third/moira/incremental/mailman/Makefile.in
   trunk/third/moira/incremental/winad/Makefile.in
   trunk/third/moira/incremental/winad/gssldap-int.h
   trunk/third/moira/incremental/winad/gssldap.h
   trunk/third/moira/incremental/winad/gsssasl.h
   trunk/third/moira/incremental/winad/krb5_utils.c
   trunk/third/moira/incremental/winad/ldap-int.h
   trunk/third/moira/incremental/winad/ldap_adgssapi_bind.c
   trunk/third/moira/incremental/winad/setpw.c
   trunk/third/moira/incremental/winad/winad.c
   trunk/third/moira/lib/Makefile.in
   trunk/third/moira/lib/critical.c
   trunk/third/moira/lib/fixhost.c
   trunk/third/moira/lib/fixname.c
   trunk/third/moira/lib/hash.c
   trunk/third/moira/lib/kname_unparse.c
   trunk/third/moira/lib/mr_access.c
   trunk/third/moira/lib/mr_auth.c
   trunk/third/moira/lib/mr_call.c
   trunk/third/moira/lib/mr_connect.c
   trunk/third/moira/lib/mr_et.et
   trunk/third/moira/lib/mr_init.c
   trunk/third/moira/lib/mr_ops.c
   trunk/third/moira/lib/mr_private.h
   trunk/third/moira/lib/mr_query.c
   trunk/third/moira/lib/nfsparttype.c
   trunk/third/moira/lib/sq.c
   trunk/third/moira/lib/strs.c
   trunk/third/moira/man/Makefile.in
   trunk/third/moira/man/addusr.1
   trunk/third/moira/man/blanche.1
   trunk/third/moira/man/chfn.1
   trunk/third/moira/man/chpobox.1
   trunk/third/moira/man/chsh.1
   trunk/third/moira/man/dcm.8
   trunk/third/moira/man/mailmaint.1
   trunk/third/moira/man/mitch.1
   trunk/third/moira/man/moira.1
   trunk/third/moira/man/moirad.8
   trunk/third/moira/man/mrcheck.1
   trunk/third/moira/man/mrtest.8
   trunk/third/moira/man/reg_svr.8
   trunk/third/moira/man/setquota.8
   trunk/third/moira/man/stanley.1
   trunk/third/moira/man/stella.1
   trunk/third/moira/man/update_server.8
   trunk/third/moira/man/userreg.1
   trunk/third/moira/mkinstalldirs
   trunk/third/moira/reg_svr/Makefile.in
   trunk/third/moira/reg_svr/coupons/INSTRUCTIONS
   trunk/third/moira/reg_svr/genkey.c
   trunk/third/moira/reg_svr/genwords.pc
   trunk/third/moira/reg_svr/kerberos.c
   trunk/third/moira/reg_svr/protocol.c
   trunk/third/moira/reg_svr/reg_svr.pc
   trunk/third/moira/reg_svr/startreg.c
   trunk/third/moira/reg_svr/words.c
   trunk/third/moira/regtape/Makefile.in
   trunk/third/moira/regtape/common.h
   trunk/third/moira/regtape/common.pc
   trunk/third/moira/regtape/grouper.pl
   trunk/third/moira/regtape/staff.pc
   trunk/third/moira/regtape/student.pc
   trunk/third/moira/regtape/vote.pc
   trunk/third/moira/server/Makefile.in
   trunk/third/moira/server/increment.pc
   trunk/third/moira/server/mr_main.c
   trunk/third/moira/server/mr_sauth.c
   trunk/third/moira/server/mr_scall.c
   trunk/third/moira/server/mr_server.h
   trunk/third/moira/server/mr_shutdown.c
   trunk/third/moira/server/mr_util.c
   trunk/third/moira/server/qaccess.pc
   trunk/third/moira/server/qfollow.pc
   trunk/third/moira/server/qrtn.h
   trunk/third/moira/server/qrtn.pc
   trunk/third/moira/server/qsetup.pc
   trunk/third/moira/server/qsubs.c
   trunk/third/moira/server/qsupport.pc
   trunk/third/moira/server/queries2.c
   trunk/third/moira/server/query.h
   trunk/third/moira/server/qvalidate.pc
   trunk/third/moira/server/startmoira.c
   trunk/third/moira/update/Makefile.in
   trunk/third/moira/update/auth_002.c
   trunk/third/moira/update/auth_003.c
   trunk/third/moira/update/checksum.c
   trunk/third/moira/update/client.c
   trunk/third/moira/update/config.c
   trunk/third/moira/update/exec_002.c
   trunk/third/moira/update/get_file.c
   trunk/third/moira/update/send_file.c
   trunk/third/moira/update/sendrecv.c
   trunk/third/moira/update/smskey.c
   trunk/third/moira/update/ticket.c
   trunk/third/moira/update/update_server.c
   trunk/third/moira/update/update_test.c
   trunk/third/moira/update/xfer_002.c
   trunk/third/moira/update/xfer_003.c
   trunk/third/moira/util/et/Makefile.in
   trunk/third/moira/util/et/com_err.3
   trunk/third/moira/util/et/com_err.c
   trunk/third/moira/util/et/compile_et.1
   trunk/third/moira/util/et/compile_et.c
   trunk/third/moira/util/et/error_message.c
   trunk/third/moira/util/et/error_table.y
   trunk/third/moira/util/et/et_lex.lex.l
   trunk/third/moira/util/et/et_name.c
   trunk/third/moira/util/et/init_et.c
   trunk/third/moira/util/rsaref/Makefile.in
   trunk/third/moira/webmoira/Makefile.in
   trunk/third/moira/webmoira/moirai.c
Log:
Take a new snapshot from CVS for Moira, and add a debathena-moira-update-server
package


Modified: trunk/third/moira/Makefile.in
===================================================================
--- trunk/third/moira/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.11 2001-10-09 14:33:10 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/afssync/Makefile.in
===================================================================
--- trunk/third/moira/afssync/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/afssync/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.8 2002-09-25 20:46:51 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/afssync/sync.pc
===================================================================
--- trunk/third/moira/afssync/sync.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/afssync/sync.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/afssync/sync.pc,v 1.7 2007-05-16 19:42:00 zacheiss Exp $
+/* $Header$
  *
  *
  *  (c) Copyright 1989 by the Massachusetts Institute of Technology.

Modified: trunk/third/moira/afssync/ubik.c
===================================================================
--- trunk/third/moira/afssync/ubik.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/afssync/ubik.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: ubik.c,v 1.6 2006-05-12 20:20:08 zacheiss Exp $ */
+/* $Id$ */
 
 #include <sys/types.h>
 #include <netinet/in.h>

Modified: trunk/third/moira/afssync/utils.c
===================================================================
--- trunk/third/moira/afssync/utils.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/afssync/utils.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/afssync/utils.c,v 1.7 1992-07-05 13:03:50 probe Exp $";
+static char rcsid[] = "$Header$";
 #endif
 
 /*	

Modified: trunk/third/moira/afssync/vis.c
===================================================================
--- trunk/third/moira/afssync/vis.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/afssync/vis.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: vis.c,v 1.1 2001-10-23 19:35:56 zacheiss Exp $
+/* $Id$
  * vis functions - visually encode characters
  * Originally from OpenBSD
  */

Modified: trunk/third/moira/afssync/vis.h
===================================================================
--- trunk/third/moira/afssync/vis.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/afssync/vis.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: vis.h,v 1.1 2001-10-23 19:35:56 zacheiss Exp $
+/* $Id$
  * vis functions - visually encode characters
  * Originally from OpenBSD
  */

Modified: trunk/third/moira/backup/Makefile.in
===================================================================
--- trunk/third/moira/backup/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/backup/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.8 2000-06-05 05:58:37 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/backup/db2bkup.awk
===================================================================
--- trunk/third/moira/backup/db2bkup.awk	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/backup/db2bkup.awk	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-#	$Id: db2bkup.awk,v 1.16 2004-10-19 03:43:59 zacheiss Exp $
+#	$Id$
 #
 #	This converts the file used to originally create the database
 #	into a program to back it up.

Modified: trunk/third/moira/backup/db2rest.awk
===================================================================
--- trunk/third/moira/backup/db2rest.awk	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/backup/db2rest.awk	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-#	$Id: db2rest.awk,v 1.11 2004-10-19 03:43:59 zacheiss Exp $
+#	$Id$
 #
 #	This converts the file used to originally create the database
 #	into a program to restore it from a backup.

Modified: trunk/third/moira/backup/dump_db.h
===================================================================
--- trunk/third/moira/backup/dump_db.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/backup/dump_db.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: dump_db.h,v 1.6 2000-03-10 20:55:04 zacheiss Exp $ */
+/* $Id$ */
 
 #include <stdio.h>
 #include <moira.h>

Modified: trunk/third/moira/backup/dump_db.pc
===================================================================
--- trunk/third/moira/backup/dump_db.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/backup/dump_db.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: dump_db.pc,v 1.9 2000-03-10 20:55:04 zacheiss Exp $
+/* $Id$
  *
  * 	This program dumps the Moira database to a series of output files
  * which can be later read back into Moira in the event of a crash.
@@ -19,7 +19,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/backup/dump_db.pc,v 1.9 2000-03-10 20:55:04 zacheiss Exp $");
+RCSID("$Header$");
 
 EXEC SQL BEGIN DECLARE SECTION;
 char *db = "moira";

Modified: trunk/third/moira/backup/dumprest.pc
===================================================================
--- trunk/third/moira/backup/dumprest.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/backup/dumprest.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: dumprest.pc,v 1.4 1998-02-05 22:50:23 danw Exp $
+/* $Id$
  *
  * (c) Copyright 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -11,7 +11,7 @@
 
 #include <stdio.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/backup/dumprest.pc,v 1.4 1998-02-05 22:50:23 danw Exp $");
+RCSID("$Header$");
 
 extern void sqlglm(char *, unsigned int *, unsigned int *);
 

Modified: trunk/third/moira/backup/report.pl
===================================================================
--- trunk/third/moira/backup/report.pl	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/backup/report.pl	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/moira/bin/perl
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/backup/report.pl,v 1.2 2003-04-05 07:24:04 jweiss Exp $
+# $Header$
 
 chdir($ARGV[0]);
 

Modified: trunk/third/moira/backup/rest_db.pc
===================================================================
--- trunk/third/moira/backup/rest_db.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/backup/rest_db.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: rest_db.pc,v 1.6 2002-05-01 04:38:03 zacheiss Exp $
+/* $Id$
  *
  * 	This program restores the Moira database from an mrbackup.
  *
@@ -19,7 +19,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/backup/rest_db.pc,v 1.6 2002-05-01 04:38:03 zacheiss Exp $");
+RCSID("$Header$");
 
 int yes_or_no(char *prompt);
 

Modified: trunk/third/moira/clients/Makefile.in
===================================================================
--- trunk/third/moira/clients/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.9 2003-02-04 04:42:04 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/addusr/Makefile.in
===================================================================
--- trunk/third/moira/clients/addusr/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/addusr/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.6 1999-07-12 16:20:42 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/addusr/addusr.c
===================================================================
--- trunk/third/moira/clients/addusr/addusr.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/addusr/addusr.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: addusr.c,v 1.23 2007-11-29 21:09:01 zacheiss Exp $
+/* $Id$
  *
  * Program to add users en masse to the moira database
  *
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/addusr/addusr.c,v 1.23 2007-11-29 21:09:01 zacheiss Exp $");
+RCSID("$Header$");
 
 struct owner_type {
   int type;

Modified: trunk/third/moira/clients/blanche/Makefile.in
===================================================================
--- trunk/third/moira/clients/blanche/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/blanche/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 1999-07-12 16:20:43 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/blanche/blanche.c
===================================================================
--- trunk/third/moira/clients/blanche/blanche.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/blanche/blanche.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: blanche.c,v 1.62 2007-05-14 16:05:43 zacheiss Exp $
+/* $Id$
  *
  * Command line oriented Moira List tool.
  *
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/blanche/blanche.c,v 1.62 2007-05-14 16:05:43 zacheiss Exp $");
+RCSID("$Header$");
 
 struct member {
   int type;

Modified: trunk/third/moira/clients/chfn/Makefile.in
===================================================================
--- trunk/third/moira/clients/chfn/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/chfn/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.1 2000-03-16 06:03:09 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/chfn/chfn.c
===================================================================
--- trunk/third/moira/clients/chfn/chfn.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/chfn/chfn.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: chfn.c,v 1.3 2006-08-23 20:33:33 zacheiss Exp $
+/* $Id$
  *
  * Talk to the Moira database to change a person's GECOS information.
  *
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/chfn/chfn.c,v 1.3 2006-08-23 20:33:33 zacheiss Exp $");
+RCSID("$Header$");
 
 #define FALSE 0
 #define TRUE 1

Modified: trunk/third/moira/clients/chpobox/Makefile.in
===================================================================
--- trunk/third/moira/clients/chpobox/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/chpobox/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.1 2000-03-16 06:03:30 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/chpobox/chpobox.c
===================================================================
--- trunk/third/moira/clients/chpobox/chpobox.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/chpobox/chpobox.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: chpobox.c,v 1.6 2008-05-16 16:49:38 zacheiss Exp $
+/* $Id$
  *
  * Talk to the Moira database to change a person's home mail machine. This may
  * be an Athena machine, or a completely arbitrary address.
@@ -38,7 +38,7 @@
 
 #define argis(a, b) (!strcmp(*arg + 1, a) || !strcmp(*arg + 1, b))
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/chpobox/chpobox.c,v 1.6 2008-05-16 16:49:38 zacheiss Exp $");
+RCSID("$Header$");
 
 int get_pobox(int argc, char **argv, void *callarg);
 void usage(void);

Modified: trunk/third/moira/clients/chsh/Makefile.in
===================================================================
--- trunk/third/moira/clients/chsh/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/chsh/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.1 2000-03-16 06:03:59 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/chsh/chsh.c
===================================================================
--- trunk/third/moira/clients/chsh/chsh.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/chsh/chsh.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: chsh.c,v 1.5 2008-03-04 20:36:30 zacheiss Exp $
+/* $Id$
  *
  * Talk to the Moira database to change a person's login shell.  The chosen
  * shell must exist.  A warning will be issued if the shell is not in
@@ -26,7 +26,7 @@
 
 #define argis(a, b) (!strcmp(*arg + 1, a) || !strcmp(*arg + 1, b))
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/chsh/chsh.c,v 1.5 2008-03-04 20:36:30 zacheiss Exp $");
+RCSID("$Header$");
 
 void usage(void);
 int get_shell(int argc, char **argv, void *username);

Modified: trunk/third/moira/clients/lib/Makefile.in
===================================================================
--- trunk/third/moira/clients/lib/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/lib/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.3 2000-08-10 02:05:35 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 

Modified: trunk/third/moira/clients/lib/error.c
===================================================================
--- trunk/third/moira/clients/lib/error.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/lib/error.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: error.c,v 1.2 2002-08-15 20:38:33 zacheiss Exp $
+/* $Id$
  *
  * mrcl error interface
  *
@@ -19,7 +19,7 @@
 
 #include <com_err.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/lib/error.c,v 1.2 2002-08-15 20:38:33 zacheiss Exp $");
+RCSID("$Header$");
 
 static char *mrcl_message = NULL;
 

Modified: trunk/third/moira/clients/lib/mail.c
===================================================================
--- trunk/third/moira/clients/lib/mail.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/lib/mail.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mail.c,v 1.2 2000-08-16 05:25:40 zacheiss Exp $
+/* $Id$
  *
  * Library-internal routines for categorizing machines in terms
  * of email.
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/lib/mail.c,v 1.2 2000-08-16 05:25:40 zacheiss Exp $");
+RCSID("$Header$");
 
 static int save_sloc_machine(int argc, char **argv, void *sq);
 static int save_alias_value(int argc, char **argv, void *sq);
@@ -31,7 +31,7 @@
   int status, match = 0;
   static struct save_queue *pop = NULL, *local = NULL;
   static struct save_queue *mailhub = NULL, *mailhub_name = NULL;
-  static struct save_queue *imap = NULL;
+  static struct save_queue *imap = NULL, *exchange = NULL;
 
   mrcl_clear_message();
 
@@ -173,6 +173,29 @@
   if (match)
     return MAILTYPE_MAILHUB;
 
+  /* 6. Check for EXCHANGE service. */
+  if (!exchange)
+    {
+      char *service = "EXCHANGE";
+      exchange = sq_create();
+      status = mr_query("get_server_locations", 1, &service,
+			save_sloc_machine, exchange);
+      if (status && (status != MR_NO_MATCH))
+	{
+	  mrcl_set_message("Could not read list of EXCHANGE servers: %s",
+			   error_message(status));
+	  return MAILTYPE_ERROR;
+	}
+    }
+
+  while (sq_get_data(exchange, &name))
+    {
+      if (!match && !strcasecmp(name, machine))
+	match = 1;
+    }
+  if (match)
+    return MAILTYPE_EXCHANGE;
+
   return MAILTYPE_SMTP;
 }
 

Modified: trunk/third/moira/clients/lib/member.c
===================================================================
--- trunk/third/moira/clients/lib/member.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/lib/member.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: member.c,v 1.5 2002-09-25 20:44:54 zacheiss Exp $
+/* $Id$
  *
  * Shared routines for playing with list membership.
  *
@@ -19,7 +19,7 @@
 
 #include <krb.h>
 
-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 $");
+RCSID("$Header$");
 
 static char default_realm[REALM_SZ];
 

Modified: trunk/third/moira/clients/lib/mrclient-internal.h
===================================================================
--- trunk/third/moira/clients/lib/mrclient-internal.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/lib/mrclient-internal.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mrclient-internal.h,v 1.1 2000-08-10 02:05:35 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1999 by the Massachusetts Institute of Technology
  *
@@ -10,7 +10,7 @@
 void mrcl_set_message(char *, ...);
 void mrcl_clear_message(void);
 
-enum { MAILTYPE_ERROR, MAILTYPE_IMAP, MAILTYPE_POP, 
+enum { MAILTYPE_ERROR, MAILTYPE_IMAP, MAILTYPE_EXCHANGE, MAILTYPE_POP, 
        MAILTYPE_LOCAL, MAILTYPE_MAILHUB, MAILTYPE_SMTP };
 int mailtype(char *machine);
 

Modified: trunk/third/moira/clients/lib/pobox.c
===================================================================
--- trunk/third/moira/clients/lib/pobox.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/lib/pobox.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: pobox.c,v 1.7 2000-08-10 06:51:38 zacheiss Exp $
+/* $Id$
  *
  * Shared routines for pobox changing.
  *
@@ -18,7 +18,7 @@
 
 #include <com_err.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/lib/pobox.c,v 1.7 2000-08-10 06:51:38 zacheiss Exp $");
+RCSID("$Header$");
 
 static int save_sloc_machine(int argc, char **argv, void *sq);
 static int save_alias_value(int argc, char **argv, void *sq);
@@ -97,6 +97,7 @@
 	  break;
 
 	case MAILTYPE_MAILHUB:
+	case MAILTYPE_EXCHANGE:
 	  if (!strcmp(p, user))
 	    {
 	      mrcl_set_message("The address \"%s@%s\" would create a mail "

Modified: trunk/third/moira/clients/lib/utils.c
===================================================================
--- trunk/third/moira/clients/lib/utils.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/lib/utils.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.7 2006-08-23 19:01:05 zacheiss Exp $
+/* $Id$
  *
  * Random client utilities.
  *
@@ -32,7 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/lib/utils.c,v 1.7 2006-08-23 19:01:05 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami;
 extern krb5_context context;

Modified: trunk/third/moira/clients/mailmaint/Makefile.in
===================================================================
--- trunk/third/moira/clients/mailmaint/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/mailmaint/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 1999-07-12 16:20:49 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/mailmaint/mailmaint.c
===================================================================
--- trunk/third/moira/clients/mailmaint/mailmaint.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/mailmaint/mailmaint.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mailmaint.c,v 1.47 2006-08-23 20:07:17 zacheiss Exp $
+/* $Id$
  *
  * Simple add-me-to/remove-me-from list client
  *
@@ -54,7 +54,7 @@
 #define DELETE_A_CHAR() printf("\b \b");
 #endif /* !_WIN32 */
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/mailmaint/mailmaint.c,v 1.47 2006-08-23 20:07:17 zacheiss Exp $");
+RCSID("$Header$");
 
 #define STARTCOL 0
 #define STARTROW 3

Modified: trunk/third/moira/clients/mitch/Makefile.in
===================================================================
--- trunk/third/moira/clients/mitch/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/mitch/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.1 2003-02-04 04:44:41 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/mitch/mitch.c
===================================================================
--- trunk/third/moira/clients/mitch/mitch.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/mitch/mitch.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Id: mitch.c,v 1.1 2003-02-04 04:44:41 zacheiss Exp $");
+RCSID("$Id$");
 
 struct owner_type {
   int type;

Modified: trunk/third/moira/clients/moira/Doc/Makefile
===================================================================
--- trunk/third/moira/clients/moira/Doc/Makefile	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/Doc/Makefile	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/Doc/Makefile,v 1.1 1996-07-02 02:01:45 danw Exp $
+# $Header$
 
 all: internal.PS
 

Modified: trunk/third/moira/clients/moira/Doc/internal.mss
===================================================================
--- trunk/third/moira/clients/moira/Doc/internal.mss	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/Doc/internal.mss	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-@Comment($Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/Doc/internal.mss,v 1.1 1996-07-02 02:01:45 danw Exp $)
+@Comment($Header$)
 @Make(Manual)
 @Device(PostScript)
 @PageFooting(center "Draft of @value(date)")

Modified: trunk/third/moira/clients/moira/Makefile.in
===================================================================
--- trunk/third/moira/clients/moira/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.9 2000-02-10 19:14:05 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/moira/acl.c
===================================================================
--- trunk/third/moira/clients/moira/acl.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/acl.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: acl.c,v 1.2 2000-03-15 22:44:01 rbasch Exp $
+/* $Id$
  *
  *	This is the file acl.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/acl.c,v 1.2 2000-03-15 22:44:01 rbasch Exp $");
+RCSID("$Header$");
 
 void RealDeleteACL(char **info, Bool one_item);
 void ChangeACL(char **info, Bool one_item);

Modified: trunk/third/moira/clients/moira/attach.c
===================================================================
--- trunk/third/moira/clients/moira/attach.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/attach.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: attach.c,v 1.50 2000-08-03 21:49:13 zacheiss Exp $
+/* $Id$
  *
  *	This is the file attach.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -32,7 +32,7 @@
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/attach.c,v 1.50 2000-08-03 21:49:13 zacheiss Exp $");
+RCSID("$Header$");
 
 char *canonicalize_cell(char *c);
 int GetAliasValue(int argc, char **argv, void *retval);

Modified: trunk/third/moira/clients/moira/cluster.c
===================================================================
--- trunk/third/moira/clients/moira/cluster.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/cluster.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: cluster.c,v 1.69 2008-04-22 17:44:37 zacheiss Exp $
+/* $Id$
  *
  *	This is the file cluster.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.

Modified: trunk/third/moira/clients/moira/dcmmaint.c
===================================================================
--- trunk/third/moira/clients/moira/dcmmaint.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/dcmmaint.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: dcmmaint.c,v 1.18 1998-03-10 21:09:34 danw Exp $
+/* $Id$
  *
  * DCM-related functions for Moira client
  *
@@ -18,7 +18,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/dcmmaint.c,v 1.18 1998-03-10 21:09:34 danw Exp $");
+RCSID("$Header$");
 
 extern char *whoami;
 static char buf[BUFSIZ];

Modified: trunk/third/moira/clients/moira/defs.h
===================================================================
--- trunk/third/moira/clients/moira/defs.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/defs.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: defs.h,v 1.27 2007-12-03 20:40:56 zacheiss Exp $
+/* $Id$
  *
  *	This is the file defs.h for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.

Modified: trunk/third/moira/clients/moira/delete.c
===================================================================
--- trunk/third/moira/clients/moira/delete.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/delete.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: delete.c,v 1.29 1998-07-09 19:03:43 danw Exp $
+/* $Id$
  *
  *	This is the file delete.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/delete.c,v 1.29 1998-07-09 19:03:43 danw Exp $");
+RCSID("$Header$");
 
 int CheckListForDeletion(char *name, Bool verbose);
 void CheckAce(char *type, char *name, Bool verbose);

Modified: trunk/third/moira/clients/moira/f_defs.h
===================================================================
--- trunk/third/moira/clients/moira/f_defs.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/f_defs.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: f_defs.h,v 1.38 2007-11-29 18:09:07 zacheiss Exp $
+/* $Id$
  *
  *	This is the file f_defs.h for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.

Modified: trunk/third/moira/clients/moira/globals.c
===================================================================
--- trunk/third/moira/clients/moira/globals.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/globals.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: globals.c,v 1.11 1998-03-10 21:09:36 danw Exp $
+/* $Id$
  *
  *	This is the file globals.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -16,7 +16,7 @@
 #include <moira.h>
 #include "defs.h"
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/globals.c,v 1.11 1998-03-10 21:09:36 danw Exp $");
+RCSID("$Header$");
 
 Bool verbose;			/* TRUE if verbose mode is active (default). */
 Bool found_some;		/* used by lists.c for determining if there

Modified: trunk/third/moira/clients/moira/globals.h
===================================================================
--- trunk/third/moira/clients/moira/globals.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/globals.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: globals.h,v 1.9 1998-03-10 21:09:36 danw Exp $
+/* $Id$
  *
  *	This is the file globals.h for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.

Modified: trunk/third/moira/clients/moira/lists.c
===================================================================
--- trunk/third/moira/clients/moira/lists.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/lists.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: lists.c,v 1.54 2004-11-22 19:24:18 zacheiss Exp $
+/* $Id$
  *
  *	This is the file lists.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/lists.c,v 1.54 2004-11-22 19:24:18 zacheiss Exp $");
+RCSID("$Header$");
 
 struct mqelem *GetListInfo(int type, char *name1, char *name2);
 char **AskListInfo(char **info, Bool name);

Modified: trunk/third/moira/clients/moira/main.c
===================================================================
--- trunk/third/moira/clients/moira/main.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/main.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.43 2006-08-23 19:02:27 zacheiss Exp $
+/* $Id$
  *
  *	This is the file main.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/main.c,v 1.43 2006-08-23 19:02:27 zacheiss Exp $");
+RCSID("$Header$");
 
 static void ErrorExit(char *buf, int status);
 static void Usage(void);

Modified: trunk/third/moira/clients/moira/menu.c
===================================================================
--- trunk/third/moira/clients/moira/menu.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/menu.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: menu.c,v 1.59 2000-03-16 22:23:49 zacheiss Exp $
+/* $Id$
  *
  * Generic menu system module.
  *
@@ -34,7 +34,7 @@
 #define getpid _getpid
 #endif /* _WIN32 */
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/menu.c,v 1.59 2000-03-16 22:23:49 zacheiss Exp $");
+RCSID("$Header$");
 
 #ifdef MAX
 #undef MAX

Modified: trunk/third/moira/clients/moira/menu.h
===================================================================
--- trunk/third/moira/clients/moira/menu.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/menu.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: menu.h,v 1.5 1998-03-10 21:09:39 danw Exp $ */
+/* $Id$ */
 
 #define MAX_ARGC 16		/* Maximum argument count per line */
 #define MAX_ARGLEN 128		/* Maximum length of an argument */

Modified: trunk/third/moira/clients/moira/menus.c
===================================================================
--- trunk/third/moira/clients/moira/menus.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/menus.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: menus.c,v 1.47 2007-11-29 18:09:07 zacheiss Exp $
+/* $Id$
  *
  *	This is the file menus.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -22,7 +22,7 @@
 
 #include <stdio.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/menus.c,v 1.47 2007-11-29 18:09:07 zacheiss Exp $");
+RCSID("$Header$");
 
 /* ------------------------- Second Tier Menus ------------------------- */
 

Modified: trunk/third/moira/clients/moira/misc.c
===================================================================
--- trunk/third/moira/clients/moira/misc.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/misc.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.12 2000-03-15 22:44:04 rbasch Exp $
+/* $Id$
  *
  *	This is the file misc.c for the Moira Client, which allows a naieve
  *      to quickly and easily maintain most parts of the Moira database.
@@ -34,7 +34,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/misc.c,v 1.12 2000-03-15 22:44:04 rbasch Exp $");
+RCSID("$Header$");
 
 void PrintStats(char **info);
 void PrintClients(char **info);

Modified: trunk/third/moira/clients/moira/namespace.c
===================================================================
--- trunk/third/moira/clients/moira/namespace.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/namespace.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: namespace.c,v 1.16 2006-08-23 19:02:27 zacheiss Exp $
+/* $Id$
  *
  *	This is the file main.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -25,7 +25,7 @@
 
 #include <krb.h>
 
-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 $");
+RCSID("$Header$");
 
 static void ErrorExit(char *buf, int status);
 static void Usage(void);

Modified: trunk/third/moira/clients/moira/nfs.c
===================================================================
--- trunk/third/moira/clients/moira/nfs.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/nfs.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: nfs.c,v 1.26 1999-04-30 17:41:08 danw Exp $
+/* $Id$
  *
  *	This is the file nfs.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/nfs.c,v 1.26 1999-04-30 17:41:08 danw Exp $");
+RCSID("$Header$");
 
 char **AskNFSInfo(char **info);
 

Modified: trunk/third/moira/clients/moira/pobox.c
===================================================================
--- trunk/third/moira/clients/moira/pobox.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/pobox.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: pobox.c,v 1.38 2000-08-10 02:28:47 zacheiss Exp $
+/* $Id$
  *
  *	This is the file pobox.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/pobox.c,v 1.38 2000-08-10 02:28:47 zacheiss Exp $");
+RCSID("$Header$");
 
 /*	Function Name: PrintPOBox
  *	Description: Yet another specialized print function.

Modified: trunk/third/moira/clients/moira/printer.c
===================================================================
--- trunk/third/moira/clients/moira/printer.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/printer.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: printer.c,v 1.28 2007-03-27 15:07:36 zacheiss Exp $
+/* $Id$
  *
  *	This is the file printer.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/printer.c,v 1.28 2007-03-27 15:07:36 zacheiss Exp $");
+RCSID("$Header$");
 
 void RealDeletePrn(char **info, Bool one_item);
 void ChangePrn(char **info, Bool one_item);

Modified: trunk/third/moira/clients/moira/quota.c
===================================================================
--- trunk/third/moira/clients/moira/quota.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/quota.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: quota.c,v 1.31 2003-09-22 20:44:16 zacheiss Exp $
+/* $Id$
  *
  *	This is the file quota.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.

Modified: trunk/third/moira/clients/moira/user.c
===================================================================
--- trunk/third/moira/clients/moira/user.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/user.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: user.c,v 1.72 2007-11-29 22:56:02 zacheiss Exp $
+/* $Id$
  *
  *	This is the file user.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -27,7 +27,7 @@
 
 #include <krb.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/user.c,v 1.72 2007-11-29 22:56:02 zacheiss Exp $");
+RCSID("$Header$");
 
 void CorrectCapitalization(char **name);
 char **AskUserInfo(char **info, Bool name);

Modified: trunk/third/moira/clients/moira/utils.c
===================================================================
--- trunk/third/moira/clients/moira/utils.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/utils.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.51 2006-08-23 19:02:27 zacheiss Exp $
+/* $Id$
  *
  *	This is the file utils.c for the Moira Client, which allows users
  *      to quickly and easily maintain most parts of the Moira database.
@@ -34,7 +34,7 @@
 #include <string.h>
 #include <time.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/utils.c,v 1.51 2006-08-23 19:02:27 zacheiss Exp $");
+RCSID("$Header$");
 
 /*	Function Name: AddQueue
  *	Description: Adds an element to a queue

Modified: trunk/third/moira/clients/moira/zephyr.c
===================================================================
--- trunk/third/moira/clients/moira/zephyr.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/moira/zephyr.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: zephyr.c,v 1.13 2000-09-27 08:54:17 zacheiss Exp $
+/* $Id$
  *
  * Zephyr ACL routines for the Moira client
  *
@@ -18,7 +18,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/zephyr.c,v 1.13 2000-09-27 08:54:17 zacheiss Exp $");
+RCSID("$Header$");
 
 void RealDeleteZephyr(char **info, Bool one_item);
 

Modified: trunk/third/moira/clients/mrcheck/Makefile.in
===================================================================
--- trunk/third/moira/clients/mrcheck/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/mrcheck/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 1999-07-12 16:20:58 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/mrcheck/mrcheck.c
===================================================================
--- trunk/third/moira/clients/mrcheck/mrcheck.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/mrcheck/mrcheck.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mrcheck.c,v 1.22 2006-08-23 19:01:50 zacheiss Exp $
+/* $Id$
  *
  * Verify that all Moira updates are successful
  *
@@ -19,7 +19,7 @@
 
 #define argis(a, b) (!strcmp(*arg + 1, a) || !strcmp(*arg + 1, b))
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/mrcheck/mrcheck.c,v 1.22 2006-08-23 19:01:50 zacheiss Exp $");
+RCSID("$Header$");
 
 char *atot(char *itime);
 int process_server(int argc, char **argv, void *sqv);

Modified: trunk/third/moira/clients/mrtest/Makefile.in
===================================================================
--- trunk/third/moira/clients/mrtest/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/mrtest/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 1999-07-12 16:20:59 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/mrtest/mrtest.c
===================================================================
--- trunk/third/moira/clients/mrtest/mrtest.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/mrtest/mrtest.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mrtest.c,v 1.52 2007-08-27 15:22:15 zacheiss Exp $
+/* $Id$
  *
  * Bare-bones Moira client
  *
@@ -43,7 +43,7 @@
 #include "readline/history.h"
 #endif
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/mrtest/mrtest.c,v 1.52 2007-08-27 15:22:15 zacheiss Exp $");
+RCSID("$Header$");
 
 int recursion = 0, quote_output = 0, interactive;
 int count, quit = 0, cancel = 0;

Modified: trunk/third/moira/clients/regapplet/Makefile
===================================================================
--- trunk/third/moira/clients/regapplet/Makefile	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/regapplet/Makefile	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.1 2005-06-22 06:03:38 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 TARGET=regclasses.zip

Modified: trunk/third/moira/clients/regapplet/mit/cipher/ArrayUtil.java
===================================================================
--- trunk/third/moira/clients/regapplet/mit/cipher/ArrayUtil.java	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/regapplet/mit/cipher/ArrayUtil.java	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 // crib'd from cryptix
 
-// $Id: ArrayUtil.java,v 1.1 1998-08-01 18:25:15 danw Exp $
+// $Id$
 
 /*
  * Copyright (c) 1997 Systemics Ltd
@@ -21,7 +21,7 @@
  * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development Team</a>.
  * <br>All rights reserved.
  * <p>
- * <b>$Revision: 1.1 $</b>
+ * <b>$Revision$</b>
  * @since   Cryptix 2.2.2
  * @author  Raif Naffah
  * @author  David Hopwood

Modified: trunk/third/moira/clients/regapplet/mit/cipher/BI.java
===================================================================
--- trunk/third/moira/clients/regapplet/mit/cipher/BI.java	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/regapplet/mit/cipher/BI.java	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-// $Id: BI.java,v 1.1 1998-08-01 18:25:15 danw Exp $
+// $Id$
 
 /*
  * Copyright (c) 1997 Systemics Ltd
@@ -20,7 +20,7 @@
  * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development Team</a>.
  * <br>All rights reserved.
  * <p>
- * <b>$Revision: 1.1 $</b>
+ * <b>$Revision$</b>
  * @since   Cryptix 2.2.2
  * @author  Raif S. Naffah
  */

Modified: trunk/third/moira/clients/regapplet/mit/cipher/DES.java
===================================================================
--- trunk/third/moira/clients/regapplet/mit/cipher/DES.java	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/regapplet/mit/cipher/DES.java	2008-09-17 22:23:57 UTC (rev 23178)
@@ -61,7 +61,7 @@
  * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development Team</a>.
  * <br>All rights reserved.
  * <p>
- * <b>$Revision: 1.1 $</b>
+ * <b>$Revision$</b>
  * @author  Systemics Ltd
  * @author  Geoffrey Keating (this Java implementation)
  * @author  Eric Young

Modified: trunk/third/moira/clients/regapplet/mit/cipher/Hex.java
===================================================================
--- trunk/third/moira/clients/regapplet/mit/cipher/Hex.java	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/regapplet/mit/cipher/Hex.java	2008-09-17 22:23:57 UTC (rev 23178)
@@ -21,7 +21,7 @@
  * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development Team</a>.
  * <br>All rights reserved.
  *
- * <p><b>$Revision: 1.1 $</b>
+ * <p><b>$Revision$</b>
  * @author  David Hopwood
  * @author  Raif Naffah
  * @author  Systemics Ltd

Modified: trunk/third/moira/clients/regapplet/mit/cipher/RSAAlgorithm.java
===================================================================
--- trunk/third/moira/clients/regapplet/mit/cipher/RSAAlgorithm.java	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/regapplet/mit/cipher/RSAAlgorithm.java	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 // Crib'd from cryptix by JIS
 
-// $Id: RSAAlgorithm.java,v 1.1 1998-08-01 18:25:19 danw Exp $
+// $Id$
 
 /*
  * Copyright (c) 1997 Systemics Ltd
@@ -39,7 +39,7 @@
  * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development Team</a>.
  * <br>All rights reserved.
  * <p>
- * <b>$Revision: 1.1 $</b>
+ * <b>$Revision$</b>
  * @author  Raif S. Naffah
  * @author  David Hopwood
  * @since   Cryptix 2.2.2

Modified: trunk/third/moira/clients/regapplet/mit/random/SHA1.java
===================================================================
--- trunk/third/moira/clients/regapplet/mit/random/SHA1.java	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/regapplet/mit/random/SHA1.java	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-// $Id: SHA1.java,v 1.1 1998-08-01 18:25:30 danw Exp $
+// $Id$
 
 /*
  * Copyright (c) 1995-1997 Systemics Ltd
@@ -35,7 +35,7 @@
  * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development Team</a>.
  * <br>All rights reserved.
  * <p>
- * <b>$Revision: 1.1 $</b>
+ * <b>$Revision$</b>
  * @author Systemics Ltd
  * @author David Hopwood
  * @since  Cryptix 2.2.2

Modified: trunk/third/moira/clients/stanley/Makefile.in
===================================================================
--- trunk/third/moira/clients/stanley/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/stanley/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.1 2001-09-25 23:00:01 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/stanley/stanley.c
===================================================================
--- trunk/third/moira/clients/stanley/stanley.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/stanley/stanley.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/stanley/stanley.c,v 1.15 2008-02-25 20:49:05 zacheiss Exp $");
+RCSID("$Header$");
 
 struct owner_type {
   int type;

Modified: trunk/third/moira/clients/stella/Makefile.in
===================================================================
--- trunk/third/moira/clients/stella/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/stella/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.1 2000-02-10 05:33:43 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/clients/stella/stella.c
===================================================================
--- trunk/third/moira/clients/stella/stella.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/clients/stella/stella.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -31,7 +31,7 @@
 #include <arpa/inet.h>
 #endif
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/stella/stella.c,v 1.20 2003-12-20 02:55:49 zacheiss Exp $");
+RCSID("$Header$");
 
 struct owner_type {
   int type;

Modified: trunk/third/moira/config.guess
===================================================================
--- trunk/third/moira/config.guess	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/config.guess	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,11 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
-#
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2006-06-06'
+
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -14,160 +18,326 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
 # The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
+# don't specify an explicit build system type.
 
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
+# (ghazi@noc.rutgers.edu 1994-08-24)
 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
 	PATH=$PATH:/.attbin ; export PATH
 fi
 
 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
-
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
     alpha:OSF1:*:*)
-	if test $UNAME_RELEASE = "V4.0"; then
+	case $UNAME_RELEASE in
+	*4.0)
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-	fi
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	cat <<EOF >dummy.s
-	.globl main
-	.ent main
-main:
-	.frame \$30,0,\$26,0
-	.prologue 0
-	.long 0x47e03d80 # implver $0
-	lda \$2,259
-	.long 0x47e20c21 # amask $2,$1
-	srl \$1,8,\$2
-	sll \$2,2,\$2
-	sll \$0,3,\$0
-	addl \$1,\$0,\$0
-	addl \$2,\$0,\$0
-	ret \$31,(\$26),1
-	.end main
-EOF
-	${CC-cc} dummy.s -o dummy 2>/dev/null
-	if test "$?" = 0 ; then
-		./dummy
-		case "$?" in
-			7)
-				UNAME_MACHINE="alpha"
-				;;
-			15)
-				UNAME_MACHINE="alphaev5"
-				;;
-			14)
-				UNAME_MACHINE="alphaev56"
-				;;
-			10)
-				UNAME_MACHINE="alphapca56"
-				;;
-			16)
-				UNAME_MACHINE="alphaev6"
-				;;
-		esac
-	fi
-	rm -f dummy.s dummy
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
-	exit 0 ;;
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
     21064:Windows_NT:50:3)
 	echo alpha-dec-winnt3.5
-	exit 0 ;;
+	exit ;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-cbm-sysv4
-	exit 0;;
-    amiga:NetBSD:*:*)
-      echo m68k-cbm-netbsd${UNAME_RELEASE}
-      exit 0 ;;
-    amiga:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
+	echo m68k-unknown-sysv4
+	exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
 	echo ${UNAME_MACHINE}-unknown-amigaos
-	exit 0 ;;
-    arc64:OpenBSD:*:*)
-	echo mips64el-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    arc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    hkmips:OpenBSD:*:*)
-	echo mips-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    pmax:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sgi:OpenBSD:*:*)
-	echo mips-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    wgrisc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
-	exit 0;;
-    arm32:NetBSD:*:*)
-	echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
-    SR2?01:HI-UX/MPP:*:*)
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
-	exit 0;;
-    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
 		echo pyramid-pyramid-sysv3
 	else
 		echo pyramid-pyramid-bsd
 	fi
-	exit 0 ;;
-    NILE:*:*:dcosx)
+	exit ;;
+    NILE*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
-	exit 0 ;;
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     i86pc:SunOS:5.*:*)
 	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
 	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     sun4*:SunOS:*:*)
 	case "`/usr/bin/arch -k`" in
 	    Series*|S4*)
@@ -176,12 +346,12 @@
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
 	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-	exit 0 ;;
+	exit ;;
     sun3*:SunOS:*:*)
 	echo m68k-sun-sunos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
@@ -191,55 +361,63 @@
 		echo sparc-sun-sunos${UNAME_RELEASE}
 		;;
 	esac
-	exit 0 ;;
+	exit ;;
     aushp:SunOS:*:*)
 	echo sparc-auspex-sunos${UNAME_RELEASE}
-	exit 0 ;;
-    atari*:NetBSD:*:*)
-	echo m68k-atari-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    atari*:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sun3*:NetBSD:*:*)
-	echo m68k-sun-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sun3*:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mac68k:NetBSD:*:*)
-	echo m68k-apple-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mac68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme88k:OpenBSD:*:*)
-	echo m88k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
     powerpc:machten:*:*)
 	echo powerpc-apple-machten${UNAME_RELEASE}
-	exit 0 ;;
-    macppc:NetBSD:*:*)
-        echo powerpc-apple-netbsd${UNAME_RELEASE}
-        exit 0 ;;
+	exit ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
-	exit 0 ;;
+	exit ;;
     RISC*:ULTRIX:*:*)
 	echo mips-dec-ultrix${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     VAX*:ULTRIX*:*:*)
 	echo vax-dec-ultrix${UNAME_RELEASE}
-	exit 0 ;;
-    2020:CLIX:*:*)
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
 	echo clipper-intergraph-clix${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-	sed 's/^	//' << EOF >dummy.c
-	int main (argc, argv) int argc; char **argv; {
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
 	#if defined (host_mips) && defined (MIPSEB)
 	#if defined (SYSTYPE_SYSV)
 	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
@@ -254,62 +432,83 @@
 	  exit (-1);
 	}
 EOF
-	${CC-cc} dummy.c -o dummy \
-	  && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-	  && rm dummy.c dummy && exit 0
-	rm -f dummy.c dummy
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
 	echo mips-mips-riscos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
     Night_Hawk:Power_UNIX:*:*)
 	echo powerpc-harris-powerunix
-	exit 0 ;;
+	exit ;;
     m88k:CX/UX:7*:*)
 	echo m88k-harris-cxux7
-	exit 0 ;;
+	exit ;;
     m88k:*:4*:R4*)
 	echo m88k-motorola-sysv4
-	exit 0 ;;
+	exit ;;
     m88k:*:3*:R3*)
 	echo m88k-motorola-sysv3
-	exit 0 ;;
+	exit ;;
     AViiON:dgux:*:*)
         # DG/UX returns AViiON for all architectures
         UNAME_PROCESSOR=`/usr/bin/uname -p`
-        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
-	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
 		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
 	else
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
-        else echo i586-dg-dgux${UNAME_RELEASE}
-        fi
- 	exit 0 ;;
+ 	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
-	exit 0 ;;
+	exit ;;
     M88*:*:R3*:*)
 	# Delta 88k system running SVR3
 	echo m88k-motorola-sysv3
-	exit 0 ;;
+	exit ;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
 	echo m88k-tektronix-sysv3
-	exit 0 ;;
+	exit ;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
 	echo m68k-tektronix-bsd
-	exit 0 ;;
+	exit ;;
     *:IRIX*:*:*)
 	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-	exit 0 ;;
+	exit ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
-	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
-    i?86:AIX:*:*)
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
 	echo i386-ibm-aix
-	exit 0 ;;
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		sed 's/^		//' << EOF >dummy.c
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
 		#include <sys/systemcfg.h>
 
 		main()
@@ -320,18 +519,21 @@
 			exit(0);
 			}
 EOF
-		${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
-		rm -f dummy.c dummy
-		echo rs6000-ibm-aix3.2.5
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
 		echo rs6000-ibm-aix3.2.4
 	else
 		echo rs6000-ibm-aix3.2
 	fi
-	exit 0 ;;
-    *:AIX:*:4)
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
@@ -339,54 +541,73 @@
 	if [ -x /usr/bin/oslevel ] ; then
 		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV=4.${UNAME_RELEASE}
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
 	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-	exit 0 ;;
+	exit ;;
     *:AIX:*:*)
 	echo rs6000-ibm-aix
-	exit 0 ;;
+	exit ;;
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
 	echo romp-ibm-bsd4.4
-	exit 0 ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
 	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-	exit 0 ;;                           # report: romp-ibm BSD 4.3
+	exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
 	echo rs6000-bull-bosx
-	exit 0 ;;
+	exit ;;
     DPX/2?00:B.O.S.:*:*)
 	echo m68k-bull-sysv3
-	exit 0 ;;
+	exit ;;
     9000/[34]??:4.3bsd:1.*:*)
 	echo m68k-hp-bsd
-	exit 0 ;;
+	exit ;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
 	echo m68k-hp-bsd4.4
-	exit 0 ;;
+	exit ;;
     9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 	case "${UNAME_MACHINE}" in
 	    9000/31? )            HP_ARCH=m68000 ;;
 	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 )
-              sed 's/^              //' << EOF >dummy.c
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
               #include <stdlib.h>
               #include <unistd.h>
-              
+
               int main ()
               {
               #if defined(_SC_KERNEL_BITS)
                   long bits = sysconf(_SC_KERNEL_BITS);
-              #endif 
+              #endif
                   long cpu  = sysconf (_SC_CPU_VERSION);
-              
-                  switch (cpu) 
+
+                  switch (cpu)
               	{
               	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
               	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0: 
+              	case CPU_PA_RISC2_0:
               #if defined(_SC_KERNEL_BITS)
-              	    switch (bits) 
+              	    switch (bits)
               		{
               		case 64: puts ("hppa2.0w"); break;
               		case 32: puts ("hppa2.0n"); break;
@@ -394,20 +615,46 @@
               		} break;
               #else  /* !defined(_SC_KERNEL_BITS) */
               	    puts ("hppa2.0"); break;
-              #endif 
+              #endif
               	default: puts ("hppa1.0"); break;
               	}
                   exit (0);
               }
 EOF
-	(${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy`
-	rm -f dummy.c dummy
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
 	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-	exit 0 ;;
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
     3050*:HI-UX:*:*)
-	sed 's/^	//' << EOF >dummy.c
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
 	#include <unistd.h>
 	int
 	main ()
@@ -432,341 +679,475 @@
 	  exit (0);
 	}
 EOF
-	${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
-	rm -f dummy.c dummy
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
 	echo unknown-hitachi-hiuxwe2
-	exit 0 ;;
+	exit ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
 	echo hppa1.1-hp-bsd
-	exit 0 ;;
+	exit ;;
     9000/8??:4.3bsd:*:*)
 	echo hppa1.0-hp-bsd
-	exit 0 ;;
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
 	echo hppa1.1-hp-osf
-	exit 0 ;;
+	exit ;;
     hp8??:OSF1:*:*)
 	echo hppa1.0-hp-osf
-	exit 0 ;;
-    i?86:OSF1:*:*)
+	exit ;;
+    i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
 	    echo ${UNAME_MACHINE}-unknown-osf1mk
 	else
 	    echo ${UNAME_MACHINE}-unknown-osf1
 	fi
-	exit 0 ;;
+	exit ;;
     parisc*:Lites*:*:*)
 	echo hppa1.1-hp-lites
-	exit 0 ;;
+	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-        exit 0 ;;
+        exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-        exit 0 ;;
+        exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-        exit 0 ;;
+        exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-        exit 0 ;;
+        exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-        exit 0 ;;
-    CRAY*X-MP:*:*:*)
-	echo xmp-cray-unicos
-        exit 0 ;;
+        exit ;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE}
-	exit 0 ;;
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
     CRAY*[A-Z]90:*:*:*)
 	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
-	exit 0 ;;
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE}
-	exit 0 ;;
-    CRAY-2:*:*:*)
-	echo cray2-cray-unicos
-        exit 0 ;;
-    F300:UNIX_System_V:*:*)
-        FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit 0 ;;
-    F301:UNIX_System_V:*:*)
-       echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
-       exit 0 ;;
-    hp3[0-9][05]:NetBSD:*:*)
-	echo m68k-hp-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    hp300:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
     sparc*:BSD/OS:*:*)
 	echo sparc-unknown-bsdi${UNAME_RELEASE}
-	exit 0 ;;
-    i?86:BSD/386:*:* | *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
     *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit 0 ;;
-    *:NetBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
-    *:OpenBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
-	exit 0 ;;
+	exit ;;
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
-	exit 0 ;;
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    x86:Interix*:[345]*)
+	echo i586-pc-interix${UNAME_RELEASE}
+	exit ;;
+    EM64T:Interix*:[345]*)
+	echo x86_64-unknown-interix${UNAME_RELEASE}
+	exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
     p*:CYGWIN*:*)
 	echo powerpcle-unknown-cygwin
-	exit 0 ;;
+	exit ;;
     prep*:SunOS:5.*:*)
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     *:GNU:*:*)
+	# the GNU system
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-	exit 0 ;;
-    *:Linux:*:*)
-	# uname on the ARM produces all sorts of strangeness, and we need to
-	# filter it out.
-	case "$UNAME_MACHINE" in
-	  arm* | sa110*)	      UNAME_MACHINE="arm" ;;
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
 	esac
-
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
 	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us.
-	ld_help_string=`ld --help 2>&1`
-	ld_supported_emulations=`echo $ld_help_string \
-			 | sed -ne '/supported emulations:/!d
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
 				    s/[ 	][ 	]*/ /g
-				    s/.*supported emulations: *//
+				    s/.*supported targets: *//
 				    s/ .*//
 				    p'`
-        case "$ld_supported_emulations" in
-	  i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
-	  i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
-	  sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  armlinux)   echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  elf32ppc)   echo "powerpc-unknown-linux-gnu"              ; exit 0 ;;
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
 	esac
-
-	if test "${UNAME_MACHINE}" = "alpha" ; then
-		sed 's/^	//'  <<EOF >dummy.s
-		.globl main
-		.ent main
-	main:
-		.frame \$30,0,\$26,0
-		.prologue 0
-		.long 0x47e03d80 # implver $0
-		lda \$2,259
-		.long 0x47e20c21 # amask $2,$1
-		srl \$1,8,\$2
-		sll \$2,2,\$2
-		sll \$0,3,\$0
-		addl \$1,\$0,\$0
-		addl \$2,\$0,\$0
-		ret \$31,(\$26),1
-		.end main
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
 EOF
-		LIBC=""
-		${CC-cc} dummy.s -o dummy 2>/dev/null
-		if test "$?" = 0 ; then
-			./dummy
-			case "$?" in
-			7)
-				UNAME_MACHINE="alpha"
-				;;
-			15)
-				UNAME_MACHINE="alphaev5"
-				;;
-			14)
-				UNAME_MACHINE="alphaev56"
-				;;
-			10)
-				UNAME_MACHINE="alphapca56"
-				;;
-			16)
-				UNAME_MACHINE="alphaev6"
-				;;
-			esac	
-
-			objdump --private-headers dummy | \
-			  grep ld.so.1 > /dev/null
-			if test "$?" = 0 ; then
-				LIBC="libc1"
-			fi
-		fi	
-		rm -f dummy.s dummy
-		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
-	elif test "${UNAME_MACHINE}" = "mips" ; then
-	  cat >dummy.c <<EOF
-main(argc, argv)
-     int argc;
-     char *argv[];
-{
-#ifdef __MIPSEB__
-  printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
-  printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
-  return 0;
-}
-EOF
-	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
-	  rm -f dummy.c dummy
-	else
-	  # Either a pre-BFD a.out linker (linux-gnuoldld)
-	  # or one that does not give us useful --help.
-	  # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
-	  # If ld does not provide *any* "supported emulations:"
-	  # that means it is gnuoldld.
-	  echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
-	  test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
-	  case "${UNAME_MACHINE}" in
-	  i?86)
-	    VENDOR=pc;
-	    ;;
-	  *)
-	    VENDOR=unknown;
-	    ;;
-	  esac
-	  # Determine whether the default compiler is a.out or elf
-	  cat >dummy.c <<EOF
-#include <features.h>
-main(argc, argv)
-     int argc;
-     char *argv[];
-{
-#ifdef __ELF__
-# ifdef __GLIBC__
-#  if __GLIBC__ >= 2
-    printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
-#  else
-    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-#  endif
-# else
-   printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-#else
-  printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
-#endif
-  return 0;
-}
-EOF
-	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
-	  rm -f dummy.c dummy
-	fi ;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
-# are messed up and put the nodename in both sysname and nodename.
-    i?86:DYNIX/ptx:4*:*)
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
 	echo i386-sequent-sysv4
-	exit 0 ;;
-    i?86:UNIX_SV:4.2MP:2.*)
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
         # Unixware is an offshoot of SVR4, but it has its own version
         # number series starting with 2...
         # I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
         # Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-	exit 0 ;;
-    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
 	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
 	fi
-	exit 0 ;;
-    i?86:*:3.2:*)
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
 		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
-		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
-		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
 	else
 		echo ${UNAME_MACHINE}-pc-sysv32
 	fi
-	exit 0 ;;
-    i?86:UnixWare:*:*)
-	if /bin/uname -X 2>/dev/null >/dev/null ; then
-	  (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
-	    && UNAME_MACHINE=i586
-	fi
-	echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
-	exit 0 ;;
+	exit ;;
     pc:*:*:*)
+	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
         # the processor, so we play safe by assuming i386.
 	echo i386-pc-msdosdjgpp
-        exit 0 ;;
+        exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
-	exit 0 ;;
+	exit ;;
     paragon:*:*:*)
 	echo i860-intel-osf1
-	exit 0 ;;
+	exit ;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
 	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
 	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
 	fi
-	exit 0 ;;
+	exit ;;
     mini*:CTIX:SYS*5:*)
 	# "miniframe"
 	echo m68010-convergent-sysv
-	exit 0 ;;
-    M68*:*:R3V[567]*:*)
-	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && echo i486-ncr-sysv4 && exit 0 ;;
-    m68*:LynxOS:2.*:*)
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
-	exit 0 ;;
-    i?86:LynxOS:2.*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     TSUNAMI:LynxOS:2.*:*)
 	echo sparc-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
-    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+	exit ;;
+    rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
     RM*:SINIX-*:*:*)
 	echo mips-sni-sysv4
-	exit 0 ;;
+	exit ;;
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -774,48 +1155,156 @@
 	else
 		echo ns32k-sni-sysv
 	fi
-	exit 0 ;;
-    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                           # says <Richard.M.Bartel@ccMail.Census.GOV>
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
         echo i586-unisys-sysv4
-        exit 0 ;;
+        exit ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
 	echo hppa1.1-stratus-sysv4
-	exit 0 ;;
+	exit ;;
     *:*:*:FTX*)
 	# From seanf@swdc.stratus.com.
 	echo i860-stratus-sysv4
-	exit 0 ;;
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
     mc68*:A/UX:*:*)
 	echo m68k-apple-aux${UNAME_RELEASE}
-	exit 0 ;;
-    news*:NEWS-OS:*:6*)
+	exit ;;
+    news*:NEWS-OS:6*:*)
 	echo mips-sony-newsos6
-	exit 0 ;;
-    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
 	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
 	        echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-        exit 0 ;;
+        exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
-	exit 0 ;;
+	exit ;;
     BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
 	echo powerpc-apple-beos
-	exit 0 ;;
+	exit ;;
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	echo i586-pc-beos
-	exit 0 ;;
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
 
-cat >dummy.c <<EOF
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
 # include <sys/types.h>
 # include <sys/utsname.h>
@@ -840,7 +1329,7 @@
 #endif
 
 #if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix"); exit (0);
+  printf ("arm-acorn-riscix\n"); exit (0);
 #endif
 
 #if defined (hp300) && !defined (hpux)
@@ -853,7 +1342,10 @@
 #endif
   int version;
   version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
   exit (0);
 #endif
 
@@ -898,12 +1390,25 @@
 #endif
 
 #if defined (vax)
-#if !defined (ultrix)
-  printf ("vax-dec-bsd\n"); exit (0);
-#else
-  printf ("vax-dec-ultrix\n"); exit (0);
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
 #endif
-#endif
 
 #if defined (alliant) && defined (i860)
   printf ("i860-alliant-bsd\n"); exit (0);
@@ -913,12 +1418,12 @@
 }
 EOF
 
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
 
 # Apollos put the system type in the environment.
 
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
 
 # Convex versions that predate uname can use getsysinfo(1)
 
@@ -927,25 +1432,69 @@
     case `getsysinfo -f cpu_type` in
     c1*)
 	echo c1-convex-bsd
-	exit 0 ;;
+	exit ;;
     c2*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-	exit 0 ;;
+	exit ;;
     c34*)
 	echo c34-convex-bsd
-	exit 0 ;;
+	exit ;;
     c38*)
 	echo c38-convex-bsd
-	exit 0 ;;
+	exit ;;
     c4*)
 	echo c4-convex-bsd
-	exit 0 ;;
+	exit ;;
     esac
 fi
 
-#echo '(Unable to guess system type)' 1>&2
+cat >&2 <<EOF
+$0: unable to guess system type
 
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
 exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

Modified: trunk/third/moira/config.sub
===================================================================
--- trunk/third/moira/config.sub	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/config.sub	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2008-01-16'
+timestamp='2006-06-06'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -72,8 +72,8 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -245,12 +245,12 @@
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| fido | fr30 | frv \
+	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep \
+	| maxq | mb | microblaze | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -276,7 +276,6 @@
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| score \
 	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
@@ -285,7 +284,7 @@
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
@@ -324,7 +323,7 @@
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
-	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
@@ -368,15 +367,11 @@
 	| tron-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa*-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
 	| ymp-* \
 	| z8k-*)
 		;;
-	# Recognize the basic CPU types without company name, with glob match.
-	xtensa*)
-		basic_machine=$basic_machine-unknown
-		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -447,14 +442,6 @@
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
-	blackfin)
-		basic_machine=bfin-unknown
-		os=-linux
-		;;
-	blackfin-*)
-		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
@@ -487,8 +474,8 @@
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16)
-		basic_machine=cr16-unknown
+	cr16c)
+		basic_machine=cr16c-unknown
 		os=-elf
 		;;
 	crds | unos)
@@ -680,14 +667,6 @@
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
-	m68knommu)
-		basic_machine=m68k-unknown
-		os=-linux
-		;;
-	m68knommu-*)
-		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -703,10 +682,6 @@
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
-	mingw32ce)
-		basic_machine=arm-unknown
-		os=-mingw32ce
-		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -833,14 +808,6 @@
 		basic_machine=i860-intel
 		os=-osf
 		;;
-	parisc)
-		basic_machine=hppa-unknown
-		os=-linux
-		;;
-	parisc-*)
-		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -942,10 +909,6 @@
 	sb1el)
 		basic_machine=mipsisa64sb1el-unknown
 		;;
-	sde)
-		basic_machine=mipsisa32-sde
-		os=-elf
-		;;
 	sei)
 		basic_machine=mips-sei
 		os=-seiux
@@ -957,9 +920,6 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sh5el)
-		basic_machine=sh5le-unknown
-		;;
 	sh64)
 		basic_machine=sh64-unknown
 		;;
@@ -1049,10 +1009,6 @@
 		basic_machine=tic6x-unknown
 		os=-coff
 		;;
-	tile*)
-		basic_machine=tile-unknown
-		os=-linux-gnu
-		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -1258,7 +1214,7 @@
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	      | -skyos* | -haiku* | -rdos*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1410,9 +1366,6 @@
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
-		os=-elf
-		;;
         spu-*)
 		os=-elf
 		;;
@@ -1453,9 +1406,6 @@
 	m68*-cisco)
 		os=-aout
 		;;
-        mep-*)
-		os=-elf
-		;;
 	mips*-cisco)
 		os=-elf
 		;;

Modified: trunk/third/moira/configure
===================================================================
--- trunk/third/moira/configure	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/configure	2008-09-17 22:23:57 UTC (rev 23178)
@@ -3181,11 +3181,6 @@
 fi;
 echo "$as_me:$LINENO: result: $krb4" >&5
 echo "${ECHO_T}$krb4" >&6
-if test $krb4 = "no"; then
-    { { echo "$as_me:$LINENO: error: Kerberos is required for Moira" >&5
-echo "$as_me: error: Kerberos is required for Moira" >&2;}
-   { (exit 1); exit 1; }; }
-fi
 if test "$krb4" != yes; then
 
 
@@ -5879,7 +5874,15 @@
 
 
 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
-KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
+KLIBS="$KRB4_LIBS -lcom_err $LIBS"
+KLIBS="$LIBS"
+if test "$hesiod" != no; then
+  KLIBS="-lhesiod $KLIBS"
+fi
+KLIBS="$KRB4_LIBS -lcom_err $KLIBS"
+if test "$zephyr" != no; then
+  KLIBS="-lzephyr $KLIBS"
+fi
 LIBS="-lmoira $KLIBS"
 
 

Modified: trunk/third/moira/configure.in
===================================================================
--- trunk/third/moira/configure.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/configure.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -115,9 +115,6 @@
     [  --with-krb4=PREFIX      Specify location of krb4],
     [krb4="$withval"], [krb4=no])
 AC_MSG_RESULT($krb4)
-if test $krb4 = "no"; then
-    AC_MSG_ERROR(Kerberos is required for Moira)
-fi
 if test "$krb4" != yes; then
     MR_INCLUDE($krb4/include)
     if test -d "$krb4/include/kerberosIV"; then
@@ -449,7 +446,15 @@
 MR_INCLUDE('$(BUILDTOP)/db')
 MR_INCLUDE('$(srcdir)')
 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
-KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
+KLIBS="$KRB4_LIBS -lcom_err $LIBS"
+KLIBS="$LIBS"
+if test "$hesiod" != no; then
+  KLIBS="-lhesiod $KLIBS"
+fi
+KLIBS="$KRB4_LIBS -lcom_err $KLIBS"
+if test "$zephyr" != no; then
+  KLIBS="-lzephyr $KLIBS"
+fi
 LIBS="-lmoira $KLIBS"
 AC_SUBST(KLIBS)
 

Modified: trunk/third/moira/db/Makefile.in
===================================================================
--- trunk/third/moira/db/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/db/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.2 1999-07-12 16:21:01 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/db/dbopt.sql
===================================================================
--- trunk/third/moira/db/dbopt.sql	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/db/dbopt.sql	2008-09-17 22:23:57 UTC (rev 23178)
@@ -4,6 +4,8 @@
 create index i_usr_last on  users (last, first);
 create index i_usr_uid on  users (unix_uid);
 create index i_usr_pop on  users (pop_id);
+create index i_usr_imap on users (imap_id);
+create index i_usr_exchange on users (exchange_id);
 create index i_usr_clearid on users (clearid);
 create index i_usr_resv on users (reservations);
 create index i_usr_sponsor on users (sponsor_id);

Modified: trunk/third/moira/db/doschema.awk
===================================================================
--- trunk/third/moira/db/doschema.awk	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/db/doschema.awk	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: doschema.awk,v 1.2 1998-04-15 03:00:15 danw Exp $
+# $Id$
 #
 # Build moira_schema.c and .h from the schema.sql file
 # It knows which one to build cased on whether or not its input is

Modified: trunk/third/moira/db/schema.sql
===================================================================
--- trunk/third/moira/db/schema.sql	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/db/schema.sql	2008-09-17 22:23:57 UTC (rev 23178)
@@ -30,6 +30,7 @@
 	pop_id		INTEGER		DEFAULT 0	NOT NULL,
 	imap_id		INTEGER		DEFAULT 0	NOT NULL,
 	box_id		INTEGER		DEFAULT 0	NOT NULL,
+	exchange_id	INTEGER		DEFAULT 0	NOT NULL,
 	pmodtime	DATE    	DEFAULT SYSDATE	NOT NULL,
 	pmodby		INTEGER		DEFAULT 0	NOT NULL,
 	pmodwith	VARCHAR(8) 	DEFAULT CHR(0)	NOT NULL,

Modified: trunk/third/moira/dbck/Makefile.in
===================================================================
--- trunk/third/moira/dbck/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.7 2000-09-10 02:53:27 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/dbck/dbck.h
===================================================================
--- trunk/third/moira/dbck/dbck.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/dbck.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dbck/dbck.h,v 1.17 2007-12-03 21:22:59 zacheiss Exp $
+/* $Header$
  *
  * Declarations for Moira database consistancy checker
  *

Modified: trunk/third/moira/dbck/dbck.pc
===================================================================
--- trunk/third/moira/dbck/dbck.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/dbck.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: dbck.pc,v 1.8 2005-09-20 22:03:18 zacheiss Exp $
+/* $Id$
  *
  * Moira database consistency checker
  *
@@ -18,7 +18,7 @@
 EXEC SQL INCLUDE sqlca;
 EXEC SQL INCLUDE sqlda;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dbck/dbck.pc,v 1.8 2005-09-20 22:03:18 zacheiss Exp $");
+RCSID("$Header$");
 
 int debug = 0;
 int mode = MODE_ASK;

Modified: trunk/third/moira/dbck/fix.pc
===================================================================
--- trunk/third/moira/dbck/fix.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/fix.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: fix.pc,v 1.3 1998-02-05 22:51:02 danw Exp $
+/* $Id$
  *
  * User interface routines for dbck (Moira database consistency checker)
  *
@@ -16,7 +16,7 @@
 EXEC SQL INCLUDE sqlca;  /* SQL Communications Area */
 EXEC SQL INCLUDE sqlda;  /* SQL Descriptor Area */
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dbck/fix.pc,v 1.3 1998-02-05 22:51:02 danw Exp $");
+RCSID("$Header$");
 
 EXEC SQL BEGIN DECLARE SECTION;
 char *_table;

Modified: trunk/third/moira/dbck/members.pc
===================================================================
--- trunk/third/moira/dbck/members.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/members.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dbck/members.pc,v 1.4 2002-08-14 14:01:21 zacheiss Exp $
+/* $Header$
  */
 
 #include <stdio.h>

Modified: trunk/third/moira/dbck/phase1.pc
===================================================================
--- trunk/third/moira/dbck/phase1.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/phase1.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: phase1.pc,v 1.15 2007-12-03 21:22:59 zacheiss Exp $
+/* $Id$
  *
  * (c) Copyright 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -14,7 +14,7 @@
 #include <string.h>
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dbck/phase1.pc,v 1.15 2007-12-03 21:22:59 zacheiss Exp $");
+RCSID("$Header$");
 
 EXEC SQL WHENEVER SQLERROR DO dbmserr();
 int show_user_id(void *user);
@@ -358,7 +358,8 @@
 
   EXEC SQL DECLARE csr102 CURSOR FOR
     SELECT users_id, login, last, first, status, potype, pop_id, box_id,
-    imap_id, modby, fmodby, pmodby, comments, sigwho, sponsor_type, sponsor_id
+    imap_id, exchange_id, modby, fmodby, pmodby, comments, sigwho, 
+    sponsor_type, sponsor_id
     FROM users ORDER BY users_id;
   EXEC SQL OPEN csr102;
   while (1)
@@ -367,13 +368,13 @@
       char login[USERS_LOGIN_SIZE], nbuf[USERS_FIRST_SIZE + USERS_LAST_SIZE];
       char last[USERS_LAST_SIZE], first[USERS_FIRST_SIZE];
       char potype[USERS_POTYPE_SIZE], sponsor_type[USERS_SPONSOR_TYPE_SIZE];
-      int users_id, status, pop_id, box_id, imap_id, modby, fmodby, pmodby;
-      int comments, sigwho, sponsor_id;
+      int users_id, status, pop_id, box_id, imap_id, exchange_id, modby;
+      int fmodby, pmodby, comments, sigwho, sponsor_id;
       EXEC SQL END DECLARE SECTION;
 
       EXEC SQL FETCH csr102 INTO :users_id, :login, :last, :first,
-	:status, :potype, :pop_id, :box_id, :imap_id, :modby, :fmodby,
-	:pmodby, :comments, :sigwho, :sponsor_type, :sponsor_id;
+	:status, :potype, :pop_id, :box_id, :imap_id, :exchange_id, :modby, 
+	:fmodby, :pmodby, :comments, :sigwho, :sponsor_type, :sponsor_id;
       if (sqlca.sqlcode)
 	break;
 
@@ -405,6 +406,8 @@
 	case 'I':
 	  u->pobox_id = imap_id;
 	  break;
+	case 'E':
+	  u->pobox_id = exchange_id;
 	default:
 	  u->pobox_id = 0;
 	}

Modified: trunk/third/moira/dbck/phase2.pc
===================================================================
--- trunk/third/moira/dbck/phase2.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/phase2.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: phase2.pc,v 1.23 2007-12-03 21:22:59 zacheiss Exp $
+/* $Id$
  *
  * (c) Copyright 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -15,7 +15,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dbck/phase2.pc,v 1.23 2007-12-03 21:22:59 zacheiss Exp $");
+RCSID("$Header$");
 
 EXEC SQL WHENEVER SQLERROR DO dbmserr();
 
@@ -667,6 +667,19 @@
 	}
       break;
 
+    case 'E':
+      if (!hash_lookup(machines, u->pobox_id))
+	{
+	  printf("User %s(%s) has P.O.Box on non-existant machine %d\n",
+		 u->login, u->fullname, u->pobox_id);
+	  if (single_fix("Delete", 0))
+	    {
+	      remove_pobox(u->users_id);
+	      u->potype = 'N';
+	    }
+	}
+      break;
+
     case 'S':
       if (hash_lookup(string_dups, u->pobox_id))
 	{

Modified: trunk/third/moira/dbck/phase3.pc
===================================================================
--- trunk/third/moira/dbck/phase3.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/phase3.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: phase3.pc,v 1.4 1998-02-05 22:51:05 danw Exp $
+/* $Id$
  *
  * (c) Copyright 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -11,7 +11,7 @@
 
 #include <stdio.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dbck/phase3.pc,v 1.4 1998-02-05 22:51:05 danw Exp $");
+RCSID("$Header$");
 
 void empty_list_check(int id, void *list, void *hint);
 void unref_string_check(int id, void *string, void *hint);

Modified: trunk/third/moira/dbck/phase4.pc
===================================================================
--- trunk/third/moira/dbck/phase4.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dbck/phase4.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: phase4.pc,v 1.6 2005-09-20 22:03:19 zacheiss Exp $
+/* $Id$
  *
  * (c) Copyright 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -15,7 +15,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dbck/phase4.pc,v 1.6 2005-09-20 22:03:19 zacheiss Exp $");
+RCSID("$Header$");
 
 EXEC SQL WHENEVER SQLERROR DO dbmserr();
 

Modified: trunk/third/moira/dcm/Makefile.in
===================================================================
--- trunk/third/moira/dcm/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dcm/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.7 2000-01-20 19:18:47 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/dcm/dcm.pc
===================================================================
--- trunk/third/moira/dcm/dcm.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dcm/dcm.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: dcm.pc,v 1.17 2006-08-22 17:36:24 zacheiss Exp $
+/* $Id$
  *
  * The Data Control Manager for Moira.
  *
@@ -27,7 +27,7 @@
 EXEC SQL INCLUDE sqlca;
 void sqlglm(char *, unsigned int *, unsigned int *);
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dcm/dcm.pc,v 1.17 2006-08-22 17:36:24 zacheiss Exp $");
+RCSID("$Header$");
 
 int generate_service(char *name, int force);
 void do_hosts(char *service);

Modified: trunk/third/moira/dcm/startdcm.c
===================================================================
--- trunk/third/moira/dcm/startdcm.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/dcm/startdcm.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: startdcm.c,v 1.12 1998-02-05 22:51:07 danw Exp $
+/* $Id$
  *
  * This program starts the DCM in a "clean" environment.
  * and then waits for it to exit.
@@ -22,7 +22,7 @@
 #include <string.h>
 #include <unistd.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/dcm/startdcm.c,v 1.12 1998-02-05 22:51:07 danw Exp $");
+RCSID("$Header$");
 
 #define PROG 	"dcm"
 

Modified: trunk/third/moira/debian/changelog
===================================================================
--- trunk/third/moira/debian/changelog	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/debian/changelog	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,3 +1,11 @@
+debathena-moira (4.0.0+cvs20080830-0debathena1) unstable; urgency=low
+
+  * New CVS snapshot
+  * Add a debathena-moira-update-server package that installs
+    update_server
+
+ -- Evan Broder <broder@mit.edu>  Fri, 01 Aug 2008 10:54:26 -0400
+
 debathena-moira (4.0.0+cvs20080701-0debathena1) unstable; urgency=low
 
   * New CVS snapshot

Modified: trunk/third/moira/debian/control
===================================================================
--- trunk/third/moira/debian/control	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/debian/control	2008-09-17 22:23:57 UTC (rev 23178)
@@ -2,7 +2,7 @@
 Section: debathena/net
 Priority: extra
 Maintainer: Debian-Athena Project <debathena@mit.edu>
-Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 4.2.0), quilt, patchutils (>= 0.2.25), cdbs (>= 0.4.27-1), comerr-dev, libkrb5-dev, libhesiod-dev, libzephyr-dev, libzephyr3-krb, libreadline-dev, libncurses-dev
+Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 4.2.0), quilt, patchutils (>= 0.2.25), cdbs (>= 0.4.27), comerr-dev, libkrb5-dev, libhesiod-dev, libzephyr-dev, libzephyr3-krb, libreadline-dev, libncurses-dev
 Standards-Version: 3.7.2
 
 Package: debathena-moira-clients
@@ -15,6 +15,17 @@
  .
  This package contains clients such as moira, stella, blanche, etc.
 
+Package: debathena-moira-update-server
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Athena update_server
+ Moira is the Athena Service Management system.  It serves as the 
+ central repository for information about users, groups hosts, print 
+ queues, and several other aspects of the Athena environment.
+ .
+ This package contains the update_server daemon, which is used for
+ servers that automatically receive information dumps from moira.
+
 Package: debathena-libmoira-dev
 Section: debathena/libdevel
 Architecture: any

Modified: trunk/third/moira/debian/control.in
===================================================================
--- trunk/third/moira/debian/control.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/debian/control.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -15,6 +15,17 @@
  .
  This package contains clients such as moira, stella, blanche, etc.
 
+Package: debathena-moira-update-server
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Athena update_server
+ Moira is the Athena Service Management system.  It serves as the 
+ central repository for information about users, groups hosts, print 
+ queues, and several other aspects of the Athena environment.
+ .
+ This package contains the update_server daemon, which is used for
+ servers that automatically receive information dumps from moira.
+
 Package: debathena-libmoira-dev
 Section: debathena/libdevel
 Architecture: any

Added: trunk/third/moira/debian/debathena-moira-update-server.init
===================================================================
--- trunk/third/moira/debian/debathena-moira-update-server.init	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/debian/debathena-moira-update-server.init	2008-09-17 22:23:57 UTC (rev 23178)
@@ -0,0 +1,126 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          debathena-moira-update-server
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Moira update_server
+# Description:       The moira update_server program for taking updates from
+#                    moira
+### END INIT INFO
+
+# Author: Evan Broder <broder@mit.edu>
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/usr/sbin:/usr/bin:/sbin:/bin
+DESC="Moira update_server"
+NAME=debathena-moira-update-server
+DAEMON=/usr/sbin/update_server
+DAEMON_ARGS=""
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+	# Return
+	#   0 if daemon has been started
+	#   1 if daemon was already running
+	#   2 if daemon could not be started
+	start-stop-daemon --start --quiet --exec $DAEMON --test > /dev/null \
+		|| return 1
+	start-stop-daemon --start --quiet --exec $DAEMON -- \
+		$DAEMON_ARGS \
+		|| return 2
+	# Add code here, if necessary, that waits for the process to be ready
+	# to handle requests from services started subsequently which depend
+	# on this one.  As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+	# Return
+	#   0 if daemon has been stopped
+	#   1 if daemon was already stopped
+	#   2 if daemon could not be stopped
+	#   other if a failure occurred
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name $NAME
+	RETVAL="$?"
+	[ "$RETVAL" = 2 ] && return 2
+	# Wait for children to finish too if this is a daemon that forks
+	# and if the daemon is only ever run from this initscript.
+	# If the above conditions are not satisfied then add some other code
+	# that waits for the process to drop all resources that could be
+	# needed by services started subsequently.  A last resort is to
+	# sleep for some time.
+	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+	[ "$?" = 2 ] && return 2
+	return "$RETVAL"
+}
+
+case "$1" in
+  start)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+	do_start
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  stop)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  restart|force-reload)
+	#
+	# If the "reload" option is implemented then remove the
+	# 'force-reload' alias
+	#
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+	  	# Failed to stop
+		log_end_msg 1
+		;;
+	esac
+	;;
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
+
+:


Property changes on: trunk/third/moira/debian/debathena-moira-update-server.init
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/third/moira/debian/debathena-moira-update-server.install
===================================================================
--- trunk/third/moira/debian/debathena-moira-update-server.install	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/debian/debathena-moira-update-server.install	2008-09-17 22:23:57 UTC (rev 23178)
@@ -0,0 +1,4 @@
+usr/bin/update_test
+usr/sbin/update_server
+usr/share/man/man8/update_server.8
+etc/athena/moira.conf

Added: trunk/third/moira/debian/patches/install-sample-moira-conf.patch
===================================================================
--- trunk/third/moira/debian/patches/install-sample-moira-conf.patch	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/debian/patches/install-sample-moira-conf.patch	2008-09-17 22:23:57 UTC (rev 23178)
@@ -0,0 +1,20 @@
+Index: debathena-moira-4.0.0+cvs20080701/update/Makefile.in
+===================================================================
+--- debathena-moira-4.0.0+cvs20080701.orig/update/Makefile.in	2008-08-01 11:42:10.000000000 -0400
++++ debathena-moira-4.0.0+cvs20080701/update/Makefile.in	2008-08-01 11:42:10.000000000 -0400
+@@ -22,6 +22,7 @@
+ exec_prefix=@exec_prefix@
+ bindir=@bindir@
+ sbindir=@sbindir@
++sysconfdir=@sysconfdir@
+ 
+ SOBJS=	auth_002.o auth_003.o checksum.o config.o exec_002.o get_file.o \
+ 	update_server.o xfer_002.o xfer_003.o sendrecv.o
+@@ -45,6 +46,7 @@
+ install: all
+ 	$(INSTALL_PROGRAM) update_test $(DESTDIR)$(bindir)
+ 	$(INSTALL_PROGRAM) update_server $(DESTDIR)$(sbindir)
++	$(INSTALL) -m 644 -D moira.conf $(DESTDIR)$(sysconfdir)/athena/moira.conf
+ 
+ update_test: $(COBJS) $(MR_LIBDEP)
+ 	$(CC) -o $@ $(LDFLAGS) $(COBJS) $(LIBS)

Modified: trunk/third/moira/debian/patches/series
===================================================================
--- trunk/third/moira/debian/patches/series	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/debian/patches/series	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1 +1,2 @@
 moira-build-destdir.patch
+install-sample-moira-conf.patch

Modified: trunk/third/moira/gen/Makefile.in
===================================================================
--- trunk/third/moira/gen/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.50 2008-01-16 16:56:09 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@
@@ -31,16 +31,16 @@
 LIB_TARGET=libdcm.a
 
 OBJS=	acl.o boot.o confluence.o dhcp.o directory.o events.o hesiod.o \
-	hosts.o mailhub.o ndb.o network.o nfs.o pobox.o postoffice.o print.o \
-	winad.o www.o zephyr.o
+	hosts.o lpcaccess.o mailhub.o ndb.o network.o nfs.o pobox.o \
+	postoffice.o print.o winad.o www.o zephyr.o
 
 CFILES= acl.c boot.c confluence.c dhcp.c directory.c events.c hesiod.c \
-	hosts.c mailhub.c ndb.c network.c nfs.c pobox.c postoffice.c print.c \
-	winad.c www.c zephyr.c
+	hosts.c lpcaccess.c mailhub.c ndb.c network.c nfs.c pobox.c \
+	 postoffice.c print.c winad.c www.c zephyr.c
 
 TARGET=	acl.gen boot.gen confluence.gen dhcp.gen directory.gen events.gen \
-	hesiod.gen hosts.gen mailhub.gen ndb.gen network.gen nfs.gen \
-	pobox.gen postoffice.gen print.gen winad.gen www.gen zephyr.gen
+	hesiod.gen hosts.gen lpcaccess.gen mailhub.gen ndb.gen network.gen \
+	nfs.gen pobox.gen postoffice.gen print.gen winad.gen www.gen zephyr.gen
 
 SCRIPTS=access.gen access.sh acl.sh aliases.sh boot.sh ca.gen calendar.gen \
 	dhcp.sh events.sh hesiod.sh ip-billing.gen \
@@ -137,3 +137,6 @@
 
 winad.gen: winad.o libdcm.a $(MR_LIBDEP)
 	$(CC) -o $@ $(LDFLAGS) winad.o libdcm.a $(SQL_LIBS) $(LIBS)
+
+lpcaccess.gen: lpcaccess.o libdcm.a $(MR_LIBDEP)
+	$(CC) -o $@ $(LDFLAGS) lpcaccess.o libdcm.a $(SQL_LIBS) $(LIBS)

Modified: trunk/third/moira/gen/access.gen
===================================================================
--- trunk/third/moira/gen/access.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/access.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: access.gen,v 1.1 2003-10-21 18:35:48 zacheiss Exp $
+# $Id$
 
 use DBI;
 

Modified: trunk/third/moira/gen/access.sh
===================================================================
--- trunk/third/moira/gen/access.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/access.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/access.sh,v 1.1 2003-10-21 18:35:48 zacheiss Exp $
+# $Header$
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
 export PATH

Modified: trunk/third/moira/gen/acl.pc
===================================================================
--- trunk/third/moira/gen/acl.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/acl.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: acl.pc,v 1.5 2005-12-28 21:38:00 zacheiss Exp $
+/* $Id$
  *
  * This generates acl files for various servers.
  *
@@ -23,7 +23,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/acl.pc,v 1.5 2005-12-28 21:38:00 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "acl.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/acl.sh
===================================================================
--- trunk/third/moira/gen/acl.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/acl.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: acl.sh,v 1.6 2005-12-28 21:42:14 zacheiss Exp $
+# $Id$
 if [ -d /var/athena ] && [ -w /var/athena ]; then
     exec >/var/athena/moira_update.log 2>&1
 else 

Modified: trunk/third/moira/gen/aliases.sh
===================================================================
--- trunk/third/moira/gen/aliases.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/aliases.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -24,4 +24,4 @@
 rm -f $0
 exit 0
 
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/aliases.sh,v 1.8 2000-05-29 22:17:58 zacheiss Exp $
+# $Header$

Modified: trunk/third/moira/gen/boot.pc
===================================================================
--- trunk/third/moira/gen/boot.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/boot.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: boot.pc,v 1.7 1999-06-15 19:14:22 danw Exp $
+/* $Id$
  *
  * This generates the bootptab and associated files.
  *
@@ -22,7 +22,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/boot.pc,v 1.7 1999-06-15 19:14:22 danw Exp $");
+RCSID("$Header$");
 
 char *whoami = "boot.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/boot.sh
===================================================================
--- trunk/third/moira/gen/boot.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/boot.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $Id: boot.sh,v 1.3 2000-05-08 18:30:30 zacheiss Exp $
+# $Id$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then
     exec >/var/athena/moira_update.log 2>&1

Modified: trunk/third/moira/gen/ca.gen
===================================================================
--- trunk/third/moira/gen/ca.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/ca.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: ca.gen,v 1.3 2006-05-11 16:55:28 zacheiss Exp $
+# $Id$
 
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:

Modified: trunk/third/moira/gen/calendar.gen
===================================================================
--- trunk/third/moira/gen/calendar.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/calendar.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: calendar.gen,v 1.3 2002-08-22 20:45:30 zacheiss Exp $
+# $Id$
 
 # The following exit codes are defined and MUST BE CONSISTENT withh the
 # error codes the library uses:

Modified: trunk/third/moira/gen/confluence.pc
===================================================================
--- trunk/third/moira/gen/confluence.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/confluence.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: confluence.pc,v 1.1 2007-11-15 22:09:20 zacheiss Exp $
+/* $Id$
  *
  * (c) Copyright 2007 by the Massachusetts Institute of Technology.
  */

Modified: trunk/third/moira/gen/dhcp.pc
===================================================================
--- trunk/third/moira/gen/dhcp.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/dhcp.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: dhcp.pc,v 1.6 2007-04-03 20:52:58 zacheiss Exp $
+/* $Id$
  *
  * This generates the dhcpd.conf.print and associated files.
  *
@@ -24,7 +24,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/dhcp.pc,v 1.6 2007-04-03 20:52:58 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "dhcp.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/dhcp.sh
===================================================================
--- trunk/third/moira/gen/dhcp.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/dhcp.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $Id: dhcp.sh,v 1.3 2001-01-16 18:37:27 zacheiss Exp $
+# $Id$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then
     exec >/var/athena/moira_update.log 2>&1

Modified: trunk/third/moira/gen/directory.pc
===================================================================
--- trunk/third/moira/gen/directory.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/directory.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: directory.pc,v 1.5 2007-06-15 14:48:14 zacheiss Exp $
+/* $Id$
  *
  * This generates a master /etc/passwd containing all active (status != 0)
  * accounts.
@@ -20,7 +20,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/directory.pc,v 1.5 2007-06-15 14:48:14 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "directory.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/events.pc
===================================================================
--- trunk/third/moira/gen/events.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/events.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: events.pc,v 1.1 2007-03-26 18:14:41 zacheiss Exp $
+/* $Id$
  *
  * (c) Copyright 2007 by the Massachusetts Institute of Technology.
  */

Modified: trunk/third/moira/gen/events.sh
===================================================================
--- trunk/third/moira/gen/events.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/events.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: events.sh,v 1.2 2005-09-19 21:37:47 zacheiss Exp $
+# $Id$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then 
     exec >/var/athena/moira_update.log 2>&1

Modified: trunk/third/moira/gen/genacl.pc
===================================================================
--- trunk/third/moira/gen/genacl.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/genacl.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: genacl.pc,v 1.4 2002-02-27 09:53:12 zacheiss Exp $
+/* $Id$
  *
  * Utility functions for outputting ACLs
  *
@@ -17,10 +17,11 @@
 #include <string.h>
 
 #include <krb.h>
+#include <krb5.h>
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/genacl.pc,v 1.4 2002-02-27 09:53:12 zacheiss Exp $");
+RCSID("$Header$");
 
 static char defaultrealm[REALM_SZ];
 
@@ -65,6 +66,7 @@
 void canon_krb(struct imember *m, int vers, char *buf, int len)
 {
   char *at;
+  char kbuf[MAX_K_NAME_SZ];
 
   switch (m->type)
     {
@@ -73,30 +75,59 @@
       break;
 
     case 'K':
+      /* We assume we have a krb4-style namespace.  If we want a krb5 acl, we need to
+       * krb5_425_conv_principal() on it. For krb4, do nothing special.
+       */ 
       at = strchr(m->name, '@');
       if (!at)
 	at = strchr(m->name, '\0');
+      snprintf(kbuf, len, "%s", m->name);
+
+      if (!*at)
+	{
+	  int plen = strlen(kbuf);
+	  snprintf(kbuf + plen, len - plen, "@%s", defaultrealm);
+	}
+
       if (vers == 5)
 	{
-	  char *dot = strchr(m->name, '.');
-	  if (dot && dot < at)
-	    snprintf(buf, len, "%.*s/%s", dot - m->name, m->name, dot + 1);
-	  else
-	    snprintf(buf, len, "%s", m->name);
+	  char name[ANAME_SZ] = "\0", inst[INST_SZ] = "\0", realm[REALM_SZ] = "\0";
+	  char *kuser = NULL;
+	  krb5_context context = NULL;
+	  krb5_principal client = NULL;
+	  int status = 0;
+
+	  if (kname_parse(name, inst, realm, kbuf) != KSUCCESS)
+	    goto out;
+
+	  status = krb5_init_context(&context);
+	  if (status)
+	    goto out;
+
+	  status = krb5_425_conv_principal(context, name, inst, realm, &client);
+	  if (status)
+	    goto out;
+
+	  status = krb5_unparse_name(context, client, &kuser);
+	  if (status)
+	    goto out;
+
+	  strncpy(buf, kuser, MAX_K_NAME_SZ);
+	  buf[MAX_K_NAME_SZ - 1] = '\0';
+
+	out:
+	  if (kuser)
+	    krb5_free_unparsed_name(context, kuser);
+	  if (client)
+	    krb5_free_principal(context, client);
+	  if (context)
+	    krb5_free_context(context);
 	}
       else
 	{
-	  char *slash = strchr(m->name, '/');
-	  if (slash && slash < at)
-	    snprintf(buf, len, "%.*s.%s", slash - m->name, m->name, slash + 1);
-	  else
-	    snprintf(buf, len, "%s", m->name);
+	  /* v4 output, and we should already have added a realm. */
+	  snprintf(buf, len, "%s", kbuf);
 	}
-      if (!*at)
-	{
-	  int plen = strlen(buf);
-	  snprintf(buf + plen, len - plen, "@%s", defaultrealm);
-	}
       break;
     }
 }

Modified: trunk/third/moira/gen/hesiod.pc
===================================================================
--- trunk/third/moira/gen/hesiod.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/hesiod.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: hesiod.pc,v 1.19 2007-03-06 04:09:33 zacheiss Exp $
+/* $Id$
  *
  * This generates the zone files necessary to load a hesiod server.
  * The following zones are generated: passwd, uid, pobox, group,
@@ -23,7 +23,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/hesiod.pc,v 1.19 2007-03-06 04:09:33 zacheiss Exp $");
+RCSID("$Header$");
 
 #ifndef HTYPE
 #define HTYPE "TXT"
@@ -40,7 +40,7 @@
  * query.  This is 512 - overhead (~78) [derived empirically]
  * (it used to be 446 with older versions of bind)
  */
-#define MAXHESSIZE 434
+#define MAXHESSIZE 256
 
 char hesiod_dir[MAXPATHLEN];
 
@@ -202,7 +202,7 @@
   char fullname[USERS_FULLNAME_SIZE], oa[USERS_OFFICE_ADDR_SIZE];
   char op[USERS_OFFICE_PHONE_SIZE], hp[USERS_HOME_PHONE_SIZE];
   char nn[USERS_NICKNAME_SIZE], potype[USERS_POTYPE_SIZE];
-  int uid, id, pid, iid, mid, status;
+  int uid, id, pid, iid, eid, mid, status;
   EXEC SQL END DECLARE SECTION;
 
   sprintf(poutf, "%s/passwd.db", hesiod_dir);
@@ -237,7 +237,8 @@
   users = create_hash(12001);
   EXEC SQL DECLARE u_cursor CURSOR FOR
     SELECT login, unix_uid, shell, fullname, nickname, office_addr,
-    office_phone, home_phone, users_id, potype, pop_id, imap_id, status
+    office_phone, home_phone, users_id, potype, pop_id, imap_id, exchange_id,
+    status
     FROM users
     WHERE status = 1 OR status = 2 OR status = 5 OR status = 6
     ORDER BY users_id;
@@ -245,7 +246,7 @@
   while (1)
     {
       EXEC SQL FETCH u_cursor INTO :login, :uid, :shell, :fullname, :nn,
-	:oa, :op, :hp, :id, :potype, :pid, :iid, :status;
+	:oa, :op, :hp, :id, :potype, :pid, :iid, :eid, :status;
       if (sqlca.sqlcode)
 	break;
       strtrim(login);
@@ -268,6 +269,17 @@
 	  fprintf(uout, "%d.uid\t%s CNAME %s.passwd\n", uid, HCLASS, login);
 	}
 
+      if (eid != 0)
+	{
+	  /* Check for IMAP.  Can't use iid because it should be zero. */
+	  EXEC SQL SELECT mach_id INTO :mid FROM filesys
+	    WHERE label = :login || '.po' AND type = 'IMAP';
+	  if (sqlca.sqlcode == 0)
+	    pid = mid;
+	  else
+	    pid = eid;
+	}
+
       if (iid != 0)
 	{
 	  EXEC SQL SELECT mach_id INTO :mid FROM filesys

Modified: trunk/third/moira/gen/hesiod.sh
===================================================================
--- trunk/third/moira/gen/hesiod.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/hesiod.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # This script performs updates of hesiod files on hesiod servers.
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/hesiod.sh,v 1.19 2000-05-08 18:30:30 zacheiss Exp $
+# $Header$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then
     exec >/var/athena/moira_update.log 2>&1
@@ -44,9 +44,13 @@
 # on the same parition as $DEST_DIR.
 if test ! -d $SRC_DIR
 then
-	chdir $DEST_DIR
+	# Tell linux cd/pwd not to be so "helpful".
+	# This will generate an ignorable error on older platforms.
+	set -P
+
+	cd $DEST_DIR
 	mkdir ../_nameserver
-	chdir ../_nameserver
+	cd ../_nameserver
 	if test $SRC_DIR != `pwd`
 	then
 		ln -s `pwd` $SRC_DIR
@@ -90,7 +94,7 @@
 # existance as evidence that named as has been successfully restarted.
 
 # First, get statistics
-kill -ILL `cat $NAMED_PID`
+/usr/athena/etc/rndc stats
 sleep 1
 kill -KILL `cat $NAMED_PID`
 rm -f $NAMED_PID

Modified: trunk/third/moira/gen/hosts.pc
===================================================================
--- trunk/third/moira/gen/hosts.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/hosts.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: hosts.pc,v 1.8 2000-11-30 23:27:40 zacheiss Exp $
+/* $Id$
  *
  * This generates the hstath.txt hosttable.
  *
@@ -24,7 +24,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/hosts.pc,v 1.8 2000-11-30 23:27:40 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "hosts.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/install_dirs
===================================================================
--- trunk/third/moira/gen/install_dirs	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/install_dirs	2008-09-17 22:23:57 UTC (rev 23178)
@@ -74,6 +74,6 @@
 exit 0
 
 #
-# 	$Source: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/install_dirs,v $
-#	$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/install_dirs,v 1.12 1998-01-07 17:13:18 danw Exp $
+# 	$Source$
+#	$Header$
 #

Modified: trunk/third/moira/gen/install_quotas
===================================================================
--- trunk/third/moira/gen/install_quotas	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/install_quotas	2008-09-17 22:23:57 UTC (rev 23178)
@@ -24,6 +24,6 @@
 exit 0
 
 #
-# 	$Source: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/install_quotas,v $
-#	$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/install_quotas,v 1.4 1998-01-07 17:13:18 danw Exp $
+# 	$Source$
+#	$Header$
 #

Modified: trunk/third/moira/gen/ip-billing.gen
===================================================================
--- trunk/third/moira/gen/ip-billing.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/ip-billing.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: ip-billing.gen,v 1.7 2002-03-27 14:51:56 zacheiss Exp $
+# $Id$
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:
 $MR_DBMS_ERR = 47836421;

Modified: trunk/third/moira/gen/ip-billing.sh
===================================================================
--- trunk/third/moira/gen/ip-billing.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/ip-billing.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/ip-billing.sh,v 1.2 2002-03-19 22:07:06 zacheiss Exp $
+# $Header$
 
 PATH=/usr/bin:/bin:/usr/sbin:/sbin
 

Modified: trunk/third/moira/gen/ldap.gen
===================================================================
--- trunk/third/moira/gen/ldap.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/ldap.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: ldap.gen,v 1.8 2007-11-13 17:37:31 zacheiss Exp $
+# $Id$
 
 use DBI;
 

Modified: trunk/third/moira/gen/longjobs.gen
===================================================================
--- trunk/third/moira/gen/longjobs.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/longjobs.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: longjobs.gen,v 1.1 2001-08-02 17:21:11 zacheiss Exp $
+# $Id$
 
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:

Modified: trunk/third/moira/gen/longjobs.sh
===================================================================
--- trunk/third/moira/gen/longjobs.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/longjobs.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $Id: longjobs.sh,v 1.1 2001-08-25 12:06:37 zacheiss Exp $
+# $Id$
 
 # Wrapper script to install the groups file output by moira, and update
 # the quota database for current group membership.

Modified: trunk/third/moira/gen/mailhosts.gen
===================================================================
--- trunk/third/moira/gen/mailhosts.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/mailhosts.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: mailhosts.gen,v 1.5 2007-07-18 19:38:27 zacheiss Exp $
+# $Id$
 
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:

Modified: trunk/third/moira/gen/mailhub.pc
===================================================================
--- trunk/third/moira/gen/mailhub.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/mailhub.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mailhub.pc,v 1.20 2003-08-08 21:25:52 zacheiss Exp $
+/* $Id$
  *
  * This generates the /usr/lib/aliases file for the mailhub.
  *
@@ -22,7 +22,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/mailhub.pc,v 1.20 2003-08-08 21:25:52 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "mailhub.gen";
 char *db = "moira/moira";
@@ -34,6 +34,8 @@
 #define FALSE 0
 #define TRUE (!FALSE)
 
+FILE *out = stdout;
+
 struct hash *users, *machines, *strings, *lists;
 struct user {
   char *login;
@@ -56,10 +58,10 @@
 };
 
 void get_info(void);
+void save_mlist(int id, void *list, void *force);
 int check_string(char *s);
 void output_login(int dummy, void *names, void *out);
-void output_mlist(int id, void *list, void *out);
-void output_membership(struct list *l, FILE *out);
+void output_mlist(int id, struct list *l);
 void put_fill(FILE *aliases, char *string);
 void do_people(void);
 
@@ -69,9 +71,7 @@
 {
   time_t tm = time(NULL);
   char filename[MAXPATHLEN], *targetfile;
-  FILE *out = stdout;
 
-  srand(tm);
   EXEC SQL CONNECT :db;
 
   if (argc == 2)
@@ -100,7 +100,7 @@
 
   incount = 0;
   fprintf(out, "\n%s\n# Mailing lists\n%s\n\n", divide, divide);
-  hash_step(lists, output_mlist, out);
+  hash_step(lists, save_mlist, FALSE);
   fprintf(stderr, "Output %d lists\n", incount);
 
   incount = 0;
@@ -124,7 +124,7 @@
 void get_info(void)
 {
   EXEC SQL BEGIN DECLARE SECTION;
-  int id, pid, iid, bid, cnt, maillistp, acl, mid, mailman;
+  int id, pid, iid, bid, eid, cnt, maillistp, acl, mid, mailman;
   char mname[MACHINE_NAME_SIZE], str[STRINGS_STRING_SIZE];
   char login[USERS_LOGIN_SIZE], potype[USERS_POTYPE_SIZE];
   char lname[LIST_NAME_SIZE], desc[LIST_DESCRIPTION_SIZE];
@@ -150,7 +150,7 @@
     WHERE status = 1
     AND ( mach_id IN ( SELECT UNIQUE pop_id FROM users ) OR
 	  mach_id IN ( SELECT UNIQUE mach_id FROM filesys
-		       WHERE type = 'IMAP' ) )
+		       WHERE type = 'IMAP' ) )    
     ORDER BY mach_id;
   EXEC SQL OPEN m_cursor;
   while (1)
@@ -174,6 +174,28 @@
     }
   EXEC SQL CLOSE m_cursor;
 
+  EXEC SQL DECLARE e_cursor CURSOR FOR
+    SELECT mach_id, name
+    FROM machine
+    WHERE status = 1
+    AND mach_id in (SELECT UNIQUE exchange_id FROM users)
+    ORDER BY mach_id;
+  EXEC SQL OPEN e_cursor;
+  while (1)
+    {
+      EXEC SQL FETCH e_cursor INTO :id, :mname;
+      if (sqlca.sqlcode)
+	break;
+      strtrim(mname);
+      if (hash_store(machines, id, strdup(mname)) < 0)
+	{
+	  fprintf(stderr, "Out of memory!\n");
+	  exit(MR_NO_MEM);
+	}
+      cnt++;
+    }
+  EXEC SQL CLOSE e_cursor;
+	
   fprintf(stderr, "Loaded %d machines\n", cnt);
 
   cnt = 0;
@@ -204,7 +226,7 @@
   users = create_hash(13001);
 
   EXEC SQL DECLARE u_cursor CURSOR FOR
-    SELECT users_id, login, potype, pop_id, imap_id, box_id
+    SELECT users_id, login, potype, pop_id, imap_id, box_id, exchange_id
     FROM users
     WHERE status != 3
     ORDER BY users_id;
@@ -213,7 +235,8 @@
     {
       char *saddr = NULL, *paddr = NULL;
 
-      EXEC SQL FETCH u_cursor INTO :id, :login, :potype, :pid, :iid, :bid;
+      EXEC SQL FETCH u_cursor INTO :id, :login, :potype, :pid, :iid, :bid,
+	:eid;
       if (sqlca.sqlcode)
 	break;
       u = malloc(sizeof(struct user));
@@ -230,7 +253,7 @@
 
 	      /* If SMTP, clear pid and iid. */
 	      if (potype[1] == 'M')
-		pid = iid = 0;
+		pid = iid = eid = 0;
 	    }
 
 	  /* If IMAP, or SPLIT with IMAP, set pid to mach_id. */
@@ -240,6 +263,10 @@
 		WHERE filsys_id = :iid;
 	    }
 
+	  /* If EXCHANGE or SPLIT with EXCHANGE, set pid to eid. */
+	  if (potype[0] == 'E' || (potype[0] == 'S' && eid))
+	    pid = eid;
+
 	  if (pid && (s = hash_lookup(machines, pid)))
 	    {
 	      paddr = malloc(strlen(u->login) + strlen(s) + 2);
@@ -355,6 +382,34 @@
 }
 
 
+void save_mlist(int id, void *list, void *force)
+{
+  struct member *m;
+  struct list *l = list, *l1;
+
+  if (l->maillist > 1 || (l->maillist == 0 && !force) ||
+      !check_string(l->name))
+    return;
+
+  /* If user group appears on list, replace with user. */
+  if (l->m && l->m->next == NULL && !strcasecmp(l->name, l->m->name))
+    {
+      l->maillist = 3;
+      return;
+    }
+  l->maillist = 2;
+  output_mlist(id, l);
+
+  if (l->acl_t == 'L' && (l1 = hash_lookup(lists, l->acl_id)))
+    save_mlist(0, l1, (void *)TRUE);
+
+  for (m = l->m; m; m = m->next)
+    {
+      if (m->list_id && (l1 = hash_lookup(lists, m->list_id)))
+	save_mlist(0, l1, (void *)TRUE);
+    }
+}
+
 void output_login(int dummy, void *user, void *out)
 {
   struct user *u = user;
@@ -364,25 +419,21 @@
     fprintf(out, "%s: %s\n", u->login, u->pobox);
 }
 
-int line_width, alias_width;
 static const char *mailman_suffixes[] = { "-admin", "-owner", "-request",
-					  "-bounces", "-confirm", "-join",
-					  "-leave", "-subscribe",
-					  "-unsubscribe", NULL };
+ 					  "-bounces", "-confirm", "-join",
+ 					  "-leave", "-subscribe",
+ 					  "-unsubscribe", NULL };
 
-void output_mlist(int id, void *list, void *out)
+void output_mlist(int id, struct list *l)
 {
-  struct list *l = list, *l1;
+  struct list *l1;
+  struct member *m;
   struct user *u;
-  int len = strlen(l->name), i;
+  int line_width, alias_width, word_width, beginning;
+  static int cont = 1;
+  char str[8];
+  int i;
 
-  if (!l->maillist || !check_string(l->name))
-    return;
-
-  /* If standard user group appears on a list, substitute in the user. */
-  if (l->m && l->m->next == NULL && !strcasecmp(l->name, l->m->name))
-    return;
-
   put_fill(out, l->description);
 
   if (l->mailman && strcmp(l->mailman_server, "[NONE]"))
@@ -390,44 +441,23 @@
       for (i = 0; mailman_suffixes[i]; i++)
 	fprintf(out, "%s%s: %s%s@%s\n", l->name, mailman_suffixes[i], l->name,
 		mailman_suffixes[i], l->mailman_server);
-      fprintf(out, "owner-%s: %s-owner@%s\n", l->name, l->name,
-	      l->mailman_server);
+      fprintf(out, "owner-%s: %s-owner@%s\n%s: ", l->name, l->name,
+	      l->mailman_server, l->name);
     }
   else if (l->acl_t ==  'L' && (l1 = hash_lookup(lists, l->acl_id)))
-    {
-      fprintf(out, "owner-%s: ", l->name);
-      if ((l1->maillist) && (strcmp(l->name, l1->name)))
-	fprintf(out, "%s\n", l1->name);
-      else
-	{
-	  alias_width = line_width = len + 8;
-	  output_membership(l1, out);
-	  fprintf(out, "\n");
-	}
-    }
+    fprintf(out, "owner-%s: %s\n%s: ", l->name, l1->name, l->name);
   else if (l->acl_t ==  'U' && (u = hash_lookup(users, l->acl_id)))
-    fprintf(out, "owner-%s: %s\n", l->name, u->login);
+    fprintf(out, "owner-%s: %s\n%s: ", l->name, u->login, l->name);
+  else
+    fprintf(out, "%s: ", l->name);
 
-  fprintf(out, "%s: ", l->name);
-  alias_width = line_width = len + 2;
-  output_membership(l, out);
-  fprintf(out, "\n\n");
-  incount++;
-}
-
-void output_membership(struct list *l, FILE *out)
-{
-  struct member *m;
-  struct list *l1;
-  int word_width, linestart = 1;
-  static int cont = 1;
-  char str[8];
-
+  alias_width = line_width = strlen(l->name) + 2;
+  beginning = 1;
   for (m = l->m; m; m = m->next)
     {
       word_width = strlen(m->name);
 
-      if (!linestart && alias_width + word_width + 2 > MAX_ALIAS_WIDTH)
+      if (!beginning && alias_width + word_width + 2 > MAX_ALIAS_WIDTH)
 	{
 	  /* Make a continuation. */
 	  sprintf(str, "%c%c%c%c%c%c", rand() % 26 + 97, rand() % 26 + 97,
@@ -436,18 +466,20 @@
 	  fprintf(out, ",\n\tcont%d-%s\ncont%d-%s: ", cont, str, cont, str);
 	  cont++;
 	  alias_width = line_width = 17 + word_width;
+	  fputs(m->name, out);
 	}
-      else if (linestart)
+      else if (beginning)
 	{
-	  /* First word on line, so we can't wrap. */
+	  /* Beginning of alias, so don't wrap. */
 	  line_width += word_width;
 	  alias_width = line_width;
-	  linestart = 0;
+	  fputs(m->name, out);
+	  beginning = 0;
 	}
       else if (line_width + word_width + 2 > MAX_LINE_WIDTH)
 	{
 	  /* Wrap. */
-	  fputs(",\n\t", out);
+	  fprintf(out, ",\n\t%s", m->name);
 	  alias_width += line_width + word_width + 2;
 	  line_width = word_width + 8;
 	}
@@ -455,16 +487,13 @@
 	{
 	  /* Continue line. */
 	  line_width += word_width + 2;
-	  fputs(", ", out);
+	  fprintf(out, ", %s", m->name);
 	}
-
-      if (m->list_id && (l1 = hash_lookup(lists, m->list_id)) && !l1->maillist)
-	output_membership(l1, out);
-      else
-	fputs(m->name, out);
     }
   if (!l->m)
     fprintf(out, "/dev/null");
+  fprintf(out, "\n\n");
+  incount++;
 }
 
 /* Write a word-wrapped list description to the aliases file as a
@@ -521,7 +550,7 @@
 }
 
 
-/* Illegal chars: this no longer corresponds to the array 
+/* Illegal chars: this no longer corresponds to the array
  * in setup_alis.  '+' is a valid character in a string on 
  * a list, but is not a valid character in a listname.
  */

Modified: trunk/third/moira/gen/mailhub.sh
===================================================================
--- trunk/third/moira/gen/mailhub.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/mailhub.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/mailhub.sh,v 1.13 2003-04-18 22:06:03 jweiss Exp $
+# $Header$
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
 export PATH

Modified: trunk/third/moira/gen/mailman.gen
===================================================================
--- trunk/third/moira/gen/mailman.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/mailman.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: mailman.gen,v 1.1 2003-01-02 01:05:05 zacheiss Exp $
+# $Id$
 
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:

Modified: trunk/third/moira/gen/mailman.sh
===================================================================
--- trunk/third/moira/gen/mailman.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/mailman.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,3 +1,3 @@
 #!/bin/sh
-# $Id: mailman.sh,v 1.1 2003-03-31 14:27:24 zacheiss Exp $
+# $Id$
 exec /home/mailman/moiraupdate

Modified: trunk/third/moira/gen/nagios-colo.gen
===================================================================
--- trunk/third/moira/gen/nagios-colo.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/nagios-colo.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: nagios-colo.gen,v 1.6 2008-04-17 17:24:36 zacheiss Exp $
+# $Id$
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:
 $MR_DBMS_ERR = 47836421;

Modified: trunk/third/moira/gen/nagios-colo.sh
===================================================================
--- trunk/third/moira/gen/nagios-colo.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/nagios-colo.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: nagios-colo.sh,v 1.1 2007-08-17 15:26:40 zacheiss Exp $
+# $Id$
 
 file=/var/nagios/etc/moira-colo-hosts.cfg
 

Modified: trunk/third/moira/gen/nagios-printers.gen
===================================================================
--- trunk/third/moira/gen/nagios-printers.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/nagios-printers.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: nagios-printers.gen,v 1.3 2008-04-17 17:24:36 zacheiss Exp $
+# $Id$
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:
 $MR_DBMS_ERR = 47836421;

Modified: trunk/third/moira/gen/nagios-printers.sh
===================================================================
--- trunk/third/moira/gen/nagios-printers.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/nagios-printers.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: nagios-printers.sh,v 1.1 2006-01-31 21:50:25 zacheiss Exp $
+# $Id$
 
 file=/var/nagios/etc/moira-printers.cfg
 

Modified: trunk/third/moira/gen/nagios-wsh.gen
===================================================================
--- trunk/third/moira/gen/nagios-wsh.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/nagios-wsh.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: nagios-wsh.gen,v 1.5 2008-04-17 17:24:37 zacheiss Exp $
+# $Id$
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:
 $MR_DBMS_ERR = 47836421;

Modified: trunk/third/moira/gen/nagios-wsh.sh
===================================================================
--- trunk/third/moira/gen/nagios-wsh.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/nagios-wsh.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: nagios-wsh.sh,v 1.1 2008-01-16 16:56:09 zacheiss Exp $
+# $Id$
 
 file=/var/nagios/etc/moira-wsh-hosts.cfg
 

Modified: trunk/third/moira/gen/ndb.pc
===================================================================
--- trunk/third/moira/gen/ndb.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/ndb.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: ndb.pc,v 1.5 2000-07-17 17:52:43 zacheiss Exp $
+/* $Id$
  *
  * This generates the msql database for the network tables.
  *
@@ -19,7 +19,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/ndb.pc,v 1.5 2000-07-17 17:52:43 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "ndb.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/ndb.sh
===================================================================
--- trunk/third/moira/gen/ndb.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/ndb.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -23,4 +23,4 @@
 rm -f $0
 exit 0 
 
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/ndb.sh,v 1.2 2000-05-08 18:30:30 zacheiss Exp $
+# $Header$

Modified: trunk/third/moira/gen/network.pc
===================================================================
--- trunk/third/moira/gen/network.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/network.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: network.pc,v 1.6 2001-05-23 21:31:03 zacheiss Exp $
+/* $Id$
  *
  * This generates the network table.
  *
@@ -22,7 +22,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/network.pc,v 1.6 2001-05-23 21:31:03 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "network.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/nfs.pc
===================================================================
--- trunk/third/moira/gen/nfs.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/nfs.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: nfs.pc,v 1.12 2002-08-13 15:49:31 zacheiss Exp $
+/* $Id$
  *
  * This generates the files necessary to load an nfs server.
  *
@@ -23,7 +23,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/nfs.pc,v 1.12 2002-08-13 15:49:31 zacheiss Exp $");
+RCSID("$Header$");
 
 #define min(x, y)	((x) < (y) ? (x) : (y))
 

Modified: trunk/third/moira/gen/nfs.sh
===================================================================
--- trunk/third/moira/gen/nfs.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/nfs.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # This script performs nfs updates on servers.
 #
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/nfs.sh,v 1.25 2000-05-25 05:43:22 zacheiss Exp $
+# $Header$
 
 # redirect output, and find the credentials directory (not robust, but
 # works for now).

Modified: trunk/third/moira/gen/pobox.pc
===================================================================
--- trunk/third/moira/gen/pobox.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/pobox.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: pobox.pc,v 1.8 2002-03-15 18:11:19 zacheiss Exp $
+/* $Id$
  *
  * This generates a list of everyone's poboxes for the mitdir.
  *
@@ -21,7 +21,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/pobox.pc,v 1.8 2002-03-15 18:11:19 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "pobox.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/postoffice.pc
===================================================================
--- trunk/third/moira/gen/postoffice.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/postoffice.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: postoffice.pc,v 1.2 2000-11-30 23:27:48 zacheiss Exp $
+/* $Id$
  *
  * This generates the post office location data.
  *
@@ -21,7 +21,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/postoffice.pc,v 1.2 2000-11-30 23:27:48 zacheiss Exp $");
+RCSID("$Header$");
 
 
 #ifndef PO_SUBDIR

Modified: trunk/third/moira/gen/postoffice.sh
===================================================================
--- trunk/third/moira/gen/postoffice.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/postoffice.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 #!/bin/sh 
 # This script performs postoffice updates.
 #
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/postoffice.sh,v 1.3 2000-05-08 18:30:30 zacheiss Exp $
+# $Header$
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
 export PATH

Modified: trunk/third/moira/gen/print.pc
===================================================================
--- trunk/third/moira/gen/print.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/print.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: print.pc,v 1.10 2004-06-22 18:26:27 zacheiss Exp $
+/* $Id$
  *
  * This generates printcaps and other files for Athena print servers
  *
@@ -22,7 +22,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/print.pc,v 1.10 2004-06-22 18:26:27 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami = "print.gen";
 char *db = "moira/moira";

Modified: trunk/third/moira/gen/print.sh
===================================================================
--- trunk/third/moira/gen/print.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/print.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $Id: print.sh,v 1.5 2002-02-23 03:53:49 zacheiss Exp $
+# $Id$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then
     exec >/var/athena/moira_update.log 2>&1

Modified: trunk/third/moira/gen/rt.sh
===================================================================
--- trunk/third/moira/gen/rt.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/rt.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: rt.sh,v 1.1 2007-10-25 14:47:54 zacheiss Exp $
+# $Id$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then 
     exec >/var/athena/moira_update.log 2>&1

Modified: trunk/third/moira/gen/sapprint.gen
===================================================================
--- trunk/third/moira/gen/sapprint.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/sapprint.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: sapprint.gen,v 1.3 2000-12-22 20:22:34 zacheiss Exp $
+# $Id$
 
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:

Modified: trunk/third/moira/gen/sapprint.sh
===================================================================
--- trunk/third/moira/gen/sapprint.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/sapprint.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $Id: sapprint.sh,v 1.3 2007-04-03 15:36:01 zacheiss Exp $
+# $Id$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then 
     exec >/var/athena/moira_update.log 2>&1

Modified: trunk/third/moira/gen/setquota.c
===================================================================
--- trunk/third/moira/gen/setquota.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/setquota.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 /*
- *      $Source: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/setquota.c,v $
- *      $Author: danw $
- *      $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/setquota.c,v 1.8 1998-01-06 20:39:51 danw Exp $
+ *      $Source$
+ *      $Author$
+ *      $Header$
  *
  *      Copyright (C) 1987 by the Massachusetts Institute of Technology
  *
@@ -13,7 +13,7 @@
  */
 
 #ifndef lint
-static char *rcsid_setquota_c = "$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/setquota.c,v 1.8 1998-01-06 20:39:51 danw Exp $";
+static char *rcsid_setquota_c = "$Header$";
 #endif lint
 
 #include <stdio.h>

Modified: trunk/third/moira/gen/spwatch.gen
===================================================================
--- trunk/third/moira/gen/spwatch.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/spwatch.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/moira/bin/perl -Tw
-# $Id: spwatch.gen,v 1.2 2001-08-28 02:38:20 jweiss Exp $
+# $Id$
 #
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:

Modified: trunk/third/moira/gen/tar.c
===================================================================
--- trunk/third/moira/gen/tar.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/tar.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: tar.c,v 1.2 1999-07-12 16:27:56 danw Exp $
+/* $Id$
  *
  * Utility routines for writing tar files.
  *
@@ -16,7 +16,7 @@
 
 #include "util.h"
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/tar.c,v 1.2 1999-07-12 16:27:56 danw Exp $");
+RCSID("$Header$");
 
 static char tar_zeros[512];
 

Modified: trunk/third/moira/gen/tsm.gen
===================================================================
--- trunk/third/moira/gen/tsm.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/tsm.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: tsm.gen,v 1.2 2007-05-29 18:49:15 zacheiss Exp $
+# $Id$
 
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:

Modified: trunk/third/moira/gen/tsm.sh
===================================================================
--- trunk/third/moira/gen/tsm.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/tsm.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: tsm.sh,v 1.2 2007-07-03 19:22:09 zacheiss Exp $
+# $Id$
 
 outfile=/tsm-mit/data/tsmlists
 loadprog=/tsm-mit/bin/loadAdminTable.pl

Modified: trunk/third/moira/gen/util.c
===================================================================
--- trunk/third/moira/gen/util.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/util.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: util.c,v 1.14 2000-11-30 23:27:48 zacheiss Exp $
+/* $Id$
  *
  * Utility routines used by the MOIRA extraction programs.
  *
@@ -16,7 +16,7 @@
 
 #include "util.h"
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/util.c,v 1.14 2000-11-30 23:27:48 zacheiss Exp $");
+RCSID("$Header$");
 
 /* Julian day of the UNIX epoch (January 1, 1970) */
 #define UNIX_EPOCH 2440588

Modified: trunk/third/moira/gen/warehouse.gen
===================================================================
--- trunk/third/moira/gen/warehouse.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/warehouse.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/usr/athena/bin/perl -Tw
 #
-# $Id: warehouse.gen,v 1.1 2007-01-03 20:31:58 zacheiss Exp $
+# $Id$
 # Generate a database extract from the users table for the MIT Data Warehouse.
 $MR_DBMS_ERR = 47836421;
 $MR_OCONFIG = 47836460;

Modified: trunk/third/moira/gen/warehouse.sh
===================================================================
--- trunk/third/moira/gen/warehouse.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/warehouse.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: warehouse.sh,v 1.5 2007-01-03 20:31:59 zacheiss Exp $
+# $Id$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then
     exec >/var/athena/moira_update.log 2>&1

Modified: trunk/third/moira/gen/winad.pc
===================================================================
--- trunk/third/moira/gen/winad.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/winad.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: winad.pc,v 1.6 2004-07-26 20:17:10 zacheiss Exp $
+/* $Id$
  *
  * This generates the user, list, list membership, filesys data
  * for windows active directory update

Modified: trunk/third/moira/gen/winstats.gen
===================================================================
--- trunk/third/moira/gen/winstats.gen	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/winstats.gen	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/moira/bin/perl -Tw
 
-# $Id: winstats.gen,v 1.1 2003-12-15 20:16:23 zacheiss Exp $
+# $Id$
 
 # The following exit codes are defined and MUST BE CONSISTENT with the
 # error codes the library uses:

Modified: trunk/third/moira/gen/winstats.sh
===================================================================
--- trunk/third/moira/gen/winstats.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/winstats.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: winstats.sh,v 1.4 2003-12-16 20:51:00 zacheiss Exp $
+# $Id$
 
 dir=/var/ops/populate/stats
 tarfile=/var/tmp/winstats.out

Modified: trunk/third/moira/gen/www.pc
===================================================================
--- trunk/third/moira/gen/www.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/www.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: www.pc,v 1.8 2002-04-05 22:53:50 zacheiss Exp $
+/* $Id$
  *
  * This generates the web server user & group data.
  *
@@ -21,7 +21,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/www.pc,v 1.8 2002-04-05 22:53:50 zacheiss Exp $");
+RCSID("$Header$");
 
 
 #ifndef WWW_SUBDIR

Modified: trunk/third/moira/gen/www.sh
===================================================================
--- trunk/third/moira/gen/www.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/www.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # This script performs updates of the web server.
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/www.sh,v 1.3 2000-05-24 04:29:03 danw Exp $
+# $Header$
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
 export PATH

Modified: trunk/third/moira/gen/zephyr.pc
===================================================================
--- trunk/third/moira/gen/zephyr.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/zephyr.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: zephyr.pc,v 1.2 2000-01-10 23:09:15 danw Exp $
+/* $Id$
  *
  * This generates zephyr acl files
  *
@@ -21,7 +21,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/zephyr.pc,v 1.2 2000-01-10 23:09:15 danw Exp $");
+RCSID("$Header$");
 
 void do_class(TARFILE *tf, char *class);
 void dump_zacl(FILE *out, char *type, int id);

Modified: trunk/third/moira/gen/zephyr.sh
===================================================================
--- trunk/third/moira/gen/zephyr.sh	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/zephyr.sh	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: zephyr.sh,v 1.4 2000-05-08 18:30:31 zacheiss Exp $
+# $Id$
 
 if [ -d /var/athena ] && [ -w /var/athena ]; then
     exec >/var/athena/moira_update.log 2>&1

Modified: trunk/third/moira/gen/zero_quotas
===================================================================
--- trunk/third/moira/gen/zero_quotas	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/gen/zero_quotas	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 #!/bin/csh -f
 #
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/zero_quotas,v 1.4 1998-01-05 19:52:53 danw Exp $
+# $Header$
 #
 # This script zeros quotas for uid's which are not in standard input
 # Note that the input must be sorted in increasing order by uid.

Modified: trunk/third/moira/include/Makefile.in
===================================================================
--- trunk/third/moira/include/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/include/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.2 1999-07-12 16:21:05 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 

Modified: trunk/third/moira/include/mit-copyright.h
===================================================================
--- trunk/third/moira/include/mit-copyright.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/include/mit-copyright.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mit-copyright.h,v 1.3 1998-02-05 22:51:16 danw Exp $
+/* $Id$
 
 Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
 

Modified: trunk/third/moira/include/moira.h
===================================================================
--- trunk/third/moira/include/moira.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/include/moira.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: moira.h,v 1.34 2008-04-17 20:51:16 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
  *

Modified: trunk/third/moira/include/moira_site.h
===================================================================
--- trunk/third/moira/include/moira_site.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/include/moira_site.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: moira_site.h,v 1.51 2007-11-29 21:09:02 zacheiss Exp $
+/* $Id$
  *
  * This file contains all definitions that allow easy access to
  * elements returned by most of the @i[Moira] queries.  It also defines

Modified: trunk/third/moira/include/mrclient.h
===================================================================
--- trunk/third/moira/include/mrclient.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/include/mrclient.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mrclient.h,v 1.4 2000-08-25 23:06:36 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1999 by the Massachusetts Institute of Technology
  *

Modified: trunk/third/moira/include/ureg_proto.h
===================================================================
--- trunk/third/moira/include/ureg_proto.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/include/ureg_proto.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: ureg_proto.h,v 1.5 1998-02-05 22:51:18 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
  *

Modified: trunk/third/moira/incremental/Makefile.in
===================================================================
--- trunk/third/moira/incremental/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.10 2003-01-02 01:05:36 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/incremental/afs/Makefile.in
===================================================================
--- trunk/third/moira/incremental/afs/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/afs/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.2 2002-09-25 20:46:53 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/incremental/afs/afs.c
===================================================================
--- trunk/third/moira/incremental/afs/afs.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/afs/afs.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/incremental/afs/afs.c,v 1.3 2006-08-22 17:36:25 zacheiss Exp $
+/* $Header$
  *
  * Do AFS incremental updates
  *

Modified: trunk/third/moira/incremental/afs/afs_utils.pl
===================================================================
--- trunk/third/moira/incremental/afs/afs_utils.pl	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/afs/afs_utils.pl	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/incremental/afs/afs_utils.pl,v 1.5 2004-06-11 21:07:44 zacheiss Exp $
+# $Header$
 
 use Fcntl;
 

Modified: trunk/third/moira/incremental/ksrvtgt.c
===================================================================
--- trunk/third/moira/incremental/ksrvtgt.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/ksrvtgt.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,6 +1,6 @@
 /*
- * $Source: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/incremental/ksrvtgt.c,v $
- * $Author: danw $
+ * $Source$
+ * $Author$
  *
  * Copyright 1988 by the Massachusetts Institute of Technology.
  *
@@ -21,7 +21,7 @@
 /*#include <conf.h>*/
 
 char rcsid[] =
-    "$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/incremental/ksrvtgt.c,v 1.7 1998-02-05 22:51:20 danw Exp $";
+    "$Header$";
 
 void usage(char **argv);
 

Modified: trunk/third/moira/incremental/mailman/Makefile.in
===================================================================
--- trunk/third/moira/incremental/mailman/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/mailman/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.1 2002-12-03 21:40:33 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/incremental/winad/Makefile.in
===================================================================
--- trunk/third/moira/incremental/winad/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.3 2006-05-13 02:36:08 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/incremental/winad/gssldap-int.h
===================================================================
--- trunk/third/moira/incremental/winad/gssldap-int.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/gssldap-int.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1998-2000 Luke Howard. All rights reserved.
  * CONFIDENTIAL
- * $Id: gssldap-int.h,v 1.1 2000-06-06 04:38:34 zacheiss Exp $
+ * $Id$
  *
  * Structures for handling GSS-API binds within LDAP client
  * and server libraries. This isn't entirely SASL specific,

Modified: trunk/third/moira/incremental/winad/gssldap.h
===================================================================
--- trunk/third/moira/incremental/winad/gssldap.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/gssldap.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1998-2000 Luke Howard. All rights reserved.
  * CONFIDENTIAL
- * $Id: gssldap.h,v 1.1 2000-06-06 04:38:34 zacheiss Exp $
+ * $Id$
  *
  * Public client API for GSS-API LDAP SASL mechanism.
  */

Modified: trunk/third/moira/incremental/winad/gsssasl.h
===================================================================
--- trunk/third/moira/incremental/winad/gsssasl.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/gsssasl.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1998-2000 Luke Howard. All rights reserved.
  * CONFIDENTIAL
- * $Id: gsssasl.h,v 1.1 2000-06-06 04:38:34 zacheiss Exp $
+ * $Id$
  *
  * General GSS-API SASL (not LDAP specific) stuff.
  */

Modified: trunk/third/moira/incremental/winad/krb5_utils.c
===================================================================
--- trunk/third/moira/incremental/winad/krb5_utils.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/krb5_utils.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -42,7 +42,7 @@
                CONTEXT_SPECIFIC = 0x80, PRIVATE = 0xC0 } asn1_class;
 #endif
 
-static const char rcsid[] = "$Id: krb5_utils.c,v 1.3 2001-04-23 02:11:22 zacheiss Exp $";
+static const char rcsid[] = "$Id$";
 
 asn1_error_code asn1_encode_realm(asn1buf *buf, const krb5_principal val, 
                                   int *retlen);

Modified: trunk/third/moira/incremental/winad/ldap-int.h
===================================================================
--- trunk/third/moira/incremental/winad/ldap-int.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/ldap-int.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -471,10 +471,10 @@
  * following macros. This is so we can plug-in alternative memory
  * allocators, etc. as the need arises.
  */
-#define NSLDAPI_MALLOC( size )		nsldapi_malloc( size )
+#define NSLDAPI_MALLOC( size )		ldap_x_malloc( size )
 #define NSLDAPI_CALLOC( nelem, elsize )	nsldapi_calloc( nelem, elsize )
 #define NSLDAPI_REALLOC( ptr, size )	nsldapi_realloc( ptr, size )
-#define NSLDAPI_FREE( ptr )		nsldapi_free( ptr )
+#define NSLDAPI_FREE( ptr )		ldap_x_free( ptr )
 
 
 /*

Modified: trunk/third/moira/incremental/winad/ldap_adgssapi_bind.c
===================================================================
--- trunk/third/moira/incremental/winad/ldap_adgssapi_bind.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/ldap_adgssapi_bind.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1998-2000 Luke Howard. All rights reserved.
  * CONFIDENTIAL
- * $Id: ldap_adgssapi_bind.c,v 1.5 2003-07-29 20:22:33 zacheiss Exp $
+ * $Id$
  *
  * Implementation of GSS-API client side binding for SASL
  */

Modified: trunk/third/moira/incremental/winad/setpw.c
===================================================================
--- trunk/third/moira/incremental/winad/setpw.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/setpw.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -99,7 +99,7 @@
 #endif
 #endif /* _WIN32 && !__CYGWIN32__ */
 
-static const char rcsid[] = "$Id: setpw.c,v 1.7 2006-05-13 02:37:18 zacheiss Exp $";
+static const char rcsid[] = "$Id$";
 
 static int frequency[26][26] =
 { {4, 20, 28, 52, 2, 11, 28, 4, 32, 4, 6, 62, 23, 167, 2, 14, 0, 83, 76, 
@@ -698,7 +698,7 @@
   static char temp[128];
   ULONG       version = LDAP_VERSION3;
   ULONG       rc;
-  int         Max_wait_time = 500;
+  int         Max_wait_time = 1000;
   int         Max_size_limit = LDAP_NO_LIMIT;
 
   if (strlen(ldap_domain) == 0)
@@ -764,7 +764,7 @@
           rc = ldap_set_option((*ldap_handle), LDAP_OPT_SIZELIMIT, 
                                (void *)&Max_size_limit);
           rc = ldap_set_option((*ldap_handle), LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
-          rc = ldap_adgssapi_bind((*ldap_handle), dn_path, GSSSASL_PRIVACY_PROTECTION);
+          rc = ldap_adgssapi_bind((*ldap_handle), dn_path, 0);
           if (rc == LDAP_SUCCESS)
             {
               if (connect_to_kdc)

Modified: trunk/third/moira/incremental/winad/winad.c
===================================================================
--- trunk/third/moira/incremental/winad/winad.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/incremental/winad/winad.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,93 +1,149 @@
-/* $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/incremental/winad/winad.c,v 1.50 2007-07-12 15:58:28 zacheiss Exp $
-/* winad.incr arguments examples
+/* $Header$
+/* winad.incr arguments example
  *
- * arguments when moira creates the account - ignored by winad.incr since the account is unusable.
- * users 0 11 #45198 45198 /bin/cmd cmd Last First Middle 0 950000001 2000 121049
- *   login, unix_uid, shell, winconsoleshell, last, first, middle, status, mitid, type, moiraid
+ * arguments when moira creates the account - ignored by winad.incr since the 
+ * account is unusable. users 0 11 #45198 45198 /bin/cmd cmd Last First Middle
+ * 0 950000001 2000 121049
  *
+ * login, unix_uid, shell, winconsoleshell, last, 
+ * first, middle, status, mitid, type, moiraid
+ *
  * arguments for creating or updating a user account 
- * users 11 11 username 45206 /bin/cmd cmd Last First Middle 2 950000001 STAFF 121058  PathToHomeDir PathToProfileDir username 45206 /bin/cmd cmd Last First Middle 1 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
- * users 11 11 #45206 45206 /bin/cmd cmd Last First Middle 0 950000001 STAFF 121058  PathToHomeDir PathToProfileDir newuser 45206 /bin/cmd cmd Last First Middle 2 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
- *   login, unix_uid, shell, winconsoleshell, last, first, middle, status, mitid, type, moiraid
+ * users 11 11 username 45206 /bin/cmd cmd Last First Middle 2 950000001 STAFF
+ * 121058  PathToHomeDir PathToProfileDir username 45206 /bin/cmd cmd Last
+ * First Middle 1 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
+ * users 11 11 #45206 45206 /bin/cmd cmd Last First Middle 0 950000001 STAFF
+ * 121058  PathToHomeDir PathToProfileDir newuser 45206 /bin/cmd cmd Last
+ * First Middle 2 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
  *
+ * login, unix_uid, shell, winconsoleshell, last, first, middle, status, 
+ * mitid, type, moiraid
+ *
  * arguments for deactivating/deleting a user account
- * users 11 11 username 45206 /bin/cmd cmd Last First Middle 1 950000001 STAFF 121058  PathToHomeDir PathToProfileDir username 45206 /bin/cmd cmd Last First Middle 3 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
- * users 11 11 username 45206 /bin/cmd cmd Last First Middle 2 950000001 STAFF 121058  PathToHomeDir PathToProfileDir username 45206 /bin/cmd cmd Last First Middle 3 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
- *   login, unix_uid, shell, winconsoleshell, last, first, middle, status, mitid, type, moiraid
+ * users 11 11 username 45206 /bin/cmd cmd Last First Middle 1 950000001 STAFF
+ * 121058  PathToHomeDir PathToProfileDir username 45206 /bin/cmd cmd Last
+ * First Middle 3 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
+ * users 11 11 username 45206 /bin/cmd cmd Last First Middle 2 950000001 STAFF
+ * 121058  PathToHomeDir PathToProfileDir username 45206 /bin/cmd cmd Last
+ * First Middle 3 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
+ * 
+ * login, unix_uid, shell, winconsoleshell, last, first, middle, status,
+ * mitid, type, moiraid
  *
  * arguments for reactivating a user account
- * users 11 11 username 45206 /bin/cmd cmd Last First Middle 3 950000001 STAFF 121058 username 45206 /bin/cmd cmd Last First Middle 1 950000001 STAFF 121058
- * users 11 11 username 45206 /bin/cmd cmd Last First Middle 3 950000001 STAFF 121058 username 45206 /bin/cmd cmd Last First Middle 2 950000001 STAFF 121058
- *   login, unix_uid, shell, winconsoleshell, last, first, middle, status, mitid, type, moiraid
+ * users 11 11 username 45206 /bin/cmd cmd Last First Middle 3 950000001 STAFF
+ * 121058 username 45206 /bin/cmd cmd Last First Middle 1 950000001 STAFF
+ * 121058
+ * users 11 11 username 45206 /bin/cmd cmd Last First Middle 3 950000001 STAFF
+ * 121058 username 45206 /bin/cmd cmd Last First Middle 2 950000001 STAFF 12105
  *
+ * login, unix_uid, shell, winconsoleshell, last, first, middle, status, 
+ * mitid, type, moiraid
+ *
  * arguments for changing user name
- * users 11 11 oldusername 45206 /bin/cmd cmd Last First Middle 1 950000001 STAFF 121058 PathToHomeDir PathToProfileDir newusername 45206 /bin/cmd cmd Last First Middle 1 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
- *   login, unix_uid, shell, winconsoleshell, last, first, middle, status, mitid, type, moiraid
+ * users 11 11 oldusername 45206 /bin/cmd cmd Last First Middle 1 950000001 
+ * STAFF 121058 PathToHomeDir PathToProfileDir newusername 45206 /bin/cmd cmd 
+ * Last First Middle 1 950000001 STAFF 121058 PathToHomeDir PathToProfileDir
  *
+ * login, unix_uid, shell, winconsoleshell, last, first, middle, status, 
+ * mitid, type, moiraid
+ *
  * arguments for expunging a user
- * users 11 0 username 45198 /bin/cmd cmd Last First Middle 0 950000001 2000 121049
- *   login, unix_uid, shell, winconsoleshell, last, first, middle, status, mitid, type, moiraid
+ * users 11 0 username 45198 /bin/cmd cmd Last First Middle 0 950000001 2000
+ * 121049
  *
+ * login, unix_uid, shell, winconsoleshell, last, first, middle, status, 
+ * mitid, type, moiraid
+ *
  * arguments for creating a "special" group/list
  * list 0 11 listname 1 1 0 0 0 -1 NONE 0 description 92616
- *   listname, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, moiraid
+ *
+ * listname, active, publicflg, hidden, maillist, grouplist, gid, acl_type, 
+ * acl_id, description, moiraid
  * 
  * arguments for creating a "mail" group/list
  * list 0 11 listname 1 1 0 1 0 -1 NONE 0 description 92616
- *   listname, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, moiraid
  *
+ * listname, active, publicflg, hidden, maillist, grouplist, gid, acl_type, 
+ * acl_id, description, moiraid
+ *
  * arguments for creating a "group" group/list
  * list 0 11 listname 1 1 0 0 1 -1 NONE 0 description 92616
- *   listname, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, moiraid
+ * 
+ * listname, active, publicflg, hidden, maillist, grouplist, gid, acl_type, 
+ * acl_id, description, moiraid
  *
  * arguments for creating a "group/mail" group/list
  * list 0 11 listname 1 1 0 1 1 -1 NONE 0 description 92616
- *   listname, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, moiraid
  *
+ * listname, active, publicflg, hidden, maillist, grouplist, gid, acl_type, 
+ * acl_id, description, moiraid
+ *
  * arguments to add a USER member to group/list
  * imembers 0 12 listname USER userName 1 1 0 0 0 -1 1 92616 121047
- *   list_name, user_type, name, active, publicflg, hidden, maillist, grouplist, gid, userStatus, moiraListId, moiraUserId
  *
+ * list_name, user_type, name, active, publicflg, hidden, maillist, grouplist,
+ * gid, userStatus, moiraListId, moiraUserId
+ *
  * arguments to add a STRING or KERBEROS member to group/list
  * imembers 0 10 listname STRING stringName 1 1 0 0 0 -1 92616
  * imembers 0 10 listlistnameName KERBEROS kerberosName 1 1 0 0 0 -1 92616
- *   list_name, user_type, name, active, publicflg, hidden, maillist, grouplist, gid, moiraListId
  *
+ * list_name, user_type, name, active, publicflg, hidden, maillist, grouplist,
+ * gid, moiraListId
+ *
  * NOTE: group members of type LIST are ignored.
  *
  * arguments to remove a USER member to group/list
  * imembers 12 0 listname USER userName 1 1 0 0 0 -1 1 92616 121047
- *   list_name, user_type, name, active, publicflg, hidden, maillist, grouplist, gid, userStatus, moiraListId, moiraUserId
+ * 
+ * list_name, user_type, name, active, publicflg, hidden, maillist, grouplist,
+ * gid, userStatus, moiraListId, moiraUserId
  *
  * arguments to remove a STRING or KERBEROS member to group/list
  * imembers 10 0 listname STRING stringName 1 1 0 0 0 -1 92616
  * imembers 10 0 listname KERBEROS kerberosName 1 1 0 0 0 -1 92616
- *   list_name, user_type, name, active, publicflg, hidden, maillist, grouplist, gid, moiraListId
  *
+ * list_name, user_type, name, active, publicflg, hidden, maillist, grouplist,
+ * gid, moiraListId
+ *
  * NOTE: group members of type LIST are ignored.
  *
  * arguments for renaming a group/list
- * list 11 11 oldlistname 1 1 0 0 0 -1 NONE 0 description 92616 newlistname 1 1 0 0 0 -1 description 0 92616
- *   name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, moiraListId
+ * list 11 11 oldlistname 1 1 0 0 0 -1 NONE 0 description 92616 newlistname 1
+ * 1 0 0 0 -1 description 0 92616
+ * 
+ * name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, 
+ * acl_id, description, moiraListId
  *
  * arguments for deleting a group/list
  * list 11 0 listname 1 1 0 0 0 -1 NONE 0 description 92616
- *   name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, moiraListId
  *
+ * name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, 
+ * acl_id, description, moiraListId
+ *
  * arguments for adding a file system
- * filesys 0 12 username AFS ATHENA.MIT.EDU /afs/athena.mit.edu/user/n/e/username /mit/username w descripton username wheel 1 HOMEDIR 101727
+ * filesys 0 12 username AFS ATHENA.MIT.EDU 
+ * /afs/athena.mit.edu/user/n/e/username /mit/username w descripton username
+ * wheel 1 HOMEDIR 101727
  *
  * arguments for deleting a file system
- * filesys 12 0 username AFS ATHENA.MIT.EDU /afs/athena.mit.edu/user/n/e/username /mit/username w descripton username wheel 1 HOMEDIR 101727
+ * filesys 12 0 username AFS ATHENA.MIT.EDU 
+ * /afs/athena.mit.edu/user/n/e/username /mit/username w descripton username
+ * wheel 1 HOMEDIR 101727
  *
  * arguments when moira creates a container (OU).
- * containers 0 8 machines/test/bottom description location contact USER 105316 2222 [none]
+ * containers 0 8 machines/test/bottom description location contact USER
+ * 105316 2222 [none]
  *
  * arguments when moira deletes a container (OU).
- * containers 8 0 machines/test/bottom description location contact USER 105316 2222 groupname
+ * containers 8 0 machines/test/bottom description location contact USER 
+ * 105316 2222 groupname
  *
  * arguments when moira modifies a container information (OU).
- * containers 8 8 machines/test/bottom description location contact USER 105316 2222 groupname machines/test/bottom description1 location contact USER 105316 2222 groupname
+ * containers 8 8 machines/test/bottom description location contact USER 
+ * 105316 2222 groupname machines/test/bottom description1 location contact 
+ * USER 105316 2222 groupname
  *
  * arguments when moira adds a machine from an OU
  * table name, beforec, afterc, machine_name, container_name, mach_id, cnt_id
@@ -98,7 +154,9 @@
  * mcntmap 0 5 DAVIDT.MIT.EDU dttest/dttest1 76767 46 groupname
  *
 */
+
 #include <mit-copyright.h>
+
 #ifdef _WIN32
 #include <winsock2.h>
 #include <windows.h>
@@ -106,6 +164,7 @@
 #include <malloc.h>
 #include <lmaccess.h>
 #endif
+
 #include <hesiod.h>
 #include <string.h>
 #include <ldap.h>
@@ -115,7 +174,7 @@
 #include <mrclient.h>
 #include <krb5.h>
 #include <gsssasl.h>
-#include <gssldap.h>
+#include <gssldap.h> 
 #include "kpasswd.h"
 
 #ifdef _WIN32
@@ -288,15 +347,19 @@
 #define NOT_HIDDEN_GROUP            "NotHiddenGroup.g"
 #define NOT_HIDDEN_GROUP_WITH_ADMIN "NotHiddenGroupWithAdmin.g"
 
+#define ADDRESS_LIST_PREFIX "CN=MIT Directory,CN=All Address Lists,\
+CN=Address Lists Container,CN=Massachusetts Institute of Technology,\
+CN=Microsoft Exchange,CN=Services,CN=Configuration,"
+
 #define ADD_ATTR(t, v, o) 		\
   mods[n] = malloc(sizeof(LDAPMod));	\
-  mods[n]->mod_op = o;	\
+  mods[n]->mod_op = o;	                \
   mods[n]->mod_type = t; 		\
   mods[n++]->mod_values = v
 
-#define DEL_ATTR(t, o) 		\
+#define DEL_ATTR(t, o) 		        \
   DelMods[i] = malloc(sizeof(LDAPMod));	\
-  DelMods[i]->mod_op = o;	\
+  DelMods[i]->mod_op = o;	        \
   DelMods[i]->mod_type = t; 		\
   DelMods[i++]->mod_values = NULL
 
@@ -306,21 +369,18 @@
 #define SERVER  "SERVER:"
 #define MSSFU   "SFU:"
 #define SFUTYPE "30"
+#define GROUP_SUFFIX "GROUP_SUFFIX:"
+#define GROUP_TYPE   "GROUP_TYPE:"
+#define SET_GROUP_ACE    "SET_GROUP_ACE:"
+#define SET_PASSWORD "SET_PASSWORD:"
+#define EXCHANGE "EXCHANGE:"
+#define PROCESS_MACHINE_CONTAINER "PROCESS_MACHINE_CONTAINER:"
 #define MAX_DOMAINS 10
 char DomainNames[MAX_DOMAINS][128];
 
-char    PrincipalName[128];
-#ifndef _WIN32
-#define KRB5CCNAME "KRB5CCNAME=/tmp/krb5cc_winad.incr"
-#define KRBTKFILE "KRBTKFILE=/tmp/tkt_winad.incr"
-#define KEYTABFILE "/etc/krb5.keytab"
-#else
-#define KRB5CCNAME "KRB5CCNAME=\\tmp\\krb5cc_winad.incr"
-#define KRBTKFILE "KRBTKFILE=\\tmp\\tkt_winad.incr"
-#define KEYTABFILE "\\keytabs\\krb5.keytab"
-#endif
+LK_ENTRY *member_base = NULL;
 
-LK_ENTRY *member_base = NULL;
+char   PrincipalName[128];
 static char tbl_buf[1024];
 char  kerberos_ou[] = "OU=kerberos,OU=moira";
 char  contact_ou[] = "OU=strings,OU=moira";
@@ -336,20 +396,27 @@
 char *whoami;
 char ldap_domain[256];
 char *ServerList[MAX_SERVER_NAMES];
+char default_server[256];
+static char tbl_buf[1024];
+char group_suffix[256];
+char exchange_acl[256];
 int  mr_connections = 0;
 int  callback_rc;
-char default_server[256];
-static char tbl_buf[1024];
 int  UseSFU30 = 0;
-int  NoChangeConfigFile;
+int  UseGroupSuffix = 1;
+int  UseGroupUniversal = 0;
+int  SetGroupAce = 1;
+int  SetPassword = 1;
+int  Exchange = 0;
+int  ProcessMachineContainer = 1;
 int  UpdateDomainList;
 
 extern int set_password(char *user, char *password, char *domain);
 
 int ad_get_group(LDAP *ldap_handle, char *dn_path, char *group_name, 
-                char *group_membership, char *MoiraId, char *attribute,
-                LK_ENTRY **linklist_base, int *linklist_count,
-              char *rFilter);
+		 char *group_membership, char *MoiraId, char *attribute,
+		 LK_ENTRY **linklist_base, int *linklist_count,
+		 char *rFilter);
 void AfsToWinAfs(char* path, char* winPath);
 int ad_connect(LDAP **ldap_handle, char *ldap_domain, char *dn_path, 
                char *Win2kPassword, char *Win2kUser, char *default_server,
@@ -357,11 +424,12 @@
 void ad_kdc_disconnect();
 int ad_server_connect(char *connectedServer, char *domain);
 int attribute_update(LDAP *ldap_handle, char *distinguished_name, 
-                      char *attribute_value, char *attribute, char *user_name);
+		     char *attribute_value, char *attribute, char *user_name);
 int BEREncodeSecurityBits(ULONG uBits, char *pBuffer);
 int checkADname(LDAP *ldap_handle, char *dn_path, char *Name);
 int check_winad(void);
-int check_user(LDAP *ldap_handle, char *dn_path, char *UserName, char *MoiraId);
+int check_user(LDAP *ldap_handle, char *dn_path, char *UserName, 
+	       char *MoiraId);
 /* containers */
 int container_adupdate(LDAP *ldap_handle, char *dn_path, char *dName, 
                        char *distinguishedName, int count, char **av);
@@ -369,20 +437,21 @@
 int container_create(LDAP *ldap_handle, char *dn_path, int count, char **av);
 int container_delete(LDAP *ldap_handle, char *dn_path, int count, char **av);
 int container_get_distinguishedName(LDAP *ldap_handle, char *dn_path, 
-                                     char *distinguishedName, int count, char **av);
+				    char *distinguishedName, int count, 
+				    char **av);
 void container_get_dn(char *src, char *dest);
 void container_get_name(char *src, char *dest);
 int container_move_objects(LDAP *ldap_handle, char *dn_path, char *dName);
-int container_rename(LDAP *ldap_handle, char *dn_path, int beforec, char **before, 
-                     int afterc, char **after);
-int container_update(LDAP *ldap_handle, char *dn_path, int beforec, char **before,
-                     int afterc, char **after);
+int container_rename(LDAP *ldap_handle, char *dn_path, int beforec, 
+		     char **before, int afterc, char **after);
+int container_update(LDAP *ldap_handle, char *dn_path, int beforec, 
+		     char **before, int afterc, char **after);
 
 int GetAceInfo(int ac, char **av, void *ptr);
-int GetServerList(char *ldap_domain, char **MasterServe);
 int get_group_membership(char *group_membership, char *group_ou, 
                          int *security_flag, char **av);
-int get_machine_ou(LDAP *ldap_handle, char *dn_path, char *member, char *machine_ou, char *pPtr);
+int get_machine_ou(LDAP *ldap_handle, char *dn_path, char *member, 
+		   char *machine_ou, char *pPtr);
 int Moira_container_group_create(char **after);
 int Moira_container_group_delete(char **before);
 int Moira_groupname_create(char *GroupName, char *ContainerName,
@@ -396,17 +465,19 @@
 		       int ParentFlag);
 int Moira_setContainerGroup(char *ContainerName, char *GroupName);
 int ProcessAce(LDAP *ldap_handle, char *dn_path, char *group_name, char *Type,
-               int UpdateGroup, int *ProcessGroup);
+               int UpdateGroup, int *ProcessGroup, char *maillist);
 int process_group(LDAP *ldap_handle, char *dn_path, char *MoiraId, 
                   char *group_name, char *group_ou, char *group_membership, 
-                  int group_security_flag, int type);
+                  int group_security_flag, int type, char *maillist);
 int process_lists(int ac, char **av, void *ptr);
-int ProcessGroupSecurity(LDAP *ldap_handle, char *dn_path, char *TargetGroupName, 
-                         int HiddenGroup, char *AceType, char *AceName);
+int ProcessGroupSecurity(LDAP *ldap_handle, char *dn_path, 
+			 char *TargetGroupName, int HiddenGroup, 
+			 char *AceType, char *AceName);
 int ProcessMachineName(int ac, char **av, void *ptr);
 int ReadConfigFile(char *DomainName);
 int ReadDomainList();
 void StringTrim(char *StringToTrim);
+int save_query_info(int argc, char **argv, void *hint);
 int user_create(int ac, char **av, void *ptr);
 int user_change_status(LDAP *ldap_handle, char *dn_path, 
                        char *user_name, char *MoiraId, int operation);
@@ -416,36 +487,43 @@
                 char *user_name);
 int user_update(LDAP *ldap_handle, char *dn_path, char *user_name,
                 char *uid, char *MitId, char *MoiraId, int State,
-                char *WinHomeDir, char *WinProfileDir);
+                char *WinHomeDir, char *WinProfileDir, char *first,
+		char *middle, char *last);
 void change_to_lower_case(char *ptr);
 int contact_create(LDAP *ld, char *bind_path, char *user, char *group_ou);
+int contact_remove_email(LDAP *ld, char *bind_path,
+			 LK_ENTRY **linklist_entry, int linklist_current);
 int group_create(int ac, char **av, void *ptr);
 int group_delete(LDAP *ldap_handle, char *dn_path, 
                  char *group_name, char *group_membership, char *MoiraId);
 int group_rename(LDAP *ldap_handle, char *dn_path, 
                  char *before_group_name, char *before_group_membership, 
-                 char *before_group_ou, int before_security_flag, char *before_desc,
-                 char *after_group_name, char *after_group_membership, 
-                 char *after_group_ou, int after_security_flag, char *after_desc,
-                 char *MoiraId, char *filter);
+                 char *before_group_ou, int before_security_flag, 
+		 char *before_desc, char *after_group_name, 
+		 char *after_group_membership, char *after_group_ou, 
+		 int after_security_flag, char *after_desc,
+                 char *MoiraId, char *filter, char *maillist);
 int machine_check(LDAP *ldap_handle, char *dn_path, char *machine_name);
 int machine_GetMoiraContainer(int ac, char **av, void *ptr);
-int machine_get_moira_container(LDAP *ldap_handle, char *dn_path, char *machine_name, char *container_name);
-int machine_move_to_ou(LDAP *ldap_handle, char *dn_path, char *MoiraMachineName, char *DestinationOu);
+int machine_get_moira_container(LDAP *ldap_handle, char *dn_path, 
+				char *machine_name, char *container_name);
+int machine_move_to_ou(LDAP *ldap_handle, char *dn_path, 
+		       char *MoiraMachineName, char *DestinationOu);
 int make_new_group(LDAP *ldap_handle, char *dn_path, char *MoiraId, 
                    char *group_name, char *group_ou, char *group_membership, 
-                   int group_security_flag, int updateGroup);
+                   int group_security_flag, int updateGroup, char *maillist);
 int member_list_build(int ac, char **av, void *ptr);
 int member_add(LDAP *ldap_handle, char *dn_path, char *group_name, 
-                        char *group_ou, char *group_membership, 
-                        char *user_name, char *pUserOu, char *MoiraId);
+	       char *group_ou, char *group_membership, 
+	       char *user_name, char *pUserOu, char *MoiraId);
 int member_remove(LDAP *ldap_handle, char *dn_path, char *group_name, 
                   char *group_ou, char *group_membership, char *user_name,
                   char *pUserOu, char *MoiraId);
 int populate_group(LDAP *ldap_handle, char *dn_path, char *group_name, 
                    char *group_ou, char *group_membership, 
                    int group_security_flag, char *MoiraId);
-int SetHomeDirectory(LDAP *ldap_handle, char *user_name, char *DistinguishedName,
+int SetHomeDirectory(LDAP *ldap_handle, char *user_name, 
+		     char *DistinguishedName,
                      char *WinHomeDir, char *WinProfileDir,
                      char **homedir_v, char **winProfile_v,
                      char **drives_v, LDAPMod **mods, 
@@ -456,9 +534,8 @@
 int check_container_name(char* s);
 
 int mr_connect_cl(char *server, char *client, int version, int auth);
-void WriteDomainList();
 void do_container(LDAP *ldap_handle, char *dn_path, char *ldap_hostname,
-             char **before, int beforec, char **after, int afterc);
+		  char **before, int beforec, char **after, int afterc);
 void do_filesys(LDAP *ldap_handle, char *dn_path, char *ldap_hostname,
 		char **before, int beforec, char **after, int afterc);
 void do_list(LDAP *ldap_handle, char *dn_path, char *ldap_hostname,
@@ -497,10 +574,12 @@
 void print_to_screen(const char *fmt, ...);
 int GetMachineName(char *MachineName);
 int tickets_get_k5();
-int get_tickets();
 int destroy_cache(void);
 int dest_tkt(void);
 
+int find_homeMDB(LDAP *ldap_handle, char *dn_path, char **homeMDB,
+		 char **homeServerName);
+
 int main(int argc, char **argv)
 {
   unsigned long   rc;
@@ -516,18 +595,19 @@
   LDAP            *ldap_handle;
   char            dn_path[256];
   char            *orig_argv[64];
-
+  
   whoami = ((whoami = (char *)strrchr(argv[0], '/')) ? whoami+1 : argv[0]);
-
+  
   if (argc < 4)
     {
       com_err(whoami, 0, "Unable to process %s", "argc < 4");
       exit(1);
     }
-
+  
   if (argc < (4 + atoi(argv[2]) + atoi(argv[3])))
     {
-      com_err(whoami, 0, "Unable to process %s", "argc < (4 + beforec + afterc)");
+      com_err(whoami, 0, "Unable to process %s", 
+	      "argc < (4 + beforec + afterc)");
       exit(1);
     }
 
@@ -539,6 +619,7 @@
       strcat(tbl_buf, argv[i]);
       strcat(tbl_buf, " ");
     }
+
   com_err(whoami, 0, "%s", tbl_buf);
 
   if (check_winad())
@@ -547,17 +628,12 @@
       exit(1);
     }
 
-  if (get_tickets())
-    {
-      com_err(whoami, 0, "%s failed", "get_tickets()");
-      exit(1);
-    }
-
   initialize_sms_error_table();
   initialize_krb_error_table();
 
   UpdateDomainList = 0;
   memset(DomainNames, '\0', sizeof(DomainNames[0]) * MAX_DOMAINS);
+
   if (ReadDomainList())
     {
       com_err(whoami, 0, "%s failed", "ReadDomainList()");
@@ -583,8 +659,20 @@
       memset(ServerList, '\0', sizeof(ServerList[0]) * MAX_SERVER_NAMES);
       memset(default_server, '\0', sizeof(default_server));
       memset(dn_path, '\0', sizeof(dn_path));
+      memset(group_suffix, '\0', sizeof(group_suffix));
+      memset(exchange_acl, '\0', sizeof(exchange_acl));
+
       UseSFU30 = 0;
-      NoChangeConfigFile = 0;
+      UseGroupSuffix = 1;
+      UseGroupUniversal = 0;
+      SetGroupAce = 1;
+      SetPassword = 1;
+      Exchange = 0;
+      ProcessMachineContainer = 1;
+
+      sprintf(group_suffix, "%s", "_group");
+      sprintf(exchange_acl, "%s", "exchange-acl");
+
       beforec = atoi(orig_argv[2]);
       afterc = atoi(orig_argv[3]);
       table = orig_argv[1];
@@ -598,9 +686,7 @@
 	before = NULL;
 
       if (ReadConfigFile(DomainNames[k]))
-	{
-	  continue;
-	}
+	continue;
 
       OldUseSFU30 = UseSFU30;
 
@@ -613,35 +699,13 @@
 	      com_err(whoami, 0, "connected to domain %s", DomainNames[k]);
 	      break;
 	    }
-
-	  if (ldap_handle == NULL)
-	    {
-	      if (!NoChangeConfigFile)
-		{
-		  for (j = 0; j < MAX_SERVER_NAMES; j++)
-		    {
-		      if (ServerList[j] != NULL)
-			{
-			  free(ServerList[j]);
-			  ServerList[j] = NULL;
-			}
-		    }
-		  if (rc = GetServerList(ldap_domain, ServerList))
-		    {
-		      com_err("incremental", 0,
-			      "winad.incr cannot bind to any server in domain %s",
-			      DomainNames[k]);
-		      continue;
-		    }
-		}
-	    }
 	}
 
       if ((rc) || (ldap_handle == NULL))
 	{
   	  critical_alert("incremental",
-			 "winad.incr cannot connect to any server in domain %s",
-			 DomainNames[k]);
+			 "winad.incr cannot connect to any server in "
+			 "domain %s", DomainNames[k]);
 	  continue;
 	}
 
@@ -663,9 +727,7 @@
       else if (!strcmp(table, "mcntmap"))
 	do_mcntmap(ldap_handle, dn_path, ldap_domain, before, beforec, after,
 		   afterc);
-      if (!NoChangeConfigFile)
-	GetServerList(ldap_domain, ServerList);
-
+      
       ad_kdc_disconnect();
 
       for (i = 0; i < MAX_SERVER_NAMES; i++)
@@ -676,103 +738,126 @@
 	      ServerList[i] = NULL;
 	    }
 	}
-
+      
       rc = ldap_unbind_s(ldap_handle);
     }
-
-  if (UpdateDomainList == 1)
-    WriteDomainList();
-
-  destroy_cache();
+  
   exit(0);
 }
 
 void do_mcntmap(LDAP *ldap_handle, char *dn_path, char *ldap_hostname,
                 char **before, int beforec, char **after, int afterc)
 {
-    char    MoiraContainerName[128];
-    char    ADContainerName[128];
-    char    MachineName[1024];
-    char    OriginalMachineName[1024];
-    long    rc;
-    int     DeleteMachine;
-    char    MoiraContainerGroup[64];
+  char    MoiraContainerName[128];
+  char    ADContainerName[128];
+  char    MachineName[1024];
+  char    OriginalMachineName[1024];
+  long    rc;
+  int     DeleteMachine;
+  char    MoiraContainerGroup[64];
 
-    DeleteMachine = 0;
-    memset(ADContainerName, '\0', sizeof(ADContainerName));
-    memset(MoiraContainerName, '\0', sizeof(MoiraContainerName));
-
-    if ((beforec == 0) && (afterc == 0))
-        return;
-
-    if (rc = moira_connect())
+  if (!ProcessMachineContainer)
     {
-        critical_alert("AD incremental",
-                       "Error contacting Moira server : %s",
-                       error_message(rc));
-        return;
+      com_err(whoami, 0, "Process machines and containers disabled, skipping");
+      return;
     }
-
-    if ((beforec != 0) && (afterc == 0)) /*remove a machine*/
+  
+  DeleteMachine = 0;
+  memset(ADContainerName, '\0', sizeof(ADContainerName));
+  memset(MoiraContainerName, '\0', sizeof(MoiraContainerName));
+  
+  if ((beforec == 0) && (afterc == 0))
+    return;
+  
+  if (rc = moira_connect())
     {
-        strcpy(OriginalMachineName, before[OU_MACHINE_NAME]);
-        strcpy(MachineName, before[OU_MACHINE_NAME]);
-        strcpy(MoiraContainerGroup, before[OU_CONTAINER_GROUP]);
-        DeleteMachine = 1;
-        com_err(whoami, 0, "removing machine %s from %s", OriginalMachineName, before[OU_CONTAINER_NAME]);
+      critical_alert("AD incremental",
+		     "Error contacting Moira server : %s",
+		     error_message(rc));
+      return;
     }
-    else if ((beforec == 0) && (afterc != 0)) /*add a machine*/
+  
+  if ((beforec != 0) && (afterc == 0)) /*remove a machine*/
     {
-        strcpy(OriginalMachineName, after[OU_MACHINE_NAME]);
-        strcpy(MachineName, after[OU_MACHINE_NAME]);
-        strcpy(MoiraContainerGroup, after[OU_CONTAINER_GROUP]);
-        com_err(whoami, 0, "adding machine %s to container %s", OriginalMachineName, after[OU_CONTAINER_NAME]);
+      strcpy(OriginalMachineName, before[OU_MACHINE_NAME]);
+      strcpy(MachineName, before[OU_MACHINE_NAME]);
+      strcpy(MoiraContainerGroup, before[OU_CONTAINER_GROUP]);
+      DeleteMachine = 1;
+      com_err(whoami, 0, "removing machine %s from %s", 
+	      OriginalMachineName, before[OU_CONTAINER_NAME]);
     }
-    else
-      {
-        moira_disconnect();
-        return;
-      }
+  else if ((beforec == 0) && (afterc != 0)) /*add a machine*/
+    {
+      strcpy(OriginalMachineName, after[OU_MACHINE_NAME]);
+      strcpy(MachineName, after[OU_MACHINE_NAME]);
+      strcpy(MoiraContainerGroup, after[OU_CONTAINER_GROUP]);
+      com_err(whoami, 0, "adding machine %s to container %s", 
+	      OriginalMachineName, after[OU_CONTAINER_NAME]);
+    }
+  else
+    {
+      moira_disconnect();
+      return;
+    }
+  
+  rc = GetMachineName(MachineName);
 
-    rc = GetMachineName(MachineName);
-    if (strlen(MachineName) == 0)
+  if (strlen(MachineName) == 0)
     {
-        moira_disconnect();
-        com_err(whoami, 0, "Unable to find alais for machine %s in Moira", OriginalMachineName);
-        return;
+      moira_disconnect();
+      com_err(whoami, 0, "Unable to find alais for machine %s in Moira", 
+	      OriginalMachineName);
+      return;
     }
-    Moira_process_machine_container_group(MachineName, MoiraContainerGroup,
-					  DeleteMachine);
-    if (machine_check(ldap_handle, dn_path, MachineName))
+
+  Moira_process_machine_container_group(MachineName, MoiraContainerGroup,
+					DeleteMachine);
+
+  if (machine_check(ldap_handle, dn_path, MachineName))
     {
-        com_err(whoami, 0, "Unable to find machine %s (alias %s) in AD.", OriginalMachineName, MachineName);
-        moira_disconnect();
-        return;
+      com_err(whoami, 0, "Unable to find machine %s (alias %s) in AD.", 
+	      OriginalMachineName, MachineName);
+      moira_disconnect();
+      return;
     }
-    memset(MoiraContainerName, '\0', sizeof(MoiraContainerName));
-    machine_get_moira_container(ldap_handle, dn_path, MachineName, MoiraContainerName);
-    if (strlen(MoiraContainerName) == 0)
+
+  memset(MoiraContainerName, '\0', sizeof(MoiraContainerName));
+  machine_get_moira_container(ldap_handle, dn_path, MachineName, 
+			      MoiraContainerName);
+
+  if (strlen(MoiraContainerName) == 0)
     {
-        com_err(whoami, 0, "Unable to fine machine %s (alias %s) container in Moira - moving to orphans OU.",
-                OriginalMachineName, MachineName);
-        machine_move_to_ou(ldap_handle, dn_path, MachineName, orphans_machines_ou);
-        moira_disconnect();
-        return;
+      com_err(whoami, 0, "Unable to fine machine %s (alias %s) container "
+	      "in Moira - moving to orphans OU.",
+	      OriginalMachineName, MachineName);
+      machine_move_to_ou(ldap_handle, dn_path, MachineName, 
+			 orphans_machines_ou);
+      moira_disconnect();
+      return;
     }
-    container_get_dn(MoiraContainerName, ADContainerName);
-    if (MoiraContainerName[strlen(MoiraContainerName) - 1] != '/')
-       strcat(MoiraContainerName, "/");
-    container_check(ldap_handle, dn_path, MoiraContainerName);
-    machine_move_to_ou(ldap_handle, dn_path, MachineName, ADContainerName);
-    moira_disconnect();
-    return;
+
+  container_get_dn(MoiraContainerName, ADContainerName);
+
+  if (MoiraContainerName[strlen(MoiraContainerName) - 1] != '/')
+    strcat(MoiraContainerName, "/");
+
+  container_check(ldap_handle, dn_path, MoiraContainerName);
+  machine_move_to_ou(ldap_handle, dn_path, MachineName, ADContainerName);
+  moira_disconnect();
+  return;
 }
 
 void do_container(LDAP *ldap_handle, char *dn_path, char *ldap_hostname,
-             char **before, int beforec, char **after, int afterc)
+		  char **before, int beforec, char **after, int afterc)
 {
   long rc;
 
+  if (!ProcessMachineContainer)
+    {
+      com_err(whoami, 0, "Process machines and containers disabled, skipping");
+      return;
+    }
+
   if ((beforec == 0) && (afterc == 0))
     return;
 
@@ -791,6 +876,7 @@
       moira_disconnect();
       return;
     }
+
   if ((beforec == 0) && (afterc != 0)) /*create a container*/
     {
       com_err(whoami, 0, "creating container %s", after[CONTAINER_NAME]);
@@ -803,20 +889,22 @@
 
   if (strcasecmp(before[CONTAINER_NAME], after[CONTAINER_NAME]))
     {
-      com_err(whoami, 0, "renaming container %s to %s", before[CONTAINER_NAME], after[CONTAINER_NAME]);
+      com_err(whoami, 0, "renaming container %s to %s", 
+	      before[CONTAINER_NAME], after[CONTAINER_NAME]);
       container_rename(ldap_handle, dn_path, beforec, before, afterc, after);
       Moira_container_group_update(before, after);
       moira_disconnect();
       return;
     }
-  com_err(whoami, 0, "updating container %s information", after[CONTAINER_NAME]);
+
+  com_err(whoami, 0, "updating container %s information", 
+	  after[CONTAINER_NAME]);
   container_update(ldap_handle, dn_path, beforec, before, afterc, after);
   Moira_container_group_update(before, after);
   moira_disconnect();
   return;
 }
 
-
 #define L_LIST_DESC 9
 #define L_LIST_ID   10
 
@@ -857,8 +945,10 @@
           strcpy(before_list_id, before[L_LIST_ID]);
         }
       before_security_flag = 0;
-      get_group_membership(before_group_membership, before_group_ou, &before_security_flag, before);
+      get_group_membership(before_group_membership, before_group_ou, 
+			   &before_security_flag, before);
     }
+
   if (afterc > L_GID)
     {
       if (afterc < L_LIST_ID)
@@ -870,27 +960,34 @@
       security_flag = 0;
       get_group_membership(group_membership, group_ou, &security_flag, after);
     }
-
+  
   if ((beforec == 0) && (afterc == 0)) /*this case should never happen*/
     return;
 
   updateGroup = 0;
+  
   if (beforec)
     {
       updateGroup = 1;
-      if ((rc = process_group(ldap_handle, dn_path, before_list_id, before[L_NAME], 
-                              before_group_ou, before_group_membership, 
-                              before_security_flag, CHECK_GROUPS)))
+
+      if ((rc = process_group(ldap_handle, dn_path, before_list_id, 
+			      before[L_NAME], before_group_ou, 
+			      before_group_membership, 
+                              before_security_flag, CHECK_GROUPS,
+			      before[L_MAILLIST])))
         {
           if (rc == AD_NO_GROUPS_FOUND)
             updateGroup = 0;
           else
             {
-              if ((rc == AD_WRONG_GROUP_DN_FOUND) || (rc == AD_MULTIPLE_GROUPS_FOUND))
+              if ((rc == AD_WRONG_GROUP_DN_FOUND) || 
+		  (rc == AD_MULTIPLE_GROUPS_FOUND))
                 {
-                  rc = process_group(ldap_handle, dn_path, before_list_id, before[L_NAME], 
-                                     before_group_ou, before_group_membership, 
-                                     before_security_flag, CLEANUP_GROUPS);
+                  rc = process_group(ldap_handle, dn_path, before_list_id, 
+				     before[L_NAME], before_group_ou, 
+				     before_group_membership, 
+                                     before_security_flag, CLEANUP_GROUPS,
+				     before[L_MAILLIST]);
                 }
               if ((rc != AD_NO_GROUPS_FOUND) && (rc != 0))
                 {
@@ -907,29 +1004,35 @@
   if ((beforec != 0) && (afterc != 0))
     {
       if (((strcmp(after[L_NAME], before[L_NAME])) || 
-          ((!strcmp(after[L_NAME], before[L_NAME])) && 
-           (strcmp(before_group_ou, group_ou)))) &&
+	   ((!strcmp(after[L_NAME], before[L_NAME])) && 
+	    (strcmp(before_group_ou, group_ou)))) &&
           (updateGroup == 1))
         {
           com_err(whoami, 0, "Changing list name from %s to %s",
                   before[L_NAME], after[L_NAME]);
-          if ((strlen(before_group_ou) == 0) || (strlen(before_group_membership) == 0) ||
+
+          if ((strlen(before_group_ou) == 0) || 
+	      (strlen(before_group_membership) == 0) ||
               (strlen(group_ou) == 0) || (strlen(group_membership) == 0))
             {
               com_err(whoami, 0, "%s", "Unable to find the group OU's");
               return;
             }
+
           memset(filter, '\0', sizeof(filter));
+
           if ((rc = group_rename(ldap_handle, dn_path, 
                                  before[L_NAME], before_group_membership, 
-                                 before_group_ou, before_security_flag, before[L_LIST_DESC],
-                                 after[L_NAME], group_membership, 
-                                 group_ou, security_flag, after[L_LIST_DESC],
-                                 list_id, filter)))
+                                 before_group_ou, before_security_flag, 
+				 before[L_LIST_DESC], after[L_NAME], 
+				 group_membership, group_ou, security_flag, 
+				 after[L_LIST_DESC],
+                                 list_id, filter, after[L_MAILLIST])))
             {
               if (rc != AD_NO_GROUPS_FOUND)
                 {
-                  com_err(whoami, 0, "Unable to change list name from %s to %s",
+                  com_err(whoami, 0, 
+			  "Unable to change list name from %s to %s",
                           before[L_NAME], after[L_NAME]);
                   return;
                 }
@@ -940,39 +1043,50 @@
       else
         beforec = 0;
     }
-
+  
   if (beforec)
     {
-      if ((strlen(before_group_ou) == 0) || (strlen(before_group_membership) == 0))
+      if ((strlen(before_group_ou) == 0) || 
+	  (strlen(before_group_membership) == 0))
         {
-          com_err(whoami, 0, "Unable to find the group OU for group %s", before[L_NAME]);
+          com_err(whoami, 0, 
+		  "Unable to find the group OU for group %s", before[L_NAME]);
           return;
         }
+
       com_err(whoami, 0, "Deleting group %s", before[L_NAME]);
       rc = group_delete(ldap_handle, dn_path, before[L_NAME], 
                         before_group_membership, before_list_id);
       return;
     }
+
   if (afterc)
     {
       if (!updateGroup)
         {
           com_err(whoami, 0, "Creating group %s", after[L_NAME]);
+
           if (rc = process_group(ldap_handle, dn_path, list_id, after[L_NAME], 
                                   group_ou, group_membership, 
-                                  security_flag, CHECK_GROUPS))
+                                  security_flag, CHECK_GROUPS,
+				 after[L_MAILLIST]))
             {
               if (rc != AD_NO_GROUPS_FOUND)
                 {
-                  if ((rc == AD_WRONG_GROUP_DN_FOUND) || (rc == AD_MULTIPLE_GROUPS_FOUND))
+                  if ((rc == AD_WRONG_GROUP_DN_FOUND) || 
+		      (rc == AD_MULTIPLE_GROUPS_FOUND))
                     {
-                      rc = process_group(ldap_handle, dn_path, list_id, after[L_NAME], 
+                      rc = process_group(ldap_handle, dn_path, list_id, 
+					 after[L_NAME], 
                                          group_ou, group_membership, 
-                                         security_flag, CLEANUP_GROUPS);
+                                         security_flag, CLEANUP_GROUPS,
+					 after[L_MAILLIST]);
                     }
+
                   if (rc)
                     {
-                      com_err(whoami, 0, "Unable to create list %s", after[L_NAME]);
+                      com_err(whoami, 0, 
+			      "Unable to create list %s", after[L_NAME]);
                       return;
                     }
                 }
@@ -990,24 +1104,32 @@
         }
 
       ProcessGroup = 0;
-      if (ProcessAce(ldap_handle, dn_path, after[L_NAME], "LIST", 0, &ProcessGroup))
+
+      if (ProcessAce(ldap_handle, dn_path, after[L_NAME], "LIST", 0, 
+		     &ProcessGroup, after[L_MAILLIST]))
         return;
+
       if (ProcessGroup)
         {
-          if (ProcessAce(ldap_handle, dn_path, after[L_NAME], "LIST", 1, &ProcessGroup))
+          if (ProcessAce(ldap_handle, dn_path, after[L_NAME], "LIST", 1, 
+			 &ProcessGroup, after[L_MAILLIST]))
             return;
         }
+
       if (make_new_group(ldap_handle, dn_path, list_id, after[L_NAME], 
-                         group_ou, group_membership, security_flag, updateGroup))
+                         group_ou, group_membership, security_flag, 
+			 updateGroup, after[L_MAILLIST]))
         {
           moira_disconnect();
           return;
         }
+
       if (atoi(after[L_ACTIVE]))
         {
           populate_group(ldap_handle, dn_path, after[L_NAME], group_ou, 
                          group_membership, security_flag, list_id);
         }
+
       moira_disconnect();
     }
   return;
@@ -1027,6 +1149,10 @@
 void do_member(LDAP *ldap_handle, char *dn_path, char *ldap_hostname,
                char **before, int beforec, char **after, int afterc)
 {
+  LK_ENTRY *group_base;
+  int group_count;
+  char  filter[128];
+  char *attr_array[3];
   char  group_name[128];
   char  user_name[128];
   char  user_type[128];
@@ -1035,35 +1161,46 @@
   char  group_membership[1];
   char  group_ou[256];
   char  machine_ou[256];
+  char  member[256];
   char  *args[16];
   char  **ptr;
   char  *av[7];
   char  *call_args[7];
   char  *pUserOu;
+  char  *s;
   char  NewMachineName[1024];
   int   security_flag;
   int   rc;
   int   ProcessGroup;
+  char  *save_argv[U_END];
 
   pUserOu = NULL;
   ptr = NULL;
   memset(moira_list_id, '\0', sizeof(moira_list_id));
   memset(moira_user_id, '\0', sizeof(moira_user_id));
+
   if (afterc)
     {
       if (afterc < LM_EXTRA_GID)
         return;
+
       if (!atoi(after[LM_EXTRA_ACTIVE]))
         {
-        com_err(whoami, 0, "Unable to add %s to group %s : group not active", after[2], after[0]);
-        return;
+	  com_err(whoami, 0, 
+		  "Unable to add %s to group %s : group not active", 
+		  after[2], after[0]);
+	  return;
         }
+
       ptr = after;
+
       if (!strcasecmp(ptr[LM_TYPE], "LIST"))
 	return;
+
       strcpy(user_name, after[LM_MEMBER]);
       strcpy(group_name, after[LM_LIST]);
       strcpy(user_type, after[LM_TYPE]);
+
       if (!strcasecmp(ptr[LM_TYPE], "MACHINE"))
         {
           if (afterc > LM_EXTRA_GROUP)
@@ -1092,15 +1229,21 @@
         return;
       if (!atoi(before[LM_EXTRA_ACTIVE]))
         {
-          com_err(whoami, 0, "Unable to add %s to group %s : group not active", before[2], before[0]);
+          com_err(whoami, 0, 
+		  "Unable to add %s to group %s : group not active", 
+		  before[2], before[0]);
           return;
         }
+
       ptr = before;
+
       if (!strcasecmp(ptr[LM_TYPE], "LIST"))
 	return;
+
       strcpy(user_name, before[LM_MEMBER]);
       strcpy(group_name, before[LM_LIST]);
       strcpy(user_type, before[LM_TYPE]);
+
       if (!strcasecmp(ptr[LM_TYPE], "MACHINE"))
         {
           if (beforec > LM_EXTRA_GROUP)
@@ -1126,7 +1269,9 @@
 
   if (ptr == NULL)
     {
-      com_err(whoami, 0, "Unable to process group : beforec = %d, afterc = %d", beforec, afterc);
+      com_err(whoami, 0, 
+	      "Unable to process group : beforec = %d, afterc = %d", 
+	      beforec, afterc);
       return;
     }
 
@@ -1141,28 +1286,39 @@
   security_flag = 0;
   memset(group_ou, '\0', sizeof(group_ou));
   get_group_membership(group_membership, group_ou, &security_flag, args);
+
   if (strlen(group_ou) == 0)
     {
-      com_err(whoami, 0, "Unable to find the group OU for group %s", group_name);
+      com_err(whoami, 0, "Unable to find the group OU for group %s", 
+	      group_name);
       return;
     }
-  if (rc = process_group(ldap_handle, dn_path, moira_list_id, group_name, group_ou, group_membership, security_flag, CHECK_GROUPS))
+
+  if (rc = process_group(ldap_handle, dn_path, moira_list_id, group_name, 
+			 group_ou, group_membership, security_flag, 
+			 CHECK_GROUPS, args[L_MAILLIST]))
     {
       if (rc != AD_NO_GROUPS_FOUND)
         {
-          if (rc = process_group(ldap_handle, dn_path, moira_list_id, group_name, group_ou, group_membership, security_flag, CLEANUP_GROUPS))
+          if (rc = process_group(ldap_handle, dn_path, moira_list_id, 
+				 group_name, group_ou, group_membership, 
+				 security_flag, CLEANUP_GROUPS,
+				 args[L_MAILLIST]))
             {
               if (rc != AD_NO_GROUPS_FOUND)
                 {
                   if (afterc)
-                    com_err(whoami, 0, "Unable to add %s to group %s - unable to process group", user_name, group_name);
+                    com_err(whoami, 0, "Unable to add %s to group %s - " 
+			    "unable to process group", user_name, group_name);
                   else
-                    com_err(whoami, 0, "Unable to remove %s from group %s - unable to process group", user_name, group_name);
+                    com_err(whoami, 0, "Unable to remove %s from group %s - "
+			    "unable to process group", user_name, group_name);
                   return;
                 }
             }
         }
     }
+
   if (rc == AD_NO_GROUPS_FOUND)
     {
       if (rc = moira_connect())
@@ -1172,88 +1328,180 @@
                          error_message(rc));
           return;
         }
-
+      
       com_err(whoami, 0, "creating group %s", group_name);
       ProcessGroup = 0;
-      if (ProcessAce(ldap_handle, dn_path, ptr[LM_LIST], "LIST", 0, &ProcessGroup))
+
+      if (ProcessAce(ldap_handle, dn_path, ptr[LM_LIST], "LIST", 0, 
+		     &ProcessGroup, ptr[LM_EXTRA_MAILLIST]))
         return;
+
       if (ProcessGroup)
         {
-          if (ProcessAce(ldap_handle, dn_path, ptr[LM_LIST], "LIST", 1, &ProcessGroup))
+          if (ProcessAce(ldap_handle, dn_path, ptr[LM_LIST], "LIST", 1, 
+			 &ProcessGroup, ptr[LM_EXTRA_MAILLIST]))
             return;
         }
+
       if (make_new_group(ldap_handle, dn_path, moira_list_id, ptr[LM_LIST], 
-                         group_ou, group_membership, security_flag, 0))
+                         group_ou, group_membership, security_flag, 0,
+			 ptr[LM_EXTRA_MAILLIST]))
         {
           moira_disconnect();
           return;
         }
+
       if (atoi(ptr[LM_EXTRA_ACTIVE]))
         {
           populate_group(ldap_handle, dn_path, ptr[LM_LIST], group_ou, 
                          group_membership, security_flag, moira_list_id);
         }
+
       moira_disconnect();
     }
+
   rc = 0;
+
   if (beforec)
     {
-      com_err(whoami, 0, "removing user %s from list %s", user_name, group_name);
+      com_err(whoami, 0, "removing user %s from list %s", user_name, 
+	      group_name);
       pUserOu = user_ou;
+
       if (!strcasecmp(ptr[LM_TYPE], "MACHINE"))
         {
           memset(machine_ou, '\0', sizeof(machine_ou));
 	  memset(NewMachineName, '\0', sizeof(NewMachineName));
-          if (get_machine_ou(ldap_handle, dn_path, ptr[LM_MEMBER], machine_ou, NewMachineName))
+          if (get_machine_ou(ldap_handle, dn_path, ptr[LM_MEMBER], 
+			     machine_ou, NewMachineName))
             return;
 	  if (ptr[LM_MEMBER] != NULL)	  
 	    free(ptr[LM_MEMBER]);
 	  ptr[LM_MEMBER] = strdup(NewMachineName);
           pUserOu = machine_ou;
         }
+
       if (!strcasecmp(ptr[LM_TYPE], "STRING"))
         {
+	  strcpy(member, ptr[LM_MEMBER]);
+
+	  if (Exchange) 
+	    {
+	      if((s = strchr(member, '@')) == (char *) NULL)
+		{ 
+		  strcat(member, "@mit.edu");
+		  
+		  if (ptr[LM_MEMBER] != NULL)
+		    free(ptr[LM_MEMBER]);
+		  ptr[LM_MEMBER] = strdup(member);
+		}
+	  
+	      if(!strncasecmp(&member[strlen(member) - 6], ".LOCAL", 6)) 
+		{
+		  s = strrchr(member, '.');
+		  *s = '\0';
+		  strcat(s, ".mit.edu");
+		  
+		  if (ptr[LM_MEMBER] != NULL)
+		    free(ptr[LM_MEMBER]);
+		  ptr[LM_MEMBER] = strdup(member);
+		}
+	    }
+
           if (contact_create(ldap_handle, dn_path, ptr[LM_MEMBER], contact_ou))
             return;
+
           pUserOu = contact_ou;
         }
       else if (!strcasecmp(ptr[LM_TYPE], "KERBEROS"))
-        {
-          if (contact_create(ldap_handle, dn_path, ptr[LM_MEMBER], kerberos_ou))
-            return;
-          pUserOu = kerberos_ou;
-        }
+	{
+	  if (contact_create(ldap_handle, dn_path, ptr[LM_MEMBER], 
+			     kerberos_ou))
+	    return;
+
+	  pUserOu = kerberos_ou;
+	}
       if (rc = member_remove(ldap_handle, dn_path, group_name,
-                             group_ou, group_membership, ptr[LM_MEMBER], 
-                             pUserOu, moira_list_id))
-          com_err(whoami, 0, "Unable to remove %s from group %s", user_name, group_name);
+			     group_ou, group_membership, ptr[LM_MEMBER], 
+			     pUserOu, moira_list_id))
+	com_err(whoami, 0, "Unable to remove %s from group %s", user_name, 
+		group_name);
+      
+      if (!strcasecmp(ptr[LM_TYPE], "STRING"))
+	{
+	  if (rc = moira_connect())
+	    {
+	      critical_alert("AD incremental",
+			     "Error contacting Moira server : %s",
+			     error_message(rc));
+	      return;
+	    }
+	  
+	  if (rc = populate_group(ldap_handle, dn_path, group_name,
+				  group_ou, group_membership, security_flag,
+				  moira_list_id))
+	    com_err(whoami, 0, "Unable to remove %s from group %s",
+		    user_name, group_name);
+	  moira_disconnect();
+	}
       return;
     }
-
+  
   com_err(whoami, 0, "Adding %s to list %s", user_name, group_name);
   pUserOu = user_ou;
-
+  
   if (!strcasecmp(ptr[LM_TYPE], "MACHINE"))
     {
       memset(machine_ou, '\0', sizeof(machine_ou));
       memset(NewMachineName, '\0', sizeof(NewMachineName));
-      if (get_machine_ou(ldap_handle, dn_path, ptr[LM_MEMBER], machine_ou, NewMachineName))
+
+      if (get_machine_ou(ldap_handle, dn_path, ptr[LM_MEMBER], machine_ou, 
+			 NewMachineName))
         return;
+
       if (ptr[LM_MEMBER] != NULL)
 	free(ptr[LM_MEMBER]);
+
       ptr[LM_MEMBER] = strdup(NewMachineName);
       pUserOu = machine_ou;
     }
   else if (!strcasecmp(ptr[LM_TYPE], "STRING"))
     {
+      strcpy(member, ptr[LM_MEMBER]);
+
+      if (Exchange) 
+	{
+	  if((s = strchr(member, '@')) == (char *) NULL)
+	    { 
+	      strcat(member, "@mit.edu");
+	      
+	      if (ptr[LM_MEMBER] != NULL)
+		free(ptr[LM_MEMBER]);
+	      ptr[LM_MEMBER] = strdup(member);
+	    }
+	  
+	  if(!strncasecmp(&member[strlen(member) - 6], ".LOCAL", 6)) 
+	    {
+	      s = strrchr(member, '.');
+	      *s = '\0';
+	      strcat(s, ".mit.edu");
+	      
+	      if (ptr[LM_MEMBER] != NULL)
+		free(ptr[LM_MEMBER]);
+	      ptr[LM_MEMBER] = strdup(member);
+	    }
+	}
+      
       if (contact_create(ldap_handle, dn_path, ptr[LM_MEMBER], contact_ou))
         return;
+
       pUserOu = contact_ou;
     }
   else if (!strcasecmp(ptr[LM_TYPE], "KERBEROS"))
     {
       if (contact_create(ldap_handle, dn_path, ptr[LM_MEMBER], kerberos_ou))
         return;
+
       pUserOu = kerberos_ou;
     }
   else if (!strcasecmp(ptr[LM_TYPE], "USER"))
@@ -1268,22 +1516,61 @@
                              error_message(rc));
               return;
             }
-          com_err(whoami, 0, "creating user %s", after[U_NAME]);
+
+          com_err(whoami, 0, "creating user %s", ptr[LM_MEMBER]);
           av[0] = ptr[LM_MEMBER];
           call_args[0] = (char *)ldap_handle;
           call_args[1] = dn_path;
           call_args[2] = moira_user_id;
           call_args[3] = NULL;
+	  
+          callback_rc = 0;
 
-          callback_rc = 0;
-          if (rc = mr_query("get_user_account_by_login", 1, av, user_create,
-                            call_args))
+	  if (Exchange)
+	    {
+	      group_count = 0;
+	      group_base = NULL;
+	  
+	      sprintf(filter, "(&(objectClass=group)(cn=%s))", ptr[LM_MEMBER]);
+	      attr_array[0] = "cn";
+	      attr_array[1] = NULL;
+	      if ((rc = linklist_build(ldap_handle, dn_path, filter, 
+				       attr_array, &group_base, &group_count,
+				       LDAP_SCOPE_SUBTREE)) != 0)
+		{
+		  com_err(whoami, 0, "Unable to process user %s : %s",
+			  ptr[LM_MEMBER], ldap_err2string(rc));
+		  return;
+		}
+	      
+	      if (group_count)
+		{
+		  com_err(whoami, 0, "Object already exists with name %s",
+			  ptr[LM_MEMBER]);
+		  return;
+		}
+	  
+	      linklist_free(group_base);
+	      group_count = 0;
+	      group_base = NULL;
+	    }
+
+          if (rc = mr_query("get_user_account_by_login", 1, av, 
+                            save_query_info, save_argv))
             {
               moira_disconnect();
               com_err(whoami, 0, "Unable to create user %s : %s",
                       ptr[LM_MEMBER], error_message(rc));
               return;
             }
+
+	  if (rc = user_create(U_END, save_argv, call_args)) 
+	    {
+              moira_disconnect();
+              com_err(whoami, 0, "Unable to create user %s", ptr[LM_MEMBER]);
+              return;
+	    }
+
           if (callback_rc)
             {
               moira_disconnect();
@@ -1298,13 +1585,31 @@
         }
       pUserOu = user_ou;
     }
-
+  
   if (rc = member_add(ldap_handle, dn_path, group_name,
-                  group_ou, group_membership, ptr[LM_MEMBER],
-                  pUserOu, moira_list_id))
+		      group_ou, group_membership, ptr[LM_MEMBER],
+		      pUserOu, moira_list_id))
+    com_err(whoami, 0, "Unable to add %s to group %s", user_name, group_name);
+  
+  if (!strcasecmp(ptr[LM_TYPE], "STRING"))
     {
-      com_err(whoami, 0, "Unable to add %s to group %s", user_name, group_name);
+      if (rc = moira_connect())
+	{
+	  critical_alert("AD incremental",
+			 "Error contacting Moira server : %s",
+			 error_message(rc));
+	  return;
+	}
+      
+      if (rc = populate_group(ldap_handle, dn_path, group_name,
+			      group_ou, group_membership, security_flag,
+			      moira_list_id))
+	com_err(whoami, 0, "Unable to add %s to group %s",
+		user_name, group_name);
+      
+      moira_disconnect();
     }
+
   return;
 }
 
@@ -1317,19 +1622,26 @@
              char **before, int beforec, char **after, 
              int afterc)
 {
+  LK_ENTRY *group_base;
+  int   group_count;
+  char  filter[128];
+  char  *attr_array[3];
   int   rc;
   char  *av[7];
   char  after_user_id[32];
   char  before_user_id[32];
   char  *call_args[7];
+  char  *save_argv[U_END];
 
   if ((beforec == 0) && (afterc == 0))
     return;
 
   memset(after_user_id, '\0', sizeof(after_user_id));
   memset(before_user_id, '\0', sizeof(before_user_id));
+
   if (beforec > U_USER_ID)
     strcpy(before_user_id, before[U_USER_ID]);
+
   if (afterc > U_USER_ID)
     strcpy(after_user_id, after[U_USER_ID]);
 
@@ -1340,11 +1652,16 @@
     {
       /*this case only happens when the account*/
       /*account is first created but not usable*/
-      com_err(whoami, 0, "Unable to process user %s because the user account is not yet usable", after[U_NAME]);
+
+      com_err(whoami, 0, "Unable to process user %s because the user account "
+	      "is not yet usable", after[U_NAME]);
       return;
     }
-  if ((beforec != 0) && (afterc == 0)) /*this case only happens when the account*/
-    {                                  /*is expunged*/
+
+  /*this case only happens when the account is expunged */
+
+  if ((beforec != 0) && (afterc == 0)) 
+    {                                 
       if (atoi(before[U_STATE]) == 0)
         {
           com_err(whoami, 0, "expunging user %s from AD", before[U_NAME]);
@@ -1352,17 +1669,20 @@
         }
       else
         {
-          com_err(whoami, 0, "Unable to process because user %s has been previously expungeded", before[U_NAME]);
+          com_err(whoami, 0, "Unable to process because user %s has been "
+		  "previously expungeded", before[U_NAME]);
         }
       return;
     }
 
   /*process anything that gets here*/
+
   if ((rc = check_user(ldap_handle, dn_path, before[U_NAME], 
                        before_user_id)) == AD_NO_USER_FOUND)
     {
       if (!check_string(after[U_NAME]))
         return;
+
       if (rc = moira_connect())
         {
           critical_alert("AD incremental", 
@@ -1370,28 +1690,69 @@
                          error_message(rc));
           return;
         }
+
       com_err(whoami, 0, "creating user %s", after[U_NAME]);
-
+      
       av[0] = after[U_NAME];
       call_args[0] = (char *)ldap_handle;
       call_args[1] = dn_path;
       call_args[2] = after_user_id;
       call_args[3] = NULL;
       callback_rc = 0;
-      if (rc = mr_query("get_user_account_by_login", 1, av, user_create,
-                        call_args))
+
+      if (Exchange) 
+	{
+	  group_count = 0;
+	  group_base = NULL;
+	  
+	  sprintf(filter, "(&(objectClass=group)(cn=%s))", after[U_NAME]);
+	  attr_array[0] = "cn";
+	  attr_array[1] = NULL;
+	  
+	  if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array,
+				   &group_base, &group_count,
+				   LDAP_SCOPE_SUBTREE)) != 0)
+	    {
+	      com_err(whoami, 0, "Unable to process user %s : %s",
+		      after[U_NAME], ldap_err2string(rc));
+	      return;
+	    }
+	  
+	  if (group_count >= 1)
+	    {
+	      com_err(whoami, 0, "Object already exists with name %s",
+		      after[U_NAME]);
+	      return;
+	    }
+      
+	  linklist_free(group_base);
+	  group_count = 0;
+	  group_base = NULL;
+	}
+
+      if (rc = mr_query("get_user_account_by_login", 1, av,
+                        save_query_info, save_argv))
         {
           moira_disconnect();
           com_err(whoami, 0, "Unable to create user %s : %s",
                   after[U_NAME], error_message(rc));
           return;
         }
+
+      if (rc = user_create(U_END, save_argv, call_args)) 
+	{
+          com_err(whoami, 0, "Unable to create user %s : %s",
+                  after[U_NAME], error_message(rc));
+	  return;
+	}
+      
       if (callback_rc)
         {
           moira_disconnect();
           com_err(whoami, 0, "Unable to create user %s", after[U_NAME]);
           return;
         }
+
       return;
     }
   else
@@ -1399,12 +1760,14 @@
       if (rc != 0)
         return;
     }
+
   if (strcmp(before[U_NAME], after[U_NAME]))
     {
       if ((check_string(before[U_NAME])) && (check_string(after[U_NAME])))
         {
           com_err(whoami, 0, "changing user %s to %s", 
                   before[U_NAME], after[U_NAME]);
+
           if ((rc = user_rename(ldap_handle, dn_path, before[U_NAME], 
                                 after[U_NAME])) != LDAP_SUCCESS)
             {
@@ -1412,11 +1775,14 @@
             }
         }
     }
+
   com_err(whoami, 0, "updating user %s information", after[U_NAME]);
   rc = user_update(ldap_handle, dn_path, after[U_NAME],
                    after[U_UID], after[U_MITID], 
-                   after_user_id, atoi(after[U_STATE]),
-                   after[U_HOMEDIR], after[U_PROFILEDIR]);
+		   after_user_id, atoi(after[U_STATE]),
+                   after[U_HOMEDIR], after[U_PROFILEDIR],
+		   after[U_FIRST], after[U_MIDDLE], after[U_LAST]);
+
   return;
 }
 
@@ -1427,14 +1793,16 @@
   LK_ENTRY    *linklist_ptr;
   int         i;
   char        *cPtr;
-
-  if (((*modvalues) = calloc(1, (modvalue_count + 1) * sizeof(char *)))
-      == NULL)
+  
+  if (((*modvalues) = calloc(1, 
+			     (modvalue_count + 1) * sizeof(char *))) == NULL)
     {
       return(1);
     }
+
   for (i = 0; i < (modvalue_count + 1); i++)
     (*modvalues)[i] = NULL;
+
   if (modvalue_count != 0)
     {
       linklist_ptr = linklist_base;
@@ -1443,7 +1811,7 @@
           if ((oldValue != NULL) && (newValue != NULL))
             {
               if ((cPtr = (char *)strstr(linklist_ptr->value, oldValue))
-                 != (char *)NULL)
+		  != (char *)NULL)
                 {
                   if (type == REPLACE)
                     {
@@ -1457,8 +1825,9 @@
                     {
                       if (((*modvalues)[i] = calloc(1, 
                                         (int)(cPtr - linklist_ptr->value) + 
-                                        (linklist_ptr->length - strlen(oldValue)) + 
-                                        strlen(newValue) + 1)) == NULL)
+					       (linklist_ptr->length - 
+					       strlen(oldValue)) + 
+					       strlen(newValue) + 1)) == NULL)
                         return(1);
                       memset((*modvalues)[i], '\0', 
                              (int)(cPtr - linklist_ptr->value) + 
@@ -1468,7 +1837,8 @@
                              (int)(cPtr - linklist_ptr->value));
                       strcat((*modvalues)[i], newValue);
                       strcat((*modvalues)[i], 
-     &linklist_ptr->value[(int)(cPtr - linklist_ptr->value) + strlen(oldValue)]);
+			     &linklist_ptr->value[(int)(cPtr - 
+				     linklist_ptr->value) + strlen(oldValue)]);
                     }
                 }
               else
@@ -1505,21 +1875,22 @@
   ldap_entry = NULL;
   (*linklist_base) = NULL;
   (*linklist_count) = 0;
+
   if ((rc = ldap_search_s(ldap_handle, dn_path, ScopeType, 
-                          search_exp, attr_array, 0, &ldap_entry))
-      != LDAP_SUCCESS)
+                          search_exp, attr_array, 0, 
+			  &ldap_entry)) != LDAP_SUCCESS)
       {
         if (rc != LDAP_SIZELIMIT_EXCEEDED)
           return(0);
       }
 
-  rc = retrieve_entries(ldap_handle, ldap_entry, linklist_base, linklist_count);
+  rc = retrieve_entries(ldap_handle, ldap_entry, linklist_base, 
+			linklist_count);
 
   ldap_msgfree(ldap_entry);
   return(rc);
 }
 
-
 int retrieve_entries(LDAP *ldap_handle, LDAPMessage *ldap_entry, 
                      LK_ENTRY **linklist_base, int *linklist_count)
 {
@@ -1529,7 +1900,7 @@
 
   if ((ldap_entry = ldap_first_entry(ldap_handle, ldap_entry)) == NULL)
     return(0);
-
+  
   memset(distinguished_name, '\0', sizeof(distinguished_name));
   get_distinguished_name(ldap_handle, ldap_entry, distinguished_name);
 
@@ -1541,19 +1912,21 @@
     {
       memset(distinguished_name, '\0', sizeof(distinguished_name));
       get_distinguished_name(ldap_handle, ldap_entry, distinguished_name);
-
-      if ((rc = retrieve_attributes(ldap_handle, ldap_entry, distinguished_name,
-                                    linklist_base)) != 0)
+      
+      if ((rc = retrieve_attributes(ldap_handle, ldap_entry, 
+				    distinguished_name, linklist_base)) != 0)
         return(rc);
     }
 
   linklist_ptr = (*linklist_base);
   (*linklist_count) = 0;
+
   while (linklist_ptr != NULL)
     {
       ++(*linklist_count);
       linklist_ptr = linklist_ptr->next;
     }
+
   return(0);
 }
 
@@ -1564,7 +1937,9 @@
   BerElement  *ptr;
 
   ptr = NULL;
-  if ((Attribute = ldap_first_attribute(ldap_handle, ldap_entry, &ptr)) != NULL)
+
+  if ((Attribute = ldap_first_attribute(ldap_handle, ldap_entry, 
+					&ptr)) != NULL)
     {
       retrieve_values(ldap_handle, ldap_entry, Attribute, distinguished_name,
                       linklist_current);
@@ -1577,7 +1952,9 @@
           ldap_memfree(Attribute);
         }
     }
+
   ldap_ber_free(ptr, 0);
+
   return(0);
 }
 
@@ -1592,6 +1969,7 @@
   LK_ENTRY    *linklist_previous;
   LDAP_BERVAL **ber_value;
   DWORD       ber_length;
+
 #ifdef LDAP_DEBUG
   SID         *sid;
   GUID        *guid;
@@ -1604,68 +1982,81 @@
 
   use_bervalue = 0;
   memset(temp, '\0', sizeof(temp));
+
   if ((!strcmp(Attribute, "objectSid")) ||
       (!strcmp(Attribute, "objectGUID")))
     use_bervalue = 1;
-
+  
   if (use_bervalue)
     {
       ber_value = ldap_get_values_len(ldap_handle, ldap_entry, Attribute);
       Ptr = (void **)ber_value;
       str_value = NULL;
-      }
+    }
   else
     {
       str_value = ldap_get_values(ldap_handle, ldap_entry, Attribute);
       Ptr = (void **)str_value;
       ber_value = NULL;
     }
+
   if (Ptr != NULL)
     {
       for (; *Ptr; Ptr++) 
         {
           if ((linklist_previous = calloc(1, sizeof(LK_ENTRY))) == NULL)
             return(1);
+
           memset(linklist_previous, '\0', sizeof(LK_ENTRY));
           linklist_previous->next = (*linklist_current);
           (*linklist_current) = linklist_previous;
-
+	  
           if (((*linklist_current)->attribute = calloc(1, 
-                                               strlen(Attribute) + 1)) == NULL)
+					      strlen(Attribute) + 1)) == NULL)
             return(1);
+
           memset((*linklist_current)->attribute, '\0', strlen(Attribute) + 1);
           strcpy((*linklist_current)->attribute, Attribute);
+
           if (use_bervalue)
             {
               ber_length = (*(LDAP_BERVAL **)Ptr)->bv_len;
+
               if (((*linklist_current)->value = calloc(1, ber_length)) == NULL)
                 return(1);
+
               memset((*linklist_current)->value, '\0', ber_length);
-              memcpy((*linklist_current)->value, (*(LDAP_BERVAL **)Ptr)->bv_val, 
-                                                  ber_length);
+              memcpy((*linklist_current)->value, 
+		     (*(LDAP_BERVAL **)Ptr)->bv_val, ber_length);
               (*linklist_current)->length = ber_length;
             }
           else
             {
               if (((*linklist_current)->value = calloc(1, 
-                                                  strlen(*Ptr) + 1)) == NULL)
+						    strlen(*Ptr) + 1)) == NULL)
                 return(1);
+
               memset((*linklist_current)->value, '\0', strlen(*Ptr) + 1);
               (*linklist_current)->length = strlen(*Ptr);
               strcpy((*linklist_current)->value, *Ptr);
             }
+
           (*linklist_current)->ber_value = use_bervalue;
+
           if (((*linklist_current)->dn = calloc(1, 
-                                      strlen(distinguished_name) + 1)) == NULL)
+				      strlen(distinguished_name) + 1)) == NULL)
             return(1);
-          memset((*linklist_current)->dn, '\0', strlen(distinguished_name) + 1);
+
+          memset((*linklist_current)->dn, '\0', 
+		 strlen(distinguished_name) + 1);
           strcpy((*linklist_current)->dn, distinguished_name);
 
 #ifdef LDAP_DEBUG
           if (!strcmp(Attribute, "objectGUID"))
             {
               guid = (GUID *)((*linklist_current)->value);
-              sprintf(temp, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 
+              sprintf(temp, 
+		      "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 
                       guid->Data1, guid->Data2, guid->Data3, 
                       guid->Data4[0], guid->Data4[1], guid->Data4[2], 
                       guid->Data4[3], guid->Data4[4], guid->Data4[5], 
@@ -1675,6 +2066,7 @@
           else if (!strcmp(Attribute, "objectSid"))
             {
               sid = (SID *)((*(LDAP_BERVAL **)Ptr)->bv_val);
+
 #ifdef _WIN32
               print_to_screen("        Revision = %d\n", sid->Revision);
               print_to_screen("        SID Identifier Authority:\n");
@@ -1686,7 +2078,7 @@
               else if (sid_auth->Value[2])
                 print_to_screen("            SECURITY_LOCAL_SID_AUTHORITY\n");
               else if (sid_auth->Value[3])
-                print_to_screen("            SECURITY_CREATOR_SID_AUTHORITY\n");
+                print_to_screen("           SECURITY_CREATOR_SID_AUTHORITY\n");
               else if (sid_auth->Value[5])
                 print_to_screen("            SECURITY_NT_AUTHORITY\n");
               else
@@ -1709,6 +2101,7 @@
             {
               intValue = atoi(*Ptr);
               print_to_screen("     %20s : %ld\n",Attribute, intValue);
+
               if (!memcmp(Attribute, "userAccountControl", 
                           strlen("userAccountControl")))
                 {
@@ -1753,12 +2146,16 @@
             }
 #endif /*LDAP_DEBUG*/
         }
+
       if (str_value != NULL)
         ldap_value_free(str_value);
+
       if (ber_value != NULL)
         ldap_value_free_len(ber_value);
     }
+
   (*linklist_current) = linklist_previous;
+
   return(0);
 }
 
@@ -1769,27 +2166,20 @@
 
   if (!mr_connections++)
     {
+
 #ifdef _WIN32
       memset(HostName, '\0', sizeof(HostName));
       strcpy(HostName, "ttsp");
       rc = mr_connect_cl(HostName, "winad.incr", QUERY_VERSION, 1);
-/*det
-      rc = mr_connect(HostName);
-*/
 #else
       struct utsname uts;
       uname(&uts);
       rc = mr_connect_cl(uts.nodename, "winad.incr", QUERY_VERSION, 1);
-/*
-      rc = mr_connect(uts.nodename);
-*/
 #endif /*WIN32*/
-/*det
-      if (!rc)
-        rc = mr_krb5_auth("winad.incr");
-*/
+
       return rc;
     }
+
   return 0;
 }
 
@@ -1806,8 +2196,10 @@
                          STOP_FILE, tbl_buf);
           return(1);
         }
+
       sleep(60);
     }
+
   return(0);
 }
 
@@ -1818,6 +2210,7 @@
     {
       mr_disconnect();
     }
+
   return 0;
 }
 
@@ -1825,10 +2218,12 @@
                             char *distinguished_name)
 {
   char    *CName;
+  
+  CName = ldap_get_dn(ldap_handle, ldap_entry);
 
-  CName = ldap_get_dn(ldap_handle, ldap_entry);
   if (CName == NULL)
     return;
+
   strcpy(distinguished_name, CName);
   ldap_memfree(CName);
 }
@@ -1837,10 +2232,12 @@
                           LK_ENTRY **linklist_entry)
 {
   (*linklist_entry) = calloc(1, sizeof(LK_ENTRY));
+
   if (!(*linklist_entry))
     {
       return(1);
     }
+
   memset((*linklist_entry), '\0', sizeof(LK_ENTRY));
   (*linklist_entry)->attribute = calloc(1, strlen(attribute) + 1);
   memset((*linklist_entry)->attribute, '\0', strlen(attribute) + 1);
@@ -1850,6 +2247,7 @@
   strcpy((*linklist_entry)->value, value);
   (*linklist_entry)->length = strlen(value);
   (*linklist_entry)->next = NULL;
+
   return(0);
 }
 
@@ -1868,18 +2266,21 @@
 {
   int  maillist_flag;
   int  group_flag;
-
+  
   maillist_flag = atoi(av[L_MAILLIST]);
   group_flag = atoi(av[L_GROUP]);
+
   if (security_flag != NULL)
     (*security_flag) = 0;
-
+  
   if ((maillist_flag) && (group_flag))
     {
       if (group_membership != NULL)
         group_membership[0] = 'B';
+
       if (security_flag != NULL)
         (*security_flag) = 1;
+
       if (group_ou != NULL)
         strcpy(group_ou, group_ou_both);
     }
@@ -1887,8 +2288,10 @@
     {
       if (group_membership != NULL)
         group_membership[0] = 'S';
+
       if (security_flag != NULL)
         (*security_flag) = 1;
+
       if (group_ou != NULL)
         strcpy(group_ou, group_ou_security);
     }
@@ -1896,6 +2299,7 @@
     {
       if (group_membership != NULL)
         group_membership[0] = 'D';
+
       if (group_ou != NULL)
         strcpy(group_ou, group_ou_distribution);
     }
@@ -1903,50 +2307,108 @@
     {
       if (group_membership != NULL)
         group_membership[0] = 'N';
+
       if (group_ou != NULL)
         strcpy(group_ou, group_ou_neither);
     }
+
   return(0);
 }
 
 int group_rename(LDAP *ldap_handle, char *dn_path, 
                  char *before_group_name, char *before_group_membership, 
-                 char *before_group_ou, int before_security_flag, char *before_desc,
-                 char *after_group_name, char *after_group_membership, 
-                 char *after_group_ou, int after_security_flag, char *after_desc,
-                 char *MoiraId, char *filter)
+                 char *before_group_ou, int before_security_flag, 
+		 char *before_desc, char *after_group_name, 
+		 char *after_group_membership, char *after_group_ou, 
+		 int after_security_flag, char *after_desc,
+                 char *MoiraId, char *filter, char *maillist)
 {
   LDAPMod   *mods[20];
   char      old_dn[512];
   char      new_dn[512];
   char      new_dn_path[512];
   char      sam_name[256];
+  char      mail[256];
+  char      mail_nickname[256];
+  char      proxy_address[256];
+  char      address_book[256];
   char      *attr_array[3];
   char      *mitMoiraId_v[] = {NULL, NULL};
   char      *name_v[] = {NULL, NULL};
   char      *samAccountName_v[] = {NULL, NULL};
   char      *groupTypeControl_v[] = {NULL, NULL};
-  u_int     groupTypeControl = ADS_GROUP_TYPE_GLOBAL_GROUP;
+  char      *mail_v[] = {NULL, NULL};
+  char      *proxy_address_v[] = {NULL, NULL};
+  char      *mail_nickname_v[] = {NULL, NULL};
+  char      *reportToOriginator_v[] = {NULL, NULL};
+  char      *address_book_v[] = {NULL, NULL};
+  char      *legacy_exchange_dn_v[] = {NULL, NULL};
+  u_int     groupTypeControl;
   char      groupTypeControlStr[80];
+  char      contact_mail[256];
   int       n;
   int       i;
   int       rc;
   LK_ENTRY  *group_base;
   int       group_count;
+  int       MailDisabled = 0;
 
+  if(UseGroupUniversal)
+    groupTypeControl = ADS_GROUP_TYPE_UNIVERSAL_GROUP;
+  else
+    groupTypeControl = ADS_GROUP_TYPE_GLOBAL_GROUP;
+     
   if (!check_string(before_group_name))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP list name %s", before_group_name);
+      com_err(whoami, 0, 
+	      "Unable to process invalid LDAP list name %s", 
+	      before_group_name);
       return(AD_INVALID_NAME);
     }
+
   if (!check_string(after_group_name))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP list name %s", after_group_name);
+      com_err(whoami, 0, 
+	      "Unable to process invalid LDAP list name %s", after_group_name);
       return(AD_INVALID_NAME);
     }
 
+  if (Exchange) 
+    {
+      if(atoi(maillist)) 
+	{
+	  group_count = 0;
+	  group_base = NULL;
+	  
+	  sprintf(filter, "(&(objectClass=user)(cn=%s))", after_group_name);
+	  attr_array[0] = "cn";
+	  attr_array[1] = NULL;
+
+	  if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array,
+				   &group_base, &group_count,
+				   LDAP_SCOPE_SUBTREE)) != 0)
+	  {
+	    com_err(whoami, 0, "Unable to process group %s : %s",
+		    after_group_name, ldap_err2string(rc));
+	    return(rc);
+	  }
+	  
+	  if (group_count)
+	    {
+	      com_err(whoami, 0, "Object already exists with name %s",
+		      after_group_name);
+	      MailDisabled++;
+	    }
+	
+	  linklist_free(group_base);
+	  group_base = NULL;
+	  group_count = 0;
+	}
+    }
+
   group_count = 0;
   group_base = NULL;
+
   if (rc = ad_get_group(ldap_handle, dn_path, before_group_name, 
                         before_group_membership, 
                         MoiraId, "distinguishedName", &group_base, 
@@ -1957,13 +2419,14 @@
     {
       return(AD_NO_GROUPS_FOUND);
     }
+
   if (group_count != 1)
     {
-      com_err(whoami, 0,
-              "Unable to process multiple groups with MoiraId = %s exist in the AD",
-              MoiraId);
+      com_err(whoami, 0, "Unable to process multiple groups with "
+	      "MoiraId = %s exist in the AD", MoiraId);
       return(AD_MULTIPLE_GROUPS_FOUND);
     }
+
   strcpy(old_dn, group_base->value);
 
   linklist_free(group_base);
@@ -1971,13 +2434,16 @@
   group_count = 0;
   attr_array[0] = "sAMAccountName";
   attr_array[1] = NULL;
+
   if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                           &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0)
     {
       com_err(whoami, 0, "Unable to get list %s dn : %s",
               after_group_name, ldap_err2string(rc));
       return(rc);
     }
+
   if (group_count != 1)
     {
       com_err(whoami, 0,
@@ -1985,14 +2451,20 @@
               before_group_name);
       return(AD_LDAP_FAILURE);
     }
-
+  
   strcpy(sam_name, group_base->value);
   linklist_free(group_base);
   group_base = NULL;
   group_count = 0;
-
+  
   sprintf(new_dn_path, "%s,%s", after_group_ou, dn_path);
   sprintf(new_dn, "cn=%s", after_group_name);
+  sprintf(mail, "%s@%s", after_group_name, lowercase(ldap_domain));
+  sprintf(contact_mail, "%s@mit.edu", after_group_name); 
+  sprintf(proxy_address, "SMTP:%s@%s", after_group_name, 
+	  lowercase(ldap_domain));
+  sprintf(mail_nickname, "%s", after_group_name);
+  
   if ((rc = ldap_rename_s(ldap_handle, old_dn, new_dn, new_dn_path,
                           TRUE, NULL, NULL)) != LDAP_SUCCESS)
     {
@@ -2002,38 +2474,85 @@
     }
 
   name_v[0] = after_group_name;
-  if (!strncmp(&sam_name[strlen(sam_name) - strlen("_group")], "_group", strlen("_group")))
+
+  if (!strncmp(&sam_name[strlen(sam_name) - strlen(group_suffix)], 
+	       group_suffix, strlen(group_suffix)))
     {
-      sprintf(sam_name, "%s_group", after_group_name);
+      sprintf(sam_name, "%s%s", after_group_name, group_suffix);
     }
   else
     {
-      com_err(whoami, 0, "Unable to rename list from %s to %s : sAMAccountName not found",
+      com_err(whoami, 0, 
+	      "Unable to rename list from %s to %s : sAMAccountName not found",
               before_group_name, after_group_name);
       return(rc);
     }
+
   samAccountName_v[0] = sam_name;
+
   if (after_security_flag)
     groupTypeControl |= ADS_GROUP_TYPE_SECURITY_ENABLED;
+
   sprintf(groupTypeControlStr, "%ld", groupTypeControl);
   groupTypeControl_v[0] = groupTypeControlStr;
   mitMoiraId_v[0] = MoiraId;
 
   sprintf(new_dn, "cn=%s,%s,%s", after_group_name, after_group_ou, dn_path);
-  rc = attribute_update(ldap_handle, new_dn, after_desc, "description", after_group_name);
+  rc = attribute_update(ldap_handle, new_dn, after_desc, "description", 
+			after_group_name);
   n = 0;
   ADD_ATTR("samAccountName", samAccountName_v, LDAP_MOD_REPLACE);
   ADD_ATTR("displayName", name_v, LDAP_MOD_REPLACE);
   ADD_ATTR("mitMoiraId", mitMoiraId_v, LDAP_MOD_REPLACE);
   ADD_ATTR("groupType", groupTypeControl_v, LDAP_MOD_REPLACE);
+
+  if (Exchange)
+    {
+      if(atoi(maillist) && !MailDisabled && email_isvalid(mail)) 
+	{
+	  mail_nickname_v[0] = mail_nickname;
+	  proxy_address_v[0] = proxy_address;
+	  mail_v[0] = mail;
+	  ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_REPLACE);
+	  ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE);
+	  ADD_ATTR("proxyAddresses", proxy_address_v, LDAP_MOD_REPLACE);
+	} 
+      else 
+	{
+	  mail_nickname_v[0] = NULL;
+	  proxy_address_v[0] = NULL;
+	  mail_v[0] = NULL;
+	  legacy_exchange_dn_v[0] = NULL;
+	  address_book_v[0] = NULL;
+
+	  ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_REPLACE);
+	  ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE);
+	  ADD_ATTR("proxyAddresses", proxy_address_v, LDAP_MOD_REPLACE);
+	  ADD_ATTR("legacyExchangeDN", legacy_exchange_dn_v, LDAP_MOD_REPLACE);
+	  ADD_ATTR("showInAddressBook", address_book_v, LDAP_MOD_REPLACE);
+	}
+    }
+  else
+    {
+      if(atoi(maillist) && email_isvalid(contact_mail)) 
+	{
+	  mail_v[0] = contact_mail;
+	  ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE);
+	}
+    }
+
   mods[n] = NULL;
+
   if ((rc = ldap_modify_s(ldap_handle, new_dn, mods)) != LDAP_SUCCESS)
     {
-      com_err(whoami, 0, "Unable to modify list data for %s after renaming: %s",
+      com_err(whoami, 0, 
+	      "Unable to modify list data for %s after renaming: %s",
               after_group_name, ldap_err2string(rc));
     }
+
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   return(rc);
 }
 
@@ -2045,6 +2564,11 @@
   char new_group_name[256];
   char sam_group_name[256];
   char cn_group_name[256];
+  char mail[256];
+  char contact_mail[256];
+  char mail_nickname[256];
+  char proxy_address[256];
+  char address_book[256];
   char *cn_v[] = {NULL, NULL};
   char *objectClass_v[] = {"top", "group", NULL};
   char info[256];
@@ -2056,21 +2580,38 @@
   char *info_v[] = {NULL, NULL};
   char *mitMoiraId_v[] = {NULL, NULL};
   char *groupTypeControl_v[] = {NULL, NULL};
+  char *mail_v[] = {NULL, NULL};
+  char *proxy_address_v[] = {NULL, NULL};
+  char *mail_nickname_v[] = {NULL, NULL};
+  char *reportToOriginator_v[] = {NULL, NULL};
+  char *address_book_v[] = {NULL, NULL};
+  char *legacy_exchange_dn_v[] = {NULL, NULL};
   char groupTypeControlStr[80];
   char group_membership[1];
   int  i;
   int  security_flag;
-  u_int groupTypeControl = ADS_GROUP_TYPE_GLOBAL_GROUP;
+  u_int groupTypeControl;
   int  n;
   int  rc;
   int  updateGroup;
+  int  MailDisabled = 0;
   char **call_args;
-
+  LK_ENTRY *group_base;
+  int  group_count;
+  char filter[1024];
+  char *attr_array[3];
+  
   call_args = ptr;
 
+  if(UseGroupUniversal)
+    groupTypeControl = ADS_GROUP_TYPE_UNIVERSAL_GROUP;
+  else 
+    groupTypeControl = ADS_GROUP_TYPE_GLOBAL_GROUP;
+
   if (!check_string(av[L_NAME]))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP list name %s", av[L_NAME]);
+      com_err(whoami, 0, "Unable to process invalid LDAP list name %s", 
+	      av[L_NAME]);
       return(AD_INVALID_NAME);
     }
 
@@ -2078,22 +2619,27 @@
   memset(group_ou, 0, sizeof(group_ou));
   memset(group_membership, 0, sizeof(group_membership));
   security_flag = 0;
+
   get_group_membership(group_membership, group_ou, &security_flag, av);
+
   strcpy(new_group_name, av[L_NAME]);
   sprintf(new_dn, "cn=%s,%s,%s", new_group_name, group_ou, call_args[1]);
+  sprintf(contact_mail, "%s@mit.edu", av[L_NAME]);
+  sprintf(mail, "%s@%s", av[L_NAME], lowercase(ldap_domain));
+  sprintf(mail_nickname, "%s", av[L_NAME]);
+
   if (security_flag)
     groupTypeControl |= ADS_GROUP_TYPE_SECURITY_ENABLED;
   
-  sprintf(sam_group_name, "%s_group", av[L_NAME]);
+  sprintf(sam_group_name, "%s%s", av[L_NAME], group_suffix);
 
   if (!updateGroup)
     {
-
       sprintf(groupTypeControlStr, "%ld", groupTypeControl);
       groupTypeControl_v[0] = groupTypeControlStr;
 
       strcpy(cn_group_name, av[L_NAME]);
-
+      
       samAccountName_v[0] = sam_group_name;
       name_v[0] = new_group_name;
       cn_v[0] = new_group_name;
@@ -2104,29 +2650,84 @@
       ADD_ATTR("sAMAccountName", samAccountName_v, LDAP_MOD_ADD);
       ADD_ATTR("displayName", name_v, LDAP_MOD_ADD);
       ADD_ATTR("name", name_v, LDAP_MOD_ADD);
+      
+      if (Exchange)
+	{
+	  if(atoi(av[L_MAILLIST])) 
+	    {
+	      group_count = 0;
+	      group_base = NULL;
+	      
+	      sprintf(filter, "(&(objectClass=user)(cn=%s))", av[L_NAME]);
+	      attr_array[0] = "cn";
+	      attr_array[1] = NULL;
+	      
+	      if ((rc = linklist_build((LDAP *)call_args[0], call_args[1], 
+				       filter, attr_array, &group_base, 
+				       &group_count,
+				       LDAP_SCOPE_SUBTREE)) != 0)
+		{
+		  com_err(whoami, 0, "Unable to process group %s : %s",
+			  av[L_NAME], ldap_err2string(rc));
+		  return(rc);
+		}
+	      
+	      if (group_count)
+		{
+		  com_err(whoami, 0, "Object already exists with name %s",
+			  av[L_NAME]);
+		  MailDisabled++;
+		}
+	
+	      linklist_free(group_base);
+	      group_base = NULL;
+	      group_count = 0;
+	    }
+	  
+	  if(atoi(av[L_MAILLIST]) && !MailDisabled && email_isvalid(mail)) 
+	    {
+	      mail_nickname_v[0] = mail_nickname;
+	      ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_ADD);
+	    }
+	}
+      else
+	{
+	  if(atoi(av[L_MAILLIST]) && email_isvalid(contact_mail)) 
+	    {
+	      mail_v[0] = contact_mail;
+	      ADD_ATTR("mail", mail_v, LDAP_MOD_ADD);
+	    }
+	}
+      
       if (strlen(av[L_DESC]) != 0)
-        {
-          desc_v[0] = av[L_DESC];
-          ADD_ATTR("description", desc_v, LDAP_MOD_ADD);
-        }
+	{
+	  desc_v[0] = av[L_DESC];
+	  ADD_ATTR("description", desc_v, LDAP_MOD_ADD);
+	}
+      
       ADD_ATTR("groupType", groupTypeControl_v, LDAP_MOD_ADD);
+      
       if (strlen(av[L_ACE_NAME]) != 0)
         {
-          sprintf(info, "The Administrator of this list is: %s", av[L_ACE_NAME]);
+          sprintf(info, "The Administrator of this list is: %s", 
+		  av[L_ACE_NAME]);
           info_v[0] = info;
           ADD_ATTR("info", info_v, LDAP_MOD_ADD);
         }
+
       if (strlen(call_args[5]) != 0)
         {
           mitMoiraId_v[0] = call_args[5];
           ADD_ATTR("mitMoiraId", mitMoiraId_v, LDAP_MOD_ADD);
         }
+
       mods[n] = NULL;
-
+      
       rc = ldap_add_ext_s((LDAP *)call_args[0], new_dn, mods, NULL, NULL);
-
+      
       for (i = 0; i < n; i++)
         free(mods[i]);
+
       if ((rc != LDAP_SUCCESS) && (rc != LDAP_ALREADY_EXISTS))
         {
           com_err(whoami, 0, "Unable to create list %s in AD : %s",
@@ -2135,29 +2736,106 @@
           return(rc);
         }
     }
+
   if ((rc == LDAP_ALREADY_EXISTS) || (updateGroup))
     {
-      rc = attribute_update((LDAP *)call_args[0], new_dn, av[L_DESC], "description", av[L_NAME]);
+      rc = attribute_update((LDAP *)call_args[0], new_dn, av[L_DESC], 
+			    "description", av[L_NAME]);
       sprintf(info, "The Administrator of this list is: %s", av[L_ACE_NAME]);
-      rc = attribute_update((LDAP *)call_args[0], new_dn, info, "info", av[L_NAME]);
+      rc = attribute_update((LDAP *)call_args[0], new_dn, info, "info", 
+			    av[L_NAME]);
       n = 0;
+
       if (strlen(call_args[5]) != 0)
         {
           mitMoiraId_v[0] = call_args[5];
           ADD_ATTR("mitMoiraId", mitMoiraId_v, LDAP_MOD_REPLACE);
         }
+
       if (!(atoi(av[L_ACTIVE])))
         {
           member_v[0] = NULL;
           ADD_ATTR("member", member_v, LDAP_MOD_REPLACE);
         }
+   
+      if (Exchange)
+	{
+	  if(atoi(av[L_MAILLIST])) 
+	    {
+	      group_count = 0;
+	      group_base = NULL;
+	      
+	      sprintf(filter, "(&(objectClass=user)(cn=%s))", av[L_NAME]);
+	      attr_array[0] = "cn";
+	      attr_array[1] = NULL;
+	      
+	      if ((rc = linklist_build((LDAP *)call_args[0], call_args[1], 
+				       filter, attr_array, &group_base, 
+				       &group_count,
+				       LDAP_SCOPE_SUBTREE)) != 0)
+		{
+		  com_err(whoami, 0, "Unable to process group %s : %s",
+			  av[L_NAME], ldap_err2string(rc));
+		  return(rc);
+		}
+	      
+	      if (group_count)
+		{
+		  com_err(whoami, 0, "Object already exists with name %s",
+			  av[L_NAME]);
+		  MailDisabled++;
+		}
+	      
+	      linklist_free(group_base);
+	      group_base = NULL;
+	      group_count = 0;
+	    }
+
+	  if (atoi(av[L_MAILLIST]) && !MailDisabled && email_isvalid(mail)) 
+	    {
+	      mail_nickname_v[0] = mail_nickname;
+	      ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_REPLACE);
+	    } 
+	  else 
+	    {
+	      mail_v[0] = NULL;
+	      mail_nickname_v[0] = NULL;
+	      proxy_address_v[0] = NULL;
+	      legacy_exchange_dn_v[0] = NULL;
+	      address_book_v[0] = NULL;
+
+	      ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_REPLACE);
+	      ADD_ATTR("proxyAddresses", proxy_address_v, LDAP_MOD_REPLACE);
+	      ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE);
+	      ADD_ATTR("legacyExchangeDN", legacy_exchange_dn_v, 
+		       LDAP_MOD_REPLACE);
+	      ADD_ATTR("showInAddressBook", address_book_v, LDAP_MOD_REPLACE);
+	    }
+	}
+      else
+	{
+	  if (atoi(av[L_MAILLIST]) && email_isvalid(contact_mail)) 
+	    {
+	      mail_v[0] = contact_mail;
+	      ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE);
+	    }
+	  else
+	    {
+	      mail_v[0] = NULL;
+	      ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE);
+	    }
+	}
+   
       mods[n] = NULL;
       rc = LDAP_SUCCESS;
+
       if (n != 0)
         {
           rc = ldap_modify_s((LDAP *)call_args[0], new_dn, mods);
+
           for (i = 0; i < n; i++)
               free(mods[i]);
+
           if (rc != LDAP_SUCCESS)
             {
               com_err(whoami, 0, "Unable to update list %s in AD : %s",
@@ -2174,8 +2852,9 @@
   return(LDAP_SUCCESS);
 }
 
-int ProcessGroupSecurity(LDAP *ldap_handle, char *dn_path, char *TargetGroupName, 
-                         int HiddenGroup, char *AceType, char *AceName)
+int ProcessGroupSecurity(LDAP *ldap_handle, char *dn_path, 
+			 char *TargetGroupName, int HiddenGroup, 
+			 char *AceType, char *AceName)
 {
   char          filter_exp[1024];
   char          *attr_array[5];
@@ -2191,6 +2870,10 @@
   unsigned char UserTemplateSid[128];
   char          acBERBuf[N_SD_BER_BYTES];
   char          GroupSecurityTemplate[256];
+  char          hide_addres_lists[256];
+  char          address_book[256];
+  char          *hide_address_lists_v[] = {NULL, NULL};
+  char          *address_book_v[] = {NULL, NULL};
   int           AceSidCount;
   int           UserTemplateSidCount;
   int           group_count;
@@ -2210,23 +2893,28 @@
   LDAPControl *apsServerControls[] = {&sControl, NULL};
   LDAPMessage *psMsg;
 
-  dwInfo = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
+  dwInfo = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | 
+    DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
   BEREncodeSecurityBits(dwInfo, acBERBuf);
 
   sprintf(search_path, "%s,%s", group_ou_root, dn_path);
-  sprintf(filter_exp, "(sAMAccountName=%s_group)", TargetGroupName);
+  sprintf(filter_exp, "(sAMAccountName=%s%s)", TargetGroupName, group_suffix);
   attr_array[0] = "sAMAccountName";
   attr_array[1] = NULL;
   group_count = 0;
   group_base = NULL;
+
   if ((rc = linklist_build(ldap_handle, search_path, filter_exp, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE) != 0))
+			   &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE) != 0))
     return(1);
+
   if (group_count != 1)
     {
       linklist_free(group_base);
       return(1);
     }
+
   strcpy(TargetDn, group_base->dn);
   strcpy(TargetSamName, group_base->value);
   linklist_free(group_base);
@@ -2240,11 +2928,12 @@
   AceSidCount = 0;
   group_base = NULL;
   group_count = 0;
+
   if (strlen(AceName) != 0)
     {
       if (!strcmp(AceType, "LIST"))
         {
-          sprintf(AceSamAccountName, "%s_group", AceName);
+          sprintf(AceSamAccountName, "%s%s", AceName, group_suffix);
           strcpy(root_ou, group_ou_root);
         }
       else if (!strcmp(AceType, "USER"))
@@ -2252,6 +2941,7 @@
           sprintf(AceSamAccountName, "%s", AceName);
           strcpy(root_ou, user_ou);
         }
+
       if (strlen(AceSamAccountName) != 0)
         {
           sprintf(search_path, "%s", dn_path);
@@ -2260,8 +2950,10 @@
           attr_array[1] = NULL;
           group_count = 0;
           group_base = NULL;
-          if ((rc = linklist_build(ldap_handle, search_path, filter_exp, attr_array, 
-                                   &group_base, &group_count, LDAP_SCOPE_SUBTREE) != 0))
+
+          if ((rc = linklist_build(ldap_handle, search_path, filter_exp, 
+				   attr_array, &group_base, &group_count, 
+				   LDAP_SCOPE_SUBTREE) != 0))
             return(1);
           if (group_count == 1)
             {
@@ -2274,9 +2966,11 @@
           group_count = 0;
         }
     }
+
   if (AceSidCount == 0)
     {
-      com_err(whoami, 0, "Group %s: Administrator: %s, Type: %s - does not have an AD SID.", TargetGroupName, AceName, AceType);
+      com_err(whoami, 0, "Group %s: Administrator: %s, Type: %s - does not "
+	      "have an AD SID.", TargetGroupName, AceName, AceType);
       com_err(whoami, 0, "   Non-admin security group template will be used.");
     }
   else
@@ -2288,12 +2982,16 @@
 
       group_count = 0;
       group_base = NULL;
-      if ((rc = linklist_build(ldap_handle, search_path, filter_exp, attr_array, 
-                                   &group_base, &group_count, LDAP_SCOPE_SUBTREE) != 0))
+
+      if ((rc = linklist_build(ldap_handle, search_path, filter_exp, 
+			       attr_array, &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE) != 0))
         return(1);
+
       if ((rc != 0) || (group_count != 1))
         {
-          com_err(whoami, 0, "Unable to process user security template: %s", "UserTemplate");
+          com_err(whoami, 0, "Unable to process user security template: %s", 
+		  "UserTemplate");
           AceSidCount = 0;
         }
       else
@@ -2329,7 +3027,8 @@
       else
         {
           strcpy(GroupSecurityTemplate, NOT_HIDDEN_GROUP_WITH_ADMIN);
-          sprintf(filter_exp, "(sAMAccountName=%s)", NOT_HIDDEN_GROUP_WITH_ADMIN);
+          sprintf(filter_exp, "(sAMAccountName=%s)", 
+		  NOT_HIDDEN_GROUP_WITH_ADMIN);
         }
     }
 
@@ -2338,21 +3037,26 @@
   attr_array[1] = NULL;
   group_count = 0;
   group_base = NULL;
+
   if ((rc = linklist_build(ldap_handle, search_path, filter_exp, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE) != 0))
+			   &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE) != 0))
     return(1);
+
   if (group_count != 1)
     {
       linklist_free(group_base);
-      com_err(whoami, 0, "Unable to process group security template: %s - security not set", GroupSecurityTemplate);
+      com_err(whoami, 0, "Unable to process group security template: %s - "
+	      "security not set", GroupSecurityTemplate);
       return(1);
     }
+
   strcpy(TemplateDn, group_base->dn);
   strcpy(TemplateSamName, group_base->value);
   linklist_free(group_base);
   group_base = NULL;
   group_count = 0;
-
+  
   sprintf(filter_exp, "(sAMAccountName=%s)", TemplateSamName);
   rc = ldap_search_ext_s(ldap_handle,
                          TemplateDn,
@@ -2368,23 +3072,29 @@
 
   if ((psMsg = ldap_first_entry(ldap_handle, psMsg)) == NULL)
     {
-      com_err(whoami, 0, "Unable to find group security template: %s - security not set", GroupSecurityTemplate);
+      com_err(whoami, 0, "Unable to find group security template: %s - "
+	      "security not set", GroupSecurityTemplate);
       return(1);
     }
+
   ppsValues = ldap_get_values_len(ldap_handle, psMsg, "ntSecurityDescriptor");
+
   if (ppsValues == NULL)
     {
-      com_err(whoami, 0, "Unable to find group security descriptor for group %s - security not set", GroupSecurityTemplate);
+      com_err(whoami, 0, "Unable to find group security descriptor for group "
+	      "%s - security not set", GroupSecurityTemplate);
       return(1);
     }
-
+  
   if (AceSidCount != 0)
     {
       for (nVal = 0; ppsValues[nVal] != NULL; nVal++)
         {
-          for (i = 0; i < (int)(ppsValues[nVal]->bv_len - UserTemplateSidCount); i++)
+          for (i = 0; 
+	       i < (int)(ppsValues[nVal]->bv_len - UserTemplateSidCount); i++)
             {
-              if (!memcmp(&ppsValues[nVal]->bv_val[i], UserTemplateSid, UserTemplateSidCount))
+              if (!memcmp(&ppsValues[nVal]->bv_val[i], UserTemplateSid, 
+			  UserTemplateSidCount))
                 {
                   memcpy(&ppsValues[nVal]->bv_val[i], AceSid, AceSidCount);
                   break;
@@ -2394,22 +3104,46 @@
     }
 
   n = 0;
-  ADD_ATTR("ntSecurityDescriptor", (char **)ppsValues, LDAP_MOD_REPLACE | LDAP_MOD_BVALUES);
+  ADD_ATTR("ntSecurityDescriptor", (char **)ppsValues, 
+	   LDAP_MOD_REPLACE | LDAP_MOD_BVALUES);
+
+  if (Exchange)
+    {
+      if(HiddenGroup) 
+	{
+	  hide_address_lists_v[0] = "TRUE";
+	  address_book_v[0] = NULL;
+	  ADD_ATTR("msExchHideFromAddressLists", hide_address_lists_v, 
+		   LDAP_MOD_REPLACE);
+	  ADD_ATTR("showInAddressBook", address_book_v, LDAP_MOD_REPLACE);
+	} else {
+	  hide_address_lists_v[0] = NULL;
+	  ADD_ATTR("msExchHideFromAddressLists", hide_address_lists_v, 
+		   LDAP_MOD_REPLACE);
+	}
+    }
+
   mods[n] = NULL;
 
   rc = ldap_modify_s(ldap_handle, TargetDn, mods);
+
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   ldap_value_free_len(ppsValues);
   ldap_msgfree(psMsg);
+
   if (rc != LDAP_SUCCESS)
     {
       com_err(whoami, 0, "Unable to set security settings for group %s : %s",
               TargetGroupName, ldap_err2string(rc));
+
       if (AceSidCount != 0)
         {
-          com_err(whoami, 0, "Trying to set security for group %s without admin.",
+          com_err(whoami, 0, 
+		  "Trying to set security for group %s without admin.",
                   TargetGroupName);
+
           if (rc = ProcessGroupSecurity(ldap_handle, dn_path, TargetGroupName, 
                                         HiddenGroup, "", ""))
             {
@@ -2420,6 +3154,7 @@
         }
       return(rc);
     }
+
   return(rc);
 }
 
@@ -2434,7 +3169,8 @@
 
   if (!check_string(group_name))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP list name %s", group_name);
+      com_err(whoami, 0, 
+	      "Unable to process invalid LDAP list name %s", group_name);
       return(AD_INVALID_NAME);
     }
 
@@ -2442,6 +3178,7 @@
   group_count = 0;
   group_base = NULL;
   sprintf(temp, "%s,%s", group_ou_root, dn_path);
+
   if (rc = ad_get_group(ldap_handle, temp, group_name, 
                         group_membership, MoiraId, 
                         "distinguishedName", &group_base, 
@@ -2465,7 +3202,7 @@
       com_err(whoami, 0, "Unable to find list %s in AD.", group_name);
       return(AD_NO_GROUPS_FOUND);
     }
-
+  
   return(0);
 }
 
@@ -2503,12 +3240,14 @@
   LK_ENTRY  *linklist;
   char      temp[1024];
   char      **call_args;
-
+  char      *s;
   call_args = ptr;
+  
+  strcpy(temp, av[ACE_NAME]);
 
-  strcpy(temp, av[ACE_NAME]);
   if (!check_string(temp))
     return(0);
+
   if (!strcmp(av[ACE_TYPE], "USER"))
     {
       if (!((int)call_args[3] & MOIRA_USERS))
@@ -2516,10 +3255,27 @@
     }
   else if (!strcmp(av[ACE_TYPE], "STRING"))
     {
+      if (Exchange)
+	{
+	  if((s = strchr(temp, '@')) == (char *) NULL) 
+	    {
+	      strcat(temp, "@mit.edu");
+	    }
+	  
+	  if(!strncasecmp(&temp[strlen(temp) - 6], ".LOCAL", 6))
+	    {
+	      s = strrchr(temp, '.');
+	      *s = '\0';
+	      strcat(s, ".mit.edu");
+	    }
+	}
+      
       if (!((int)call_args[3] & MOIRA_STRINGS))
         return(0);
+
       if (contact_create((LDAP *)call_args[0], call_args[1], temp, contact_ou))
         return(0);
+
     }
   else if (!strcmp(av[ACE_TYPE], "LIST"))
     {
@@ -2530,19 +3286,25 @@
     {
       if (!((int)call_args[3] & MOIRA_KERBEROS))
         return(0);
-      if (contact_create((LDAP *)call_args[0], call_args[1], temp, kerberos_ou))
+
+      if (contact_create((LDAP *)call_args[0], call_args[1], temp, 
+			 kerberos_ou))
         return(0);
+
     }
   else
     return(0);
 
   linklist = member_base;
+
   while (linklist)
     {
     if (!strcasecmp(temp, linklist->member))
       return(0);
+
     linklist = linklist->next;
     }
+
   linklist = calloc(1, sizeof(LK_ENTRY));
   linklist->op = 1;
   linklist->dn = NULL;
@@ -2554,6 +3316,7 @@
   strcpy(linklist->member, temp);
   linklist->next = member_base;
   member_base = linklist;
+
   return(0);
 }
 
@@ -2565,12 +3328,14 @@
   char        *modvalues[2];
   char        temp[256];
   char        filter[128];
+  char        *attr_array[3];
   int         group_count;
   int         i;
   int         n;
   LDAPMod     *mods[20];
   LK_ENTRY    *group_base;
   ULONG       rc;
+  char        *s;
 
   if (!check_string(group_name))
     return(AD_INVALID_NAME);
@@ -2578,6 +3343,7 @@
   memset(filter, '\0', sizeof(filter));
   group_base = NULL;
   group_count = 0;
+
   if (rc = ad_get_group(ldap_handle, dn_path, group_name, 
                         group_membership, MoiraId, 
                         "distinguishedName", &group_base, 
@@ -2593,12 +3359,14 @@
       group_count = 0;
       goto cleanup;
     }
+
   strcpy(distinguished_name, group_base->value);
   linklist_free(group_base);
   group_base = NULL;
   group_count = 0;
 
   sprintf(temp, "CN=%s,%s,%s", user_name, UserOu, dn_path);
+
   modvalues[0] = temp;
   modvalues[1] = NULL;
 
@@ -2606,10 +3374,13 @@
   ADD_ATTR("member", modvalues, LDAP_MOD_DELETE);
   mods[n] = NULL;
   rc = ldap_modify_s(ldap_handle, distinguished_name, mods);
+
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   if (rc == LDAP_UNWILLING_TO_PERFORM)
     rc = LDAP_SUCCESS;
+
   if (rc != LDAP_SUCCESS)
     {
       com_err(whoami, 0, "Unable to modify list %s members : %s",
@@ -2617,7 +3388,54 @@
       goto cleanup;
     }
 
-cleanup:
+  if ((!strcmp(UserOu, contact_ou)) || (!strcmp(UserOu, kerberos_ou))) 
+    {
+      if (Exchange)
+	{
+	  if(!strcmp(UserOu, contact_ou) && 
+	     ((s = strstr(user_name, "@mit.edu")) != (char *) NULL))
+	    {
+	      memset(temp, '\0', sizeof(temp));
+	      strcpy(temp, user_name);
+	      s = strchr(temp, '@');
+	      *s = '\0';
+	      
+	      sprintf(filter, "(&(objectClass=user)(mailNickName=%s))", temp);
+	  
+	      if ((rc = linklist_build(ldap_handle, dn_path, filter, NULL,
+				       &group_base, &group_count, 
+				       LDAP_SCOPE_SUBTREE) != 0))
+		return(rc);	  
+	      
+	      if(group_count)
+		goto cleanup;
+	      
+	      linklist_free(group_base);
+	      group_base = NULL;
+	      group_count = 0;
+	    }
+      
+	  sprintf(filter, "(distinguishedName=%s)", temp);
+	  attr_array[0] = "memberOf";
+	  attr_array[1] = NULL;
+	  
+	  if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array,
+				   &group_base, &group_count, 
+				   LDAP_SCOPE_SUBTREE) != 0))
+	    return(rc);
+	  
+
+	  if(!group_count) 
+	    {
+	      com_err(whoami, 0, "Removing unreferenced object %s", temp);
+	  
+	      if ((rc = ldap_delete_s(ldap_handle, temp)) != 0) 
+		return(rc);
+	    }
+	}
+    }
+
+ cleanup:
   return(rc);
 }
 
@@ -2643,6 +3461,7 @@
   memset(filter, '\0', sizeof(filter));
   group_base = NULL;
   group_count = 0;
+
   if (rc = ad_get_group(ldap_handle, dn_path, group_name, 
                         group_membership, MoiraId, 
                         "distinguishedName", &group_base, 
@@ -2672,38 +3491,105 @@
   ADD_ATTR("member", modvalues, LDAP_MOD_ADD);
   mods[n] = NULL;
   rc = ldap_modify_s(ldap_handle, distinguished_name, mods);
+
   if (rc == LDAP_ALREADY_EXISTS)
     rc = LDAP_SUCCESS;
+
   if ((!strcmp(UserOu, contact_ou)) || (!strcmp(UserOu, kerberos_ou)))
     {
       if (rc == LDAP_UNWILLING_TO_PERFORM)
         rc = LDAP_SUCCESS;
     }
+
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   if (rc != LDAP_SUCCESS)
     {
       com_err(whoami, 0, "Unable to add %s to list %s as a member : %s",
               user_name, group_name, ldap_err2string(rc));
     }
-
+  
   return(rc);
 }
 
+int contact_remove_email(LDAP *ld, char *bind_path,
+			 LK_ENTRY **linklist_base, int linklist_current)
+{
+  LK_ENTRY  *gPtr;
+  int       rc;
+  char      *mail_v[] = {NULL, NULL};
+  LDAPMod   *mods[20];
+  int n;
+  int i;
+
+  mail_v[0] = NULL;
+
+  n = 0;
+  ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE);
+  ADD_ATTR("mailNickName", mail_v, LDAP_MOD_REPLACE);
+  ADD_ATTR("proxyAddresses", mail_v, LDAP_MOD_REPLACE);
+  ADD_ATTR("targetAddress", mail_v, LDAP_MOD_REPLACE);
+  mods[n] = NULL;
+
+  gPtr = (*linklist_base);
+  
+  while(gPtr) {
+    rc = ldap_modify_s(ld, gPtr->dn, mods);
+    
+    if ((rc != LDAP_SUCCESS) && (rc != LDAP_ALREADY_EXISTS))
+      {
+	com_err(whoami, 0, "Unable to modify contact %s in AD : %s",
+		gPtr->dn, ldap_err2string(rc));
+	return(rc);
+      }
+
+    gPtr = gPtr->next;
+  }
+
+  for (i = 0; i < n; i++)
+    free(mods[i]);
+  
+    return(rc);
+}
+
 int contact_create(LDAP *ld, char *bind_path, char *user, char *group_ou)
 {
   LDAPMod *mods[20];
+  LK_ENTRY  *group_base;
+  int  group_count;
   char new_dn[256];
   char cn_user_name[256];
   char contact_name[256];
+  char mail_nickname[256];
+  char proxy_address_internal[256];
+  char proxy_address_external[256];
+  char target_address[256];
+  char internal_contact_name[256];
+  char filter[128];
+  char mail[256];
+  char mit_address_book[256];
+  char default_address_book[256];
+  char contact_address_book[256];
   char *email_v[] = {NULL, NULL};
   char *cn_v[] = {NULL, NULL};
   char *contact_v[] = {NULL, NULL};
+  char *mail_nickname_v[] = {NULL, NULL};
+  char *proxy_address_internal_v[] = {NULL, NULL};
+  char *proxy_address_external_v[] = {NULL, NULL};
+  char *target_address_v[] = {NULL, NULL};
+  char *mit_address_book_v[] = {NULL, NULL};
+  char *default_address_book_v[] = {NULL, NULL};
+  char *contact_address_book_v[] = {NULL, NULL};
+  char *hide_address_lists_v[] = {NULL, NULL};
+  char *attr_array[3];
+
   char *objectClass_v[] = {"top", "person", 
                            "organizationalPerson", 
                            "contact", NULL};
   char *name_v[] = {NULL, NULL};
   char *desc_v[] = {NULL, NULL};
+  char *s;
   int  n;
   int  rc;
   int  i;
@@ -2713,30 +3599,191 @@
       com_err(whoami, 0, "Unable to process invalid LDAP name %s", user);
       return(AD_INVALID_NAME);
     }
-  strcpy(contact_name, user);
+
+  strcpy(mail, user);
+  strcpy(contact_name, mail);
+  strcpy(internal_contact_name, mail);
+
+  if((s = strchr(internal_contact_name, '@')) != NULL) {
+    *s = '?';
+  }
+
   sprintf(cn_user_name,"CN=%s,%s,%s", contact_name, group_ou, bind_path);
+  sprintf(target_address, "SMTP:%s", contact_name);
+  sprintf(proxy_address_external, "SMTP:%s", contact_name);
+  sprintf(mail_nickname, "%s", internal_contact_name);
+  
   cn_v[0] = cn_user_name;
   contact_v[0] = contact_name;
   name_v[0] = user;
   desc_v[0] = "Auto account created by Moira";
-  email_v[0] = user;
-
+  email_v[0] = mail;
+  proxy_address_internal_v[0] = proxy_address_internal;
+  proxy_address_external_v[0] = proxy_address_external;
+  mail_nickname_v[0] = mail_nickname;
+  target_address_v[0] = target_address;
+  mit_address_book_v[0] = mit_address_book;
+  default_address_book_v[0] = default_address_book;
+  contact_address_book_v[0] = contact_address_book;
   strcpy(new_dn, cn_user_name);
   n = 0;
+
   ADD_ATTR("cn", contact_v, LDAP_MOD_ADD);
   ADD_ATTR("objectClass", objectClass_v, LDAP_MOD_ADD);
   ADD_ATTR("name", name_v, LDAP_MOD_ADD);
   ADD_ATTR("displayName", name_v, LDAP_MOD_ADD);
   ADD_ATTR("description", desc_v, LDAP_MOD_ADD);
-  if (!strcmp(group_ou, contact_ou))
+
+  if (Exchange)
     {
-      ADD_ATTR("mail", email_v, LDAP_MOD_ADD);
+      if (!strcmp(group_ou, contact_ou) && email_isvalid(mail))
+	{
+	  group_count = 0;
+	  group_base = NULL;
+	  
+	  sprintf(filter, "(&(objectClass=user)(cn=%s))", mail);
+	  attr_array[0] = "cn";
+	  attr_array[1] = NULL;
+
+	  if ((rc = linklist_build(ld, bind_path, filter, attr_array,
+				   &group_base, &group_count, 
+				   LDAP_SCOPE_SUBTREE)) != 0) 
+	    {
+	      com_err(whoami, 0, "Unable to process contact %s : %s", 
+		      user, ldap_err2string(rc));
+	      return(rc);
+	    }
+      
+	  if (group_count) 
+	    {
+	      com_err(whoami, 0, "Object already exists with name %s",
+		      user);
+	      return(1);
+	    }
+
+	  linklist_free(group_base);
+	  group_base = NULL;
+	  group_count = 0;
+      
+	  sprintf(filter, "(&(objectClass=group)(cn=%s))", mail);
+	  attr_array[0] = "cn";
+	  attr_array[1] = NULL;
+
+	  if ((rc = linklist_build(ld, bind_path, filter, attr_array,
+				   &group_base, &group_count, 
+				   LDAP_SCOPE_SUBTREE)) != 0) 
+	    {
+	      com_err(whoami, 0, "Unable to process contact %s : %s", 
+		      user, ldap_err2string(rc));
+	      return(rc);
+	    }
+	  
+	  if (group_count) 
+	    {
+	      com_err(whoami, 0, "Object already exists with name %s",
+		      user);
+	      return(1);
+	    }
+  
+	  linklist_free(group_base);
+	  group_count = 0;
+	  group_base = NULL;
+	  
+	  sprintf(filter, "(&(objectClass=user)(mail=%s))", mail);
+	  attr_array[0] = "cn";
+	  attr_array[1] = NULL;
+
+	  if ((rc = linklist_build(ld, bind_path, filter, attr_array,
+				   &group_base, &group_count, 
+				   LDAP_SCOPE_SUBTREE)) != 0) 
+	    {
+	      com_err(whoami, 0, "Unable to process contact %s : %s", 
+		      user, ldap_err2string(rc));
+	      return(rc);
+	    }
+	  
+	  if (group_count) 
+	    {
+	      com_err(whoami, 0, "Object already exists with name %s",
+		      user);
+	      return(1);
+	    }
+
+	  linklist_free(group_base);
+	  group_base = NULL;
+	  group_count = 0;
+
+	  sprintf(filter, "(&(objectClass=group)(mail=%s))", mail);
+	  attr_array[0] = "cn";
+	  attr_array[1] = NULL;
+
+	  if ((rc = linklist_build(ld, bind_path, filter, attr_array,
+				   &group_base, &group_count, 
+				   LDAP_SCOPE_SUBTREE)) != 0) 
+	    {
+	      com_err(whoami, 0, "Unable to process contact %s : %s", 
+		      user, ldap_err2string(rc));
+	      return(rc);
+	    }
+      
+	  if (group_count) 
+	    {
+	      com_err(whoami, 0, "Object already exists with name %s",
+		      user);
+	      return(1);
+	    }
+	  
+	  linklist_free(group_base);
+	  group_base = NULL;
+	  group_count = 0;
+	  
+	  ADD_ATTR("mail", email_v, LDAP_MOD_ADD);
+	  ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_ADD);
+	  ADD_ATTR("proxyAddresses", proxy_address_external_v, LDAP_MOD_ADD);
+	  ADD_ATTR("targetAddress", target_address_v, LDAP_MOD_ADD);
+	  
+	  hide_address_lists_v[0] = "TRUE";
+	  ADD_ATTR("msExchHideFromAddressLists", hide_address_lists_v,
+		   LDAP_MOD_ADD);
+	}
     }
+
   mods[n] = NULL;
 
   rc = ldap_add_ext_s(ld, new_dn, mods, NULL, NULL);
+
   for (i = 0; i < n; i++)
     free(mods[i]);
+
+  if (Exchange)
+    {
+      if ((rc != LDAP_SUCCESS) && (rc == LDAP_ALREADY_EXISTS)) 
+	{
+	  n = 0;
+	  
+	  ADD_ATTR("mail", email_v, LDAP_MOD_REPLACE);
+	  ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_REPLACE);
+	  ADD_ATTR("proxyAddresses", proxy_address_external_v, 
+		   LDAP_MOD_REPLACE);
+	  ADD_ATTR("targetAddress", target_address_v, LDAP_MOD_REPLACE);
+
+	  hide_address_lists_v[0] = "TRUE";
+	  ADD_ATTR("msExchHideFromAddressLists", hide_address_lists_v,
+		   LDAP_MOD_REPLACE);
+    
+	  mods[n] = NULL;
+	  rc = ldap_modify_s(ld, new_dn, mods);
+      
+	  if (rc) 
+	    {
+	      com_err(whoami, 0, "Unable to update contact %s", mail);
+	    }
+      
+	  for (i = 0; i < n; i++)
+	    free(mods[i]);
+	}
+    }
+
   if ((rc != LDAP_SUCCESS) && (rc != LDAP_ALREADY_EXISTS))
     {
       n = 0;
@@ -2747,26 +3794,31 @@
       ADD_ATTR("description", desc_v, LDAP_MOD_ADD);
       mods[n] = NULL;
       rc = ldap_add_ext_s(ld, new_dn, mods, NULL, NULL);
+
       for (i = 0; i < n; i++)
         free(mods[i]);
     }
+
   if ((rc != LDAP_SUCCESS) && (rc != LDAP_ALREADY_EXISTS))
     {
       com_err(whoami, 0, "Unable to create contact %s : %s",
               user, ldap_err2string(rc));
       return(rc);
     }
+
   return(0);
 }
 
 int user_update(LDAP *ldap_handle, char *dn_path, char *user_name,
                 char *Uid, char *MitId, char *MoiraId, int State,
-                char *WinHomeDir, char *WinProfileDir)
+                char *WinHomeDir, char *WinProfileDir, char *first,
+		char *middle, char *last)
 {
   LDAPMod   *mods[20];
   LK_ENTRY  *group_base;
   int  group_count;
   char distinguished_name[512];
+  char displayName[256];
   char *mitMoiraId_v[] = {NULL, NULL};
   char *uid_v[] = {NULL, NULL};
   char *mitid_v[] = {NULL, NULL};
@@ -2774,38 +3826,88 @@
   char *winProfile_v[] = {NULL, NULL};
   char *drives_v[] = {NULL, NULL};
   char *userAccountControl_v[] = {NULL, NULL};
+  char *alt_recipient_v[] = {NULL, NULL};
+  char *hide_address_lists_v[] = {NULL, NULL};
+  char *mail_v[] = {NULL, NULL};
   char userAccountControlStr[80];
   int  n;
   int  rc;
   int  i;
   int  OldUseSFU30;
-  u_int userAccountControl = UF_NORMAL_ACCOUNT | UF_DONT_EXPIRE_PASSWD | UF_PASSWD_CANT_CHANGE;
+  u_int userAccountControl = UF_NORMAL_ACCOUNT | UF_DONT_EXPIRE_PASSWD | 
+    UF_PASSWD_CANT_CHANGE;
   char filter[128];
   char *attr_array[3];
   char temp[256];
+  char mail[256];
+  char contact_mail[256];
+  char filter_exp[1024];
+  char search_path[512];
+  char TemplateDn[512];
+  char TemplateSamName[128];
+  char alt_recipient[256];
+  char acBERBuf[N_SD_BER_BYTES];
+  LDAPControl sControl = {"1.2.840.113556.1.4.801",
+                          { N_SD_BER_BYTES, acBERBuf },
+                          TRUE};
+  LDAPControl *apsServerControls[] = {&sControl, NULL};
+  LDAPMessage *psMsg;
+  LDAP_BERVAL   **ppsValues;
+  ULONG dwInfo;
+  char *argv[3];
+  char *homeMDB;
+  char *homeServerName;
+  char *save_argv[7];
+  char search_string[256];
 
+  dwInfo = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
+    DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
+  BEREncodeSecurityBits(dwInfo, acBERBuf);
+
   if (!check_string(user_name))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP user name %s", user_name);
+      com_err(whoami, 0, "Unable to process invalid LDAP user name %s", 
+	      user_name);
       return(AD_INVALID_NAME);
     }
+  
+  memset(contact_mail, '\0', sizeof(contact_mail));
+  sprintf(contact_mail, "%s@mit.edu", user_name);
+  memset(mail, '\0', sizeof(mail));
+  sprintf(mail, "%s@%s", user_name, lowercase(ldap_domain));
+  memset(alt_recipient, '\0', sizeof(alt_recipient));
+  sprintf(alt_recipient, "cn=%s@mit.edu,%s,%s", user_name, contact_ou, 
+	  dn_path);
+  sprintf(search_string, "@%s", uppercase(ldap_domain));
 
+  if (Exchange)
+    {
+      if(contact_create(ldap_handle, dn_path, contact_mail, contact_ou))
+	{
+	  com_err(whoami, 0, "Unable to create user contact %s", contact_mail);
+	}
+    }
+
   group_count = 0;
   group_base = NULL;
 
+  memset(displayName, '\0', sizeof(displayName));
+
   if (strlen(MoiraId) != 0)
     {
       sprintf(filter, "(&(objectClass=user)(mitMoiraId=%s))", MoiraId);
       attr_array[0] = "cn";
       attr_array[1] = NULL;
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to process user %s : %s",
                   user_name, ldap_err2string(rc));
           return(rc);
         }
     }
+
   if (group_count != 1)
     {
       linklist_free(group_base);
@@ -2816,7 +3918,8 @@
       attr_array[1] = NULL;
       sprintf(temp, "%s,%s", user_ou, dn_path);
       if ((rc = linklist_build(ldap_handle, temp, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to process user %s : %s",
                   user_name, ldap_err2string(rc));
@@ -2831,20 +3934,73 @@
       linklist_free(group_base);
       return(AD_NO_USER_FOUND);
     }
+
   strcpy(distinguished_name, group_base->dn);
 
   linklist_free(group_base);
   group_count = 0;
 
   if ((strlen(MitId) != 0) && (MitId[0] == '9'))
-    rc = attribute_update(ldap_handle, distinguished_name, MitId, "employeeID", user_name);
+    rc = attribute_update(ldap_handle, distinguished_name, MitId, 
+			  "employeeID", user_name);
   else
-    rc = attribute_update(ldap_handle, distinguished_name, "none", "employeeID", user_name);
-  rc = attribute_update(ldap_handle, distinguished_name, Uid, "uid", user_name);
-  rc = attribute_update(ldap_handle, distinguished_name, MoiraId, "mitMoiraId", user_name);
+    rc = attribute_update(ldap_handle, distinguished_name, "none", 
+			  "employeeID", user_name);
 
+  if(strlen(first)) {
+    strcat(displayName, first);
+  }
+
+  if(strlen(middle)) {
+    if(strlen(first)) 
+      strcat(displayName, " ");
+
+    strcat(displayName, middle);
+  }
+
+  if(strlen(last)) {
+    if(strlen(middle) || strlen(first))
+      strcat(displayName, " ");
+
+    strcat(displayName, last);
+  }
+
+  if(strlen(displayName)) 
+    rc = attribute_update(ldap_handle, distinguished_name, displayName, 
+			  "displayName", user_name);
+  else
+    rc = attribute_update(ldap_handle, distinguished_name, user_name,
+			  "displayName", user_name);
+  
+  if(strlen(first))
+    rc = attribute_update(ldap_handle, distinguished_name, first, 
+			  "givenName", user_name);
+  else
+    rc = attribute_update(ldap_handle, distinguished_name, "",
+			  "givenName", user_name);
+
+  if(strlen(middle) == 1) 
+    rc = attribute_update(ldap_handle, distinguished_name, middle,
+			  "initials", user_name);
+  else 
+    rc = attribute_update(ldap_handle, distinguished_name, "",
+			  "initials", user_name);
+  
+  if(strlen(last))
+    rc = attribute_update(ldap_handle, distinguished_name, last,
+			  "sn", user_name);
+  else 
+    rc = attribute_update(ldap_handle, distinguished_name, "",
+			  "sn", user_name);
+  
+  rc = attribute_update(ldap_handle, distinguished_name, Uid, "uid", 
+			user_name);
+  rc = attribute_update(ldap_handle, distinguished_name, MoiraId, 
+			"mitMoiraId", user_name);
+
   n = 0;
   uid_v[0] = Uid;
+
   if (!UseSFU30)
     {
       ADD_ATTR("uidNumber", uid_v, LDAP_MOD_REPLACE);
@@ -2854,32 +4010,180 @@
       ADD_ATTR("msSFU30UidNumber", uid_v, LDAP_MOD_REPLACE);
     }
 
+  if ((State != US_NO_PASSWD) && (State != US_REGISTERED))
+    {
+      userAccountControl |= UF_ACCOUNTDISABLE;
 
-  if ((State != US_NO_PASSWD) && (State != US_REGISTERED))
-    userAccountControl |= UF_ACCOUNTDISABLE;
+      if (Exchange)
+	{
+	  hide_address_lists_v[0] = "TRUE";
+	  ADD_ATTR("msExchHideFromAddressLists", hide_address_lists_v,
+		   LDAP_MOD_REPLACE);
+	}
+    }
+  else
+    {
+      if (Exchange)
+	{
+	  hide_address_lists_v[0] = NULL;
+	  ADD_ATTR("msExchHideFromAddressLists", hide_address_lists_v,
+		   LDAP_MOD_REPLACE);
+	}
+    }
+
   sprintf(userAccountControlStr, "%ld", userAccountControl);
   userAccountControl_v[0] = userAccountControlStr;
   ADD_ATTR("userAccountControl", userAccountControl_v, LDAP_MOD_REPLACE);
 
+  if (Exchange)
+    {
+      if (rc = moira_connect())
+	{
+	  critical_alert("AD incremental", 
+			 "Error contacting Moira server : %s",
+			 error_message(rc));
+	  return;
+	}
+ 
+      argv[0] = user_name;
+
+      if (!(rc = mr_query("get_pobox", 1, argv, save_query_info, save_argv)))
+	{
+	  if(!strcmp(save_argv[1], "EXCHANGE") || 
+	     (strstr(save_argv[3], search_string) != NULL))
+	    {
+	      alt_recipient_v[0] = NULL;
+	      ADD_ATTR("altRecipient", alt_recipient_v, LDAP_MOD_REPLACE);
+
+	      argv[0] = exchange_acl;
+	      argv[1] = "USER";
+	      argv[2] = user_name;
+	      
+	      rc = mr_query("add_member_to_list", 3, argv, NULL, NULL);
+	      
+	      if ((rc) && (rc != MR_EXISTS))
+		{
+		  com_err(whoami, 0, "Unable to add user %s to %s: %s",
+			  user_name, exchange_acl, error_message(rc));
+		}
+	    }
+	  else 
+	    {
+	      alt_recipient_v[0] = alt_recipient;
+	      ADD_ATTR("altRecipient", alt_recipient_v, LDAP_MOD_REPLACE);
+	      
+	      argv[0] = exchange_acl;
+	      argv[1] = "USER";
+	      argv[2] = user_name;
+	      
+	      rc = mr_query("delete_member_from_list", 3, argv, NULL, NULL);
+	      
+	      if ((rc) && (rc != MR_NO_MATCH))
+		{  
+		  com_err(whoami, 0,
+			  "Unable to remove user %s from %s: %s, %d",
+			  user_name, exchange_acl, error_message(rc), rc);
+		}  
+	    }
+	}
+      else
+	{
+	  alt_recipient_v[0] = alt_recipient;
+	  ADD_ATTR("altRecipient", alt_recipient_v, LDAP_MOD_REPLACE);
+	  
+	  argv[0] = exchange_acl;
+	  argv[1] = "USER";
+	  argv[2] = user_name;
+	  
+	  rc = mr_query("delete_member_from_list", 3, argv, NULL, NULL);
+	  
+	  if ((rc) && (rc != MR_NO_MATCH))
+	    {  
+	      com_err(whoami, 0,
+		      "Unable to remove user %s from %s: %s, %d",
+		      user_name, exchange_acl, error_message(rc), rc);
+	    }  
+	}
+      
+      moira_disconnect();
+    }
+  else
+    {
+      mail_v[0] = contact_mail;
+      ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE);
+    }
+
   n = SetHomeDirectory(ldap_handle, user_name, distinguished_name, WinHomeDir, 
                        WinProfileDir, homedir_v, winProfile_v,
                        drives_v, mods, LDAP_MOD_REPLACE, n);
 
+  sprintf(filter_exp, "(sAMAccountName=%s)", "UserTemplate.u");
+  sprintf(search_path, "%s,%s", security_template_ou, dn_path);
+  attr_array[0] = "sAMAccountName";
+  attr_array[1] = NULL;
+  group_count = 0;
+  group_base = NULL;
+
+  if ((rc = linklist_build(ldap_handle, search_path, filter_exp, attr_array,
+			   &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE) != 0))
+    return(1);
+
+  if (group_count != 1)
+    {
+      com_err(whoami, 0, "Unable to process user security template: %s - "
+	      "security not set", "UserTemplate.u");
+      return(1);
+    }
+
+  strcpy(TemplateDn, group_base->dn);
+  strcpy(TemplateSamName, group_base->value);
+  linklist_free(group_base);
+  group_base = NULL;
+  group_count = 0;
+
+  rc = ldap_search_ext_s(ldap_handle, search_path, LDAP_SCOPE_SUBTREE,
+			 filter_exp, NULL, 0, apsServerControls, NULL,
+			 NULL, 0, &psMsg);
+
+  if ((psMsg = ldap_first_entry(ldap_handle, psMsg)) == NULL)
+    {
+      com_err(whoami, 0, "Unable to find user security template: %s - "
+	      "security not set", "UserTemplate.u");
+      return(1);
+    }
+
+  ppsValues = ldap_get_values_len(ldap_handle, psMsg, "ntSecurityDescriptor");
+
+  if (ppsValues == NULL)
+    {
+      com_err(whoami, 0, "Unable to find user security template: %s - "
+	      "security not set", "UserTemplate.u");
+      return(1);
+    }
+  
+  ADD_ATTR("ntSecurityDescriptor", (char **)ppsValues,
+	   LDAP_MOD_REPLACE | LDAP_MOD_BVALUES);
+  
   mods[n] = NULL;
-  if ((rc = ldap_modify_s(ldap_handle, distinguished_name, mods)) != LDAP_SUCCESS)
+
+  if ((rc = ldap_modify_s(ldap_handle, distinguished_name, 
+			  mods)) != LDAP_SUCCESS)
     {
-        OldUseSFU30 = UseSFU30;
-        SwitchSFU(mods, &UseSFU30, n);
-        if (OldUseSFU30 != UseSFU30)
-            rc = ldap_modify_s(ldap_handle, distinguished_name, mods);
-        if (rc)
+      OldUseSFU30 = UseSFU30;
+      SwitchSFU(mods, &UseSFU30, n);
+      if (OldUseSFU30 != UseSFU30)
+	rc = ldap_modify_s(ldap_handle, distinguished_name, mods);
+      if (rc)
         {
-            com_err(whoami, 0, "Unable to modify user data for %s : %s",
-                user_name, ldap_err2string(rc));
+	  com_err(whoami, 0, "Unable to modify user data for %s : %s",
+		  user_name, ldap_err2string(rc));
         }
     }
+  
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   return(rc);
 }
 
@@ -2890,29 +4194,44 @@
   char new_dn[256];
   char old_dn[256];
   char upn[256];
-  char temp[128];
+  char mail[256];
+  char contact_mail[256];
+  char proxy_address[256];
+  char query_base_dn[256];
+  char temp[256];
   char *userPrincipalName_v[] = {NULL, NULL};
   char *altSecurityIdentities_v[] = {NULL, NULL};
   char *name_v[] = {NULL, NULL};
   char *samAccountName_v[] = {NULL, NULL};
+  char *mail_v[] = {NULL, NULL};
+  char *mail_nickname_v[] = {NULL, NULL};
+  char *proxy_address_v[] = {NULL, NULL};
+  char *query_base_dn_v[] = {NULL, NULL};
   int  n;
   int  rc;
   int  i;
 
   if (!check_string(before_user_name))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP user name %s", before_user_name);
+      com_err(whoami, 0, 
+	      "Unable to process invalid LDAP user name %s", before_user_name);
       return(AD_INVALID_NAME);
     }
+
   if (!check_string(user_name))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP user name %s", user_name);
+      com_err(whoami, 0, 
+	      "Unable to process invalid LDAP user name %s", user_name);
       return(AD_INVALID_NAME);
     }
 
   strcpy(user_name, user_name);
   sprintf(old_dn, "cn=%s,%s,%s", before_user_name, user_ou, dn_path);
   sprintf(new_dn, "cn=%s", user_name);
+  sprintf(mail, "%s@%s", user_name, lowercase(ldap_domain));
+  sprintf(contact_mail, "%s@mit.edu", user_name);
+  sprintf(proxy_address, "SMTP:%s@%s", user_name, lowercase(ldap_domain)); 
+
   if ((rc = ldap_rename_s(ldap_handle, old_dn, new_dn, NULL, TRUE, 
                            NULL, NULL)) != LDAP_SUCCESS)
     {
@@ -2921,31 +4240,71 @@
       return(rc);
     }
 
+  if (Exchange)
+    {
+      sprintf(temp, "cn=%s@mit.edu,%s,%s", before_user_name, contact_ou, 
+	      dn_path);
+
+      if(rc = ldap_delete_s(ldap_handle, temp))
+	{
+	  com_err(whoami, 0, "Unable to delete user contact for %s",
+		  user_name);
+	}
+      
+      if(contact_create(ldap_handle, dn_path, contact_mail, contact_ou))
+	{
+	  com_err(whoami, 0, "Unable to create user contact %s", contact_mail);
+	}
+    }
+
   name_v[0] = user_name;
   sprintf(upn, "%s@%s", user_name, ldap_domain);
   userPrincipalName_v[0] = upn;
   sprintf(temp, "Kerberos:%s@%s", user_name, PRIMARY_REALM);
+  sprintf(query_base_dn, "%s%s", ADDRESS_LIST_PREFIX, dn_path);
   altSecurityIdentities_v[0] = temp;
   samAccountName_v[0] = user_name;
+  mail_v[0] = mail;
+  mail_nickname_v[0] = user_name;
+  proxy_address_v[0] = proxy_address; 
+  query_base_dn_v[0] = query_base_dn;
 
   n = 0;
   ADD_ATTR("altSecurityIdentities", altSecurityIdentities_v, LDAP_MOD_REPLACE);
   ADD_ATTR("userPrincipalName", userPrincipalName_v, LDAP_MOD_REPLACE);
   ADD_ATTR("displayName", name_v, LDAP_MOD_REPLACE);
   ADD_ATTR("sAMAccountName", samAccountName_v, LDAP_MOD_REPLACE);
+
+  if (Exchange)
+    {
+      ADD_ATTR("msExchQueryBaseDN", query_base_dn_v, LDAP_MOD_REPLACE);
+      ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_REPLACE); 
+      ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE); 
+      ADD_ATTR("proxyAddresses", proxy_address_v, LDAP_MOD_REPLACE);
+    }
+  else
+    {
+      mail_v[0] = contact_mail;
+      ADD_ATTR("mail", mail_v, LDAP_MOD_REPLACE); 
+    }
+
   mods[n] = NULL;
+  
   sprintf(new_dn, "cn=%s,%s,%s", user_name, user_ou, dn_path);
+
   if ((rc = ldap_modify_s(ldap_handle, new_dn, mods)) != LDAP_SUCCESS)
     {
-      com_err(whoami, 0, "Unable to modify user data for %s after renaming : %s",
+      com_err(whoami, 0, 
+	      "Unable to modify user data for %s after renaming : %s",
               user_name, ldap_err2string(rc));
     }
+  
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   return(rc);
 }
 
-
 int user_create(int ac, char **av, void *ptr)
 {
   LDAPMod *mods[20];
@@ -2953,6 +4312,14 @@
   char user_name[256];
   char sam_name[256];
   char upn[256];
+  char mail[256];
+  char contact_mail[256];
+  char proxy_address[256];
+  char mail_nickname[256];
+  char query_base_dn[256];
+  char displayName[256];
+  char address_book[256];
+  char alt_recipient[256];
   char *cn_v[] = {NULL, NULL};
   char *objectClass_v[] = {"top", "person", 
                            "organizationalPerson", 
@@ -2970,9 +4337,31 @@
   char *homedir_v[] = {NULL, NULL};
   char *winProfile_v[] = {NULL, NULL};
   char *drives_v[] = {NULL, NULL};
+  char *mail_v[] = {NULL, NULL};
+  char *givenName_v[] = {NULL, NULL};
+  char *sn_v[] = {NULL, NULL};
+  char *initials_v[] = {NULL, NULL};
+  char *displayName_v[] = {NULL, NULL};
+  char *proxy_address_v[] = {NULL, NULL};
+  char *mail_nickname_v[] = {NULL, NULL};
+  char *query_base_dn_v[] = {NULL, NULL};
+  char *address_book_v[] = {NULL, NULL};
+  char *homeMDB_v[] = {NULL, NULL};
+  char *homeServerName_v[] = {NULL, NULL};
+  char *mdbUseDefaults_v[] = {NULL, NULL};
+  char *mailbox_guid_v[] = {NULL, NULL};
+  char *user_culture_v[] = {NULL, NULL};
+  char *user_account_control_v[] = {NULL, NULL};
+  char *msexch_version_v[] = {NULL, NULL};
+  char *alt_recipient_v[] = {NULL, NULL};
+  char *hide_address_lists_v[] = {NULL, NULL};
   char userAccountControlStr[80];
   char temp[128];
-  u_int userAccountControl = UF_NORMAL_ACCOUNT | UF_DONT_EXPIRE_PASSWD | UF_PASSWD_CANT_CHANGE;
+  char filter_exp[1024];
+  char search_path[512];
+  char *attr_array[3];
+  u_int userAccountControl = UF_NORMAL_ACCOUNT | UF_DONT_EXPIRE_PASSWD | 
+    UF_PASSWD_CANT_CHANGE; 
   int  n;
   int  rc;
   int  i;
@@ -2980,37 +4369,127 @@
   char **call_args;
   char WinHomeDir[1024];
   char WinProfileDir[1024];
+  char *homeMDB;
+  char *homeServerName;
+  ULONG dwInfo;
+  char acBERBuf[N_SD_BER_BYTES];
+  LK_ENTRY  *group_base;
+  int    group_count;
+  char TemplateDn[512];
+  char TemplateSamName[128];
+  LDAP_BERVAL **ppsValues;
+  LDAPControl sControl = {"1.2.840.113556.1.4.801",
+                          { N_SD_BER_BYTES, acBERBuf },
+                          TRUE};
+  LDAPControl *apsServerControls[] = {&sControl, NULL};
+  LDAPMessage *psMsg;
+  char *argv[3];
+  char *save_argv[7];
+  char search_string[256];
 
   call_args = ptr;
 
+  dwInfo = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
+    DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
+  BEREncodeSecurityBits(dwInfo, acBERBuf);
+
   if (!check_string(av[U_NAME]))
     {
       callback_rc = AD_INVALID_NAME;
-      com_err(whoami, 0, "Unable to process invalid LDAP user name %s", av[U_NAME]);
+      com_err(whoami, 0, "Unable to process invalid LDAP user name %s", 
+	      av[U_NAME]);
       return(AD_INVALID_NAME);
     }
 
   memset(WinHomeDir, '\0', sizeof(WinHomeDir));
   memset(WinProfileDir, '\0', sizeof(WinProfileDir));
+  memset(displayName, '\0', sizeof(displayName));
+  memset(query_base_dn, '\0', sizeof(query_base_dn));
   strcpy(WinHomeDir, av[U_WINHOMEDIR]);
   strcpy(WinProfileDir, av[U_WINPROFILEDIR]);
   strcpy(user_name, av[U_NAME]);
   sprintf(upn, "%s@%s", user_name, ldap_domain);
   sprintf(sam_name, "%s", av[U_NAME]);
+
+  if(strlen(av[U_FIRST])) {
+    strcat(displayName, av[U_FIRST]);
+  }
+
+  if(strlen(av[U_MIDDLE])) {
+    if(strlen(av[U_FIRST]))
+       strcat(displayName, " "); 
+
+    strcat(displayName, av[U_MIDDLE]);
+  }
+
+  if(strlen(av[U_LAST])) {
+    if(strlen(av[U_FIRST]) || strlen(av[U_LAST]))
+      strcat(displayName, " ");
+
+    strcat(displayName, av[U_LAST]);
+  }
+
   samAccountName_v[0] = sam_name;
-  if ((atoi(av[U_STATE]) != US_NO_PASSWD) && (atoi(av[U_STATE]) != US_REGISTERED))
-    userAccountControl |= UF_ACCOUNTDISABLE;
+  if ((atoi(av[U_STATE]) != US_NO_PASSWD) && 
+      (atoi(av[U_STATE]) != US_REGISTERED))
+    {
+      userAccountControl |= UF_ACCOUNTDISABLE;
+
+      if (Exchange)
+	{
+	  hide_address_lists_v[0] = "TRUE";
+	  ADD_ATTR("msExchHideFromAddressLists", hide_address_lists_v,
+		   LDAP_MOD_ADD);
+	}
+    }
+
   sprintf(userAccountControlStr, "%ld", userAccountControl);
   userAccountControl_v[0] = userAccountControlStr;
   userPrincipalName_v[0] = upn;
-
   cn_v[0] = user_name;
   name_v[0] = user_name;
   desc_v[0] = "Auto account created by Moira";
+  mail_v[0] = mail;
+  givenName_v[0] = av[U_FIRST];
+  sn_v[0] = av[U_LAST];
+  displayName_v[0] = displayName;
+  mail_nickname_v[0] = user_name;
+  
   sprintf(temp, "Kerberos:%s@%s", user_name, PRIMARY_REALM);
   altSecurityIdentities_v[0] = temp;    
   sprintf(new_dn, "cn=%s,%s,%s", user_name, user_ou, call_args[1]);
+  sprintf(mail,"%s@%s", user_name, lowercase(ldap_domain));
+  sprintf(contact_mail, "%s@mit.edu", user_name);
+  sprintf(query_base_dn, "%s%s", ADDRESS_LIST_PREFIX, call_args[1]);
+  query_base_dn_v[0] = query_base_dn;
+  sprintf(alt_recipient, "cn=%s@mit.edu,%s,%s", user_name, contact_ou, 
+	  call_args[1]);
+  sprintf(search_string, "@%s", uppercase(ldap_domain));
 
+
+  if (Exchange)
+    {
+      if(contact_create((LDAP *)call_args[0], call_args[1], contact_mail, 
+			contact_ou))
+	{
+	  com_err(whoami, 0, "Unable to create user contact %s", 
+		  contact_mail);
+	}
+      
+      if(find_homeMDB((LDAP *)call_args[0], call_args[1], &homeMDB, 
+		      &homeServerName)) 
+	{
+	  com_err(whoami, 0, "Unable to locate homeMB and homeServerName");
+	  return(1);
+	}
+      
+      com_err(whoami, 0, "homeMDB:%s", homeMDB);
+      com_err(whoami, 0, "homeServerName:%s", homeServerName);
+  
+      homeMDB_v[0] = homeMDB;
+      homeServerName_v[0] = homeServerName; 
+    }
+
   n = 0;
   ADD_ATTR("cn", cn_v, LDAP_MOD_ADD);
   ADD_ATTR("objectClass", objectClass_v, LDAP_MOD_ADD);
@@ -3018,18 +4497,88 @@
   ADD_ATTR("userPrincipalName", userPrincipalName_v, LDAP_MOD_ADD);
   ADD_ATTR("userAccountControl", userAccountControl_v, LDAP_MOD_ADD);
   ADD_ATTR("name", name_v, LDAP_MOD_ADD);
-  ADD_ATTR("displayName", name_v, LDAP_MOD_ADD);
   ADD_ATTR("description", desc_v, LDAP_MOD_ADD);
+
+  if (Exchange)
+    {
+      ADD_ATTR("msExchQueryBaseDN", query_base_dn_v, LDAP_MOD_ADD);
+      ADD_ATTR("mailNickName", mail_nickname_v, LDAP_MOD_ADD);
+      ADD_ATTR("homeMDB", homeMDB_v, LDAP_MOD_ADD);
+      mdbUseDefaults_v[0] = "TRUE";
+      ADD_ATTR("mdbUseDefaults", mdbUseDefaults_v, LDAP_MOD_ADD);
+      ADD_ATTR("msExchHomeServerName", homeServerName_v, LDAP_MOD_ADD); 
+      
+      argv[0] = user_name;
+    
+      if (!(rc = mr_query("get_pobox", 1, argv, save_query_info, save_argv)))
+	{
+	  if(!strcmp(save_argv[1], "EXCHANGE") || 
+	     (strstr(save_argv[3], search_string) != NULL))
+	    {
+	      argv[0] = exchange_acl;
+	      argv[1] = "USER";
+	      argv[2] = user_name;
+	      
+	      rc = mr_query("add_member_to_list", 3, argv, NULL, NULL);
+	      
+	      if ((rc) && (rc != MR_EXISTS))
+		{
+		  com_err(whoami, 0, "Unable to add user %s to %s: %s",
+			  user_name, exchange_acl, error_message(rc));
+		}
+	    } 
+	  else 
+	    {
+	      alt_recipient_v[0] = alt_recipient;
+	      ADD_ATTR("altRecipient", alt_recipient_v, LDAP_MOD_ADD);
+	    }
+	}
+      else
+	{
+	  alt_recipient_v[0] = alt_recipient;
+	  ADD_ATTR("altRecipient", alt_recipient_v, LDAP_MOD_ADD);
+	  
+	  com_err(whoami, 0, "Unable to fetch pobox for %s", user_name);
+	}
+    }
+  else
+    {
+      mail_v[0] = contact_mail;
+      ADD_ATTR("mail", mail_v, LDAP_MOD_ADD);
+    }
+
+  if(strlen(av[U_FIRST])) {
+    ADD_ATTR("givenName", givenName_v, LDAP_MOD_ADD);
+  }
+
+  if(strlen(av[U_LAST])) {
+    ADD_ATTR("sn", sn_v, LDAP_MOD_ADD);
+  }
+
+  if(strlen(av[U_FIRST]) || strlen(av[U_MIDDLE]) || strlen(av[U_LAST])) {
+    ADD_ATTR("displayName", displayName_v, LDAP_MOD_ADD);
+  } else {
+    ADD_ATTR("displayName", name_v, LDAP_MOD_ADD);
+  }
+
+  if (strlen(av[U_MIDDLE]) == 1) {
+    initials_v[0] = av[U_MIDDLE];
+    ADD_ATTR("initials", initials_v, LDAP_MOD_ADD);
+  }
+
   if (strlen(call_args[2]) != 0)    
     {
       mitMoiraId_v[0] = call_args[2];
-      ADD_ATTR("mitMoiraId", mitMoiraId_v, LDAP_MOD_ADD);
+      ADD_ATTR("mitMoiraId", mitMoiraId_v, LDAP_MOD_ADD); 
     }
-  ADD_ATTR("altSecurityIdentities", altSecurityIdentities_v, LDAP_MOD_ADD);
+  
+  ADD_ATTR("altSecurityIdentities", altSecurityIdentities_v, LDAP_MOD_ADD); 
+
   if (strlen(av[U_UID]) != 0)
     {
       uid_v[0] = av[U_UID];
       ADD_ATTR("uid", uid_v, LDAP_MOD_ADD);
+
       if (!UseSFU30)
         {
           ADD_ATTR("uidNumber", uid_v, LDAP_MOD_ADD);
@@ -3039,29 +4588,81 @@
           ADD_ATTR("msSFU30UidNumber", uid_v, LDAP_MOD_ADD);
         }
     }
+
   if ((strlen(av[U_MITID]) != 0) && (av[U_MITID][0] == '9'))
       mitid_v[0] = av[U_MITID];
   else
       mitid_v[0] = "none";
+
   ADD_ATTR("employeeID", mitid_v, LDAP_MOD_ADD);
 
   n = SetHomeDirectory((LDAP *)call_args[0], user_name, new_dn, WinHomeDir, 
                        WinProfileDir, homedir_v, winProfile_v,
                        drives_v, mods, LDAP_MOD_ADD, n);
 
+  sprintf(filter_exp, "(sAMAccountName=%s)", "UserTemplate.u");
+  sprintf(search_path, "%s,%s", security_template_ou, call_args[1]);
+  attr_array[0] = "sAMAccountName";
+  attr_array[1] = NULL;
+  group_count = 0;
+  group_base = NULL;
+
+  if ((rc = linklist_build((LDAP *)call_args[0], search_path, filter_exp, 
+			   attr_array, &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE) != 0))
+    return(1);
+
+  if (group_count != 1)
+    {
+      com_err(whoami, 0, "Unable to process user security template: %s - "
+	      "security not set", "UserTemplate.u");
+      return(1);
+    }
+
+  strcpy(TemplateDn, group_base->dn);
+  strcpy(TemplateSamName, group_base->value);
+  linklist_free(group_base);
+  group_base = NULL;
+  group_count = 0;
+
+  rc = ldap_search_ext_s((LDAP *)call_args[0], search_path, LDAP_SCOPE_SUBTREE,
+			 filter_exp, NULL, 0, apsServerControls, NULL,
+			 NULL, 0, &psMsg);
+
+  if ((psMsg = ldap_first_entry((LDAP *)call_args[0], psMsg)) == NULL)
+    {
+      com_err(whoami, 0, "Unable to find user security template: %s - "
+	      "security not set", "UserTemplate.u");
+      return(1);
+    }
+
+  ppsValues = ldap_get_values_len((LDAP *)call_args[0], psMsg, 
+				  "ntSecurityDescriptor");
+  if (ppsValues == NULL)
+    {
+      com_err(whoami, 0, "Unable to find user security template: %s - "
+	      "security not set", "UserTemplate.u");
+      return(1);
+    }
+  
+  ADD_ATTR("ntSecurityDescriptor", (char **)ppsValues,
+     LDAP_MOD_REPLACE | LDAP_MOD_BVALUES); 
+
   mods[n] = NULL;
 
   rc = ldap_add_ext_s((LDAP *)call_args[0], new_dn, mods, NULL, NULL);
+
   if ((rc != LDAP_SUCCESS) && (rc != LDAP_ALREADY_EXISTS))
-  {
+    {
       OldUseSFU30 = UseSFU30;
       SwitchSFU(mods, &UseSFU30, n);
       if (OldUseSFU30 != UseSFU30)
-          rc = ldap_add_ext_s((LDAP *)call_args[0], new_dn, mods, NULL, NULL);
-  }
+	rc = ldap_add_ext_s((LDAP *)call_args[0], new_dn, mods, NULL, NULL);
+    }
 
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   if ((rc != LDAP_SUCCESS) && (rc != LDAP_ALREADY_EXISTS))
     {
       com_err(whoami, 0, "Unable to create user %s : %s",
@@ -3069,27 +4670,29 @@
       callback_rc = rc;
       return(rc);
     }
-  if (rc == LDAP_SUCCESS)
+
+  if ((rc == LDAP_SUCCESS) && (SetPassword))
     {
       if ((rc = set_password(sam_name, "", ldap_domain)) != 0)
         {
           ad_kdc_disconnect();
-          tickets_get_k5();
           if (!ad_server_connect(default_server, ldap_domain))
             {
               com_err(whoami, 0, "Unable to set password for user %s : %s",
-                      user_name, "cannot get changepw ticket from windows domain");
+                      user_name, 
+		      "cannot get changepw ticket from windows domain");
             }
           else
             {
               if ((rc = set_password(sam_name, "", ldap_domain)) != 0)
                 {
-                  com_err(whoami, 0, "Unable to set password for user %s : %ld",
-                          user_name, rc);
+                  com_err(whoami, 0, "Unable to set password for user %s "
+			  ": %ld", user_name, rc);
                 }
             }
         }
     }
+
   return(0);
 }
 
@@ -3113,7 +4716,8 @@
 
   if (!check_string(user_name))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP user name %s", user_name);
+      com_err(whoami, 0, "Unable to process invalid LDAP user name %s", 
+	      user_name);
       return(AD_INVALID_NAME);
     }
 
@@ -3126,13 +4730,15 @@
       attr_array[0] = "UserAccountControl";
       attr_array[1] = NULL;
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to process user %s : %s",
                   user_name, ldap_err2string(rc));
           return(rc);
         }
     }
+
   if (group_count != 1)
     {
       linklist_free(group_base);
@@ -3142,14 +4748,15 @@
       attr_array[0] = "UserAccountControl";
       attr_array[1] = NULL;
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to process user %s : %s",
                   user_name, ldap_err2string(rc));
           return(rc);
         }
     }
-
+  
   if (group_count != 1)
     {
       linklist_free(group_base);
@@ -3160,35 +4767,45 @@
 
   strcpy(distinguished_name, group_base->dn);
   ulongValue = atoi((*group_base).value);
+
   if (operation == MEMBER_DEACTIVATE)
     ulongValue |= UF_ACCOUNTDISABLE;
   else    
     ulongValue &= ~UF_ACCOUNTDISABLE;
+
   sprintf(temp, "%ld", ulongValue);
+
   if ((rc = construct_newvalues(group_base, group_count, (*group_base).value, 
                                 temp, &modvalues, REPLACE)) == 1)
     goto cleanup;
+
   linklist_free(group_base);
   group_base = NULL;
   group_count = 0;
   n = 0;
   ADD_ATTR("UserAccountControl", modvalues, LDAP_MOD_REPLACE);
+
   if (strlen(MoiraId) != 0)
     {
     mitMoiraId_v[0] = MoiraId;
     ADD_ATTR("mitMoiraId", mitMoiraId_v, LDAP_MOD_REPLACE);
     }
+
   mods[n] = NULL;
   rc = ldap_modify_s(ldap_handle, distinguished_name, mods);
+
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   free_values(modvalues);
+
   if (rc != LDAP_SUCCESS)
     {
       com_err(whoami, 0, "Unable to change status of user %s : %s",
               user_name, ldap_err2string(rc));
     }
-cleanup:
+  
+ cleanup:
   return(rc);
 }
 
@@ -3202,6 +4819,7 @@
   LK_ENTRY  *group_base;
   int       group_count;
   int       rc;
+  char      temp[256];
 
   if (!check_string(u_name))
     return(AD_INVALID_NAME);
@@ -3216,13 +4834,15 @@
       attr_array[0] = "name";
       attr_array[1] = NULL;
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to process user %s : %s",
                   user_name, ldap_err2string(rc));
           goto cleanup;
         }
     }
+  
   if (group_count != 1)
     {
       linklist_free(group_base);
@@ -3232,7 +4852,8 @@
       attr_array[0] = "name";
       attr_array[1] = NULL;
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to process user %s : %s",
                   user_name, ldap_err2string(rc));
@@ -3246,16 +4867,31 @@
               user_name);
       goto cleanup;
     }
+  
+  strcpy(distinguished_name, group_base->dn);
 
-  strcpy(distinguished_name, group_base->dn);
   if (rc = ldap_delete_s(ldap_handle, distinguished_name))
     {
       com_err(whoami, 0, "Unable to process user %s : %s",
               user_name, ldap_err2string(rc));
     }
 
-cleanup:
+  /* Need to add code to delete mit.edu contact */
+  
+  if (Exchange)
+    {
+      sprintf(temp, "cn=%s@mit.edu,%s,%s", user_name, contact_ou, dn_path);
+
+      if(rc = ldap_delete_s(ldap_handle, temp))
+	{
+	  com_err(whoami, 0, "Unable to delete user contact for %s",
+		  user_name);
+	}
+    }
+
+ cleanup:
   linklist_free(group_base);
+
   return(0);
 }
 
@@ -3267,16 +4903,22 @@
     {
       if (linklist_base->dn != NULL)
         free(linklist_base->dn);
+
       if (linklist_base->attribute != NULL)
         free(linklist_base->attribute);
+
       if (linklist_base->value != NULL)
         free(linklist_base->value);
+
       if (linklist_base->member != NULL)
         free(linklist_base->member);
+
       if (linklist_base->type != NULL)
         free(linklist_base->type);
+
       if (linklist_base->list != NULL)
         free(linklist_base->list);
+
       linklist_previous = linklist_base;
       linklist_base = linklist_previous->next;
       free(linklist_previous);
@@ -3288,6 +4930,7 @@
   int i;
 
   i = 0;
+
   if (modvalues != NULL)
     {
     while (modvalues[i] != NULL)
@@ -3326,12 +4969,15 @@
   for (; *s; s++)
     {
       character = *s;
+
       if (isupper(character))
         character = tolower(character);
+
       if (illegalchars[(unsigned) character])
         return 0;
     }
-  return 1;
+
+  return(1);
 }
 
 int check_container_name(char *s)
@@ -3341,15 +4987,18 @@
   for (; *s; s++)
     {
       character = *s;
+
       if (isupper(character))
         character = tolower(character);
 
-	  if (character == ' ')
-		  continue;
+      if (character == ' ')
+	continue;
+
       if (illegalchars[(unsigned) character])
         return 0;
     }
-  return 1;
+
+  return(1);
 }
 
 int mr_connect_cl(char *server, char *client, int version, int auth)
@@ -3359,6 +5008,7 @@
   char  temp[128];
 
   status = mr_connect(server);
+
   if (status)
     {
       com_err(whoami, status, "while connecting to Moira");
@@ -3366,12 +5016,14 @@
     }
 
   status = mr_motd(&motd);
+
   if (status)
     {
       mr_disconnect();
       com_err(whoami, status, "while checking server status");
       return status;
     }
+
   if (motd)
     {
       sprintf(temp, "The Moira server is currently unavailable: %s", motd);
@@ -3381,6 +5033,7 @@
     }
 
   status = mr_version(version);
+
   if (status)
     {
       if (status == MR_UNKNOWN_PROC)
@@ -3393,7 +5046,8 @@
 
       if (status == MR_VERSION_HIGH)
         {
-          com_err(whoami, 0, "Warning: This client is running newer code than the server.");
+          com_err(whoami, 0, "Warning: This client is running newer code "
+		  "than the server.");
                   com_err(whoami, 0, "Some operations may not work.");
         }
       else if (status && status != MR_VERSION_LOW)
@@ -3414,27 +5068,27 @@
           return status;
         }
     }
-
+  
   return MR_SUCCESS;
 }
 
 void AfsToWinAfs(char* path, char* winPath)
 {
-    char* pathPtr;
-    char* winPathPtr;
-    strcpy(winPath, WINAFS);
-    pathPtr = path + strlen(AFS);
-    winPathPtr = winPath + strlen(WINAFS);
-
-    while (*pathPtr)
+  char* pathPtr;
+  char* winPathPtr;
+  strcpy(winPath, WINAFS);
+  pathPtr = path + strlen(AFS);
+  winPathPtr = winPath + strlen(WINAFS);
+  
+  while (*pathPtr)
     {
-        if (*pathPtr == '/')
-          *winPathPtr = '\\';
-        else
-          *winPathPtr = *pathPtr;
-
-        pathPtr++;
-        winPathPtr++;
+      if (*pathPtr == '/')
+	*winPathPtr = '\\';
+      else
+	*winPathPtr = *pathPtr;
+      
+      pathPtr++;
+      winPathPtr++;
     }
 }
 
@@ -3444,13 +5098,12 @@
   int   security_flag;
 
   call_args = ptr;
-
+  
   strcpy(call_args[0], av[L_ACE_TYPE]);
   strcpy(call_args[1], av[L_ACE_NAME]);
   security_flag = 0;
   get_group_membership(call_args[2], call_args[3], &security_flag, av);
-  return(LDAP_SUCCESS);
-
+  return(LDAP_SUCCESS);  
 }
 
 int checkADname(LDAP *ldap_handle, char *dn_path, char *Name)
@@ -3460,15 +5113,17 @@
   int  group_count;
   int  rc;
   LK_ENTRY  *group_base;
-
+  
   group_count = 0;
   group_base = NULL;
-
+  
   sprintf(filter, "(sAMAccountName=%s)", Name);
   attr_array[0] = "sAMAccountName";
   attr_array[1] = NULL;
+
   if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                           &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0)
     {
       com_err(whoami, 0, "Unable to process ACE name %s : %s",
               Name, ldap_err2string(rc));
@@ -3477,14 +5132,17 @@
 
   linklist_free(group_base);
   group_base = NULL;
+
   if (group_count == 0)
     return(0);
+  
   return(1);
 }
 
 #define MAX_ACE 7
 
-int ProcessAce(LDAP *ldap_handle, char *dn_path, char *Name, char *Type, int UpdateGroup, int *ProcessGroup)
+int ProcessAce(LDAP *ldap_handle, char *dn_path, char *Name, char *Type, 
+	       int UpdateGroup, int *ProcessGroup, char *maillist)
 {
   char  *av[2];
   char  GroupName[256];
@@ -3496,11 +5154,19 @@
   char  AceMembership[2];
   char  AceOu[256];
   char  temp[128];
+  char  *save_argv[U_END];
 
+  if (!SetGroupAce)
+    {
+      com_err(whoami, 0, "ProcessAce disabled, skipping");
+      return(0);
+    }
+
   strcpy(GroupName, Name);
-
+  
   if (strcasecmp(Type, "LIST"))
     return(1);
+
   while (1)
     {
       av[0] = GroupName;
@@ -3513,30 +5179,39 @@
       memset(AceMembership, '\0', sizeof(AceMembership));
       memset(AceOu, '\0', sizeof(AceOu));
       callback_rc = 0;
+    
       if (rc = mr_query("get_list_info", 1, av, GetAceInfo, AceInfo))
-        {
-          com_err(whoami, 0, "Unable to get ACE info for list %s : %s", GroupName, error_message(rc));
+        { 
+          com_err(whoami, 0, "Unable to get ACE info for list %s : %s", 
+		  GroupName, error_message(rc));
           return(1);
         }
+
       if (callback_rc)
         {
           com_err(whoami, 0, "Unable to get ACE info for list %s", GroupName);
           return(1);
         }
+
       if ((strcasecmp(AceType, "USER")) && (strcasecmp(AceType, "LIST")))
         return(0);
+
       strcpy(temp, AceName);
+
       if (!strcasecmp(AceType, "LIST"))
-        sprintf(temp, "%s_group", AceName);
+        sprintf(temp, "%s%s", AceName, group_suffix);
+
       if (!UpdateGroup)
         {
           if (checkADname(ldap_handle, dn_path, temp))
             return(0);
           (*ProcessGroup) = 1;
         }
+
       if (!strcasecmp(AceInfo[0], "LIST"))
         {
-          if (make_new_group(ldap_handle, dn_path, "", AceName, AceOu, AceMembership, 0, UpdateGroup))
+          if (make_new_group(ldap_handle, dn_path, "", AceName, AceOu, 
+			     AceMembership, 0, UpdateGroup, maillist))
             return(1);
         }
       else if (!strcasecmp(AceInfo[0], "USER"))
@@ -3547,37 +5222,57 @@
           call_args[2] = "";
           call_args[3] = NULL;
           callback_rc = 0;
-          if (rc = mr_query("get_user_account_by_login", 1, av, user_create, call_args))
+
+          if (rc = mr_query("get_user_account_by_login", 1, av, 
+			    save_query_info, save_argv))
             {
-              com_err(whoami, 0, "Unable to process user ACE %s for group %s.", AceName, Name);
+              com_err(whoami, 0, "Unable to process user ACE %s for group %s.",
+		      AceName, Name);
               return(1);
             }
+
+	  if (rc = user_create(U_END, save_argv, call_args)) 
+	    {
+              com_err(whoami, 0, "Unable to process user ACE %s for group %s.",
+		      AceName, Name);
+              return(1);
+	    }
+	  
           if (callback_rc)
             {
-              com_err(whoami, 0, "Unable to process user Ace %s for group %s", AceName, Name);
+              com_err(whoami, 0, "Unable to process user Ace %s for group %s",
+		      AceName, Name);
               return(1);
             }
+
           return(0);
         }
       else
         return(1);
+
       if (!strcasecmp(AceType, "LIST"))
         {
           if (!strcasecmp(GroupName, AceName))
             return(0);
         }
+
       strcpy(GroupName, AceName);
     }
+  
   return(1);
 }
 
 int make_new_group(LDAP *ldap_handle, char *dn_path, char *MoiraId, 
                    char *group_name, char *group_ou, char *group_membership, 
-                   int group_security_flag, int updateGroup)
+                   int group_security_flag, int updateGroup, char *maillist)
 {
   char  *av[3];
-  char  *call_args[7];
+  char  *call_args[8];
   int   rc;
+  LK_ENTRY  *group_base;
+  int  group_count;
+  char filter[128];
+  char *attr_array[3];
 
   av[0] = group_name;
   call_args[0] = (char *)ldap_handle;
@@ -3586,14 +5281,21 @@
   call_args[3] = (char *)(MOIRA_USERS | MOIRA_KERBEROS | MOIRA_STRINGS);
   call_args[4] = (char *)updateGroup;
   call_args[5] = MoiraId;
-  call_args[6] = NULL;
+  call_args[6] = "0";
+  call_args[7] = NULL;
   callback_rc = 0;
+
+  group_count = 0;
+  group_base = NULL;
+
   if (rc = mr_query("get_list_info", 1, av, group_create, call_args))
     {
       moira_disconnect();
-      com_err(whoami, 0, "Unable to create list %s : %s", group_name, error_message(rc));
+      com_err(whoami, 0, "Unable to create list %s : %s", group_name, 
+	      error_message(rc));
       return(rc);
     }
+
   if (callback_rc)
     {
       moira_disconnect();
@@ -3613,6 +5315,8 @@
   char      *pUserOu;
   LK_ENTRY  *ptr;
   int       rc;
+  char      member[256];
+  char      *s;
 
   com_err(whoami, 0, "Populating group %s", group_name);
   av[0] = group_name;
@@ -3622,6 +5326,7 @@
   call_args[3] = (char *)(MOIRA_USERS | MOIRA_KERBEROS | MOIRA_STRINGS);
   call_args[4] = NULL;
   member_base = NULL;
+
   if (rc = mr_query("get_end_members_of_list", 1, av,
                     member_list_build, call_args))
     {
@@ -3629,9 +5334,11 @@
               group_name, error_message(rc));
       return(3);
     }
+
   if (member_base != NULL)
     {
       ptr = member_base;
+
       while (ptr != NULL)
         {
           if (!strcasecmp(ptr->type, "LIST"))
@@ -3639,33 +5346,42 @@
               ptr = ptr->next;
               continue;
             }
+
           pUserOu = user_ou;
+
           if (!strcasecmp(ptr->type, "STRING"))
             {
-              if (contact_create(ldap_handle, dn_path, ptr->member, contact_ou))
+              if (contact_create(ldap_handle, dn_path, ptr->member, 
+				 contact_ou))
                 return(3);
+
               pUserOu = contact_ou;
             }
           else if (!strcasecmp(ptr->type, "KERBEROS"))
             {
-              if (contact_create(ldap_handle, dn_path, ptr->member, kerberos_ou))
+              if (contact_create(ldap_handle, dn_path, ptr->member, 
+				 kerberos_ou))
                 return(3);
+
               pUserOu = kerberos_ou;
             }
+
           rc = member_add(ldap_handle, dn_path, group_name,
                           group_ou, group_membership, ptr->member, 
                           pUserOu, MoiraId);
           ptr = ptr->next;
         }
+
       linklist_free(member_base);
       member_base = NULL;
     }
+
   return(0);
 }
 
 int process_group(LDAP *ldap_handle, char *dn_path, char *MoiraId, 
                   char *group_name, char *group_ou, char *group_membership, 
-                  int group_security_flag, int type)
+                  int group_security_flag, int type, char *maillist)
 {
   char      before_desc[512];
   char      before_name[256];
@@ -3688,10 +5404,10 @@
   memset(ad_distinguishedName, '\0', sizeof(ad_distinguishedName));
   sprintf(distinguishedName, "CN=%s,%s,%s", group_name, group_ou, dn_path);
 
-
   memset(filter, '\0', sizeof(filter));
   group_base = NULL;
   group_count = 0;
+
   if (rc = ad_get_group(ldap_handle, dn_path, group_name, 
                         "*", MoiraId, 
                         "distinguishedName", &group_base, 
@@ -3708,60 +5424,79 @@
               return(0);
             }
         }
+
       linklist_free(group_base);
+
       if (group_count == 0)
         return(AD_NO_GROUPS_FOUND);
+
       if (group_count == 1)
         return(AD_WRONG_GROUP_DN_FOUND);
+
       return(AD_MULTIPLE_GROUPS_FOUND);
     }
+
   if (group_count == 0)
     {
       return(AD_NO_GROUPS_FOUND);
     }
+
   if (group_count > 1)
     {
       ptr = group_base;
+
       while (ptr != NULL)
         {
           if (!strcasecmp(distinguishedName, ptr->value))
             break;
+
           ptr = ptr->next;
         }
+
       if (ptr == NULL)
         {
-          com_err(whoami, 0, "%d groups with moira id = %s", group_count, MoiraId);
+          com_err(whoami, 0, "%d groups with moira id = %s", group_count, 
+		  MoiraId);
           ptr = group_base;
+
           while (ptr != NULL)
             {
               com_err(whoami, 0, "%s with moira id = %s", ptr->value, MoiraId);
               ptr = ptr->next;
             }
+
           linklist_free(group_base);
           return(AD_MULTIPLE_GROUPS_FOUND);
         }
+
       ptr = group_base;
+
       while (ptr != NULL)
         {
           if (strcasecmp(distinguishedName, ptr->value))
             rc = ldap_delete_s(ldap_handle, ptr->value);
+
           ptr = ptr->next;
         }
+
       linklist_free(group_base);
       memset(filter, '\0', sizeof(filter));
       group_base = NULL;
       group_count = 0;
+
       if (rc = ad_get_group(ldap_handle, dn_path, group_name, 
                             "*", MoiraId, 
                             "distinguishedName", &group_base, 
                             &group_count, filter))
         return(rc);
+
       if (group_count == 0)
         return(AD_NO_GROUPS_FOUND);
+
       if (group_count > 1)
         return(AD_MULTIPLE_GROUPS_FOUND);
     }
-
+  
   strcpy(ad_distinguishedName, group_base->value);
   linklist_free(group_base);
   group_base = NULL;
@@ -3769,15 +5504,18 @@
 
   attr_array[0] = "sAMAccountName";
   attr_array[1] = NULL;
+
   if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                           &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0)
     {
       com_err(whoami, 0, "Unable to get list info with MoiraId = %s: %s",
                MoiraId, ldap_err2string(rc));
       return(rc);
     }
+
   sprintf(filter, "(sAMAccountName=%s)", group_base->value);
-
+  
   if (!strcasecmp(ad_distinguishedName, distinguishedName))
     {
       linklist_free(group_base);
@@ -3785,6 +5523,7 @@
       group_count = 0;
       return(0);
     }
+
   linklist_free(group_base);
   group_base = NULL;
   group_count = 0;
@@ -3797,27 +5536,33 @@
   memset(before_group_membership, '\0', sizeof(before_group_membership));
   attr_array[0] = "name";
   attr_array[1] = NULL;
+
   if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                           &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0)
     {
       com_err(whoami, 0, "Unable to get list name with MoiraId = %s: %s",
               MoiraId, ldap_err2string(rc));
       return(rc);
     }
+
   strcpy(before_name, group_base->value);
   linklist_free(group_base);
   group_base = NULL;
   group_count = 0;
   attr_array[0] = "description";
   attr_array[1] = NULL;
+
   if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                           &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0)
     {
       com_err(whoami, 0, 
               "Unable to get list description with MoiraId = %s: %s",
               MoiraId, ldap_err2string(rc));
       return(rc);
     }
+
   if (group_count != 0)
     {
       strcpy(before_desc, group_base->value);
@@ -3825,6 +5570,7 @@
       group_base = NULL;
       group_count = 0;
     }
+
   change_to_lower_case(ad_distinguishedName);  
   strcpy(ou_both, group_ou_both);
   change_to_lower_case(ou_both);
@@ -3834,6 +5580,7 @@
   change_to_lower_case(ou_distribution);
   strcpy(ou_neither, group_ou_neither);
   change_to_lower_case(ou_neither);
+
   if (strstr(ad_distinguishedName, ou_both))
     {
       strcpy(before_group_ou, group_ou_both);
@@ -3860,10 +5607,14 @@
     }
   else
     return(AD_NO_OU_FOUND);
-  rc = group_rename(ldap_handle, dn_path, before_name, before_group_membership, 
+
+  rc = group_rename(ldap_handle, dn_path, before_name, 
+		    before_group_membership, 
                     before_group_ou, before_security_flag, before_desc,
-                    group_name, group_membership, group_ou, group_security_flag,
-                    before_desc, MoiraId, filter);
+                    group_name, group_membership, group_ou, 
+		    group_security_flag,
+                    before_desc, MoiraId, filter, maillist);
+
   return(rc);
 }
 
@@ -3890,18 +5641,22 @@
 
   (*linklist_base) = NULL;
   (*linklist_count) = 0;
+
   if (strlen(rFilter) != 0)
     {
       strcpy(filter, rFilter);
       attr_array[0] = attribute;
       attr_array[1] = NULL;
+      
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               linklist_base, linklist_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               linklist_base, linklist_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to get list info with MoiraId = %s: %s",
                   MoiraId, ldap_err2string(rc));
          return(rc);
        }
+
     if ((*linklist_count) == 1)
       {
         strcpy(rFilter, filter);
@@ -3912,32 +5667,40 @@
   linklist_free((*linklist_base));
   (*linklist_base) = NULL;
   (*linklist_count) = 0;
+
   if (strlen(MoiraId) != 0)
     {
       sprintf(filter, "(&(objectClass=group)(mitMoiraId=%s))", MoiraId);
       attr_array[0] = attribute;
       attr_array[1] = NULL;
+
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               linklist_base, linklist_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               linklist_base, linklist_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to get list info with MoiraId = %s: %s",
                   MoiraId, ldap_err2string(rc));
          return(rc);
        }
     }
+
   if ((*linklist_count) > 1)
     {
       com_err(whoami, 0, "multiple groups with mitMoiraId = %s", MoiraId);
       pPtr = (*linklist_base);
+
       while (pPtr)
         {
-          com_err(whoami, 0, "groups %s has mitMoiraId = %s", pPtr->value, MoiraId);
+          com_err(whoami, 0, "groups %s has mitMoiraId = %s", pPtr->value, 
+		  MoiraId);
           pPtr = pPtr->next;
         }
+
       linklist_free((*linklist_base));
       (*linklist_base) = NULL;
       (*linklist_count) = 0;
     }
+
   if ((*linklist_count) == 1)
     {
       if (!memcmp(&(*linklist_base)->value[3], group_name, strlen(group_name)))
@@ -3950,16 +5713,19 @@
   linklist_free((*linklist_base));
   (*linklist_base) = NULL;
   (*linklist_count) = 0;
-  sprintf(filter, "(sAMAccountName=%s_group)", group_name);
+  sprintf(filter, "(sAMAccountName=%s%s)", group_name, group_suffix);
   attr_array[0] = attribute;
   attr_array[1] = NULL;
+
   if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           linklist_base, linklist_count, LDAP_SCOPE_SUBTREE)) != 0)
+                           linklist_base, linklist_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0)
     {
       com_err(whoami, 0, "Unable to get list info with MoiraId = %s: %s",
               MoiraId, ldap_err2string(rc));
       return(rc);
     }
+
   if ((*linklist_count) == 1)
     {
       strcpy(rFilter, filter);
@@ -3988,17 +5754,20 @@
       attr_array[0] = "sAMAccountName";
       attr_array[1] = NULL;
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to process user %s : %s",
                   UserName, ldap_err2string(rc));
           return(rc);
         }
+
       if (group_count > 1)
         {
           com_err(whoami, 0, "multiple users exist with MoiraId = %s",
                   MoiraId);
           gPtr = group_base;
+
           while (gPtr)
             {
               com_err(whoami, 0, "user %s exist with MoiraId = %s",
@@ -4007,6 +5776,7 @@
             }
         }
     }
+
   if (group_count != 1)
     {
       linklist_free(group_base);
@@ -4015,8 +5785,10 @@
       sprintf(filter, "(sAMAccountName=%s)", UserName);
       attr_array[0] = "sAMAccountName";
       attr_array[1] = NULL;
+
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) != 0)
         {
           com_err(whoami, 0, "Unable to process user %s : %s",
                   UserName, ldap_err2string(rc));
@@ -4029,15 +5801,18 @@
       linklist_free(group_base);
       return(AD_NO_USER_FOUND);
     }
+
   strcpy(SamAccountName, group_base->value);
   linklist_free(group_base);
   group_count = 0;
   rc = 0;
+
   if (strcmp(SamAccountName, UserName))
     {
       rc = user_rename(ldap_handle, dn_path, SamAccountName, 
                        UserName);
     }
+
   return(0);
 }
 
@@ -4052,11 +5827,13 @@
 
   if (strlen(src) == 0)
     return;
+
   strcpy(name, src);
   sPtr = name;
   n = 0;
   array[n] = name;
   ++n;
+
   while (*sPtr)
     {
       if ((*sPtr) == '/')
@@ -4069,7 +5846,9 @@
       else
         ++sPtr;
     }
+
   strcpy(dest, "OU=");
+
   while (n != 0)
     {
       strcat(dest, array[n-1]);
@@ -4079,6 +5858,7 @@
           strcat(dest, ",OU=");
         }
     }
+
   return;
 }
 
@@ -4089,8 +5869,10 @@
 
   if (strlen(src) == 0)
     return;
+
   sPtr = src;
   dPtr = src;
+
   while (*sPtr)
     {
       if ((*sPtr) == '/')
@@ -4100,6 +5882,7 @@
         }
       ++sPtr;
     }
+
   strcpy(dest, dPtr);
   return;
 }
@@ -4112,6 +5895,7 @@
   int  rc;
 
   strcpy(cName, name);
+
   for (i = 0; i < (int)strlen(cName); i++)
     {
       if (cName[i] == '/')
@@ -4125,18 +5909,20 @@
           av[CONTAINER_ID] = "";
           av[CONTAINER_ROWID] = "";
           rc = container_create(ldap_handle, dn_path, 7, av);
+
           if (rc == LDAP_SUCCESS)
             {
-              com_err(whoami, 0, "container %s created without a mitMoiraId", cName);
+              com_err(whoami, 0, "container %s created without a mitMoiraId", 
+		      cName);
             }
+
           cName[i] = '/';
         }
     }
-
 }
 
-int container_rename(LDAP *ldap_handle, char *dn_path, int beforec, char **before, 
-                     int afterc, char **after)
+int container_rename(LDAP *ldap_handle, char *dn_path, int beforec, 
+		     char **before, int afterc, char **after)
 {
   char      dName[256];
   char      cName[256];
@@ -4150,15 +5936,20 @@
 
   memset(cName, '\0', sizeof(cName));
   container_get_name(after[CONTAINER_NAME], cName);
+
   if (!check_container_name(cName))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", cName);
+      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", 
+	      cName);
       return(AD_INVALID_NAME);
     }
 
   memset(distinguishedName, '\0', sizeof(distinguishedName));
-  if (rc = container_get_distinguishedName(ldap_handle, dn_path, distinguishedName, beforec, before))
+
+  if (rc = container_get_distinguishedName(ldap_handle, dn_path, 
+					   distinguishedName, beforec, before))
     return(rc);
+
   if (strlen(distinguishedName) == 0)
     {
       rc = container_create(ldap_handle, dn_path, afterc, after);
@@ -4167,6 +5958,7 @@
 
   strcpy(temp, after[CONTAINER_NAME]);
   pPtr = temp;
+
   for (i = 0; i < (int)strlen(temp); i++)
     {
       if (temp[i] == '/')
@@ -4174,13 +5966,16 @@
           pPtr = &temp[i];
         }
     }
+
   (*pPtr) = '\0';
 
   container_get_dn(temp, dName);
+
   if (strlen(temp) != 0)
     sprintf(new_dn_path, "%s,%s", dName, dn_path);
   else
     sprintf(new_dn_path, "%s", dn_path);
+
   sprintf(new_cn, "OU=%s", cName);
 
   container_check(ldap_handle, dn_path, after[CONTAINER_NAME]);
@@ -4189,13 +5984,15 @@
                           TRUE, NULL, NULL)) != LDAP_SUCCESS)
     {
       com_err(whoami, 0, "Unable to rename container from %s to %s : %s",
-              before[CONTAINER_NAME], after[CONTAINER_NAME], ldap_err2string(rc));
+              before[CONTAINER_NAME], after[CONTAINER_NAME], 
+	      ldap_err2string(rc));
       return(rc);
     }
 
   memset(dName, '\0', sizeof(dName));
   container_get_dn(after[CONTAINER_NAME], dName);
   rc = container_adupdate(ldap_handle, dn_path, dName, "", afterc, after);
+
   return(rc);
 }
 
@@ -4205,10 +6002,14 @@
   int       rc;
 
   memset(distinguishedName, '\0', sizeof(distinguishedName));
-  if (rc = container_get_distinguishedName(ldap_handle, dn_path, distinguishedName, count, av))
+
+  if (rc = container_get_distinguishedName(ldap_handle, dn_path, 
+					   distinguishedName, count, av))
     return(rc);
+
   if (strlen(distinguishedName) == 0)
     return(0);
+
   if ((rc = ldap_delete_s(ldap_handle, distinguishedName)) != LDAP_SUCCESS)
     {
       if (rc == LDAP_NOT_ALLOWED_ON_NONLEAF)
@@ -4217,6 +6018,7 @@
         com_err(whoami, 0, "Unable to delete container %s from AD : %s",
                 av[CONTAINER_NAME], ldap_err2string(rc));
     }
+
   return(rc);
 }
 
@@ -4253,13 +6055,15 @@
 
   if ((strlen(cName) == 0) || (strlen(dName) == 0))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", cName);
+      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", 
+	      cName);
       return(AD_INVALID_NAME);
     }
 
   if (!check_container_name(cName))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", cName);
+      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", 
+	      cName);
       return(AD_INVALID_NAME);
     }
 
@@ -4269,101 +6073,123 @@
   ADD_ATTR("name", name_v, LDAP_MOD_ADD);
   ou_v[0] = cName;
   ADD_ATTR("ou", ou_v, LDAP_MOD_ADD);
+
   if (strlen(av[CONTAINER_ROWID]) != 0)
     {
       moiraId_v[0] = av[CONTAINER_ROWID];
       ADD_ATTR("mitMoiraId", moiraId_v, LDAP_MOD_ADD);
     }
+
   if (strlen(av[CONTAINER_DESC]) != 0)
     {
       desc_v[0] = av[CONTAINER_DESC];
       ADD_ATTR("description", desc_v, LDAP_MOD_ADD);
     }
+
   if ((strlen(av[CONTAINER_TYPE]) != 0) && (strlen(av[CONTAINER_ID]) != 0))
     {
-	  if (!strcasecmp(av[CONTAINER_TYPE], "KERBEROS"))
-	  {
-		  if (!contact_create(ldap_handle, dn_path, av[CONTAINER_ID], kerberos_ou))
-		  {
-			sprintf(managedByDN, "CN=%s,%s,%s", av[CONTAINER_ID], kerberos_ou,dn_path);
-			managedBy_v[0] = managedByDN;
-            		ADD_ATTR("managedBy", managedBy_v, LDAP_MOD_ADD);
-		  }
-	  }
-	  else
-	  {
-		if (!strcasecmp(av[CONTAINER_TYPE], "USER"))
-        {
-          sprintf(filter, "(&(cn=%s)(&(objectCategory=person)(objectClass=user)))", av[CONTAINER_ID]);
-        }
-		if (!strcasecmp(av[CONTAINER_TYPE], "LIST"))
-        {
-          sprintf(filter, "(&(objectClass=group)(cn=%s))", av[CONTAINER_ID]);
-        }
-		if (strlen(filter) != 0)
-        {
-          attr_array[0] = "distinguishedName";
-          attr_array[1] = NULL;
-          group_count = 0;
-          group_base = NULL;
-          if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                                   &group_base, &group_count, LDAP_SCOPE_SUBTREE)) == LDAP_SUCCESS)
-            {
-              if (group_count == 1)
-                {
-                  strcpy(managedByDN, group_base->value);
-                  managedBy_v[0] = managedByDN;
-                  ADD_ATTR("managedBy", managedBy_v, LDAP_MOD_ADD);
-                }
-              linklist_free(group_base);
-              group_base = NULL;
-              group_count = 0;
-            }
-        }
+      if (!strcasecmp(av[CONTAINER_TYPE], "KERBEROS"))
+	{
+	  if (!contact_create(ldap_handle, dn_path, av[CONTAINER_ID], 
+			      kerberos_ou))
+	    {
+	      sprintf(managedByDN, "CN=%s,%s,%s", av[CONTAINER_ID], 
+		      kerberos_ou, dn_path);
+	      managedBy_v[0] = managedByDN;
+	      ADD_ATTR("managedBy", managedBy_v, LDAP_MOD_ADD);
+	    }
+	}
+      else
+	{
+	  if (!strcasecmp(av[CONTAINER_TYPE], "USER"))
+	    {
+	      sprintf(filter, "(&(cn=%s)(&(objectCategory=person)"
+		      "(objectClass=user)))", av[CONTAINER_ID]);
+	    }
+
+	  if (!strcasecmp(av[CONTAINER_TYPE], "LIST"))
+	    {
+	      sprintf(filter, "(&(objectClass=group)(cn=%s))", 
+		      av[CONTAINER_ID]);
+	    }
+
+	  if (strlen(filter) != 0)
+	    {
+	      attr_array[0] = "distinguishedName";
+	      attr_array[1] = NULL;
+	      group_count = 0;
+	      group_base = NULL;
+	      if ((rc = linklist_build(ldap_handle, dn_path, filter, 
+				       attr_array, 
+				       &group_base, &group_count, 
+				       LDAP_SCOPE_SUBTREE)) == LDAP_SUCCESS)
+		{
+		  if (group_count == 1)
+		    {
+		      strcpy(managedByDN, group_base->value);
+		      managedBy_v[0] = managedByDN;
+		      ADD_ATTR("managedBy", managedBy_v, LDAP_MOD_ADD);
+		    }
+		  linklist_free(group_base);
+		  group_base = NULL;
+		  group_count = 0;
+		}
+	    }
+	}
     }
-  }
+  
   mods[n] = NULL;
 
   sprintf(temp, "%s,%s", dName, dn_path);
   rc = ldap_add_ext_s(ldap_handle, temp, mods, NULL, NULL);
+  
   for (i = 0; i < n; i++)
     free(mods[i]);
+  
   if ((rc != LDAP_SUCCESS) && (rc != LDAP_ALREADY_EXISTS))
     {
       com_err(whoami, 0, "Unable to create container %s : %s",
               cName, ldap_err2string(rc));
       return(rc);
     }
+
   if (rc == LDAP_ALREADY_EXISTS)
     {
       if (strlen(av[CONTAINER_ROWID]) != 0)
         rc = container_adupdate(ldap_handle, dn_path, dName, "", count, av);
     }
+
   return(rc);
 }
 
-int container_update(LDAP *ldap_handle, char *dn_path, int beforec, char **before, 
-                     int afterc, char **after)
+int container_update(LDAP *ldap_handle, char *dn_path, int beforec, 
+		     char **before, int afterc, char **after)
 {
   char distinguishedName[256];
   int  rc;
 
   memset(distinguishedName, '\0', sizeof(distinguishedName));
-  if (rc = container_get_distinguishedName(ldap_handle, dn_path, distinguishedName, afterc, after))
+
+  if (rc = container_get_distinguishedName(ldap_handle, dn_path, 
+					   distinguishedName, afterc, after))
     return(rc);
+
   if (strlen(distinguishedName) == 0)
     {
       rc = container_create(ldap_handle, dn_path, afterc, after);
       return(rc);
     }
-
+  
   container_check(ldap_handle, dn_path, after[CONTAINER_NAME]);
-  rc = container_adupdate(ldap_handle, dn_path, "", distinguishedName, afterc, after);
+  rc = container_adupdate(ldap_handle, dn_path, "", distinguishedName, afterc,
+			  after);
 
   return(rc);
 }
 
-int container_get_distinguishedName(LDAP *ldap_handle, char *dn_path, char *distinguishedName, int count, char **av)
+int container_get_distinguishedName(LDAP *ldap_handle, char *dn_path, 
+				    char *distinguishedName, int count, 
+				    char **av)
 {
   char      *attr_array[3];
   LK_ENTRY  *group_base;
@@ -4381,51 +6207,63 @@
 
   if (strlen(dName) == 0)
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", av[CONTAINER_NAME]);
+      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", 
+	      av[CONTAINER_NAME]);
       return(AD_INVALID_NAME);
     }
 
   if (!check_container_name(cName))
     {
-      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", cName);
+      com_err(whoami, 0, "Unable to process invalid LDAP container name %s", 
+	      cName);
       return(AD_INVALID_NAME);
     }
-
-  sprintf(filter, "(&(objectClass=organizationalUnit)(mitMoiraId=%s))", av[CONTAINER_ROWID]);
+  
+  sprintf(filter, "(&(objectClass=organizationalUnit)(mitMoiraId=%s))", 
+	  av[CONTAINER_ROWID]);
   attr_array[0] = "distinguishedName";
   attr_array[1] = NULL;
   group_count = 0;
   group_base = NULL;
+
   if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) == LDAP_SUCCESS)
+                           &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) == LDAP_SUCCESS)
     {
       if (group_count == 1)
         {
           strcpy(distinguishedName, group_base->value);
         }
+
       linklist_free(group_base);
       group_base = NULL;
       group_count = 0;
     }
+
   if (strlen(distinguishedName) == 0)
     {
-      sprintf(filter, "(&(objectClass=organizationalUnit)(distinguishedName=%s,%s))", dName, dn_path);
+      sprintf(filter, "(&(objectClass=organizationalUnit)"
+	      "(distinguishedName=%s,%s))", dName, dn_path);
       attr_array[0] = "distinguishedName";
       attr_array[1] = NULL;
       group_count = 0;
       group_base = NULL;
+
       if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                               &group_base, &group_count, LDAP_SCOPE_SUBTREE)) == LDAP_SUCCESS)
+                               &group_base, &group_count, 
+			       LDAP_SCOPE_SUBTREE)) == LDAP_SUCCESS)
         {
           if (group_count == 1)
             {
               strcpy(distinguishedName, group_base->value);
             }
+
           linklist_free(group_base);
           group_base = NULL;
           group_count = 0;
         }
     }
+
   return(0);
 }
 
@@ -4451,29 +6289,38 @@
 
 
   strcpy(ad_path, distinguishedName);
+
   if (strlen(dName) != 0)
     sprintf(ad_path, "%s,%s", dName, dn_path);
 
-  sprintf(filter, "(&(objectClass=organizationalUnit)(distinguishedName=%s))", ad_path);
+  sprintf(filter, "(&(objectClass=organizationalUnit)(distinguishedName=%s))",
+	  ad_path);
+
   if (strlen(av[CONTAINER_ID]) != 0)
-    sprintf(filter, "(&(objectClass=organizationalUnit)(mitMoiraId=%s))", av[CONTAINER_ROWID]);
+    sprintf(filter, "(&(objectClass=organizationalUnit)(mitMoiraId=%s))", 
+	    av[CONTAINER_ROWID]);
+
   attr_array[0] = "mitMoiraId";
   attr_array[1] = "description";
   attr_array[2] = "managedBy";
   attr_array[3] = NULL;
   group_count = 0;
   group_base = NULL;
+
   if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != LDAP_SUCCESS)
+                           &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != LDAP_SUCCESS)
     {
       com_err(whoami, 0, "Unable to retreive container info for %s : %s",
               av[CONTAINER_NAME], ldap_err2string(rc));
       return(rc);
     }
+
   memset(managedByDN, '\0', sizeof(managedByDN));
   memset(moiraId, '\0', sizeof(moiraId));
   memset(desc, '\0', sizeof(desc));
   pPtr = group_base;
+
   while (pPtr)
     {
       if (!strcasecmp(pPtr->attribute, "description"))
@@ -4484,6 +6331,7 @@
         strcpy(moiraId, pPtr->value);
       pPtr = pPtr->next;
     }
+
   linklist_free(group_base);
   group_base = NULL;
   group_count = 0;
@@ -4494,9 +6342,11 @@
       moiraId_v[0] = av[CONTAINER_ROWID];
       ADD_ATTR("mitMoiraId", moiraId_v, LDAP_MOD_REPLACE);
     }
+
   if (strlen(av[CONTAINER_DESC]) != 0)
     {
-      attribute_update(ldap_handle, ad_path, av[CONTAINER_DESC], "description", dName);
+      attribute_update(ldap_handle, ad_path, av[CONTAINER_DESC], "description",
+		       dName);
     }
   else
     {
@@ -4505,84 +6355,102 @@
           attribute_update(ldap_handle, ad_path, "", "description", dName);
         }
     }
+
   if ((strlen(av[CONTAINER_TYPE]) != 0) && (strlen(av[CONTAINER_ID]) != 0))
     {
-	  if (!strcasecmp(av[CONTAINER_TYPE], "KERBEROS"))
-	  {
-		  if (!contact_create(ldap_handle, dn_path, av[CONTAINER_ID], kerberos_ou))
-		  {
-			sprintf(managedByDN, "CN=%s,%s,%s", av[CONTAINER_ID], kerberos_ou, dn_path);
-			managedBy_v[0] = managedByDN;
-            ADD_ATTR("managedBy", managedBy_v, LDAP_MOD_REPLACE);
-		  }
+      if (!strcasecmp(av[CONTAINER_TYPE], "KERBEROS"))
+	{
+	  if (!contact_create(ldap_handle, dn_path, av[CONTAINER_ID], 
+			      kerberos_ou))
+	    {
+	      sprintf(managedByDN, "CN=%s,%s,%s", av[CONTAINER_ID], 
+		      kerberos_ou, dn_path);
+	      managedBy_v[0] = managedByDN;
+	      ADD_ATTR("managedBy", managedBy_v, LDAP_MOD_REPLACE);
+	    }
+	  else
+	    {
+	      if (strlen(managedByDN) != 0)
+		{
+		  attribute_update(ldap_handle, ad_path, "", "managedBy", 
+				   dName);
+		}
+	    }
+	}
+      else
+	{
+	  memset(filter, '\0', sizeof(filter));
+
+	  if (!strcasecmp(av[CONTAINER_TYPE], "USER"))
+	    {
+	      sprintf(filter, "(&(cn=%s)(&(objectCategory=person)"
+		      "(objectClass=user)))", av[CONTAINER_ID]);
+	    }
+
+	  if (!strcasecmp(av[CONTAINER_TYPE], "LIST"))
+	    {
+	      sprintf(filter, "(&(objectClass=group)(cn=%s))", 
+		      av[CONTAINER_ID]);
+	    }
+
+	  if (strlen(filter) != 0)
+	    {
+	      attr_array[0] = "distinguishedName";
+	      attr_array[1] = NULL;
+	      group_count = 0;
+	      group_base = NULL;
+	      if ((rc = linklist_build(ldap_handle, dn_path, filter, 
+				       attr_array, &group_base, &group_count, 
+				       LDAP_SCOPE_SUBTREE)) == LDAP_SUCCESS)
+		{
+		  if (group_count == 1)
+		    {
+		      strcpy(managedByDN, group_base->value);
+		      managedBy_v[0] = managedByDN;
+		      ADD_ATTR("managedBy", managedBy_v, LDAP_MOD_REPLACE);
+		    }
 		  else
-		  {
-			if (strlen(managedByDN) != 0)
+		    {
+		      if (strlen(managedByDN) != 0)
 			{
-                attribute_update(ldap_handle, ad_path, "", "managedBy", dName);
+			  attribute_update(ldap_handle, ad_path, "", 
+					   "managedBy", dName);
 			}
-		  }
-	  }
+		    }
+
+		  linklist_free(group_base);
+		  group_base = NULL;
+		  group_count = 0;
+		}
+	    }
 	  else
-	  {
-		memset(filter, '\0', sizeof(filter));
-		if (!strcasecmp(av[CONTAINER_TYPE], "USER"))
-        {
-          sprintf(filter, "(&(cn=%s)(&(objectCategory=person)(objectClass=user)))", av[CONTAINER_ID]);
-        }
-		if (!strcasecmp(av[CONTAINER_TYPE], "LIST"))
-        {
-          sprintf(filter, "(&(objectClass=group)(cn=%s))", av[CONTAINER_ID]);
-        }
-		if (strlen(filter) != 0)
-        {
-          attr_array[0] = "distinguishedName";
-          attr_array[1] = NULL;
-          group_count = 0;
-          group_base = NULL;
-          if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                                   &group_base, &group_count, LDAP_SCOPE_SUBTREE)) == LDAP_SUCCESS)
-            {
-              if (group_count == 1)
-                {
-                  strcpy(managedByDN, group_base->value);
-                  managedBy_v[0] = managedByDN;
-                  ADD_ATTR("managedBy", managedBy_v, LDAP_MOD_REPLACE);
-                }
-              else
-                {
-                  if (strlen(managedByDN) != 0)
-                    {
-                        attribute_update(ldap_handle, ad_path, "", "managedBy", dName);
-                    }
-                }
-              linklist_free(group_base);
-              group_base = NULL;
-              group_count = 0;
-            }
-        }
-		else
-        {
-          if (strlen(managedByDN) != 0)
-            {
-                attribute_update(ldap_handle, ad_path, "", "managedBy", dName);
-            }
-        }
-	  }
+	    {
+	      if (strlen(managedByDN) != 0)
+		{
+		  attribute_update(ldap_handle, ad_path, "", "managedBy", 
+				   dName);
+		}
+	    }
+	}
     }
+
   mods[n] = NULL;
+
   if (n == 0)
     return(LDAP_SUCCESS);
 
   rc = ldap_modify_s(ldap_handle, ad_path, mods);
+
   for (i = 0; i < n; i++)
     free(mods[i]);
+
   if (rc != LDAP_SUCCESS)
     {
-        com_err(whoami, 0, "Unable to modify container info for %s : %s",
-                av[CONTAINER_NAME], ldap_err2string(rc));
-        return(rc);
+      com_err(whoami, 0, "Unable to modify container info for %s : %s",
+	      av[CONTAINER_NAME], ldap_err2string(rc));
+      return(rc);
     }
+  
   return(rc);
 }
 
@@ -4605,9 +6473,11 @@
   for (i = 0; i < 3; i++)
     {
       memset(filter, '\0', sizeof(filter));
+
       if (i == 0)
         {
-          strcpy(filter, "(!(|(objectClass=computer)(objectClass=organizationalUnit)))");
+          strcpy(filter, "(!(|(objectClass=computer)"
+		 "(objectClass=organizationalUnit)))");
           attr_array[0] = "cn";
           attr_array[1] = NULL;
         }
@@ -4627,13 +6497,17 @@
       while (1)
         {
           if ((rc = linklist_build(ldap_handle, dName, filter, attr_array, 
-                                   &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != LDAP_SUCCESS)
+                                   &group_base, &group_count, 
+				   LDAP_SCOPE_SUBTREE)) != LDAP_SUCCESS)
             {
               break;
             }
+
           if (group_count == 0)
             break;
+
           pPtr = group_base;
+
           while(pPtr)
             {
               if (!strcasecmp(pPtr->attribute, "cn"))
@@ -4644,6 +6518,7 @@
                   if (i == 1)
                     sprintf(temp, "%s,%s", orphans_machines_ou, dn_path);
                   count = 1;
+
                   while (1)
                     {
                       rc = ldap_rename_s(ldap_handle, pPtr->dn, new_cn, temp,
@@ -4661,17 +6536,21 @@
                 {
                   rc = ldap_delete_s(ldap_handle, pPtr->dn);
                 }
+
               pPtr = pPtr->next;
             }
+
           linklist_free(group_base);
           group_base = NULL;
           group_count = 0;
         }
     }
+
   return(0);
 }
 
-int get_machine_ou(LDAP *ldap_handle, char *dn_path, char *member, char *machine_ou, char *NewMachineName)
+int get_machine_ou(LDAP *ldap_handle, char *dn_path, char *member, 
+		   char *machine_ou, char *NewMachineName)
 {
   LK_ENTRY  *group_base;
   int  group_count;
@@ -4688,14 +6567,17 @@
   rc = moira_connect();
   rc = GetMachineName(NewMachineName);
   moira_disconnect();
+
   if (strlen(NewMachineName) == 0)
     {
-      com_err(whoami, 0, "Unable to find alais for machine %s in Moira", member);
+      com_err(whoami, 0, "Unable to find alais for machine %s in Moira", 
+	      member);
       return(1);
     }
 
   pPtr = NULL;
   pPtr = strchr(NewMachineName, '.');
+
   if (pPtr != NULL)
     (*pPtr) = '\0';
 
@@ -4705,146 +6587,175 @@
   attr_array[0] = "cn";
   attr_array[1] = NULL;
   sprintf(temp, "%s", dn_path);
+
   if ((rc = linklist_build(ldap_handle, temp, filter, attr_array, 
-                        &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+			   &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0)
     {
       com_err(whoami, 0, "Unable to process machine %s : %s",
               member, ldap_err2string(rc));
       return(1);
     }
+
   if (group_count != 1)
     {
-      com_err(whoami, 0, "Unable to process machine %s : machine not found in AD",
+      com_err(whoami, 0, 
+	      "Unable to process machine %s : machine not found in AD",
               NewMachineName);
       return(1);
     }
+
   strcpy(dn, group_base->dn);
   strcpy(cn, group_base->value);
+
   for (i = 0; i < (int)strlen(dn); i++)
     dn[i] = tolower(dn[i]);
+
   for (i = 0; i < (int)strlen(cn); i++)
     cn[i] = tolower(cn[i]);
+
   linklist_free(group_base);
   pPtr = NULL;
   pPtr = strstr(dn, cn);
+
   if (pPtr == NULL)
     {
       com_err(whoami, 0, "Unable to process machine %s",
               member);
       return(1);
     }
+
   pPtr += strlen(cn) + 1;
   strcpy(machine_ou, pPtr);
   pPtr = NULL;
   pPtr = strstr(machine_ou, "dc=");
+
   if (pPtr == NULL)
     {
       com_err(whoami, 0, "Unable to process machine %s",
               member);
       return(1);
     }
+
   --pPtr;
   (*pPtr) = '\0';
+
   return(0);
 }
 
-int machine_move_to_ou(LDAP *ldap_handle, char * dn_path, char *MoiraMachineName, char *DestinationOu)
+int machine_move_to_ou(LDAP *ldap_handle, char * dn_path, 
+		       char *MoiraMachineName, char *DestinationOu)
 {
+  char        NewCn[128];
+  char        OldDn[512];
+  char        MachineName[128];
+  char        filter[128];
+  char        *attr_array[3];
+  char        NewOu[256];
+  char        *cPtr = NULL;
+  int         group_count;
+  long        rc;
+  LK_ENTRY    *group_base;
 
-    char        NewCn[128];
-    char        OldDn[512];
-    char        MachineName[128];
-    char        filter[128];
-    char        *attr_array[3];
-    char        NewOu[256];
-    char        *cPtr = NULL;
-    int         group_count;
-    long        rc;
-    LK_ENTRY    *group_base;
+  group_count = 0;
+  group_base = NULL;
+  
+  strcpy(MachineName, MoiraMachineName);
+  rc = GetMachineName(MachineName);
 
-    group_count = 0;
-    group_base = NULL;
-
-    strcpy(MachineName, MoiraMachineName);
-    rc = GetMachineName(MachineName);
-    if (strlen(MachineName) == 0)
+  if (strlen(MachineName) == 0)
     {
-        com_err(whoami, 0, "Unable to find alais for machine %s in Moira", MoiraMachineName);
-        return(1);
+      com_err(whoami, 0, "Unable to find alais for machine %s in Moira", 
+	      MoiraMachineName);
+      return(1);
     }
+  
+  cPtr = strchr(MachineName, '.');
 
-    cPtr = strchr(MachineName, '.');
-    if (cPtr != NULL)
-        (*cPtr) = '\0';
-    sprintf(filter, "(sAMAccountName=%s$)", MachineName);
-    attr_array[0] = "sAMAccountName";
-    attr_array[1] = NULL;
-    if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, &group_base, 
-                             &group_count, LDAP_SCOPE_SUBTREE)) != 0)
+  if (cPtr != NULL)
+    (*cPtr) = '\0';
+
+  sprintf(filter, "(sAMAccountName=%s$)", MachineName);
+  attr_array[0] = "sAMAccountName";
+  attr_array[1] = NULL;
+
+  if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
+			   &group_base, 
+			   &group_count, LDAP_SCOPE_SUBTREE)) != 0)
     {
-        com_err(whoami, 0, "Unable to process machine %s : %s",
-                MoiraMachineName, ldap_err2string(rc));
-        return(1);
+      com_err(whoami, 0, "Unable to process machine %s : %s",
+	      MoiraMachineName, ldap_err2string(rc));
+      return(1);
     }
+  
+  if (group_count == 1)
+    strcpy(OldDn, group_base->dn);
 
-    if (group_count == 1)
-        strcpy(OldDn, group_base->dn);
-    linklist_free(group_base);
-    group_base = NULL;
-    if (group_count != 1)
+  linklist_free(group_base);
+  group_base = NULL;
+
+  if (group_count != 1)
     {
-        com_err(whoami, 0, "Unable to find machine %s in AD: %s", MoiraMachineName);
-        return(1);
+      com_err(whoami, 0, "Unable to find machine %s in AD: %s", 
+	      MoiraMachineName);
+      return(1);
     }
-    sprintf(NewOu, "%s,%s", DestinationOu, dn_path);
-    cPtr = strchr(OldDn, ',');
-    if (cPtr != NULL)
+
+  sprintf(NewOu, "%s,%s", DestinationOu, dn_path);
+  cPtr = strchr(OldDn, ',');
+
+  if (cPtr != NULL)
     {
-        ++cPtr;
-        if (!strcasecmp(cPtr, NewOu))
-            return(0);
+      ++cPtr;
+      if (!strcasecmp(cPtr, NewOu))
+	return(0);
     }
-    sprintf(NewCn, "CN=%s", MachineName);
-    rc = ldap_rename_s(ldap_handle, OldDn, NewCn, NewOu, TRUE, NULL, NULL);
-    return(rc);
+
+  sprintf(NewCn, "CN=%s", MachineName);
+  rc = ldap_rename_s(ldap_handle, OldDn, NewCn, NewOu, TRUE, NULL, NULL);
+
+  return(rc);
 }
 
 int machine_check(LDAP *ldap_handle, char *dn_path, char *machine_name)
 {
-    char    Name[128];
-    char    *pPtr;
-    int     rc;
+  char    Name[128];
+  char    *pPtr;
+  int     rc;
+  
+  memset(Name, '\0', sizeof(Name));
+  strcpy(Name, machine_name);
+  pPtr = NULL;
+  pPtr = strchr(Name, '.');
 
-    memset(Name, '\0', sizeof(Name));
-    strcpy(Name, machine_name);
-    pPtr = NULL;
-    pPtr = strchr(Name, '.');
-    if (pPtr != NULL)
-        (*pPtr) = '\0';
-    strcat(Name, "$");
-    return(!(rc = checkADname(ldap_handle, dn_path, Name)));
+  if (pPtr != NULL)
+    (*pPtr) = '\0';
+
+  strcat(Name, "$");
+  return(!(rc = checkADname(ldap_handle, dn_path, Name)));
 }
 
-int machine_get_moira_container(LDAP *ldap_handle, char *dn_path, char *machine_name, char *container_name)
+int machine_get_moira_container(LDAP *ldap_handle, char *dn_path, 
+				char *machine_name, char *container_name)
 {
-    int     rc;
-    char    *av[2];
-    char    *call_args[2];
-
-    av[0] = machine_name;
-    call_args[0] = (char *)container_name;
-    rc = mr_query("get_machine_to_container_map", 1, av, machine_GetMoiraContainer,
-                   call_args);
-    return(rc);
+  int     rc;
+  char    *av[2];
+  char    *call_args[2];
+  
+  av[0] = machine_name;
+  call_args[0] = (char *)container_name;
+  rc = mr_query("get_machine_to_container_map", 1, av, 
+		machine_GetMoiraContainer, call_args);
+  return(rc);
 }
 
 int machine_GetMoiraContainer(int ac, char **av, void *ptr)
 {
-    char **call_args;
-    
-    call_args = ptr;
-    strcpy(call_args[0], av[1]);
-    return(0);
+  char **call_args;
+  
+  call_args = ptr;
+  strcpy(call_args[0], av[1]);
+  return(0);
 }
 
 int Moira_container_group_create(char **after)
@@ -4877,7 +6788,8 @@
 
   if (rc = mr_query("add_list", 15, argv, NULL, NULL))
     {
-      com_err(whoami, 0, "Unable to create container group %s for container %s: %s",
+      com_err(whoami, 0, 
+	      "Unable to create container group %s for container %s: %s",
 	      GroupName, after[CONTAINER_NAME], error_message(rc));
     }
 
@@ -4929,7 +6841,8 @@
       
       if (rc = mr_query("update_list", 16, argv, NULL, NULL))
 	{
-	  com_err(whoami, 0, "Unable to rename container group from %s to %s: %s",
+	  com_err(whoami, 0, 
+		  "Unable to rename container group from %s to %s: %s",
 		  BeforeGroupName, AfterGroupName, error_message(rc));
 	}
     }
@@ -4948,6 +6861,7 @@
   Moira_getGroupName(before[CONTAINER_NAME], ParentGroupName, 1);
 
   memset(GroupName, '\0', sizeof(GroupName));
+
   if (strcmp(before[CONTAINER_GROUP_NAME], "[none]"))
     strcpy(GroupName, before[CONTAINER_GROUP_NAME]);
   
@@ -4956,9 +6870,11 @@
       argv[0] = ParentGroupName;
       argv[1] = "LIST";
       argv[2] = GroupName;
+
       if (rc = mr_query("delete_member_from_list", 3, argv, NULL, NULL))
 	{
-	  com_err(whoami, 0, "Unable to delete container group %s from list: %s",
+	  com_err(whoami, 0, 
+		  "Unable to delete container group %s from list: %s",
 		  GroupName, ParentGroupName, error_message(rc));
 	}
     }
@@ -4966,12 +6882,13 @@
   if (strlen(GroupName) != 0)
     {
       argv[0] = GroupName;
+
       if (rc = mr_query("delete_list", 1, argv, NULL, NULL))
 	{
 	  com_err(whoami, 0, "Unable to delete container group %s : %s",
 		  GroupName, error_message(rc));
 	}
-     }
+    }
   
   return(rc);
 }
@@ -4992,11 +6909,13 @@
   strcpy(temp, ContainerName);
   
   ptr1 = strrchr(temp, '/');
+
   if (ptr1 != NULL)
   {
     *ptr1 = '\0';
     ptr = ++ptr1;
     ptr1 = strrchr(temp, '/');
+
     if (ptr1 != NULL)
     {
         sprintf(tempgname, "%s-%s", ++ptr1, ptr);
@@ -5014,36 +6933,45 @@
 
   /* change everything to lower case */
   ptr = newGroupName;
+
   while (*ptr)
     {
       if (isupper(*ptr))
 	*ptr = tolower(*ptr);
+
       if (*ptr == ' ')
 	*ptr = '-';
+
       ptr++;
     }
 
   strcpy(tempGroupName, newGroupName);
   i = (int)'0';
+
   /* append 0-9 then a-z if a duplicate is found */
   while(1)
     {
       argv[0] = newGroupName;
+
       if (rc = mr_query("get_list_info", 1, argv, NULL, NULL))
 	{
 	  if (rc == MR_NO_MATCH)
 	    break;
-	  com_err(whoami, 0, "Moira error while creating group name for container %s : %s",
-		  ContainerName, error_message(rc));
+	  com_err(whoami, 0, "Moira error while creating group name for "
+		  "container %s : %s", ContainerName, error_message(rc));
 	  return rc;
 	}
+
       sprintf(newGroupName, "%s-%c", tempGroupName, i);
+
       if (i == (int)'z')
 	{
-	  com_err(whoami, 0, "Unable to find a unique group name for container %s: too many duplicate container names",
+	  com_err(whoami, 0, "Unable to find a unique group name for "
+		  "container %s: too many duplicate container names",
 		  ContainerName);
 	  return 1;
 	}
+
       if (i == '9')
 	i = 'a';
       else
@@ -5061,17 +6989,18 @@
   
   argv[0] = origContainerName;
   argv[1] = GroupName;
-
+  
   if ((rc = mr_query("set_container_list", 2, argv, NULL, NULL)))
     {
-         com_err(whoami, 0, "Unable to set container group %s in container %s: %s",
-                 GroupName, origContainerName, error_message(rc));
+      com_err(whoami, 0, 
+	      "Unable to set container group %s in container %s: %s",
+	      GroupName, origContainerName, error_message(rc));
     }
-
+  
   return(0);
 }
 
- int Moira_addGroupToParent(char *origContainerName, char *GroupName)
+int Moira_addGroupToParent(char *origContainerName, char *GroupName)
  {
    char ContainerName[64];
    char ParentGroupName[64];
@@ -5079,8 +7008,9 @@
    long rc;
 
    strcpy(ContainerName, origContainerName);
+   
+   Moira_getGroupName(ContainerName, ParentGroupName, 1);
 
-   Moira_getGroupName(ContainerName, ParentGroupName, 1);
    /* top-level container */
    if (strlen(ParentGroupName) == 0)
      return(0);
@@ -5088,11 +7018,14 @@
    argv[0] = ParentGroupName;
    argv[1] = "LIST";
    argv[2] = GroupName;
+
    if ((rc = mr_query("add_member_to_list", 3, argv, NULL, NULL)))
      {
-       com_err(whoami, 0, "Unable to add container group %s to parent group %s: %s",
+       com_err(whoami, 0, 
+	       "Unable to add container group %s to parent group %s: %s",
 	       GroupName, ParentGroupName, error_message(rc));
      }
+   
    return(0);
  }
 
@@ -5102,6 +7035,7 @@
   
   call_args = ptr;
   strcpy(call_args[0], av[1]);
+
   return(0);
 }
 
@@ -5119,6 +7053,7 @@
   if (ParentFlag)
     {
       ptr = strrchr(ContainerName, '/');
+
       if (ptr != NULL)
 	(*ptr) = '\0';
       else
@@ -5143,7 +7078,8 @@
   else
     com_err(whoami, 0, "Unable to get container group from container %s",
 	    ContainerName);
-     return(0);
+  
+  return(0);
 }
 
 int Moira_process_machine_container_group(char *MachineName, char* GroupName, 
@@ -5151,459 +7087,325 @@
 {
   char *argv[3];
   long rc;
-
+  
   if (strcmp(GroupName, "[none]") == 0)
     return 0;
 
   argv[0] = GroupName;
   argv[1] = "MACHINE";
   argv[2] = MachineName;
+
   if (!DeleteMachine)
     rc = mr_query("add_member_to_list", 3, argv, NULL, NULL);
   else
     rc = mr_query("delete_member_from_list", 3, argv, NULL, NULL);
+
   if (rc)
     {
       com_err(whoami, 0, "Unable to add machine %s to container group%s: %s",
 	      MachineName, GroupName, error_message(rc));
     }
+
   return(0);
 }
 
 int GetMachineName(char *MachineName)
 {
-	char    *args[2];
-    char    NewMachineName[1024];
-    char    *szDot;
-    int     rc = 0;
-    int     i;
-    DWORD   dwLen = 0;
-    char    *call_args[2];
+  char    *args[2];
+  char    NewMachineName[1024];
+  char    *szDot;
+  int     rc = 0;
+  int     i;
+  DWORD   dwLen = 0;
+  char    *call_args[2];
+  
+  // If the address happens to be in the top-level MIT domain, great!
+  strcpy(NewMachineName, MachineName);
 
-    // If the address happens to be in the top-level MIT domain, great!
-    strcpy(NewMachineName, MachineName);
-    for (i = 0; i < (int)strlen(NewMachineName); i++)
-        NewMachineName[i] = toupper(NewMachineName[i]);
-    szDot = strchr(NewMachineName,'.');
-    if ((szDot) && (!strcasecmp(szDot+1, DOMAIN_SUFFIX)))
+  for (i = 0; i < (int)strlen(NewMachineName); i++)
+    NewMachineName[i] = toupper(NewMachineName[i]);
+
+  szDot = strchr(NewMachineName,'.');
+
+  if ((szDot) && (!strcasecmp(szDot+1, DOMAIN_SUFFIX)))
     {
-        return(0);
+      return(0);
     }
-   	
-    // If not, see if it has a Moira alias in the top-level MIT domain.
-    memset(NewMachineName, '\0', sizeof(NewMachineName));
-	args[0] = "*";
-    args[1] = MachineName;
-    call_args[0] = NewMachineName;
-    call_args[1] = NULL;
-    if (rc = mr_query("get_hostalias", 2, args, ProcessMachineName, call_args))
+  
+  // If not, see if it has a Moira alias in the top-level MIT domain.
+  memset(NewMachineName, '\0', sizeof(NewMachineName));
+  args[0] = "*";
+  args[1] = MachineName;
+  call_args[0] = NewMachineName;
+  call_args[1] = NULL;
+
+  if (rc = mr_query("get_hostalias", 2, args, ProcessMachineName, call_args))
     {
-        com_err(whoami, 0, "Unable to resolve machine name %s : %s",
-                MachineName, error_message(rc));
-        strcpy(MachineName, "");
-        return(0);
+      com_err(whoami, 0, "Unable to resolve machine name %s : %s",
+	      MachineName, error_message(rc));
+      strcpy(MachineName, "");
+      return(0);
     }
+  
+  if (strlen(NewMachineName) != 0)
+    strcpy(MachineName, NewMachineName);
+  else
+    strcpy(MachineName, "");
 
-    if (strlen(NewMachineName) != 0)
-        strcpy(MachineName, NewMachineName);
-    else
-        strcpy(MachineName, "");
-    return(0);
-
+  return(0);
 }
 
 int ProcessMachineName(int ac, char **av, void *ptr)
 {
-    char    **call_args;
-    char    MachineName[1024];
-    char    *szDot;
-    int     i;
+  char    **call_args;
+  char    MachineName[1024];
+  char    *szDot;
+  int     i;
+  
+  call_args = ptr;
 
-    call_args = ptr;
-    if (strlen(call_args[0]) == 0)
+  if (strlen(call_args[0]) == 0)
     {
-        strcpy(MachineName, av[0]);
-        for (i = 0; i < (int)strlen(MachineName); i++)
-            MachineName[i] = toupper(MachineName[i]);
-        szDot = strchr(MachineName,'.');
+      strcpy(MachineName, av[0]);
+
+      for (i = 0; i < (int)strlen(MachineName); i++)
+	MachineName[i] = toupper(MachineName[i]);
+
+      szDot = strchr(MachineName,'.');
+
         if ((szDot) && (!strcasecmp(szDot+1,DOMAIN_SUFFIX)))
-        {
+	  {
             strcpy(call_args[0], MachineName);
-        }
+	  }
     }
-    return(0);
+
+  return(0);
 }
 
 void SwitchSFU(LDAPMod **mods, int *UseSFU30, int n)
 {
-    int i;
-
-    if (*UseSFU30)
+  int i;
+  
+  if (*UseSFU30)
     {
-        for (i = 0; i < n; i++)
+      for (i = 0; i < n; i++)
         {
-            if (!strcmp(mods[i]->mod_type, "msSFU30UidNumber"))
-                mods[i]->mod_type = "uidNumber";
+	  if (!strcmp(mods[i]->mod_type, "msSFU30UidNumber"))
+	    mods[i]->mod_type = "uidNumber";
         }
-        (*UseSFU30) = 0;
+
+      (*UseSFU30) = 0;
     }
-    else
+  else
     {
-        for (i = 0; i < n; i++)
+      for (i = 0; i < n; i++)
         {
-            if (!strcmp(mods[i]->mod_type, "uidNumber"))
-                mods[i]->mod_type = "msSFU30UidNumber";
+	  if (!strcmp(mods[i]->mod_type, "uidNumber"))
+	    mods[i]->mod_type = "msSFU30UidNumber";
         }
-        (*UseSFU30) = 1;
+
+      (*UseSFU30) = 1;
     }
 }
 
-int SetHomeDirectory(LDAP *ldap_handle, char *user_name, char *DistinguishedName,
+int SetHomeDirectory(LDAP *ldap_handle, char *user_name, 
+		     char *DistinguishedName,
                      char *WinHomeDir, char *WinProfileDir,
                      char **homedir_v, char **winProfile_v,
                      char **drives_v, LDAPMod **mods, 
                      int OpType, int n)
 {
-    char **hp;
-    char cWeight[3];
-    char cPath[1024];
-    char path[1024];
-    char winPath[1024];
-    char winProfile[1024];
-    char homeDrive[8];
-    int  last_weight;
-    int  i;
-    int  rc;
-    LDAPMod *DelMods[20];
+  char **hp;
+  char cWeight[3];
+  char cPath[1024];
+  char path[1024];
+  char winPath[1024];
+  char winProfile[1024];
+  char homeDrive[8];
+  int  last_weight;
+  int  i;
+  int  rc;
+  LDAPMod *DelMods[20];
+  
+  memset(homeDrive, '\0', sizeof(homeDrive));
+  memset(path, '\0', sizeof(path));
+  memset(winPath, '\0', sizeof(winPath));
+  memset(winProfile, '\0', sizeof(winProfile));
+  hp = NULL;
 
-    memset(homeDrive, '\0', sizeof(homeDrive));
-    memset(path, '\0', sizeof(path));
-    memset(winPath, '\0', sizeof(winPath));
-    memset(winProfile, '\0', sizeof(winProfile));
-    hp = NULL;
-    if ((!strcasecmp(WinHomeDir, "[afs]")) || (!strcasecmp(WinProfileDir, "[afs]")))
+  if ((!strcasecmp(WinHomeDir, "[afs]")) || 
+      (!strcasecmp(WinProfileDir, "[afs]")))
     {
-        if ((hp = hes_resolve(user_name, "filsys")) != NULL)
+      if ((hp = hes_resolve(user_name, "filsys")) != NULL)
         {
-            memset(cWeight, 0, sizeof(cWeight));
-            memset(cPath, 0, sizeof(cPath));
-            last_weight = 1000;
-            i = 0;
-            while (hp[i] != NULL)
+	  memset(cWeight, 0, sizeof(cWeight));
+	  memset(cPath, 0, sizeof(cPath));
+	  last_weight = 1000;
+	  i = 0;
+
+	  while (hp[i] != NULL)
             {
-                if (sscanf(hp[i], "%*s %s", cPath))
+	      if (sscanf(hp[i], "%*s %s", cPath))
                 {
-                    if (strnicmp(cPath, AFS, strlen(AFS)) == 0)
+		  if (strnicmp(cPath, AFS, strlen(AFS)) == 0)
                     {
-                        if (sscanf(hp[i], "%*s %*s %*s %*s %s", cWeight))
+		      if (sscanf(hp[i], "%*s %*s %*s %*s %s", cWeight))
                         {
-                            if (atoi(cWeight) < last_weight)
+			  if (atoi(cWeight) < last_weight)
                             {
-                                strcpy(path, cPath);
-                                last_weight = (int)atoi(cWeight);
+			      strcpy(path, cPath);
+			      last_weight = (int)atoi(cWeight);
                             }
                         }
-                        else 
-                            strcpy(path, cPath);
+		      else 
+			strcpy(path, cPath);
                     }
                 }
               ++i;
             }
-            if (strlen(path))
+
+	  if (strlen(path))
             {
-                if (!strnicmp(path, AFS, strlen(AFS)))
+	      if (!strnicmp(path, AFS, strlen(AFS)))
                 {
-                    AfsToWinAfs(path, winPath);
-                    strcpy(winProfile, winPath);
-                    strcat(winProfile, "\\.winprofile");
+		  AfsToWinAfs(path, winPath);
+		  strcpy(winProfile, winPath);
+		  strcat(winProfile, "\\.winprofile");
                 }
             }
         }
-        else
-            return(n);
+      else
+	return(n);
     }
 
-    if ((!strcasecmp(WinHomeDir, "[dfs]")) || (!strcasecmp(WinProfileDir, "[dfs]")))
+    if ((!strcasecmp(WinHomeDir, "[dfs]")) || 
+	(!strcasecmp(WinProfileDir, "[dfs]")))
     {
-        sprintf(path, "\\\\%s\\dfs\\profiles\\%c\\%s", ldap_domain, user_name[0], user_name);
-	if (!strcasecmp(WinProfileDir, "[dfs]"))
-	  {
-	    strcpy(winProfile, path);
-	    strcat(winProfile, "\\.winprofile");
-	  }
-	if (!strcasecmp(WinHomeDir, "[dfs]"))
-	  strcpy(winPath, path);
+      sprintf(path, "\\\\%s\\dfs\\profiles\\%c\\%s", ldap_domain, 
+	      user_name[0], user_name);
+
+      if (!strcasecmp(WinProfileDir, "[dfs]"))
+	{
+	  strcpy(winProfile, path);
+	  strcat(winProfile, "\\.winprofile");
+	}
+
+      if (!strcasecmp(WinHomeDir, "[dfs]"))
+	strcpy(winPath, path);
     }
-
+    
     if (hp != NULL)
-    {
+      {
         i = 0;
         while (hp[i])
-        {
+	  {
             free(hp[i]);
             i++;
-        }
-    }
-
+	  }
+      }
+    
     if (!strcasecmp(WinHomeDir, "[local]"))
-        memset(winPath, '\0', sizeof(winPath));
-    else if (!strcasecmp(WinHomeDir, "[afs]") || !strcasecmp(WinHomeDir, "[dfs]"))
-    {
+      memset(winPath, '\0', sizeof(winPath));
+    else if (!strcasecmp(WinHomeDir, "[afs]") || 
+	     !strcasecmp(WinHomeDir, "[dfs]"))
+      {
         strcpy(homeDrive, "H:");
-    }
+      }
     else
-    {
+      {
         strcpy(winPath, WinHomeDir);
         if (!strncmp(WinHomeDir, "\\\\", 2))
-        {
+	  {
             strcpy(homeDrive, "H:");
-        }        
-    }
-
+	  }        
+      }
+    
     // nothing needs to be done if WinProfileDir is [afs].
     if (!strcasecmp(WinProfileDir, "[local]"))
-        memset(winProfile, '\0', sizeof(winProfile));
-    else if (strcasecmp(WinProfileDir, "[afs]") && strcasecmp(WinProfileDir, "[dfs]"))
-    {
+      memset(winProfile, '\0', sizeof(winProfile));
+    else if (strcasecmp(WinProfileDir, "[afs]") && 
+	     strcasecmp(WinProfileDir, "[dfs]"))
+      {
         strcpy(winProfile, WinProfileDir);
-    }
-
+      }
+    
     if (strlen(winProfile) != 0)
-    {
+      {
         if (winProfile[strlen(winProfile) - 1] == '\\')
-            winProfile[strlen(winProfile) - 1] = '\0';
-    }
+	  winProfile[strlen(winProfile) - 1] = '\0';
+      }
+
     if (strlen(winPath) != 0)
-    {
+      {
         if (winPath[strlen(winPath) - 1] == '\\')
-            winPath[strlen(winPath) - 1] = '\0';
-    }
+	  winPath[strlen(winPath) - 1] = '\0';
+      }
+    
+    if ((winProfile[1] == ':') && (strlen(winProfile) == 2))
+      strcat(winProfile, "\\");
 
-    if ((winProfile[1] == ':') && (strlen(winProfile) == 2))
-        strcat(winProfile, "\\");
     if ((winPath[1] == ':') && (strlen(winPath) == 2))
-        strcat(winPath, "\\");
-
+      strcat(winPath, "\\");
+    
     if (strlen(winPath) == 0)
-    {
+      {
         if (OpType == LDAP_MOD_REPLACE)
-        {
+	  {
             i = 0;
             DEL_ATTR("homeDirectory", LDAP_MOD_DELETE);
             DelMods[i] = NULL;
             //unset homeDirectory attribute for user.
             rc = ldap_modify_s(ldap_handle, DistinguishedName, DelMods);
             free(DelMods[0]);
-        }
-    }
+	  }
+      }
     else
-    {
+      {
         homedir_v[0] = strdup(winPath);
         ADD_ATTR("homeDirectory", homedir_v, OpType);
-    }
-
+      }
+    
     if (strlen(winProfile) == 0)
-    {
+      {
         if (OpType == LDAP_MOD_REPLACE)
-        {
+	  {
             i = 0;
             DEL_ATTR("profilePath", LDAP_MOD_DELETE);
             DelMods[i] = NULL;
             //unset profilePate attribute for user.
             rc = ldap_modify_s(ldap_handle, DistinguishedName, DelMods);
             free(DelMods[0]);
-        }
-    }
+	  }
+      }
     else
-    {
+      {
         winProfile_v[0] = strdup(winProfile);
         ADD_ATTR("profilePath", winProfile_v, OpType);
-    }
-
+      }
+    
     if (strlen(homeDrive) == 0)
-    {
+      {
         if (OpType == LDAP_MOD_REPLACE)
-        {
+	  {
             i = 0;
             DEL_ATTR("homeDrive", LDAP_MOD_DELETE);
             DelMods[i] = NULL;
             //unset homeDrive attribute for user
             rc = ldap_modify_s(ldap_handle, DistinguishedName, DelMods);
             free(DelMods[0]);
-        }
-    }
+	  }
+      }
     else
-    {
+      {
         drives_v[0] = strdup(homeDrive);
         ADD_ATTR("homeDrive", drives_v, OpType);
-    }
+      }
 
     return(n);
 }
 
-int GetServerList(char *ldap_domain, char **ServerList)
-{
-  unsigned long   rc;
-  int             group_count;
-  int             UseSFU30;
-  int             Count;
-  int             i;
-  int             k;
-  int             ServerListFound;
-  char            default_server[256];
-  char            dn_path[256];
-  char            *attr_array[3];
-  char            *sPtr;
-  char            base[128];
-  char            filter[128];
-  char            temp[128];
-  LK_ENTRY        *group_base;
-  LK_ENTRY        *gPtr;
-  LDAP            *ldap_handle;
-  FILE            *fptr;
-
-  memset(default_server, '\0', sizeof(default_server));
-  memset(dn_path, '\0', sizeof(dn_path));
-  for (i = 0; i < MAX_SERVER_NAMES; i++)
-    {
-      if (ServerList[i] != NULL)
-        {
-          free(ServerList[i]);
-          ServerList[i] = NULL;
-        }
-    }
-  if (rc = ad_connect(&ldap_handle, ldap_domain, dn_path, "", "", default_server, 0, 
-                      ServerList))
-      return(1);
-
-  for (i = 0; i < MAX_SERVER_NAMES; i++)
-    {
-      ServerList[i] = NULL;
-    }
-
-  memset(ServerList, '\0', sizeof(ServerList[0]) * MAX_SERVER_NAMES);
-  group_count = 0;
-  group_base = NULL;
-  Count = 0;
-  ServerListFound = 0;
-
-  strcpy(filter, "(&(objectClass=rIDManager)(fSMORoleOwner=*))");
-  attr_array[0] = "fSMORoleOwner";
-  attr_array[1] = NULL;
-  if (!(rc = linklist_build(ldap_handle, dn_path, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
-    {
-      if (group_count != 0)
-        {
-          sPtr = strstr(group_base->value, ",CN=");
-          if (sPtr != NULL)
-            {
-              sPtr += strlen(",CN=");
-              if (ServerList[0] == NULL)
-                  ServerList[0] = calloc(1, 256);
-              strcpy(ServerList[0], sPtr);
-              sPtr = strstr(ServerList[0], ",");
-              if (sPtr != NULL)
-                  (*sPtr) = '\0';
-              ++Count;
-              ServerListFound = 1;
-            }
-        }
-    }
-  linklist_free(group_base);
-
-  group_count = 0;
-  group_base = NULL;
-  attr_array[0] = "cn";
-  attr_array[1] = NULL;
-  strcpy(filter, "(cn=*)");
-  sprintf(base, "cn=Servers,cn=Default-First-Site-Name,cn=Sites,cn=Configuration,%s", dn_path);
-
-  if (!(rc = linklist_build(ldap_handle, base, filter, attr_array, 
-                           &group_base, &group_count, LDAP_SCOPE_ONELEVEL)) != 0)
-    {
-      if (group_count != 0)
-        {
-          gPtr = group_base;
-          while (gPtr != NULL)
-            {
-              if (ServerListFound != 0)
-                {
-                  if (!strcasecmp(ServerList[0], gPtr->value))
-                    {
-                      gPtr = gPtr->next;
-                      continue;
-                    }
-                }
-              if (Count < MAX_SERVER_NAMES)
-                {
-                  if (ServerList[Count] == NULL)
-                      ServerList[Count] = calloc(1, 256);
-                  strcpy(ServerList[Count], gPtr->value);
-                  gPtr = gPtr->next;
-                  ++Count;
-                }
-            }
-        }
-    }
-  linklist_free(group_base);
-
-  UseSFU30 = 0;
-  group_count = 0;
-  group_base = NULL;
-
-  strcpy(filter, "(cn=msSFU-30-Uid-Number)");
-  sprintf(base, "cn=schema,cn=configuration,%s", dn_path);
-
-  if (!(rc = linklist_build(ldap_handle, base, filter, NULL, 
-                           &group_base, &group_count, LDAP_SCOPE_SUBTREE)) != 0)
-    {
-      if (group_count != 0)
-        {
-          UseSFU30 = 1;
-        }
-    }
-  linklist_free(group_base);
-  group_count = 0;
-  group_base = NULL;
-
-  sprintf(temp, "%s%s.cfg", CFG_PATH, ldap_domain);
-  if ((fptr = fopen(temp, "w+")) != NULL)
-    {
-      fprintf(fptr, "%s %s\n", DOMAIN, ldap_domain);
-      if (strlen(PrincipalName) != 0)
-          fprintf(fptr, "%s %s\n", PRINCIPALNAME, PrincipalName);
-      if (UseSFU30)
-          fprintf(fptr, "%s %s\n", MSSFU, SFUTYPE);
-      for (i = 0; i < MAX_SERVER_NAMES; i++)
-        {
-          if (ServerList[i] != NULL)
-            {
-              fprintf(fptr, "%s %s\n", SERVER, ServerList[i]);
-            }
-        }
-      fclose(fptr);
-    }
-  ldap_unbind_s(ldap_handle);
-
-  for (i = 0; i < MAX_SERVER_NAMES; i++)
-    {
-      if (ServerList[i] != NULL)
-        {
-          if (ServerList[i][strlen(ServerList[i]) - 1] == '\n')
-              ServerList[i][strlen(ServerList[i]) - 1] = '\0';
-          strcat(ServerList[i], ".");
-          strcat(ServerList[i], ldap_domain);
-          for (k = 0; k < (int)strlen(ServerList[i]); k++)
-              ServerList[i][k] = toupper(ServerList[i][k]);
-        }
-    }
-
-  return(0);
-}
-
 int attribute_update(LDAP *ldap_handle, char *distinguished_name, 
-                      char *attribute_value, char *attribute, char *user_name)
+		     char *attribute_value, char *attribute, char *user_name)
 {
   char      *mod_v[] = {NULL, NULL};
   LDAPMod   *DelMods[20];
@@ -5611,7 +7413,7 @@
   int       n;
   int       i;
   int       rc;
-
+  
   if (strlen(attribute_value) == 0)
     {
       i = 0;
@@ -5620,145 +7422,78 @@
       rc = ldap_modify_s(ldap_handle, distinguished_name, DelMods);
       free(DelMods[0]);
     }
-    else
+  else
     {
       n = 0;
       mod_v[0] = attribute_value;
       ADD_ATTR(attribute, mod_v, LDAP_MOD_REPLACE);
       mods[n] = NULL;
-      if ((rc = ldap_modify_s(ldap_handle, distinguished_name, mods)) != LDAP_SUCCESS)
+
+      if ((rc = ldap_modify_s(ldap_handle, distinguished_name, 
+			      mods)) != LDAP_SUCCESS)
         {
           free(mods[0]);
           n = 0;
           mod_v[0] = attribute_value;
           ADD_ATTR(attribute, mod_v, LDAP_MOD_ADD);
           mods[n] = NULL;
-          if ((rc = ldap_modify_s(ldap_handle, distinguished_name, mods)) != LDAP_SUCCESS)
+
+          if ((rc = ldap_modify_s(ldap_handle, distinguished_name, 
+				  mods)) != LDAP_SUCCESS)
             {
-              com_err(whoami, 0, "Unable to change the %s attribute for %s in the AD : %s",
+              com_err(whoami, 0, "Unable to change the %s attribute for %s "
+		      "in the AD : %s",
                       attribute, user_name, ldap_err2string(rc));
             }
         }
+
       free(mods[0]);
     }
+  
   return(rc);
 }
 
-int tickets_get_k5()
+void StringTrim(char *StringToTrim)
 {
-    char temp[128];
-    char KinitPath[128];
-    int  retval;
-    int  i;
-    static char EnvVar[128];
-    static char EnvVar1[128];
+  char *t, *s;
+  char *save;
 
-    strcpy(EnvVar, KRB5CCNAME);
-    retval = putenv(EnvVar);
-    strcpy(EnvVar1, KRBTKFILE);
-    retval = putenv(EnvVar1);
+  save = strdup(StringToTrim);
 
-    for (i = 0; i < (int)strlen(PrincipalName); i++)
-        PrincipalName[i] = tolower(PrincipalName[i]);
-    if (strlen(PrincipalName) == 0)
-    {
-        strcpy(PrincipalName, PRODUCTION_PRINCIPAL);
-        if (strcasecmp(ldap_domain, PRIMARY_DOMAIN))
-            strcpy(PrincipalName, TEST_PRINCIPAL);
-    }
+  s = save;
 
-    memset(KinitPath, '\0',sizeof(KinitPath));
-#ifndef _WIN32
-    strcpy(KinitPath, "/usr/athena/bin/");
-#endif
-    sprintf(temp, "%skinit -k -t %s %s", KinitPath, KEYTABFILE, PrincipalName);
-    retval = system(temp);
-    if (retval)
-      {
-	com_err(whoami, 0, "%s failed", temp);
-	sprintf(temp, "%skinit -5 -k -t %s %s", KinitPath, KEYTABFILE, PrincipalName);
-	retval = system(temp);
-	if (retval)
-	  {
-	    com_err(whoami, 0, "%s failed", temp);
-	    return(-1);
-	  }
-      }
-    return(0);
-}
+  while (isspace(*s))
+    s++;
 
-int get_tickets()
-{
-
-    if (tickets_get_k5())
+  /* skip to end of string */
+  if (*s == '\0')
     {
-        sleep(1);
-        if (tickets_get_k5())
-	  {
-	    com_err(whoami, 0, "%s", "Unable to get kerberos tickets");
-            critical_alert("AD incremental", "%s",
-                           "winad.incr incremental failed (unable to get kerberos tickets)");
-            return(1);
-	  }
+      if (*save)
+	*save = '\0';
+      strcpy(StringToTrim, save);
+      return;
     }
-    return(0);
-}
+  
+  for (t = s; *t; t++)
+    continue;
 
-int destroy_cache(void)
-{
-  krb5_context		context;
-  krb5_ccache			cache;
-  krb5_error_code	rc;
-
-  context = NULL;
-  cache = NULL;
-  if (!krb5_init_context(&context))
+  while (t > s)
     {
-      if (!krb5_cc_default(context, &cache))
-        rc = krb5_cc_destroy(context, cache);
+      --t;
+      if (!isspace(*t))
+	{
+	  t++;
+	  break;
+	}
     }
-  if (context != NULL)
-    krb5_free_context(context);
-  dest_tkt();
 
-  return(rc);
+  if (*t)
+    *t = '\0';
+  
+  strcpy(StringToTrim, s);
+  return;
 }
 
-
-void StringTrim(char *StringToTrim)
-{
-    char    *cPtr;
-    char    temp[256];
-    int     i;
-
-    if (strlen(StringToTrim) == 0)
-        return;
-
-    cPtr = StringToTrim;
-    while (isspace(*cPtr))
-    {
-        ++cPtr;
-    }
-    strcpy(temp, cPtr);
-    if (strlen(temp) == 0)
-    {
-        strcpy(StringToTrim, temp);
-        return;
-    }
-    while (1)
-    {
-        i = strlen(temp);
-        if (i == 0)
-            break;
-        if (!isspace(temp[i-1]))
-            break;
-        temp[i-1] = '\0';
-    }
-
-    strcpy(StringToTrim, temp);
-    return;
-}
-
 int ReadConfigFile(char *DomainName)
 {
     int     Count;
@@ -5771,87 +7506,156 @@
     Count = 0;
 
     sprintf(temp, "%s%s.cfg", CFG_PATH, DomainName);
+
     if ((fptr = fopen(temp, "r")) != NULL)
-    {
+      {
         while (fgets(temp, sizeof(temp), fptr) != 0)
-        {
+	  {
             for (i = 0; i < (int)strlen(temp); i++)
-                temp[i] = toupper(temp[i]);
+	      temp[i] = toupper(temp[i]);
+
             if (temp[strlen(temp) - 1] == '\n')
-                temp[strlen(temp) - 1] = '\0';
+	      temp[strlen(temp) - 1] = '\0';
+
             StringTrim(temp);
+
             if (strlen(temp) == 0)
-                continue;
+	      continue;
+
             if (!strncmp(temp, DOMAIN, strlen(DOMAIN)))
-            {
+	      {
                 if (strlen(temp) > (strlen(DOMAIN)))
-                {
+		  {
                     strcpy(ldap_domain, &temp[strlen(DOMAIN)]);
                     StringTrim(ldap_domain);
-                }
-            }
+		  }
+	      }
             else if (!strncmp(temp, PRINCIPALNAME, strlen(PRINCIPALNAME)))
-            {
+	      {
                 if (strlen(temp) > (strlen(PRINCIPALNAME)))
-                {
+		  {
                     strcpy(PrincipalName, &temp[strlen(PRINCIPALNAME)]);
                     StringTrim(PrincipalName);
-                }
-            }
+		  }
+	      }
             else if (!strncmp(temp, SERVER, strlen(SERVER)))
-            {
+	      {
                 if (strlen(temp) > (strlen(SERVER)))
-                {
+		  {
                     ServerList[Count] = calloc(1, 256);
                     strcpy(ServerList[Count], &temp[strlen(SERVER)]);
                     StringTrim(ServerList[Count]);
                     ++Count;
-                }
-            }
+		  }
+	      }
             else if (!strncmp(temp, MSSFU, strlen(MSSFU)))
-            {
+	      {
                 if (strlen(temp) > (strlen(MSSFU)))
-                {
+		  {
                     strcpy(temp1, &temp[strlen(MSSFU)]);
                     StringTrim(temp1);
                     if (!strcmp(temp1, SFUTYPE))
-                        UseSFU30 = 1;
-                }
-            }
-            else if (!strcasecmp(temp, "NOCHANGE"))
-            {
-                NoChangeConfigFile = 1;
-            }
+		      UseSFU30 = 1;
+		  }
+	      }
+	    else if (!strncmp(temp, GROUP_SUFFIX, strlen(GROUP_SUFFIX)))
+	      {
+		if (strlen(temp) > (strlen(GROUP_SUFFIX)))
+		  {
+		    strcpy(temp1, &temp[strlen(GROUP_SUFFIX)]);
+		    StringTrim(temp1);
+		    if (!strcasecmp(temp1, "NO")) 
+		      {
+			UseGroupSuffix = 0;
+			memset(group_suffix, '\0', sizeof(group_suffix));
+		      }
+		  }
+	      }
+	    else if (!strncmp(temp, GROUP_TYPE, strlen(GROUP_TYPE)))
+	      {
+		if (strlen(temp) > (strlen(GROUP_TYPE)))
+		  {
+		    strcpy(temp1, &temp[strlen(GROUP_TYPE)]);
+		    StringTrim(temp1);
+		    if (!strcasecmp(temp1, "UNIVERSAL")) 
+		      UseGroupUniversal = 1;
+		  }
+	      }
+	    else if (!strncmp(temp, SET_GROUP_ACE, strlen(SET_GROUP_ACE)))
+	      {
+		if (strlen(temp) > (strlen(SET_GROUP_ACE)))
+		  {
+		    strcpy(temp1, &temp[strlen(SET_GROUP_ACE)]);
+		    StringTrim(temp1);
+		    if (!strcasecmp(temp1, "NO"))
+		      SetGroupAce = 0;
+		  }
+	      }
+	    else if (!strncmp(temp, SET_PASSWORD, strlen(SET_PASSWORD)))
+	      {
+		if (strlen(temp) > (strlen(SET_PASSWORD)))
+		  {
+		    strcpy(temp1, &temp[strlen(SET_PASSWORD)]);
+		    StringTrim(temp1);
+		    if (!strcasecmp(temp1, "NO"))
+		      SetPassword = 0;
+		  }
+	      }
+	    else if (!strncmp(temp, EXCHANGE, strlen(EXCHANGE)))
+	      {
+		if (strlen(temp) > (strlen(EXCHANGE)))
+		  {
+		    strcpy(temp1, &temp[strlen(EXCHANGE)]);
+		    StringTrim(temp1);
+		    if (!strcasecmp(temp1, "YES"))
+		      Exchange = 1;
+		  }
+	      }
+	    else if (!strncmp(temp, PROCESS_MACHINE_CONTAINER, 
+			      strlen(PROCESS_MACHINE_CONTAINER)))
+	      {
+		if (strlen(temp) > (strlen(PROCESS_MACHINE_CONTAINER)))
+		  {
+		    strcpy(temp1, &temp[strlen(PROCESS_MACHINE_CONTAINER)]);
+		    StringTrim(temp1);
+		    if (!strcasecmp(temp1, "NO"))
+		      ProcessMachineContainer = 0;
+		  }
+	      }
             else
-            {
+	      {
                 if (strlen(ldap_domain) != 0)
-                {
+		  {
                     memset(ldap_domain, '\0', sizeof(ldap_domain));
                     break;
-                }
+		  }
+
                 if (strlen(temp) != 0)
-                    strcpy(ldap_domain, temp);
-            }
-        }
+		  strcpy(ldap_domain, temp);
+	      }
+	  }
         fclose(fptr);
-    }
-
+      }
+    
     if (strlen(ldap_domain) == 0)
-    {
+      {
       strcpy(ldap_domain, DomainName);
-    }
+      }
+
     if (Count == 0)
         return(0);
+
     for (i = 0; i < Count; i++)
-    {
+      {
         if (ServerList[i] != 0)
-        {
+	  {
             strcat(ServerList[i], ".");
             strcat(ServerList[i], ldap_domain);
             for (k = 0; k < (int)strlen(ServerList[i]); k++)
-                ServerList[i][k] = toupper(ServerList[i][k]);
-        }
-    }
+	      ServerList[i][k] = toupper(ServerList[i][k]);
+	  }
+      }
+    
     return(0);
 }
 
@@ -5869,17 +7673,22 @@
 
   Count = 0;
   sprintf(temp, "%s%s", CFG_PATH, WINADCFG);
+
   if ((fptr = fopen(temp, "r")) != NULL)
     {
       while (fgets(temp, sizeof(temp), fptr) != 0)
 	{
 	  for (i = 0; i < (int)strlen(temp); i++)
 	    temp[i] = toupper(temp[i]);
+
 	  if (temp[strlen(temp) - 1] == '\n')
 	    temp[strlen(temp) - 1] = '\0';
+
 	  StringTrim(temp);
+
 	  if (strlen(temp) == 0)
 	    continue;
+
 	  if (!strncmp(temp, DOMAIN, strlen(DOMAIN)))
 	    {
 	      if (strlen(temp) > (strlen(DOMAIN)))
@@ -5889,61 +7698,279 @@
 		  strcpy(temp, temp1);
 		}
 	    }
-	  ok = 1;
-	  rc = sscanf(temp, "%c%c%c%c%c.%c%c%c.%c%c%c%s", &c[0],
-		      &c[1], &c[2], &c[3], &c[4], &c[5], &c[6],
-		      &c[7], &c[8], &c[9], &c[10], stuff);
-	  if (rc != 11)
-	    {
-	      rc = sscanf(temp, "%c%c%c%c.%c%c%c.%c%c%c%s", &c[0],
-			  &c[1], &c[2], &c[3], &c[4], &c[5], &c[6],
-			  &c[7], &c[8], &c[9], stuff);
-	      if (rc != 10)
-		{
-		  rc = sscanf(temp, "%c%c%%c.%c%c%c.%c%c%c%s", &c[0],
-			      &c[1], &c[2], &c[3], &c[4], &c[5],
-			      &c[6], &c[7], &c[8], stuff);
-		  if (rc != 9)
-		    {
-		      UpdateDomainList = 1;
-		      ok = 0;
-		    }
-		}
-	    }
-	  if (ok)
-             {
-	       strcpy(DomainNames[Count], temp);
-	       StringTrim(DomainNames[Count]);
-	       ++Count;
-             }
+	  
+	  strcpy(DomainNames[Count], temp);
+	  StringTrim(DomainNames[Count]);
+	  ++Count;
 	}
+
       fclose(fptr);
     }
+
   if (Count == 0)
     {
-      critical_alert("incremental", "%s",
-		     "winad.incr cannot run due to a configuration error in winad.cfg");
+      critical_alert("incremental", "%s", "winad.incr cannot run due to a "
+		     "configuration error in winad.cfg");
       return(1);
     }
+  
   return(0);
 }
 
-void WriteDomainList()
+int email_isvalid(const char *address) {
+  int        count = 0;
+  const char *c, *domain;
+  static char *rfc822_specials = "()<>@,;:\\\"[]";
+
+  if(address[strlen(address) - 1] == '.') 
+    return 0;
+    
+  /* first we validate the name portion (name@domain) */
+  for (c = address;  *c;  c++) {
+    if (*c == '\"' && (c == address || *(c - 1) == '.' || *(c - 1) == 
+		       '\"')) {
+      while (*++c) {
+        if (*c == '\"') 
+	  break;
+        if (*c == '\\' && (*++c == ' ')) 
+	  continue;
+        if (*c <= ' ' || *c >= 127) 
+	  return 0;
+      }
+
+      if (!*c++) 
+	return 0;
+      if (*c == '@') 
+	break;
+      if (*c != '.') 
+	return 0;
+      continue;
+    }
+
+    if (*c == '@') 
+      break;
+    if (*c <= ' ' || *c >= 127) 
+      return 0;
+    if (strchr(rfc822_specials, *c)) 
+      return 0;
+  }
+
+  if (c == address || *(c - 1) == '.') 
+    return 0;
+
+  /* next we validate the domain portion (name@domain) */
+  if (!*(domain = ++c)) return 0;
+  do {
+    if (*c == '.') {
+      if (c == domain || *(c - 1) == '.') 
+	return 0;
+      count++;
+    }
+    if (*c <= ' ' || *c >= 127) 
+      return 0;
+    if (strchr(rfc822_specials, *c)) 
+      return 0;
+  } while (*++c);
+
+  return (count >= 1);
+}
+
+int find_homeMDB(LDAP *ldap_handle, char *dn_path, char **homeMDB, 
+	     char **homeServerName) 
 {
-  char    temp[128];
-  int     i;
-  FILE    *fptr;
+  LK_ENTRY *group_base;
+  LK_ENTRY *sub_group_base;
+  LK_ENTRY *gPtr;
+  LK_ENTRY *sub_gPtr;
+  int      group_count;
+  int      sub_group_count;
+  char     filter[1024];
+  char     sub_filter[1024];
+  char     search_path[1024];
+  char     range[1024];
+  char     *attr_array[3];
+  char     *s;
+  int      homeMDB_count = -1;
+  int      rc;
+  int      i;
+  int      mdbbl_count;
+  int      rangeStep = 1500;
+  int      rangeLow = 0;
+  int      rangeHigh = rangeLow + (rangeStep - 1);
+  int      isLast = 0;
+
+  /* Grumble..... microsoft not making it searchable from the root *grr* */
+
+  memset(filter, '\0', sizeof(filter));
+  memset(search_path, '\0', sizeof(search_path));
   
-  sprintf(temp, "%s%s", CFG_PATH, WINADCFG);
-  if ((fptr = fopen(temp, "w+")) != NULL)
+  sprintf(filter, "(objectClass=msExchMDB)");
+  sprintf(search_path, "CN=Configuration,%s", dn_path);
+  attr_array[0] = "distinguishedName";
+  attr_array[1] = NULL;
+  
+  group_base = NULL;
+  group_count = 0;
+  
+  if ((rc = linklist_build(ldap_handle, search_path, filter, attr_array,
+			   &group_base, &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0) 
     {
-      for (i = 0; i < MAX_DOMAINS; i++)
+      com_err(whoami, 0, "Unable to find msExchMDB %s",
+	      ldap_err2string(rc));
+      return(rc);
+    }
+  
+  if (group_count) 
+    {
+      gPtr = group_base;
+      
+      while(gPtr) {
+	if ((s = strstr(gPtr->dn, "Public")) != (char *) NULL)
+	  {
+	    gPtr = gPtr->next;
+	    continue;
+	  }
+
+	/* 
+	 * Due to limits in active directory we need to use the LDAP
+	 * range semantics to query and return all the values in 
+	 * large lists, we will stop increasing the range when
+	 * the result count is 0.
+         */
+
+	i = 0;	
+	mdbbl_count = 0;
+
+	for(;;) 
+	  {
+	    memset(sub_filter, '\0', sizeof(sub_filter));
+	    memset(range, '\0', sizeof(range));
+	    sprintf(sub_filter, "(objectClass=msExchMDB)");
+
+	    if(isLast)
+	      sprintf(range, "homeMDBBL;Range=%d-*", rangeLow);
+	    else 
+	      sprintf(range, "homeMDBBL;Range=%d-%d", rangeLow, rangeHigh);
+
+	    attr_array[0] = range;
+	    attr_array[1] = NULL;
+	    
+	    sub_group_base = NULL;
+	    sub_group_count = 0;
+	    
+	    if ((rc = linklist_build(ldap_handle, gPtr->dn, sub_filter, 
+				     attr_array, &sub_group_base, 
+				     &sub_group_count, 
+				     LDAP_SCOPE_SUBTREE)) != 0) 
+	      {
+		com_err(whoami, 0, "Unable to find homeMDBBL %s",
+			ldap_err2string(rc));
+		return(rc);
+	      }
+
+	    if(!sub_group_count)
+	      {
+		if(isLast) 
+		  {
+		    isLast = 0;
+		    rangeLow = 0;
+		    rangeHigh = rangeLow + (rangeStep - 1);
+		    break;
+		  }
+		else
+		  isLast++;
+	      }
+
+	    mdbbl_count += sub_group_count;
+	    rangeLow = rangeHigh + 1;
+	    rangeHigh = rangeLow + (rangeStep - 1);
+	  }
+
+	/* First time through, need to initialize or update the least used */
+	
+	com_err(whoami, 0, "Mail store %s, count %d", gPtr->dn, 
+		mdbbl_count);
+
+	if(mdbbl_count < homeMDB_count || homeMDB_count == -1) 
+	  {
+	    homeMDB_count = mdbbl_count; 
+	    *homeMDB = strdup(gPtr->dn);
+	  }
+
+	gPtr = gPtr->next;
+	linklist_free(sub_group_base);
+      }
+    }
+
+  linklist_free(group_base);
+  
+  /* 
+   * Ok found the server least allocated need to now query to get its
+   * msExchHomeServerName so we can set it as a user attribute
+   */
+  
+  attr_array[0] = "legacyExchangeDN";
+  attr_array[1] = NULL;	
+  
+  group_count = 0;
+  group_base = NULL;
+  
+  if ((rc = linklist_build(ldap_handle, *homeMDB, filter, 
+			   attr_array, &group_base, 
+			   &group_count, 
+			   LDAP_SCOPE_SUBTREE)) != 0) 
+    {
+      com_err(whoami, 0, "Unable to find msExchHomeServerName %s",
+	      ldap_err2string(rc));
+      return(rc);
+    }  
+  
+  if(group_count) 
+    {
+      *homeServerName = strdup(group_base->value);
+      if((s = strrchr(*homeServerName, '/')) != (char *) NULL) 
 	{
-	  if (strlen(DomainNames[i]) != 0)
-	    {
-	      fprintf(fptr, "%s\n", DomainNames[i]);
-	    }
+	  *s = '\0';
 	}
-      fclose(fptr);
+    } 
+
+  linklist_free(group_base);
+  
+  return(rc);
+}
+      
+char *lowercase(char *s)
+{
+  char *p;
+
+  for (p = s; *p; p++)
+    {
+      if (isupper(*p))
+	*p = tolower(*p);
     }
+  return s;
 }
+
+char *uppercase(char *s)
+{
+  char *p;
+
+  for (p = s; *p; p++)
+    {
+      if (islower(*p))
+	*p = toupper(*p);
+    }
+  return s;
+}
+
+int save_query_info(int argc, char **argv, void *hint)
+{
+  int i;
+  char **nargv = hint;
+
+  for(i = 0; i < argc; i++)
+    nargv[i] = strdup(argv[i]);
+
+  return MR_CONT;
+}

Modified: trunk/third/moira/lib/Makefile.in
===================================================================
--- trunk/third/moira/lib/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 2000-01-28 00:03:28 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 

Modified: trunk/third/moira/lib/critical.c
===================================================================
--- trunk/third/moira/lib/critical.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/critical.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: critical.c,v 1.21 2000-09-21 07:36:40 zacheiss Exp $
+/* $Id$
  *
  * Log and send a zephyrgram about any critical errors.
  *
@@ -28,7 +28,7 @@
 #endif
 #include <time.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/critical.c,v 1.21 2000-09-21 07:36:40 zacheiss Exp $");
+RCSID("$Header$");
 
 /* mode to create the file with */
 #define LOGFILEMODE	0644

Modified: trunk/third/moira/lib/fixhost.c
===================================================================
--- trunk/third/moira/lib/fixhost.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/fixhost.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: fixhost.c,v 1.23 2000-03-15 22:44:18 rbasch Exp $
+/* $Id$
  *
  * Canonicalize a hostname
  *
@@ -27,7 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/fixhost.c,v 1.23 2000-03-15 22:44:18 rbasch Exp $");
+RCSID("$Header$");
 
 static struct hostent *local_gethostbyname(void)
 {

Modified: trunk/third/moira/lib/fixname.c
===================================================================
--- trunk/third/moira/lib/fixname.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/fixname.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: fixname.c,v 1.16 2004-02-15 01:54:32 zacheiss Exp $
+/* $Id$
  *
  * Put a name into Moira-canonical form
  *
@@ -13,7 +13,7 @@
 #include <ctype.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/fixname.c,v 1.16 2004-02-15 01:54:32 zacheiss Exp $");
+RCSID("$Header$");
 
 #define LAST_LEN		100
 #define FIRST_LEN		100

Modified: trunk/third/moira/lib/hash.c
===================================================================
--- trunk/third/moira/lib/hash.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/hash.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: hash.c,v 1.15 1998-02-08 19:31:17 danw Exp $
+/* $Id$
  *
  * Generic hash table routines.  Uses integer keys to store char * values.
  *
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/hash.c,v 1.15 1998-02-08 19:31:17 danw Exp $");
+RCSID("$Header$");
 
 #define hash_func(h, key) (key >= 0 ? (key % h->size) : (-key % h->size))
 

Modified: trunk/third/moira/lib/kname_unparse.c
===================================================================
--- trunk/third/moira/lib/kname_unparse.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/kname_unparse.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: kname_unparse.c,v 1.5 2004-07-20 06:47:46 zacheiss Exp $
+/* $Id$
  *
  * Don't know why this function is not in libkrb.a.  It's the inverse
  * of kname_parse() which is there.
@@ -16,7 +16,7 @@
 #include <des.h>
 #include <krb.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/kname_unparse.c,v 1.5 2004-07-20 06:47:46 zacheiss Exp $");
+RCSID("$Header$");
 
 /* Turn a principal, instance, realm triple into a single non-ambiguous
  * string.  This is the inverse of kname_parse().  It returns a pointer

Modified: trunk/third/moira/lib/mr_access.c
===================================================================
--- trunk/third/moira/lib/mr_access.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_access.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_access.c,v 1.14 1998-02-15 17:49:00 danw Exp $
+/* $Id$
  *
  * Check access to a Moira query
  *
@@ -15,7 +15,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_access.c,v 1.14 1998-02-15 17:49:00 danw Exp $");
+RCSID("$Header$");
 
 /*
  * Check access to a named query.

Modified: trunk/third/moira/lib/mr_auth.c
===================================================================
--- trunk/third/moira/lib/mr_auth.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_auth.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_auth.c,v 1.28 2007-07-25 15:38:48 zacheiss Exp $
+/* $Id$
  *
  * Handles the client side of the sending of authenticators to the moira server
  *
@@ -21,7 +21,7 @@
 krb5_context context = NULL;
 krb5_auth_context auth_con = NULL;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_auth.c,v 1.28 2007-07-25 15:38:48 zacheiss Exp $");
+RCSID("$Header$");
 
 /* Authenticate this client with the Moira server.  prog is the name of the
  * client program, and will be recorded in the database.

Modified: trunk/third/moira/lib/mr_call.c
===================================================================
--- trunk/third/moira/lib/mr_call.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_call.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_call.c,v 1.18 2000-03-15 22:44:19 rbasch Exp $
+/* $Id$
  *
  * Pass an mr_params off to the Moira server and get a reply
  *
@@ -22,7 +22,7 @@
 #include <unistd.h>
 #endif
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_call.c,v 1.18 2000-03-15 22:44:19 rbasch Exp $");
+RCSID("$Header$");
 
 /* Moira RPC format:
 

Modified: trunk/third/moira/lib/mr_connect.c
===================================================================
--- trunk/third/moira/lib/mr_connect.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_connect.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_connect.c,v 1.37 2006-09-07 18:21:48 zacheiss Exp $
+/* $Id$
  *
  * This routine is part of the client library.  It handles
  * creating a connection to the moira server.
@@ -45,7 +45,7 @@
 #endif
 #endif
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_connect.c,v 1.37 2006-09-07 18:21:48 zacheiss Exp $");
+RCSID("$Header$");
 
 #define DEFAULT_SERV "moira_db"
 #define DEFAULT_PORT 775

Modified: trunk/third/moira/lib/mr_et.et
===================================================================
--- trunk/third/moira/lib/mr_et.et	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_et.et	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: mr_et.et,v 1.31 2008-05-16 16:50:33 zacheiss Exp $
+# $Id$
 	error_table sms
 
 ec	MR_NOT_CONNECTED,

Modified: trunk/third/moira/lib/mr_init.c
===================================================================
--- trunk/third/moira/lib/mr_init.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_init.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_init.c,v 1.12 2000-01-28 00:03:30 danw Exp $
+/* $Id$
  *
  * Initialize libmoira
  *
@@ -11,7 +11,7 @@
 #include <moira.h>
 #include "mr_private.h"
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_init.c,v 1.12 2000-01-28 00:03:30 danw Exp $");
+RCSID("$Header$");
 
 int mr_inited = 0;
 

Modified: trunk/third/moira/lib/mr_ops.c
===================================================================
--- trunk/third/moira/lib/mr_ops.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_ops.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_ops.c,v 1.17 1999-12-30 17:29:24 danw Exp $
+/* $Id$
  *
  * This routine is part of the client library.  It handles
  * the protocol operations: invoking an update and getting the
@@ -18,7 +18,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_ops.c,v 1.17 1999-12-30 17:29:24 danw Exp $");
+RCSID("$Header$");
 
 /* Invoke a DCM update. */
 

Modified: trunk/third/moira/lib/mr_private.h
===================================================================
--- trunk/third/moira/lib/mr_private.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_private.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_private.h,v 1.13 2000-03-15 22:44:20 rbasch Exp $
+/* $Id$
  *
  * Private declarations of the Moira library.
  *

Modified: trunk/third/moira/lib/mr_query.c
===================================================================
--- trunk/third/moira/lib/mr_query.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/mr_query.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_query.c,v 1.18 1998-02-19 21:22:25 danw Exp $
+/* $Id$
  *
  * Perform a Moira query
  *
@@ -16,7 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_query.c,v 1.18 1998-02-19 21:22:25 danw Exp $");
+RCSID("$Header$");
 
 /*
  * This routine is the primary external interface to the mr library.

Modified: trunk/third/moira/lib/nfsparttype.c
===================================================================
--- trunk/third/moira/lib/nfsparttype.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/nfsparttype.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: nfsparttype.c,v 1.10 1998-02-08 19:31:22 danw Exp $
+/* $Id$
  *
  * Deal with NFS partition types
  *
@@ -15,7 +15,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/nfsparttype.c,v 1.10 1998-02-08 19:31:22 danw Exp $");
+RCSID("$Header$");
 
 struct pair {
   int type;

Modified: trunk/third/moira/lib/sq.c
===================================================================
--- trunk/third/moira/lib/sq.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/sq.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: sq.c,v 1.14 1999-07-12 16:26:22 danw Exp $
+/* $Id$
  *
  * Generic Queue Routines
  *
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/sq.c,v 1.14 1999-07-12 16:26:22 danw Exp $");
+RCSID("$Header$");
 
 struct save_queue *sq_create(void)
 {

Modified: trunk/third/moira/lib/strs.c
===================================================================
--- trunk/third/moira/lib/strs.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/lib/strs.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: strs.c,v 1.18 1999-10-06 03:04:02 danw Exp $
+/* $Id$
  *
  * Miscellaneous string functions.
  *
@@ -12,7 +12,7 @@
 
 #include <ctype.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/strs.c,v 1.18 1999-10-06 03:04:02 danw Exp $");
+RCSID("$Header$");
 
 /*
  * Trim whitespace off both ends of a string.

Modified: trunk/third/moira/man/Makefile.in
===================================================================
--- trunk/third/moira/man/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.7 2003-02-04 04:42:04 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/man/addusr.1
===================================================================
--- trunk/third/moira/man/addusr.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/addusr.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH ADDUSR 1 "29 Nov 2007" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/addusr.1,v 1.7 2007-11-29 22:17:58 zacheiss Exp $
+\" RCSID: $Header$
 .SH NAME
 addusr \- add and/or register users in Moira
 .SH SYNOPSIS

Modified: trunk/third/moira/man/blanche.1
===================================================================
--- trunk/third/moira/man/blanche.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/blanche.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH BLANCHE 1 "14 Sep 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/blanche.1,v 1.16 2002-06-17 18:47:12 zacheiss Exp $
+\" RCSID: $Header$
 .SH NAME
 blanche \- examine and modify memberships in Moira lists
 .SH SYNOPSIS

Modified: trunk/third/moira/man/chfn.1
===================================================================
--- trunk/third/moira/man/chfn.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/chfn.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH CHFN 1 "1 Feb 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/chfn.1,v 1.7 1998-05-26 18:14:10 danw Exp $
+\" RCSID: $Header$
 .SH NAME
 chfn \- change finger information
 .SH SYNOPSIS

Modified: trunk/third/moira/man/chpobox.1
===================================================================
--- trunk/third/moira/man/chpobox.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/chpobox.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH CHPOBOX 1 "5 Feb 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/chpobox.1,v 1.9 2001-03-05 16:27:58 zacheiss Exp $
+\" RCSID: $Header$
 .SH NAME
 chpobox \- change address at which user receives mail
 .SH SYNOPSIS

Modified: trunk/third/moira/man/chsh.1
===================================================================
--- trunk/third/moira/man/chsh.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/chsh.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH CHSH 1 "1 Feb 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/chsh.1,v 1.7 2000-05-21 03:50:33 zacheiss Exp $
+\" RCSID: $Header$
 .SH NAME
 chsh \- change user login shell
 .SH SYNOPSIS

Modified: trunk/third/moira/man/dcm.8
===================================================================
--- trunk/third/moira/man/dcm.8	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/dcm.8	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH DCM 8 "30 Nov 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/dcm.8,v 1.8 1998-05-26 18:14:11 danw Exp $
+\" RCSID: $Header$
 .SH NAME
 dcm, startdcm \- build config files from Moira database and update servers
 .SH SYNOPSIS

Modified: trunk/third/moira/man/mailmaint.1
===================================================================
--- trunk/third/moira/man/mailmaint.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/mailmaint.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH MAILMAINT 1 "27 Apr 1994" "MIT Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/mailmaint.1,v 1.5 1994-04-27 14:10:20 jweiss Exp $
+\" RCSID: $Header$
 .SH NAME
 mailmaint \- maintain mailing lists for a user
 .SH SYNOPSIS

Modified: trunk/third/moira/man/mitch.1
===================================================================
--- trunk/third/moira/man/mitch.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/mitch.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH MITCH 1 "22 Jan 2003" "MIT Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/mitch.1,v 1.2 2003-02-05 18:42:51 zacheiss Exp $
+\" RCSID: $Header$
 .SH NAME
 mitch \- examine and modify informtion about containers in Moira
 .SH SYNOPSIS

Modified: trunk/third/moira/man/moira.1
===================================================================
--- trunk/third/moira/man/moira.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/moira.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH MOIRA 1 "29 Nov 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/moira.1,v 1.8 1998-01-07 17:09:39 danw Exp $
+\" RCSID: $Header$
 .SH NAME
 moira, listmaint, usermaint, dcmmaint \- maintain information stored in moira
 .SH SYNOPSIS

Modified: trunk/third/moira/man/moirad.8
===================================================================
--- trunk/third/moira/man/moirad.8	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/moirad.8	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH MOIRAD 8 "30 Nov 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/moirad.8,v 1.7 1998-05-26 18:14:12 danw Exp $
+\" RCSID: $Header$
 .SH NAME
 moirad, startmoira \- Moira query daemon
 .SH SYNOPSIS

Modified: trunk/third/moira/man/mrcheck.1
===================================================================
--- trunk/third/moira/man/mrcheck.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/mrcheck.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH MRCHECK 1 "7 Feb 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/mrcheck.1,v 1.6 1998-01-07 17:10:07 danw Exp $
+\" RCSID: $Header$
 .UC 4
 .SH NAME
 mrcheck \- verify that Moira updates are successful

Modified: trunk/third/moira/man/mrtest.8
===================================================================
--- trunk/third/moira/man/mrtest.8	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/mrtest.8	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH MRTEST 8 "25 Jan 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/mrtest.8,v 1.9 1998-05-26 18:14:13 danw Exp $
+\" RCSID: $Header$
 .SH NAME
 mrtest \- perform Moira operations manually
 .SH SYNOPSIS

Modified: trunk/third/moira/man/reg_svr.8
===================================================================
--- trunk/third/moira/man/reg_svr.8	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/reg_svr.8	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH REG_SVR 8 "30 Nov 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/reg_svr.8,v 1.7 1998-05-26 18:14:14 danw Exp $
+\" RCSID: $Header$
 .SH NAME
 reg_svr, startreg \- Moira user account registration server
 .SH SYNOPSIS

Modified: trunk/third/moira/man/setquota.8
===================================================================
--- trunk/third/moira/man/setquota.8	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/setquota.8	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH SETQUOTA 8 "23 Jan 1989" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/setquota.8,v 1.2 1990-01-26 20:44:35 jnrees Exp $
+\" RCSID: $Header$
 .UC 4
 .SH NAME
 setquota \- set the disk usage quotas for a given user and partition

Modified: trunk/third/moira/man/stanley.1
===================================================================
--- trunk/third/moira/man/stanley.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/stanley.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH STANLEY 1 "25 Sep 2001" "MIT Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/stanley.1,v 1.5 2007-11-29 22:17:58 zacheiss Exp $
+\" RCSID: $Header$
 .SH NAME
 stanley \- examine and modify information about users in Moira
 .SH SYNOPSIS

Modified: trunk/third/moira/man/stella.1
===================================================================
--- trunk/third/moira/man/stella.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/stella.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH STELLA 1 "10 Feb 2000" "MIT Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/stella.1,v 1.7 2001-09-13 02:32:21 zacheiss Exp $
+\" RCSID: $Header$
 .SH NAME
 stella \- examine and modify information about hosts in Moira
 .SH SYNOPSIS

Modified: trunk/third/moira/man/update_server.8
===================================================================
--- trunk/third/moira/man/update_server.8	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/update_server.8	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH UPDATE_SERVER 8 "30 Nov 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/update_server.8,v 1.4 1993-10-21 14:39:09 mar Exp $
+\" RCSID: $Header$
 .SH NAME
 update_server \- daemon that accepts config files from Moira
 .SH SYNOPSIS

Modified: trunk/third/moira/man/userreg.1
===================================================================
--- trunk/third/moira/man/userreg.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/man/userreg.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 .TH USERREG 1 "30 Nov 1988" "Project Athena"
-\" RCSID: $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/man/userreg.1,v 1.3 1990-03-19 12:45:22 mar Exp $
+\" RCSID: $Header$
 .SH NAME
 userreg \- create an account for a person known to Moira
 .SH SYNOPSIS

Modified: trunk/third/moira/mkinstalldirs
===================================================================
--- trunk/third/moira/mkinstalldirs	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/mkinstalldirs	2008-09-17 22:23:57 UTC (rev 23178)
@@ -4,7 +4,7 @@
 # Created: 1993-05-16
 # Public domain
 
-# $Id: mkinstalldirs,v 1.1 1998-05-26 18:13:25 danw Exp $
+# $Id$
 
 errstatus=0
 

Modified: trunk/third/moira/reg_svr/Makefile.in
===================================================================
--- trunk/third/moira/reg_svr/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.12 2000-01-20 19:18:49 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/reg_svr/coupons/INSTRUCTIONS
===================================================================
--- trunk/third/moira/reg_svr/coupons/INSTRUCTIONS	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/coupons/INSTRUCTIONS	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-$Id: INSTRUCTIONS,v 1.2 2000-08-28 20:15:54 zacheiss Exp $
+$Id$
 
 The executables are in /moira/bin/ on the moira server, with sources in
 /mit/moiradev/src/reg_svr/.  Most of the commands are run on the Moira

Modified: trunk/third/moira/reg_svr/genkey.c
===================================================================
--- trunk/third/moira/reg_svr/genkey.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/genkey.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: genkey.c,v 1.1 1998-07-22 14:55:24 danw Exp $
+/* $Id$
  *
  * Utility program to generate a public/private key pair
  *
@@ -25,7 +25,7 @@
 #include "global.h"
 #include "rsaref.h"
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/reg_svr/genkey.c,v 1.1 1998-07-22 14:55:24 danw Exp $");
+RCSID("$Header$");
 
 void printhex(FILE *out, unsigned char *buf, int len);
 

Modified: trunk/third/moira/reg_svr/genwords.pc
===================================================================
--- trunk/third/moira/reg_svr/genwords.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/genwords.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: genwords.pc,v 1.2 2000-08-25 23:38:35 zacheiss Exp $
+/* $Id$
  *
  * Utility program to generate magic words for a given ID
  *
@@ -18,7 +18,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/reg_svr/genwords.pc,v 1.2 2000-08-25 23:38:35 zacheiss Exp $");
+RCSID("$Header$");
 
 int main(int argc, char **argv)
 {

Modified: trunk/third/moira/reg_svr/kerberos.c
===================================================================
--- trunk/third/moira/reg_svr/kerberos.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/kerberos.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: kerberos.c,v 1.8 2005-08-09 19:45:27 zacheiss Exp $
+/* $Id$
  *
  * Kerberos routines for registration server
  *
@@ -39,7 +39,7 @@
 krb5_context context;
 #endif
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/reg_svr/kerberos.c,v 1.8 2005-08-09 19:45:27 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *hostname, *shorthostname;
 

Modified: trunk/third/moira/reg_svr/protocol.c
===================================================================
--- trunk/third/moira/reg_svr/protocol.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/protocol.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: protocol.c,v 1.4 2005-06-29 06:39:35 zacheiss Exp $
+/* $Id$
  *
  * Reg_svr protocol and encryption/decryption routines
  *
@@ -28,7 +28,7 @@
 #include "global.h"
 #include "rsaref.h"
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/reg_svr/protocol.c,v 1.4 2005-06-29 06:39:35 zacheiss Exp $");
+RCSID("$Header$");
 
 R_RSA_PRIVATE_KEY *rsa_key;
 char *emsg[NUM_REG_ERRORS], *ename[NUM_REG_ERRORS];

Modified: trunk/third/moira/reg_svr/reg_svr.pc
===================================================================
--- trunk/third/moira/reg_svr/reg_svr.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/reg_svr.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: reg_svr.pc,v 1.19 2006-08-22 17:36:26 zacheiss Exp $
+/* $Id$
  *
  * Server for user registration with Moira and Kerberos.
  *
@@ -37,7 +37,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/reg_svr/reg_svr.pc,v 1.19 2006-08-22 17:36:26 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami, *hostname, *shorthostname;
 

Modified: trunk/third/moira/reg_svr/startreg.c
===================================================================
--- trunk/third/moira/reg_svr/startreg.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/startreg.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: startreg.c,v 1.12 1998-02-05 22:51:35 danw Exp $
+/* $Id$
  *
  * This program starts the user registration server
  * in a "clean" environment, and then waits for it to exit.
@@ -22,7 +22,7 @@
 #include <string.h>
 #include <unistd.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/reg_svr/startreg.c,v 1.12 1998-02-05 22:51:35 danw Exp $");
+RCSID("$Header$");
 
 #define PROG	"reg_svr"
 

Modified: trunk/third/moira/reg_svr/words.c
===================================================================
--- trunk/third/moira/reg_svr/words.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/reg_svr/words.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: words.c,v 1.1 1998-07-22 14:55:28 danw Exp $
+/* $Id$
  *
  * 6 Magic Words generation
  *
@@ -24,7 +24,7 @@
 #include "global.h"
 #include "rsaref.h"
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/reg_svr/words.c,v 1.1 1998-07-22 14:55:28 danw Exp $");
+RCSID("$Header$");
 
 /* One-Time Password dictionary, as specified by RFC 1938 */
 

Modified: trunk/third/moira/regtape/Makefile.in
===================================================================
--- trunk/third/moira/regtape/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/regtape/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.12 2002-09-16 22:19:33 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/regtape/common.h
===================================================================
--- trunk/third/moira/regtape/common.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/regtape/common.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: common.h,v 1.1 2000-07-12 22:11:41 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1987-1999 by the Massachusetts Institute of Technology
  *

Modified: trunk/third/moira/regtape/common.pc
===================================================================
--- trunk/third/moira/regtape/common.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/regtape/common.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: common.pc,v 1.11 2008-02-26 22:03:54 zacheiss Exp $
+/* $Id$
  *
  * Staff/Student load common code
  *
@@ -19,7 +19,7 @@
 EXEC SQL INCLUDE sqlca;
 extern void sqlglm(char *, unsigned int *, unsigned int *);
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/regtape/common.pc,v 1.11 2008-02-26 22:03:54 zacheiss Exp $");
+RCSID("$Header$");
 
 EXEC SQL BEGIN DECLARE SECTION;
 extern char *prog;

Modified: trunk/third/moira/regtape/grouper.pl
===================================================================
--- trunk/third/moira/regtape/grouper.pl	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/regtape/grouper.pl	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,5 +1,5 @@
 #!/moira/bin/perl -Tw
-# $Id: grouper.pl,v 1.10 2003-09-08 03:25:21 zacheiss Exp $
+# $Id$
 
 die "Usage: $0 password\n" unless ($#ARGV == 0);
 $whpassword = $ARGV[0];

Modified: trunk/third/moira/regtape/staff.pc
===================================================================
--- trunk/third/moira/regtape/staff.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/regtape/staff.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: staff.pc,v 1.9 2008-03-31 21:00:43 zacheiss Exp $
+/* $Id$
  *
  * Load data into Moira from Personnel Office data file
  *
@@ -19,7 +19,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/regtape/staff.pc,v 1.9 2008-03-31 21:00:43 zacheiss Exp $");
+RCSID("$Header$");
 
 /* File format is:
  *

Modified: trunk/third/moira/regtape/student.pc
===================================================================
--- trunk/third/moira/regtape/student.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/regtape/student.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: student.pc,v 1.5 2001-06-13 05:40:08 zacheiss Exp $
+/* $Id$
  *
  * Load data into Moira from Registrar's Office data file
  *
@@ -21,7 +21,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/regtape/student.pc,v 1.5 2001-06-13 05:40:08 zacheiss Exp $");
+RCSID("$Header$");
 
 /* File format is:
 

Modified: trunk/third/moira/regtape/vote.pc
===================================================================
--- trunk/third/moira/regtape/vote.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/regtape/vote.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: vote.pc,v 1.3 1998-02-05 22:51:39 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1993-1998 by the Massachusetts Institute of Technology
  * For copying and distribution information, please see the file
@@ -15,7 +15,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/regtape/vote.pc,v 1.3 1998-02-05 22:51:39 danw Exp $");
+RCSID("$Header$");
 
 struct entry {
   char *line;

Modified: trunk/third/moira/server/Makefile.in
===================================================================
--- trunk/third/moira/server/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 2.8 2001-04-01 05:31:11 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/server/increment.pc
===================================================================
--- trunk/third/moira/server/increment.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/increment.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: increment.pc,v 2.20 2003-05-14 13:07:36 zacheiss Exp $
+/* $Id$
  *
  * Deal with incremental updates
  *
@@ -20,7 +20,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/increment.pc,v 2.20 2003-05-14 13:07:36 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami;
 extern char *table_name[];
@@ -30,7 +30,7 @@
 int inc_running = 0;
 time_t inc_started;
 
-#define MAXARGC 15
+#define MAXARGC 16
 
 EXEC SQL WHENEVER SQLERROR DO dbmserr();
 
@@ -96,10 +96,10 @@
     case USERS_TABLE:
       sprintf(stmt_buf, "SELECT u.login, u.unix_uid, u.shell, "
 	      "u.winconsoleshell, u.last, u.first, u.middle, u.status, "
-	      "u.clearid, u.type, u.users_id, u.winhomedir, u.winprofiledir "
-	      "FROM users u WHERE %s", qual);
+	      "u.clearid, u.type, u.users_id, u.winhomedir, u.winprofiledir, "
+	      "u.potype FROM users u WHERE %s", qual);
       dosql(before);
-      beforec = 13;
+      beforec = 14;
       break;
     case MACHINE_TABLE:
       sprintf(stmt_buf, "SELECT m.name, m.vendor, m.mach_id FROM machine m "
@@ -280,10 +280,10 @@
     case USERS_TABLE:
       sprintf(stmt_buf, "SELECT u.login, u.unix_uid, u.shell, "
 	      "u.winconsoleshell, u.last, u.first, u.middle, u.status, "
-	      "u.clearid, u.type, u.users_id, u.winhomedir, u.winprofiledir "
-	      "FROM users u WHERE %s", qual);
+	      "u.clearid, u.type, u.users_id, u.winhomedir, u.winprofiledir, "
+	      "u.potype FROM users u WHERE %s", qual);
       dosql(after);
-      afterc = 13;
+      afterc = 14;
       break;
     case MACHINE_TABLE:
       sprintf(stmt_buf, "SELECT m.name, m.vendor, m.mach_id FROM machine m "

Modified: trunk/third/moira/server/mr_main.c
===================================================================
--- trunk/third/moira/server/mr_main.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/mr_main.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_main.c,v 1.54 2006-08-22 17:36:26 zacheiss Exp $
+/* $Id$
  *
  * Moira server process.
  *
@@ -31,7 +31,7 @@
 #include <krb.h>
 #include <krb5.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/mr_main.c,v 1.54 2006-08-22 17:36:26 zacheiss Exp $");
+RCSID("$Header$");
 
 client *cur_client;
 

Modified: trunk/third/moira/server/mr_sauth.c
===================================================================
--- trunk/third/moira/server/mr_sauth.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/mr_sauth.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_sauth.c,v 1.32 2007-05-08 16:25:28 zacheiss Exp $
+/* $Id$
  *
  * Handle server side of authentication
  *
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/mr_sauth.c,v 1.32 2007-05-08 16:25:28 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami, *host;
 extern int proxy_acl;

Modified: trunk/third/moira/server/mr_scall.c
===================================================================
--- trunk/third/moira/server/mr_scall.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/mr_scall.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_scall.c,v 1.39 2006-08-22 17:36:26 zacheiss Exp $
+/* $Id$
  *
  * Do RPC
  *
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <unistd.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/mr_scall.c,v 1.39 2006-08-22 17:36:26 zacheiss Exp $");
+RCSID("$Header$");
 
 extern int nclients;
 extern client **clients;

Modified: trunk/third/moira/server/mr_server.h
===================================================================
--- trunk/third/moira/server/mr_server.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/mr_server.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_server.h,v 1.66 2008-05-19 20:21:56 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
  * For copying and distribution information, please see the file

Modified: trunk/third/moira/server/mr_shutdown.c
===================================================================
--- trunk/third/moira/server/mr_shutdown.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/mr_shutdown.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_shutdown.c,v 1.11 1998-02-15 17:49:15 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
  * For copying and distribution information, please see the file
@@ -10,7 +10,7 @@
 
 #include <errno.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/mr_shutdown.c,v 1.11 1998-02-15 17:49:15 danw Exp $");
+RCSID("$Header$");
 
 extern char *takedown;
 extern char *whoami;

Modified: trunk/third/moira/server/mr_util.c
===================================================================
--- trunk/third/moira/server/mr_util.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/mr_util.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: mr_util.c,v 1.33 2004-02-15 01:54:58 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
  * For copying and distribution information, please see the file
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/mr_util.c,v 1.33 2004-02-15 01:54:58 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami;
 

Modified: trunk/third/moira/server/qaccess.pc
===================================================================
--- trunk/third/moira/server/qaccess.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/qaccess.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: qaccess.pc,v 2.34 2008-05-19 20:21:56 zacheiss Exp $
+/* $Id$
  *
  * Check access to queries
  *
@@ -21,7 +21,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qaccess.pc,v 2.34 2008-05-19 20:21:56 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami;
 extern int dbms_errno, mr_errcode;
@@ -147,13 +147,13 @@
   int status;
 
   if (!strcmp(argv[1], "IMAP"))
-      {
-	EXEC SQL SELECT owner INTO :id FROM filesys f 
-	  WHERE f.label = :argv[2] AND f.type = 'IMAP' AND
-	  f.lockertype = 'USER';
-	if (cl->users_id != id)
-	  return MR_PERM;
-      }
+    {
+      EXEC SQL SELECT owner INTO :id FROM filesys f 
+	WHERE f.label = :argv[2] AND f.type = 'IMAP' AND
+	f.lockertype = 'USER';
+      if (cl->users_id != id)
+	return MR_PERM;
+    }
 
   /* Non-query owners can't forward mail to a POSTOFFICE or MAILHUB server,
    * nor to a nonresolving domain.
@@ -164,7 +164,7 @@
       if (status)
 	return status;
     }
-
+  
   if (cl->users_id != *(int *)argv[0])
     return MR_PERM;
   else
@@ -295,7 +295,7 @@
   if (find_member(memacl_type, memacl_id, cl))
     return MR_SUCCESS;
 
-  if (flags || q->type == DELETE)
+  if (flags || q->type == MR_Q_DELETE)
     {
       if (!strcmp("USER", argv[1]) && *(int *)argv[2] == cl->users_id)
         return MR_SUCCESS;
@@ -523,7 +523,7 @@
   else
     idx = 2;
   
-  if (q->type == APPEND)
+  if (q->type == MR_Q_APPEND)
     {
       /* Non-query owner must set use to zero */
       if (atoi(argv[6 + idx]) != 0)
@@ -557,7 +557,7 @@
       else
 	return MR_PERM;
     }
-  else /* q-type == UPDATE */
+  else /* q-type == MR_Q_UPDATE */
     {
       EXEC SQL BEGIN DECLARE SECTION;
       int status, acomment, use, ocomment, snid;
@@ -650,22 +650,22 @@
   EXEC SQL END DECLARE SECTION;
   int status;
 
-  if (q->type == RETRIEVE)
+  if (q->type == MR_Q_RETRIEVE)
     return MR_SUCCESS;
 
   id = *(int *)argv[1];
 
-  if (q->type == APPEND && isdigit(argv[0][0]))
+  if (q->type == MR_Q_APPEND && isdigit(argv[0][0]))
     return MR_BAD_CHAR;
 
   EXEC SQL SELECT count(name) INTO :cnt from hostalias WHERE mach_id = :id;
   if (dbms_errno)
     return mr_errcode;
-  /* if the type is APPEND, this is ahal and we need to make sure there
+  /* if the type is MR_Q_APPEND, this is ahal and we need to make sure there
    * will be no more than 2 aliases.  If it's not, it must be dhal and
    * any owner will do.
    */
-  if (q->type == APPEND && cnt >= 2)
+  if (q->type == MR_Q_APPEND && cnt >= 2)
     return MR_PERM;
   EXEC SQL SELECT m.owner_type, m.owner_id, s.owner_type, s.owner_id
     INTO :mtype, :mid, :stype, :sid FROM machine m, subnet s
@@ -686,7 +686,7 @@
 
 int access_snt(struct query *q, char *argv[], client *cl)
 {
-  if (q->type == RETRIEVE)
+  if (q->type == MR_Q_RETRIEVE)
     return MR_SUCCESS;
 
   return MR_PERM;
@@ -803,7 +803,7 @@
 
   /* if the container is public or the query is delete, grant access if client
    * is on owner list */
-  if (flag || q->type == DELETE)
+  if (flag || q->type == MR_Q_DELETE)
     {
 	  EXEC SQL SELECT owner_type, owner_id INTO :machine_owner_type,
 	    :machine_owner_id

Modified: trunk/third/moira/server/qfollow.pc
===================================================================
--- trunk/third/moira/server/qfollow.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/qfollow.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: qfollow.pc,v 2.28 2007-11-29 18:09:10 zacheiss Exp $
+/* $Id$
  *
  * Query followup routines
  *
@@ -20,7 +20,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qfollow.pc,v 2.28 2007-11-29 18:09:10 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami, *table_name[];
 extern int dbms_errno, mr_errcode;
@@ -394,7 +394,7 @@
   char *ptype, *p;
   int mid, sid, status, i;
   EXEC SQL BEGIN DECLARE SECTION;
-  int users_id, pid, iid, bid;
+  int users_id, pid, iid, bid, eid;
   char mach[MACHINE_NAME_SIZE], fs[FILESYS_LABEL_SIZE];
   char str[STRINGS_STRING_SIZE];
   EXEC SQL END DECLARE SECTION;
@@ -406,7 +406,7 @@
       ptype = argv[1];
       users_id = atoi(argv[2]);
 
-      EXEC SQL SELECT pop_id, imap_id, box_id INTO :pid, :iid, :bid
+      EXEC SQL SELECT pop_id, imap_id, box_id, exchange_id INTO :pid, :iid, :bid, :eid
 	FROM users WHERE users_id = :users_id;
       if (sqlca.sqlcode)
 	return MR_USER;
@@ -421,7 +421,7 @@
 
 	  /* If SMTP, don't bother fetching IMAP and POP boxes. */
 	  if (ptype[1] == 'M')
-	    pid = iid = 0;
+	    pid = iid = eid = 0;
 	}
       if (iid)
 	{
@@ -440,12 +440,20 @@
 	  if (sqlca.sqlcode)
 	    return MR_MACHINE;
 	}
+      if (eid)
+	{
+	  /* EXCHANGE, or SPLIT with EXCHANGE */
+	  EXEC SQL SELECT m.name INTO :mach FROM machine m, users u
+	    WHERE u.users_id = :users_id AND u.exchange_id = m.mach_id;
+	  if (sqlca.sqlcode)
+	    return MR_MACHINE;
+	}
 
       free(argv[2]);
       free(argv[3]);
 
       /* Now assemble the right answer. */
-      if (!strcmp(ptype, "POP"))
+      if (!strcmp(ptype, "POP") || !strcmp(ptype, "EXCHANGE"))
 	{
 	  argv[2] = xstrdup(strtrim(mach));
 	  argv[3] = xmalloc(strlen(argv[0]) + strlen(argv[2]) + 2);
@@ -808,7 +816,7 @@
    * conflicts between what is possible in the query table and what
    * is possible in SQL.
    */
-  if (q->type == APPEND)
+  if (q->type == MR_Q_APPEND)
     {
       incremental_clear_before();
       EXEC SQL INSERT INTO quota
@@ -827,7 +835,7 @@
 
   if (dbms_errno)
     return mr_errcode;
-  if (q->type == APPEND)
+  if (q->type == MR_Q_APPEND)
     {
       EXEC SQL UPDATE tblstats SET appends = appends + 1, modtime = SYSDATE
 	WHERE table_name = :tname;

Modified: trunk/third/moira/server/qrtn.h
===================================================================
--- trunk/third/moira/server/qrtn.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/qrtn.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qrtn.h,v 1.6 2000-01-28 00:03:36 danw Exp $
+/* $Header$
  *
  *  Used by the SQL query routines of the Moira server.
  */

Modified: trunk/third/moira/server/qrtn.pc
===================================================================
--- trunk/third/moira/server/qrtn.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/qrtn.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: qrtn.pc,v 2.28 2003-05-16 15:28:06 zacheiss Exp $
+/* $Id$
  *
  * Query-processing routines
  *
@@ -20,7 +20,7 @@
 EXEC SQL INCLUDE sqlca;  /* SQL Communications Area */
 EXEC SQL INCLUDE sqlda;  /* SQL Descriptor Area */
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qrtn.pc,v 2.28 2003-05-16 15:28:06 zacheiss Exp $");
+RCSID("$Header$");
 
 SQLDA *mr_sqlda;
 EXEC SQL BEGIN DECLARE SECTION;
@@ -193,7 +193,7 @@
 
   switch (q->type)
     {
-    case RETRIEVE:
+    case MR_Q_RETRIEVE:
       /* for queries that do not permit wildcarding, check if row
 	 uniquely exists */
       if (v && v->field)
@@ -245,7 +245,7 @@
 
       break;
 
-    case UPDATE:
+    case MR_Q_UPDATE:
       /* see if row already exists */
       if (v->field)
 	{
@@ -279,7 +279,7 @@
 
       break;
 
-    case APPEND:
+    case MR_Q_APPEND:
       /* see if row already exists */
       if (v->field)
 	{
@@ -322,7 +322,7 @@
 	status = (*v->post_rtn)(q, Argv, cl);
       break;
 
-    case DELETE:
+    case MR_Q_DELETE:
       /* see if row already exists */
       if (v->field)
 	{
@@ -352,7 +352,7 @@
 	status = (*v->post_rtn)(q, Argv, cl);
       break;
 
-    case SPECIAL:
+    case MR_Q_SPECIAL:
       break;
     }
 
@@ -366,7 +366,7 @@
       status = mr_errcode;
     }
 
-  if (q->type == RETRIEVE)
+  if (q->type == MR_Q_RETRIEVE)
     EXEC SQL COMMIT WORK;
   else
     {
@@ -545,7 +545,7 @@
 
   /* check argument count */
   argreq = q->argc;
-  if (q->type == UPDATE || q->type == APPEND)
+  if (q->type == MR_Q_UPDATE || q->type == MR_Q_APPEND)
     argreq += q->vcnt;
   if (argc != argreq)
     return MR_ARGS;
@@ -757,7 +757,7 @@
  **	    table - name of table objects are found in
  **	    limit - should the ID be range limited
  **
- ** - called before an APPEND operation to set the next object id to
+ ** - called before an MR_Q_APPEND operation to set the next object id to
  **   be used for the new record to the next free value
  **
  **/

Modified: trunk/third/moira/server/qsetup.pc
===================================================================
--- trunk/third/moira/server/qsetup.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/qsetup.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: qsetup.pc,v 2.58 2005-05-30 19:15:04 zacheiss Exp $
+/* $Id$
  *
  * Query setup routines
  *
@@ -21,7 +21,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qsetup.pc,v 2.58 2005-05-30 19:15:04 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami;
 extern int dbms_errno, mr_errcode;
@@ -119,7 +119,7 @@
   if ((mr_errcode = prefetch_value(q, argv, cl)) != MR_SUCCESS)
     return mr_errcode;
 
-  /* If this is an UPDATE query, we're done. */
+  /* If this is an MR_Q_UPDATE query, we're done. */
   if (row == 2)
     return MR_SUCCESS;
 
@@ -221,6 +221,10 @@
     WHERE potype = 'POP' AND pop_id = :id;
   if (cnt > 0)
     return MR_IN_USE;
+  EXEC SQL SELECT COUNT(login) INTO :cnt FROM users
+    WHERE potype = 'EXCHANGE' and exchange_id = :id;
+  if (cnt > 0)
+    return MR_IN_USE;
   EXEC SQL SELECT COUNT(mach_id) INTO :cnt FROM serverhosts
     WHERE mach_id = :id;
   if (cnt > 0)
@@ -279,7 +283,7 @@
   char *account_number;
 
   /* Check for asnt or usnt. */
-  if (q->type == APPEND)
+  if (q->type == MR_Q_APPEND)
     row = 0;
   else
     row = 1;
@@ -997,7 +1001,7 @@
  * from within a setup_...() routine with the appropriate arguments.
  *
  * Correct functioning of this routine may depend on the assumption
- * that this query is an APPEND.
+ * that this query is an MR_Q_APPEND.
  */
 
 int prefetch_value(struct query *q, char **argv, client *cl)
@@ -1023,7 +1027,7 @@
   if (sqlca.sqlerrd[2] != 1)
     return MR_INTERNAL;
 
-  argc = q->argc + q->vcnt;   /* end of Argv for APPENDs */
+  argc = q->argc + q->vcnt;   /* end of Argv for MR_Q_APPENDs */
   sprintf(argv[argc], "%d", value);
 
   return MR_SUCCESS;
@@ -1336,7 +1340,7 @@
   EXEC SQL END DECLARE SECTION;
 
   /* Check for aprn or uprn. */
-  if (q->type == APPEND)
+  if (q->type == MR_Q_APPEND)
     row = 0;
   else
     row = 1;
@@ -1349,7 +1353,7 @@
     return MR_BAD_CHAR;
   else
     {
-      if (q->type == APPEND)
+      if (q->type == MR_Q_APPEND)
 	{
 	  EXEC SQL SELECT COUNT(name) INTO :count FROM printers
 	    WHERE name = :name OR duplexname = :name;
@@ -1368,7 +1372,7 @@
 
   if (*duplexname)
     {
-      if (q->type == APPEND)
+      if (q->type == MR_Q_APPEND)
 	{
 	  EXEC SQL SELECT COUNT(name) INTO :count FROM printers
 	    WHERE name = :duplexname OR duplexname = :duplexname;

Modified: trunk/third/moira/server/qsubs.c
===================================================================
--- trunk/third/moira/server/qsubs.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/qsubs.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: qsubs.c,v 1.19 2001-11-26 18:20:28 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
  * For copying and distribution information, please see the file
@@ -11,7 +11,7 @@
 
 #include <stdlib.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qsubs.c,v 1.19 2001-11-26 18:20:28 zacheiss Exp $");
+RCSID("$Header$");
 
 extern struct query Queries[];
 extern int QueryCount;
@@ -101,7 +101,7 @@
   char *argv[32];
 
   argcount = q->argc;
-  if (q->type == UPDATE || q->type == APPEND)
+  if (q->type == MR_Q_UPDATE || q->type == MR_Q_APPEND)
     argcount += q->vcnt;
 
   switch (argcount)
@@ -136,7 +136,7 @@
       break;
     }
 
-  if (q->type == RETRIEVE)
+  if (q->type == MR_Q_RETRIEVE)
     {
       sprintf(argr, "%s => %s", argv[--argcount], q->fields[q->argc]);
       argv[argcount++] = argr;

Modified: trunk/third/moira/server/qsupport.pc
===================================================================
--- trunk/third/moira/server/qsupport.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/qsupport.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: qsupport.pc,v 2.52 2008-04-25 17:01:32 zacheiss Exp $
+/* $Id$
  *
  * Special query routines
  *
@@ -18,7 +18,7 @@
 
 EXEC SQL INCLUDE sqlca;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qsupport.pc,v 2.52 2008-04-25 17:01:32 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami, *table_name[];
 extern int dbms_errno, mr_errcode;
@@ -41,7 +41,9 @@
  * if type is POP, then box should be a machine, and its ID should be put in
  * pop_id.  If type is IMAP, then box should be a filesys, and its ID should
  * be put in pop_id.  If type is SMTP, then box should be a string and its
- * ID should be put in box_id.  If type is NONE, then box doesn't matter.
+ * ID should be put in box_id.  If type is EXCHANGE, then box should be a
+ * machine, and its ID should be put in exchange_id.  If type is NONE, then 
+ * box doesn't matter.
  */
 
 int set_pobox(struct query *q, char **argv, client *cl)
@@ -51,6 +53,7 @@
   char *box, potype[USERS_POTYPE_SIZE];
   EXEC SQL END DECLARE SECTION;
   int status;
+  char buffer[256];
 
   box = argv[2];
   user = *(int *)argv[0];
@@ -63,6 +66,9 @@
       (!strcmp(strtrim(potype), "SPLIT") && id))
     set_pop_usage(id, -1);
 
+  sprintf(buffer, "u.users_id = %d", user);
+  incremental_before(USERS_TABLE, buffer, 0);
+
   if (!strcmp(argv[1], "POP"))
     {
       status = name_to_id(box, MACHINE_TABLE, &id);
@@ -70,10 +76,20 @@
 	return MR_MACHINE;
       else if (status)
 	return status;
-      EXEC SQL UPDATE users SET potype = 'POP', pop_id = :id, imap_id = 0
-	WHERE users_id = :user;
+      EXEC SQL UPDATE users SET potype = 'POP', pop_id = :id, imap_id = 0,
+	exchange_id = 0 WHERE users_id = :user;
       set_pop_usage(id, 1);
     }
+  else if (!strcmp(argv[1], "EXCHANGE"))
+    {
+      status = name_to_id(box, MACHINE_TABLE, &id);
+      if (status == MR_NO_MATCH)
+	return MR_MACHINE;
+      else if (status)
+	return status;
+      EXEC SQL UPDATE users SET POTYPE = 'EXCHANGE', exchange_id = :id,
+	pop_id = 0, imap_id = 0 WHERE users_id = :user;
+    }
   else if (!strcmp(argv[1], "SMTP") || !strcmp(argv[1], "SPLIT"))
     {
       if (strchr(box, '/') || strchr(box, '|'))
@@ -104,8 +120,8 @@
 	WHERE label = :box AND type = 'IMAP';
       if (sqlca.sqlcode)
 	return MR_FILESYS;
-      EXEC SQL UPDATE users SET potype = 'IMAP', imap_id = :id, pop_id = 0
-	WHERE users_id = :user;
+      EXEC SQL UPDATE users SET potype = 'IMAP', imap_id = :id, pop_id = 0,
+	exchange_id = 0 WHERE users_id = :user;
     }
   else /* argv[1] == "NONE" */
     {
@@ -113,6 +129,8 @@
 	WHERE users_id = :user;
     }
 
+  incremental_after(USERS_TABLE, buffer, 0);
+
   set_pobox_modtime(q, argv, cl);
   EXEC SQL UPDATE tblstats SET updates = updates + 1, modtime = SYSDATE
     WHERE table_name = 'users';
@@ -121,22 +139,27 @@
   return MR_SUCCESS;
 }
 
-/* set_pobox_pop: Revert to existing POP or IMAP pobox.
+/* set_pobox_pop: Revert to existing POP, IMAP, or EXCHANGE pobox.
  * Also take care of keeping track of the post office usage.
  */
 int set_pobox_pop(struct query *q, char **argv, client *cl)
 {
   EXEC SQL BEGIN DECLARE SECTION;
-  int id, pid, iid, mid;
+  int id, pid, iid, mid, eid;
   char type[USERS_POTYPE_SIZE];
   EXEC SQL END DECLARE SECTION;
+  char buffer[256];
 
   id = *(int *)argv[0];
-  EXEC SQL SELECT potype, pop_id, imap_id INTO :type, :pid, :iid
+  EXEC SQL SELECT potype, pop_id, imap_id, exchange_id
+    INTO :type, :pid, :iid, :eid
     FROM users WHERE users_id = :id;
-  if (sqlca.sqlerrd[2] == 0 || (pid == 0 && iid == 0))
+  if (sqlca.sqlerrd[2] == 0 || (pid == 0 && iid == 0 && eid == 0))
     return MR_MACHINE;
 
+  sprintf(buffer, "u.users_id = %d", id);
+  incremental_before(USERS_TABLE, buffer, 0);
+
   if (pid)
     {
       EXEC SQL SELECT mach_id INTO :mid FROM machine
@@ -147,7 +170,7 @@
       if (!strcmp(strtrim(type), "POP"))
 	set_pop_usage(mid, 1);
     }
-  else
+  else if (iid)
     {
       EXEC SQL SELECT filsys_id INTO :mid FROM filesys
 	WHERE filsys_id = :iid;
@@ -155,7 +178,17 @@
 	return MR_MACHINE;
       EXEC SQL UPDATE users SET potype = 'IMAP' WHERE users_id = :id;
     }
+  else if (eid)
+    {
+      EXEC SQL SELECT mach_id INTO :mid FROM machine
+	WHERE mach_id = :eid;
+      if (sqlca.sqlerrd[2] == 0)
+	return MR_MACHINE;
+      EXEC SQL UPDATE users SET potype = 'EXCHANGE' WHERE users_id = :id;
+    }
 
+  incremental_after(USERS_TABLE, buffer, 0);
+
   set_pobox_modtime(q, argv, cl);
   EXEC SQL UPDATE tblstats SET updates = updates + 1, modtime = SYSDATE
     WHERE table_name = 'users';
@@ -1608,7 +1641,7 @@
 /* register_user - change user's login name and allocate a pobox, group,
  * filesystem, and quota for them.  The user's status must start out as 0,
  * and is left as 2.  Arguments are: user's UID, new login name, and
- * pobox type ("POP" = POP, "IMAP" or numeric = IMAP)
+ * pobox type ("POP" = POP, "IMAP" or numeric = IMAP, "EXCHANGE" = EXCHANGE)
  */
 
 int register_user(struct query *q, char **argv, client *cl)
@@ -1621,7 +1654,7 @@
   int ostatus, nstatus, fsidval, popid;
   int npid, tmp;
   int po_exists = 0;
-  static int m_id, def_quota, def_imap_quota, list_id;
+  static int m_id, def_quota, def_imap_quota, list_id, exchange_id;
   EXEC SQL END DECLARE SECTION;
   char buffer[256], *aargv[3];
 
@@ -1632,6 +1665,9 @@
 
       EXEC SQL SELECT mach_id INTO :m_id FROM machine
 	WHERE name = 'ATHENA.MIT.EDU';
+
+      EXEC SQL SELECT mach_id INTO :exchange_id FROM machine
+	WHERE name = 'EXCHANGE.MIT.EDU';
     }
 
   EXEC SQL SELECT value INTO :def_quota FROM numvalues
@@ -1756,6 +1792,13 @@
 	    WHERE users_id = :users_id;
 	  com_err(whoami, 0, "pobox set to POP:%s", strtrim(machname));
 	}	  
+      else if (!strcmp(potype, "EXCHANGE"))
+	{
+	  EXEC SQL UPDATE users SET potype = 'EXCHANGE',
+	    exchange_id = :exchange_id
+	    WHERE users_id = :users_id;
+	  com_err(whoami, 0, "pobox set to EXCHANGE:EXCHANGE.MIT.EDU");
+	}
       else
 	{
       /* Select all IMAP nfsphys entries in order of increasing

Modified: trunk/third/moira/server/queries2.c
===================================================================
--- trunk/third/moira/server/queries2.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/queries2.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: queries2.c,v 2.106 2008-04-23 21:07:58 zacheiss Exp $
+/* $Id$
  *
  * This file defines the query dispatch table
  *
@@ -3958,7 +3958,7 @@
     "get_all_logins",
     "galo",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
@@ -3975,7 +3975,7 @@
     "get_all_logins",
     "galo",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle FROM users u",
@@ -3992,7 +3992,7 @@
     "get_all_active_logins",
     "gaal",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
@@ -4009,7 +4009,7 @@
     "get_all_active_logins",
     "gaal",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle FROM users u",
@@ -4026,7 +4026,7 @@
     "get_user_account_by_login",
     "gual",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
@@ -4043,7 +4043,7 @@
     "get_user_account_by_login",
     "gual",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4060,7 +4060,7 @@
     "get_user_account_by_login",
     "gual",
     11,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4077,7 +4077,7 @@
     "get_user_account_by_login",
     "gual",
     12,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4094,7 +4094,7 @@
     "get_user_account_by_uid",
     "guau",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
@@ -4111,7 +4111,7 @@
     "get_user_account_by_uid",
     "guau",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4128,7 +4128,7 @@
     "get_user_account_by_uid",
     "guau",
     11,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4145,7 +4145,7 @@
     "get_user_account_by_uid",
     "guau",
     12,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4162,7 +4162,7 @@
     "get_user_account_by_name",
     "guan",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
@@ -4179,7 +4179,7 @@
     "get_user_account_by_name",
     "guan",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4196,7 +4196,7 @@
     "get_user_account_by_name",
     "guan",
     11,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4213,7 +4213,7 @@
     "get_user_account_by_name",
     "guan",
     12,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4230,7 +4230,7 @@
     "get_user_account_by_class",
     "guac",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
@@ -4247,7 +4247,7 @@
     "get_user_account_by_class",
     "guac",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4264,7 +4264,7 @@
     "get_user_account_by_class",
     "guac",
     11,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4281,7 +4281,7 @@
     "get_user_account_by_class",
     "guac",
     12,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4298,7 +4298,7 @@
     "get_user_account_by_id",
     "guai",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
@@ -4315,7 +4315,7 @@
     "get_user_account_by_id",
     "guai",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4332,7 +4332,7 @@
     "get_user_account_by_id",
     "guai",
     11,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4349,7 +4349,7 @@
     "get_user_account_by_id",
     "guai",
     12,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
@@ -4366,7 +4366,7 @@
     "get_user_account_by_sponsor",
     "guas",
     12,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     0,
     0,
@@ -4383,7 +4383,7 @@
     "get_user_by_login",
     "gubl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
@@ -4400,7 +4400,7 @@
     "get_user_by_login",
     "gubl",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u",
@@ -4417,7 +4417,7 @@
     "get_user_by_uid",
     "gubu",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
@@ -4434,7 +4434,7 @@
     "get_user_by_uid",
     "gubu",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u",
@@ -4451,7 +4451,7 @@
     "get_user_by_name",
     "gubn",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
@@ -4468,7 +4468,7 @@
     "get_user_by_name",
     "gubn",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u",
@@ -4485,7 +4485,7 @@
     "get_user_by_class",
     "gubc",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
@@ -4502,7 +4502,7 @@
     "get_user_by_class",
     "gubc",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS') FROM users u",
@@ -4519,7 +4519,7 @@
     "get_user_by_mitid",
     "gubm",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
@@ -4536,7 +4536,7 @@
     "get_user_by_mitid",
     "gubm",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u",
@@ -4553,7 +4553,7 @@
     "add_user_account",
     "auac",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "u",
     USERS_TABLE,
     /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
@@ -4573,7 +4573,7 @@
     "add_user_account",
     "auac",
     3,
-    APPEND,
+    MR_Q_APPEND,
     "u",
     USERS_TABLE,
     /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
@@ -4593,7 +4593,7 @@
     "add_user_account",
     "auac",
     11,
-    APPEND,
+    MR_Q_APPEND,
     "u",
     USERS_TABLE,
     /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
@@ -4613,7 +4613,7 @@
     "add_user_account",
     "auac",
     12,
-    APPEND,
+    MR_Q_APPEND,
     "u",
     USERS_TABLE,
     /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
@@ -4633,7 +4633,7 @@
     "add_user",
     "ausr",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "u",
     USERS_TABLE,
     "INTO users (login, unix_uid, shell, last, first, middle, status, clearid, type, comments, signature, secure, users_id) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, %s)",
@@ -4650,7 +4650,7 @@
     "add_user",
     "ausr",
     3,
-    APPEND,
+    MR_Q_APPEND,
     "u",
     USERS_TABLE,
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, %s, SYSDATE, %s)",
@@ -4667,7 +4667,7 @@
     "add_user",
     "ausr",
     11,
-    APPEND,
+    MR_Q_APPEND,
     "u",
     USERS_TABLE,
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
@@ -4684,7 +4684,7 @@
     "add_user",
     "ausr",
     12,
-    APPEND,
+    MR_Q_APPEND,
     "u",
     USERS_TABLE,
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, NVL('%s', CHR(0)), %s, SYSDATE, %s)",
@@ -4701,7 +4701,7 @@
     "register_user",
     "rusr",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     0,
     0,
@@ -4718,7 +4718,7 @@
     "update_user_account",
     "uuac",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     /* See comment in auac about signature. */
@@ -4736,7 +4736,7 @@
     "update_user_account",
     "uuac",
     3,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     /* See comment in auac about signature. */
@@ -4754,7 +4754,7 @@
     "update_user_account",
     "uuac",
     11,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     /* See comment in auac about signature. */
@@ -4772,7 +4772,7 @@
     "update_user_account",
     "uuac",
     12,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     /* See comment in auac about signature. */
@@ -4790,7 +4790,7 @@
     "update_user",
     "uusr",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET login = '%s', unix_uid = %s, shell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s'",
@@ -4807,7 +4807,7 @@
     "update_user",
     "uusr",
     3,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s'",
@@ -4824,7 +4824,7 @@
     "update_user",
     "uusr",
     11,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s', winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)) ",
@@ -4841,7 +4841,7 @@
     "update_user",
     "uusr",
     12,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s', winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)), sponsor_type = '%s', sponsor_id = %d, expiration = NVL('%s', CHR(0)) ",
@@ -4858,7 +4858,7 @@
     "update_user_shell",
     "uush",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET shell = '%s'",
@@ -4875,7 +4875,7 @@
     "update_user_windows_shell",
     "uuws",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET winconsoleshell = '%s'",
@@ -4892,7 +4892,7 @@
     "update_user_status",
     "uust",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET status = %s",
@@ -4909,7 +4909,7 @@
     "update_user_security_status",
     "uuss",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET secure = %s",
@@ -4926,7 +4926,7 @@
     "delete_user",
     "dusr",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "u",
     USERS_TABLE,
     NULL,
@@ -4943,7 +4943,7 @@
     "add_user_reservation",
     "aurv",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     USERS_TABLE,
     0,
@@ -4960,7 +4960,7 @@
     "get_user_reservations",
     "gurv",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     USERS_TABLE,
     0,
@@ -4977,7 +4977,7 @@
     "get_user_by_reservation",
     "gubr",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     USERS_TABLE,
     0,
@@ -4994,7 +4994,7 @@
     "delete_user_reservation",
     "durv",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     USERS_TABLE,
     0,
@@ -5011,7 +5011,7 @@
     "get_kerberos_user_map",
     "gkum",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "k",
     KRBMAP_TABLE,
     "u.login, str.string FROM krbmap km, users u, strings str",
@@ -5028,7 +5028,7 @@
     "add_kerberos_user_map",
     "akum",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "k",
     KRBMAP_TABLE,
     "INTO krbmap (users_id, string_id) VALUES (%d, %d)",
@@ -5045,7 +5045,7 @@
     "delete_kerberos_user_map",
     "dkum",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "k",
     KRBMAP_TABLE,
     0,
@@ -5062,7 +5062,7 @@
     "get_finger_by_login",
     "gfbl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, fullname, nickname, home_addr, home_phone, office_addr, office_phone, department, affiliation, TO_CHAR(fmodtime, 'DD-mon-YYYY HH24:MI:SS'), fmodby, fmodwith FROM users",
@@ -5079,7 +5079,7 @@
     "update_finger_by_login",
     "ufbl",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET fullname= NVL('%s', CHR(0)), nickname= NVL('%s', CHR(0)), home_addr= NVL('%s', CHR(0)), home_phone= NVL('%s', CHR(0)), office_addr= NVL('%s', CHR(0)), office_phone= NVL('%s', CHR(0)), department= NVL('%s', CHR(0)), affiliation= NVL('%s', CHR(0))",
@@ -5096,7 +5096,7 @@
     "get_pobox",
     "gpob",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, potype, users_id, CHR(0), TO_CHAR(pmodtime, 'DD-mon-YYYY HH24:MI:SS'), pmodby, pmodwith FROM users",
@@ -5113,7 +5113,7 @@
     "get_all_poboxes",
     "gapo",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, potype, pop_id || ':' || box_id FROM users",
@@ -5130,7 +5130,7 @@
     "get_poboxes_pop",
     "gpop",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, potype, users_id FROM users",
@@ -5147,7 +5147,7 @@
     "get_poboxes_smtp",
     "gpos",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, potype, users_id FROM users",
@@ -5164,7 +5164,7 @@
     "set_pobox",
     "spob",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     USERS_TABLE,
     0,
@@ -5181,7 +5181,7 @@
     "set_pobox_pop",
     "spop",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     USERS_TABLE,
     0,
@@ -5198,7 +5198,7 @@
     "delete_pobox",
     "dpob",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET potype = 'NONE'",
@@ -5215,7 +5215,7 @@
     "get_host",
     "ghst",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
@@ -5232,7 +5232,7 @@
     "get_host",
     "ghst",
     6,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
@@ -5249,7 +5249,7 @@
     "get_host",
     "ghst",
     8,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
@@ -5266,7 +5266,7 @@
     "get_host_by_hwaddr",
     "ghbh",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
@@ -5283,7 +5283,7 @@
     "get_host_by_hwaddr",
     "ghbh",
     6,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
@@ -5300,7 +5300,7 @@
     "get_host_by_hwaddr",
     "ghbh",
     8,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
@@ -5317,7 +5317,7 @@
     "get_host_by_account_number",
     "ghba",
     8,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",    
@@ -5334,7 +5334,7 @@
     "get_host_hwaddr",
     "ghha",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.hwaddr FROM machine m",
@@ -5351,7 +5351,7 @@
     "add_host",
     "ahst",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "m",
     MACHINE_TABLE,
     "INTO machine (name, vendor, model, os, location, contact, use, status, statuschange, snet_id, address, owner_type, owner_id, acomment, ocomment, created, inuse, mach_id, creator) VALUES (UPPER('%s'), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL('%s', CHR(0)), %s, %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, SYSDATE, %s, %s)",
@@ -5368,7 +5368,7 @@
     "add_host",
     "ahst",
     6,
-    APPEND,
+    MR_Q_APPEND,
     "m",
     MACHINE_TABLE,
     "INTO machine (name, vendor, model, os, location, contact, billing_contact, use, status, statuschange, snet_id, address, owner_type, owner_id, acomment, ocomment, created, inuse, mach_id, creator) VALUES (UPPER('%s'), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, SYSDATE, %s, %s)",
@@ -5385,7 +5385,7 @@
     "add_host",
     "ahst",
     8,
-    APPEND,
+    MR_Q_APPEND,
     "m",
     MACHINE_TABLE,
     "INTO machine (name, vendor, model, os, location, contact, billing_contact, account_number, use, status, statuschange, snet_id, address, owner_type, owner_id, acomment, ocomment, created, inuse, mach_id, creator) VALUES (UPPER('%s'), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, SYSDATE, %s, %s)",
@@ -5402,7 +5402,7 @@
     "update_host",
     "uhst",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "m",
     MACHINE_TABLE,
     "machine SET name = NVL(UPPER('%s'), CHR(0)), vendor = NVL(UPPER('%s'), CHR(0)), model = NVL(UPPER('%s'), CHR(0)), os = NVL(UPPER('%s'), CHR(0)), location = NVL(UPPER('%s'), CHR(0)), contact = NVL('%s', CHR(0)), use = %s, status = %s, snet_id = %d, address = '%s', owner_type = '%s', owner_id = %d, acomment = %d, ocomment = %d",
@@ -5419,7 +5419,7 @@
     "update_host",
     "uhst",
     6,
-    UPDATE,
+    MR_Q_UPDATE,
     "m",
     MACHINE_TABLE,
     "machine SET name = NVL(UPPER('%s'), CHR(0)), vendor = NVL(UPPER('%s'), CHR(0)), model = NVL(UPPER('%s'), CHR(0)), os = NVL(UPPER('%s'), CHR(0)), location = NVL(UPPER('%s'), CHR(0)), contact = NVL('%s', CHR(0)), billing_contact = NVL('%s', CHR(0)), use = %s, status = %s, snet_id = %d, address = '%s', owner_type = '%s', owner_id = %d, acomment = %d, ocomment = %d",
@@ -5436,7 +5436,7 @@
     "update_host",
     "uhst",
     8,
-    UPDATE,
+    MR_Q_UPDATE,
     "m",
     MACHINE_TABLE,
     "machine SET name = NVL(UPPER('%s'), CHR(0)), vendor = NVL(UPPER('%s'), CHR(0)), model = NVL(UPPER('%s'), CHR(0)), os = NVL(UPPER('%s'), CHR(0)), location = NVL(UPPER('%s'), CHR(0)), contact = NVL('%s', CHR(0)), billing_contact = NVL('%s', CHR(0)), account_number = NVL('%s', CHR(0)), use = %s, status = %s, snet_id = %d, address = '%s', owner_type = '%s', owner_id = %d, acomment = %d, ocomment = %d",
@@ -5453,7 +5453,7 @@
     "update_host_hwaddr",
     "uhha",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "m",
     MACHINE_TABLE,
     "machine SET hwaddr = NVL('%s', CHR(0))",
@@ -5470,7 +5470,7 @@
     "delete_host",
     "dhst",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "m",
     MACHINE_TABLE,
     NULL,
@@ -5487,7 +5487,7 @@
     "get_machine",
     "gmac",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "name, vendor, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM machine",
@@ -5504,7 +5504,7 @@
     "get_hostalias",
     "ghal",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "a",
     HOSTALIAS_TABLE,
     "a.name, m.name FROM hostalias a, machine m",
@@ -5521,7 +5521,7 @@
     "add_hostalias",
     "ahal",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "a",
     HOSTALIAS_TABLE,
     "INTO hostalias (name, mach_id) VALUES (UPPER('%s'), %d)",
@@ -5538,7 +5538,7 @@
     "delete_hostalias",
     "dhal",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "a",
     HOSTALIAS_TABLE,
     NULL,
@@ -5555,7 +5555,7 @@
     "get_subnet",
     "gsnt",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "s",
     SUBNET_TABLE,
     "name, description, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
@@ -5572,7 +5572,7 @@
     "get_subnet",
     "gsnt",
     8,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "s",
     SUBNET_TABLE,
     "name, description, status, contact, account_number, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
@@ -5589,7 +5589,7 @@
     "add_subnet",
     "asnt",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "s",
     SUBNET_TABLE,
     "INTO subnet (name, description, saddr, mask, low, high, prefix, owner_type, owner_id, snet_id) VALUES (UPPER('%s'), NVL('%s', CHR(0)), %s, %s, %s, %s, NVL('%s', CHR(0)), '%s', %d, %s)",
@@ -5606,7 +5606,7 @@
     "add_subnet",
     "asnt",
     8,
-    APPEND,
+    MR_Q_APPEND,
     "s",
     SUBNET_TABLE,
     "INTO subnet (name, description, status, contact, account_number, saddr, mask, low, high, prefix, owner_type, owner_id, snet_id) VALUES (UPPER('%s'), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, %s, %s, %s, NVL('%s', CHR(0)), '%s', %d, %s)",
@@ -5623,7 +5623,7 @@
     "update_subnet",
     "usnt",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SUBNET_TABLE,
     "subnet SET name = UPPER('%s'), description = NVL('%s', CHR(0)), saddr = %s, mask = %s, low = %s, high = %s, prefix = NVL('%s', CHR(0)), owner_type = '%s', owner_id = %d",
@@ -5640,7 +5640,7 @@
     "update_subnet",
     "usnt",
     8,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SUBNET_TABLE,
     "subnet SET name = UPPER('%s'), description = NVL('%s', CHR(0)), status = %s, contact = NVL('%s', CHR(0)), account_number = NVL('%s', CHR(0)), saddr = %s, mask = %s, low = %s, high = %s, prefix = NVL('%s', CHR(0)), owner_type = '%s', owner_id = %d",
@@ -5657,7 +5657,7 @@
     "delete_subnet",
     "dsnt",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "s",
     SUBNET_TABLE,
     NULL,
@@ -5674,7 +5674,7 @@
     "get_cluster",
     "gclu",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "c",
     CLUSTERS_TABLE,
     "name, description, location, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM clusters",
@@ -5691,7 +5691,7 @@
     "add_cluster",
     "aclu",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "c",
     CLUSTERS_TABLE,
     "INTO clusters (name, description, location, clu_id) VALUES ('%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s)",
@@ -5708,7 +5708,7 @@
     "update_cluster",
     "uclu",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "c",
     CLUSTERS_TABLE,
     "clusters SET name = '%s', description = NVL('%s', CHR(0)), location = NVL('%s', CHR(0))",
@@ -5725,7 +5725,7 @@
     "delete_cluster",
     "dclu",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "c",
     CLUSTERS_TABLE,
     NULL,
@@ -5742,7 +5742,7 @@
     "get_machine_to_cluster_map",
     "gmcm",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "mcm",
     MCMAP_TABLE,
     "m.name, c.name FROM machine m, clusters c, mcmap mcm",
@@ -5759,7 +5759,7 @@
     "add_machine_to_cluster",
     "amtc",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "mcm",
     MCMAP_TABLE,
     "INTO mcmap (mach_id, clu_id) VALUES (%d, %d)",
@@ -5776,7 +5776,7 @@
     "delete_machine_from_cluster",
     "dmfc",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "mcm",
     MCMAP_TABLE,
     0,
@@ -5793,7 +5793,7 @@
     "get_cluster_data",
     "gcld",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "svc",
     SVC_TABLE,
     "c.name, svc.serv_label, svc.serv_cluster FROM svc svc, clusters c",
@@ -5810,7 +5810,7 @@
     "add_cluster_data",
     "acld",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "svc",
     SVC_TABLE,
     "INTO svc (clu_id, serv_label, serv_cluster) VALUES (%d, '%s', '%s')",
@@ -5827,7 +5827,7 @@
     "delete_cluster_data",
     "dcld",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "svc",
     SVC_TABLE,
     NULL,
@@ -5844,7 +5844,7 @@
     "get_list_info",
     "glin",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "l",
     LIST_TABLE,
     "name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM list",
@@ -5861,7 +5861,7 @@
     "get_list_info",
     "glin",
     3,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "l",
     LIST_TABLE,
     "name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM list",
@@ -5878,7 +5878,7 @@
     "get_list_info",
     "glin",
     4,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "l",
     LIST_TABLE,
     "name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, memacl_type, memacl_id, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM list",
@@ -5895,7 +5895,7 @@
     "get_list_info",
     "glin",
     10,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "l",
     LIST_TABLE,
     "l.name, l.active, l.publicflg, l.hidden, l.maillist, l.grouplist, l.gid, l.nfsgroup, l.mailman, m.name, l.acl_type, l.acl_id, l.memacl_type, l.memacl_id, l.description, TO_CHAR(l.modtime, 'DD-mon-YYYY HH24:MI:SS'), l.modby, l.modwith FROM list l, machine m",
@@ -5912,7 +5912,7 @@
     "expand_list_names",
     "exln",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "l",
     LIST_TABLE,
     "name FROM list",
@@ -5929,7 +5929,7 @@
     "add_list",
     "alis",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "l",
     LIST_TABLE,
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, '%s', %d, NVL('%s', CHR(0)), %s)",
@@ -5946,7 +5946,7 @@
     "add_list",
     "alis",
     3,
-    APPEND,
+    MR_Q_APPEND,
     "l",
     LIST_TABLE,
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, '%s', %d, NVL('%s', CHR(0)), %s)", 
@@ -5963,7 +5963,7 @@
     "add_list",
     "alis",
     4,
-    APPEND,
+    MR_Q_APPEND,
     "l",
     LIST_TABLE,
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, memacl_type, memacl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, '%s', %d, '%s', %d, NVL('%s', CHR(0)), %s)",
@@ -5980,7 +5980,7 @@
     "add_list",
     "alis",
     10,
-    APPEND,
+    MR_Q_APPEND,
     "l",
     LIST_TABLE,
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, mailman, mailman_id, acl_type, acl_id, memacl_type, memacl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, %s, %d, '%s', %d, '%s', %d, NVL('%s', CHR(0)), %s)",
@@ -5997,7 +5997,7 @@
     "update_list",
     "ulis",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "l",
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, acl_type = '%s', acl_id = %d, description = NVL('%s', CHR(0))",
@@ -6014,7 +6014,7 @@
     "update_list",
     "ulis",
     3,
-    UPDATE,
+    MR_Q_UPDATE,
     "l",
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, acl_type = '%s', acl_id = %d, description = NVL('%s', CHR(0))",
@@ -6031,7 +6031,7 @@
     "update_list",
     "ulis",
     4,
-    UPDATE,
+    MR_Q_UPDATE,
     "l",
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, acl_type = '%s', acl_id = %d, memacl_type = '%s', memacl_id = %d, description = NVL('%s', CHR(0))",
@@ -6048,7 +6048,7 @@
     "update_list",
     "ulis",
     10,
-    UPDATE,
+    MR_Q_UPDATE,
     "l",
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, mailman = %s, mailman_id = %d, acl_type = '%s', acl_id = %d, memacl_type = '%s', memacl_id = %d, description = NVL('%s', CHR(0))",
@@ -6065,7 +6065,7 @@
     "delete_list",
     "dlis",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "l",
     LIST_TABLE,
     NULL,
@@ -6082,7 +6082,7 @@
     "add_member_to_list",
     "amtl",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     IMEMBERS_TABLE,
     0,
@@ -6099,7 +6099,7 @@
     "add_tagged_member_to_list",
     "atml",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     IMEMBERS_TABLE,
     0,
@@ -6116,7 +6116,7 @@
     "tag_member_of_list",
     "tmol",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     IMEMBERS_TABLE,
     0,
@@ -6133,7 +6133,7 @@
     "delete_member_from_list",
     "dmfl",
     2,
-    DELETE,
+    MR_Q_DELETE,
     0,
     IMEMBERS_TABLE,
     NULL,
@@ -6150,7 +6150,7 @@
     "get_ace_use",
     "gaus",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     0,
     0,
@@ -6167,7 +6167,7 @@
     "get_host_by_owner",
     "ghbo",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     0,
     0,
@@ -6184,7 +6184,7 @@
     "qualified_get_lists",
     "qgli",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     LIST_TABLE,
     0,
@@ -6201,7 +6201,7 @@
     "get_members_of_list",
     "gmol",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
     NULL,
@@ -6218,7 +6218,7 @@
     "get_end_members_of_list",
     "geml",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
     NULL,
@@ -6235,7 +6235,7 @@
     "get_tagged_members_of_list",
     "gtml",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
     NULL,
@@ -6252,7 +6252,7 @@
     "get_lists_of_member",
     "glom",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     IMEMBERS_TABLE,
     0,
@@ -6269,7 +6269,7 @@
     "count_members_of_list",
     "cmol",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     IMEMBERS_TABLE,
     0,
@@ -6286,7 +6286,7 @@
     "get_server_info",
     "gsin",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "s",
     SERVERS_TABLE,
     "name, update_int, target_file, script, dfgen, dfcheck, type, enable, inprogress, harderror, errmsg, acl_type, acl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM servers",
@@ -6303,7 +6303,7 @@
     "qualified_get_server",
     "qgsv",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     SERVERS_TABLE,
     0,
@@ -6320,7 +6320,7 @@
     "add_server_info",
     "asin",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "s",
     SERVERS_TABLE,
     "INTO servers (name, update_int, target_file, script, type, enable, acl_type, acl_id) VALUES (UPPER('%s'), %s, '%s', '%s', '%s', %s, '%s', %d)",
@@ -6337,7 +6337,7 @@
     "update_server_info",
     "usin",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SERVERS_TABLE,
     "servers SET update_int = %s, target_file = '%s', script = '%s', type = '%s', enable = %s, acl_type = '%s', acl_id = %d",
@@ -6354,7 +6354,7 @@
     "reset_server_error",
     "rsve",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SERVERS_TABLE,
     "servers SET harderror = 0, dfcheck = dfgen",
@@ -6371,7 +6371,7 @@
     "set_server_internal_flags",
     "ssif",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SERVERS_TABLE,
     "servers SET dfgen = %s, dfcheck = %s, inprogress = %s, harderror = %s, errmsg = NVL('%s', CHR(0))",
@@ -6388,7 +6388,7 @@
     "delete_server_info",
     "dsin",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "s",
     SERVERS_TABLE,
     NULL,
@@ -6405,7 +6405,7 @@
     "get_server_host_info",
     "gshi",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "sh",
     SERVERHOSTS_TABLE,
     "sh.service, m.name, sh.enable, sh.override, sh.success, sh.inprogress, sh.hosterror, sh.hosterrmsg, sh.ltt, sh.lts, sh.value1, sh.value2, sh.value3, TO_CHAR(sh.modtime, 'DD-mon-YYYY HH24:MI:SS'), sh.modby, sh.modwith FROM serverhosts sh, machine m",
@@ -6422,7 +6422,7 @@
     "qualified_get_server_host",
     "qgsh",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     SERVERHOSTS_TABLE,
     0,
@@ -6439,7 +6439,7 @@
     "add_server_host_info",
     "ashi",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "sh",
     SERVERHOSTS_TABLE,
     "INTO serverhosts (service, mach_id, enable, value1, value2, value3) VALUES (UPPER('%s'), %d, %s, %s, %s, NVL('%s', CHR(0)))",
@@ -6456,7 +6456,7 @@
     "update_server_host_info",
     "ushi",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
     "serverhosts SET enable = %s, value1 = %s, value2 = %s, value3 = NVL('%s', CHR(0))",
@@ -6473,7 +6473,7 @@
     "reset_server_host_error",
     "rshe",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
     "serverhosts SET hosterror = 0",
@@ -6490,7 +6490,7 @@
     "set_server_host_override",
     "ssho",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
     "serverhosts SET override = 1",
@@ -6507,7 +6507,7 @@
     "set_server_host_internal",
     "sshi",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SERVERHOSTS_TABLE,
     "serverhosts SET override = %s, success = %s, inprogress = %s, hosterror = %s, hosterrmsg = NVL('%s', CHR(0)), ltt = %s, lts = %s",
@@ -6524,7 +6524,7 @@
     "delete_server_host_info",
     "dshi",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "sh",
     SERVERHOSTS_TABLE,
     NULL,
@@ -6541,7 +6541,7 @@
     "get_server_locations",
     "gslo",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "sh",
     SERVERHOSTS_TABLE,
     "sh.service, m.name FROM serverhosts sh, machine m",
@@ -6558,7 +6558,7 @@
     "get_filesys_by_label",
     "gfsl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "fs",
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l",
@@ -6575,7 +6575,7 @@
     "get_filesys_by_machine",
     "gfsm",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "fs",
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l",
@@ -6592,7 +6592,7 @@
     "get_filesys_by_nfsphys",
     "gfsn",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "fs",
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l, nfsphys np",
@@ -6609,7 +6609,7 @@
     "get_filesys_by_group",
     "gfsg",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "fs",
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l",
@@ -6626,7 +6626,7 @@
     "get_filesys_by_path",
     "gfsp",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "fs",
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l",
@@ -6643,7 +6643,7 @@
     "add_filesys",
     "afil",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "fs",
     FILESYS_TABLE,
     "INTO filesys (label, type, mach_id, name, mount, rwaccess, comments, owner, owners, createflg, lockertype, filsys_id) VALUES ('%s', '%s', %d, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', NVL('%s', CHR(0)), %d, %d, %s, '%s', %s)",
@@ -6660,7 +6660,7 @@
     "update_filesys",
     "ufil",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "fs",
     FILESYS_TABLE,
     "filesys SET label = '%s', type = '%s', mach_id = %d, name = NVL('%s', CHR(0)), mount = NVL('%s', CHR(0)), rwaccess = '%s', comments = NVL('%s', CHR(0)), owner = %d, owners = %d, createflg = %s, lockertype = '%s'",
@@ -6677,7 +6677,7 @@
     "delete_filesys",
     "dfil",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "fs",
     FILESYS_TABLE,
     NULL,
@@ -6694,7 +6694,7 @@
     "get_fsgroup_members",
     "gfgm",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "fg",
     FSGROUP_TABLE,
     "fs.label, fg.key FROM fsgroup fg, filesys fs",
@@ -6711,7 +6711,7 @@
     "add_filesys_to_fsgroup",
     "aftg",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "fg",
     FSGROUP_TABLE,
     "INTO fsgroup (group_id, filsys_id, key) VALUES (%d, %d, '%s')",
@@ -6728,7 +6728,7 @@
     "remove_filesys_from_fsgroup",
     "rffg",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "fg",
     FSGROUP_TABLE,
     NULL,
@@ -6745,7 +6745,7 @@
     "get_all_nfsphys",
     "ganf",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "np",
     NFSPHYS_TABLE,
     "m.name, np.dir, np.device, np.status, np.allocated, np.partsize, TO_CHAR(np.modtime, 'DD-mon-YYYY HH24:MI:SS'), np.modby, np.modwith FROM nfsphys np, machine m",
@@ -6762,7 +6762,7 @@
     "get_nfsphys",
     "gnfp",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "np",
     NFSPHYS_TABLE,
     "m.name, np.dir, np.device, np.status, np.allocated, np.partsize, TO_CHAR(np.modtime, 'DD-mon-YYYY HH24:MI:SS'), np.modby, np.modwith FROM nfsphys np, machine m",
@@ -6779,7 +6779,7 @@
     "add_nfsphys",
     "anfp",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "np",
     NFSPHYS_TABLE,
     "INTO nfsphys (mach_id, dir, device, status, allocated, partsize, nfsphys_id) VALUES (%d, '%s', NVL('%s', CHR(0)), %s, %s, %s, %s)",
@@ -6796,7 +6796,7 @@
     "update_nfsphys",
     "unfp",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "np",
     NFSPHYS_TABLE,
     "nfsphys SET device = NVL('%s', CHR(0)), status = %s, allocated = %s, partsize = %s",
@@ -6813,7 +6813,7 @@
     "adjust_nfsphys_allocation",
     "ajnf",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "np",
     NFSPHYS_TABLE,
     "nfsphys SET allocated = allocated + %s",
@@ -6830,7 +6830,7 @@
     "delete_nfsphys",
     "dnfp",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "np",
     NFSPHYS_TABLE,
     NULL,
@@ -6847,7 +6847,7 @@
     "get_quota",
     "gqot",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "q",
     QUOTA_TABLE,
     "fs.label, q.type, q.entity_id, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, machine m",
@@ -6864,7 +6864,7 @@
     "get_quota_by_filesys",
     "gqbf",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "q",
     QUOTA_TABLE,
     "fs.label, q.type, q.entity_id, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, machine m",
@@ -6881,7 +6881,7 @@
     "add_quota",
     "aqot",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     QUOTA_TABLE,
     "INTO quota (filsys_id, type, entity_id, quota, phys_id) VALUES ('%s', %d, %d, %s, %s)",
@@ -6898,7 +6898,7 @@
     "update_quota",
     "uqot",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     QUOTA_TABLE,
     "quota SET quota = %s",
@@ -6915,7 +6915,7 @@
     "delete_quota",
     "dqot",
     2,
-    DELETE,
+    MR_Q_DELETE,
     0,
     QUOTA_TABLE,
     NULL,
@@ -6932,7 +6932,7 @@
     "get_nfs_quota",
     "gnfq",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "q",
     QUOTA_TABLE,
     "fs.label, u.login, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, users u, machine m",
@@ -6949,7 +6949,7 @@
     "get_nfs_quotas_by_partition",
     "gnqp",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "q",
     QUOTA_TABLE,
     "fs.label, u.login, q.quota, np.dir, m.name FROM quota q, filesys fs, users u, nfsphys np, machine m",
@@ -6966,7 +6966,7 @@
     "add_nfs_quota",
     "anfq",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     QUOTA_TABLE,
     "INTO quota (type, filsys_id, entity_id, quota, phys_id ) VALUES ('USER', %d, %d, %s, %s)",
@@ -6983,7 +6983,7 @@
     "update_nfs_quota",
     "unfq",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     QUOTA_TABLE,
     "quota SET quota = %s",
@@ -7000,7 +7000,7 @@
     "delete_nfs_quota",
     "dnfq",
     2,
-    DELETE,
+    MR_Q_DELETE,
     0,
     QUOTA_TABLE,
     NULL,
@@ -7017,7 +7017,7 @@
     "get_zephyr_class",
     "gzcl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "z",
     ZEPHYR_TABLE,
     "class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM zephyr",
@@ -7034,7 +7034,7 @@
     "get_zephyr_class",
     "gzcl",
     5,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "z",
     ZEPHYR_TABLE,
     "class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM zephyr",
@@ -7051,7 +7051,7 @@
     "add_zephyr_class",
     "azcl",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "z",
     ZEPHYR_TABLE,
     "INTO zephyr (class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id) VALUES ('%s', '%s', %d, '%s', %d, '%s', %d, '%s', %d)",
@@ -7068,7 +7068,7 @@
     "add_zephyr_class",
     "azcl",
     5,
-    APPEND,
+    MR_Q_APPEND,
     "z",
     ZEPHYR_TABLE,
     "INTO zephyr (class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, owner_type, owner_id) VALUES ('%s', '%s', %d, '%s', %d, '%s', %d, '%s', %d, '%s', %d)",
@@ -7085,7 +7085,7 @@
     "update_zephyr_class",
     "uzcl",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "z",
     ZEPHYR_TABLE,
     "zephyr SET class = '%s', xmt_type = '%s', xmt_id = %d, sub_type = '%s', sub_id = %d, iws_type = '%s', iws_id = %d, iui_type = '%s', iui_id = %d",
@@ -7102,7 +7102,7 @@
     "update_zephyr_class",
     "uzcl",
     5,
-    UPDATE,
+    MR_Q_UPDATE,
     "z",
     ZEPHYR_TABLE,
     "zephyr SET class = '%s', xmt_type = '%s', xmt_id = %d, sub_type = '%s', sub_id = %d, iws_type = '%s', iws_id = %d, iui_type = '%s', iui_id = %d, owner_type = '%s', owner_id = %d",
@@ -7119,7 +7119,7 @@
     "delete_zephyr_class",
     "dzcl",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "z",
     ZEPHYR_TABLE,
     0,
@@ -7136,7 +7136,7 @@
     "get_server_host_access",
     "gsha",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "ha",
     HOSTACCESS_TABLE,
     "m.name, ha.acl_type, ha.acl_id, TO_CHAR(ha.modtime, 'DD-mon-YYYY HH24:MI:SS'), ha.modby, ha.modwith FROM hostaccess ha, machine m",
@@ -7153,7 +7153,7 @@
     "add_server_host_access",
     "asha",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "ha",
     HOSTACCESS_TABLE,
     "INTO hostaccess (mach_id, acl_type, acl_id) VALUES (%d, '%s', %d)",
@@ -7170,7 +7170,7 @@
     "update_server_host_access",
     "usha",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "ha",
     HOSTACCESS_TABLE,
     "hostaccess SET acl_type = '%s', acl_id = %d",
@@ -7187,7 +7187,7 @@
     "delete_server_host_access",
     "dsha",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "ha",
     HOSTACCESS_TABLE,
     0,
@@ -7204,7 +7204,7 @@
     "get_acl",
     "gacl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "ac",
     ACL_TABLE,
     "m.name, ac.target, ac.kind, l.name FROM acl ac, machine m, list l",
@@ -7221,7 +7221,7 @@
     "add_acl",
     "aacl",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "ac",
     ACL_TABLE,
     "INTO acl (mach_id, target, kind, list_id) VALUES (%d, '%s', '%s', %d)",
@@ -7238,7 +7238,7 @@
     "delete_acl",
     "dacl",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "ac",
     ACL_TABLE,
     0,
@@ -7255,7 +7255,7 @@
     "get_service",
     "gsvc",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "ss",
     SERVICES_TABLE,
     "name, protocol, port, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM services",
@@ -7272,7 +7272,7 @@
     "add_service",
     "asvc",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "ss",
     SERVICES_TABLE,
     "INTO services (name, protocol, port, description) VALUES ('%s', '%s', %s, NVL('%s', CHR(0)))",
@@ -7289,7 +7289,7 @@
     "delete_service",
     "dsvc",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "ss",
     SERVICES_TABLE,
     0,
@@ -7306,7 +7306,7 @@
     "get_printer",
     "gprn",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -7323,7 +7323,7 @@
     "get_printer_by_duplexname",
     "gpbd",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -7340,7 +7340,7 @@
     "get_printer_by_ethernet",
     "gpbe",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -7357,7 +7357,7 @@
     "get_printer_by_hostname",
     "gpbh",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -7374,7 +7374,7 @@
     "get_printer_by_rm",
     "gpbr",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -7391,7 +7391,7 @@
     "get_printer_by_location",
     "gpbl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -7408,7 +7408,7 @@
     "get_printer_by_contact",
     "gpbc",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -7425,7 +7425,7 @@
     "add_printer",
     "aprn",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "pr",
     PRINTERS_TABLE,
     "INTO printers (name, type, hwtype, duplexname, mach_id, loghost, rm, rp, rq, ka, pc, ac, lpc_acl, banner, location, contact) VALUES ('%s', '%s', '%s', NVL('%s', CHR(0)), %d, %d, %d, NVL('%s', CHR(0)), %d, %s, %s, %d, %d, %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)))",
@@ -7442,7 +7442,7 @@
     "update_printer",
     "uprn",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "pr",
     PRINTERS_TABLE,
     "printers SET name = '%s', type = '%s', hwtype = '%s', duplexname = NVL('%s', CHR(0)), mach_id = %d, loghost = %d, rm = %d, rp = NVL('%s', CHR(0)), rq = %d, ka = %d, pc = %d, ac = %d, lpc_acl = %d, banner = %d, location = NVL('%s', CHR(0)), contact = NVL('%s', CHR(0))",
@@ -7459,7 +7459,7 @@
     "delete_printer",
     "dprn",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "pr",
     PRINTERS_TABLE,
     0,
@@ -7476,7 +7476,7 @@
     "get_print_server",
     "gpsv",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "ps",
     PRINTSERVERS_TABLE,
     "m.name, ps.kind, s.string, ps.owner_type, ps.owner_id, l.name, TO_CHAR(ps.modtime, 'DD-mon-YYYY HH24:MI:SS'), ps.modby, ps.modwith FROM printservers ps, machine m, strings s, list l",
@@ -7493,7 +7493,7 @@
     "add_print_server",
     "apsv",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "ps",
     PRINTSERVERS_TABLE,
     "INTO printservers (mach_id, kind, printer_types, owner_type, owner_id, lpc_acl) VALUES (%d, '%s', %d, '%s', %d, %d)",
@@ -7510,7 +7510,7 @@
     "update_print_server",
     "upsv",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "ps",
     PRINTSERVERS_TABLE,
     "printservers SET kind = '%s', printer_types = %d, owner_type = '%s', owner_id = %d, lpc_acl = %d",
@@ -7527,7 +7527,7 @@
     "delete_print_server",
     "dpsv",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "ps",
     PRINTSERVERS_TABLE,
     0,
@@ -7544,7 +7544,7 @@
     "get_alias",
     "gali",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "a",
     ALIAS_TABLE,
     "name, type, trans FROM alias",
@@ -7561,7 +7561,7 @@
     "add_alias",
     "aali",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "a",
     ALIAS_TABLE,
     "INTO alias (name, type, trans) VALUES ('%s', '%s', '%s')",
@@ -7578,7 +7578,7 @@
     "delete_alias",
     "dali",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "a",
     ALIAS_TABLE,
     NULL,
@@ -7595,7 +7595,7 @@
     "get_value",
     "gval",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "val",
     NUMVALUES_TABLE,
     "value FROM numvalues",
@@ -7612,7 +7612,7 @@
     "add_value",
     "aval",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "val",
     NUMVALUES_TABLE,
     "INTO numvalues (name, value) VALUES ('%s', %s)",
@@ -7629,7 +7629,7 @@
     "update_value",
     "uval",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "val",
     NUMVALUES_TABLE,
     "numvalues SET value = %s",
@@ -7646,7 +7646,7 @@
     "delete_value",
     "dval",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "val",
     NUMVALUES_TABLE,
     NULL,
@@ -7663,7 +7663,7 @@
     "get_all_table_stats",
     "gats",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "tbs",
     TBLSTATS_TABLE,
     "table_name, appends, updates, deletes, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS') FROM tblstats",
@@ -7680,7 +7680,7 @@
     "_set_debug_level",
     "_sdl",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     NULL,
     0,
     NULL,
@@ -7697,7 +7697,7 @@
     "get_container",
     "gcon",
     7,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "c",
     CONTAINERS_TABLE,
     "name, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM containers",
@@ -7714,7 +7714,7 @@
     "get_container",
     "gcon",
     9,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "c",
     CONTAINERS_TABLE,
     "name, publicflg, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM containers",
@@ -7731,7 +7731,7 @@
     "add_container",
     "acon",
     7,
-    APPEND,
+    MR_Q_APPEND,
     "c",
     CONTAINERS_TABLE,
     "INTO containers (name, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, cnt_id) VALUES ('%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, '%s', %d, %s)",
@@ -7748,7 +7748,7 @@
     "add_container",
     "acon",
     9,
-    APPEND,
+    MR_Q_APPEND,
     "c",
     CONTAINERS_TABLE,
     "INTO containers (name, publicflg, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, cnt_id) VALUES ('%s', %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, '%s', %d, %s)",
@@ -7765,7 +7765,7 @@
     "update_container",
     "ucon",
     7,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     CONTAINERS_TABLE,
     0,
@@ -7782,7 +7782,7 @@
     "update_container",
     "ucon",
     9,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     CONTAINERS_TABLE,
     0,
@@ -7799,7 +7799,7 @@
     "delete_container",
     "dcon",
     7,
-    DELETE,
+    MR_Q_DELETE,
     "c",
     CONTAINERS_TABLE,
     NULL,
@@ -7816,7 +7816,7 @@
     "add_machine_to_container",
     "amcn",
     7,
-    APPEND,
+    MR_Q_APPEND,
     "mcn",
     MCNTMAP_TABLE,
     "INTO mcntmap (mach_id, cnt_id) VALUES (%d, %d)",
@@ -7833,7 +7833,7 @@
     "delete_machine_from_container",
     "dmcn",
     7,
-    DELETE,
+    MR_Q_DELETE,
     "mcn",
     MCNTMAP_TABLE,
     0,
@@ -7850,7 +7850,7 @@
     "get_machine_to_container_map",
     "gmnm",
     7,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "mcn",
     MCNTMAP_TABLE,
     "m.name, c.name FROM machine m, containers c, mcntmap mcn",
@@ -7867,7 +7867,7 @@
     "get_machines_of_container",
     "gmoc",
     7,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     NULL,
     MCNTMAP_TABLE,
     NULL,
@@ -7884,7 +7884,7 @@
     "get_subcontainers_of_container",
     "gsoc",
     7,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     NULL,
     CONTAINERS_TABLE,
     NULL,
@@ -7901,7 +7901,7 @@
     "get_toplevel_containers",
     "gtlc",
     7,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "c",
     CONTAINERS_TABLE,
     "name FROM containers",
@@ -7918,7 +7918,7 @@
     "set_container_list",
     "scli",
     9,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     CONTAINERS_TABLE,
     0,
@@ -7935,7 +7935,7 @@
     "get_container_list",
     "gcli",
     9,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "c",
     CONTAINERS_TABLE,
     "c.name, l.name FROM containers c, list l",
@@ -7952,7 +7952,7 @@
     "get_list_container",
     "glic",
     9,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "c",
     CONTAINERS_TABLE,
     "c.name, l.name FROM containers c, list l",

Modified: trunk/third/moira/server/query.h
===================================================================
--- trunk/third/moira/server/query.h	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/query.h	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: query.h,v 2.14 2001-04-01 05:31:25 zacheiss Exp $
+/* $Id$
  *
  * Structures and constants used in the query dispatch table
  *
@@ -8,7 +8,7 @@
  */
 
 /* Query Types */
-enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL};
+enum query_type {MR_Q_RETRIEVE, MR_Q_UPDATE, MR_Q_APPEND, MR_Q_DELETE, MR_Q_SPECIAL};
 
 /* Query Definition Structure */
 struct query

Modified: trunk/third/moira/server/qvalidate.pc
===================================================================
--- trunk/third/moira/server/qvalidate.pc	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/qvalidate.pc	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: qvalidate.pc,v 2.24 2003-03-11 07:07:57 zacheiss Exp $
+/* $Id$
  *
  * Argument validation routines
  *
@@ -20,7 +20,7 @@
 EXEC SQL INCLUDE sqlca;
 EXEC SQL INCLUDE sqlda;
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qvalidate.pc,v 2.24 2003-03-11 07:07:57 zacheiss Exp $");
+RCSID("$Header$");
 
 extern char *whoami, *table_name[], *sqlbuffer[QMAXARGS];
 extern int dbms_errno, mr_errcode;
@@ -204,7 +204,7 @@
       return MR_EXISTS;
     }
   else if (status == MR_NO_MATCH && tbl == STRINGS_TABLE &&
-	   (q->type == APPEND || q->type == UPDATE))
+	   (q->type == MR_Q_APPEND || q->type == MR_Q_UPDATE))
     {
       if (strlen(name) >= STRINGS_STRING_SIZE)
 	return MR_ARG_TOO_LONG;
@@ -415,7 +415,7 @@
 	return MR_STRING;
       if (status == MR_NO_MATCH)
 	{
-	  if (q->type != APPEND && q->type != UPDATE)
+	  if (q->type != MR_Q_APPEND && q->type != MR_Q_UPDATE)
 	    return MR_STRING;
 	  if (strlen(name) >= STRINGS_STRING_SIZE)
 	    return MR_ARG_TOO_LONG;

Modified: trunk/third/moira/server/startmoira.c
===================================================================
--- trunk/third/moira/server/startmoira.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/server/startmoira.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: startmoira.c,v 1.19 1998-02-05 22:51:55 danw Exp $
+/* $Id$
  *
  * This program starts the moira server in a "clean" environment.
  * and then waits for it to exit.
@@ -22,7 +22,7 @@
 #include <string.h>
 #include <unistd.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/startmoira.c,v 1.19 1998-02-05 22:51:55 danw Exp $");
+RCSID("$Header$");
 
 #define PROG	"moirad"
 

Modified: trunk/third/moira/update/Makefile.in
===================================================================
--- trunk/third/moira/update/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 2006-08-22 17:36:26 zacheiss Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/update/auth_002.c
===================================================================
--- trunk/third/moira/update/auth_002.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/auth_002.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: auth_002.c,v 1.9 1998-10-21 19:27:29 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -17,7 +17,7 @@
 
 #include <krb.h>
 
-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 $");
+RCSID("$Header$");
 
 static char service[] = "rcmd";
 static char master[] = "sms";

Modified: trunk/third/moira/update/auth_003.c
===================================================================
--- trunk/third/moira/update/auth_003.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/auth_003.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: auth_003.c,v 1.2 2006-08-22 17:36:26 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -18,7 +18,7 @@
 #include <krb.h>
 #include <krb5.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/auth_003.c,v 1.2 2006-08-22 17:36:26 zacheiss Exp $");
+RCSID("$Header$");
 
 static char service[] = "host";
 static char master[] = "sms";

Modified: trunk/third/moira/update/checksum.c
===================================================================
--- trunk/third/moira/update/checksum.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/checksum.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: checksum.c,v 1.9 1998-02-15 17:49:26 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -11,7 +11,7 @@
 
 #include <stdio.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/checksum.c,v 1.9 1998-02-15 17:49:26 danw Exp $");
+RCSID("$Header$");
 
 /*
  * checksum_fd(fd)

Modified: trunk/third/moira/update/client.c
===================================================================
--- trunk/third/moira/update/client.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/client.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: client.c,v 1.27 2006-08-22 17:36:26 zacheiss Exp $
+/* $Id$
  *
  * This code handles the actual distribution of data files
  * to servers in the Moira server-update program.
@@ -21,7 +21,7 @@
 #include <krb.h>
 #include <krb5.h>
 
-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 $");
+RCSID("$Header$");
 
 extern des_cblock session;
 extern char *whoami;

Modified: trunk/third/moira/update/config.c
===================================================================
--- trunk/third/moira/update/config.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/config.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: config.c,v 1.7 1998-02-15 17:49:27 danw Exp $
+/* $Id$
  *
  * Routines to handle configuration file for Moira's update_server.
  * These routines must load the file into memory rather than parse
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <unistd.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/config.c,v 1.7 1998-02-15 17:49:27 danw Exp $");
+RCSID("$Header$");
 
 #define CONFIG_FILE	"/etc/athena/moira.conf"
 

Modified: trunk/third/moira/update/exec_002.c
===================================================================
--- trunk/third/moira/update/exec_002.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/exec_002.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: exec_002.c,v 1.20 1998-02-15 17:49:27 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -17,7 +17,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/exec_002.c,v 1.20 1998-02-15 17:49:27 danw Exp $");
+RCSID("$Header$");
 
 void exec_002(int conn, char *str)
 {

Modified: trunk/third/moira/update/get_file.c
===================================================================
--- trunk/third/moira/update/get_file.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/get_file.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: get_file.c,v 1.20 2007-07-11 16:06:31 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -19,7 +19,7 @@
 
 #include <des.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/get_file.c,v 1.20 2007-07-11 16:06:31 zacheiss Exp $");
+RCSID("$Header$");
 
 #ifndef MIN
 #define MIN(a, b)    (((a) < (b)) ? (a) : (b))

Modified: trunk/third/moira/update/send_file.c
===================================================================
--- trunk/third/moira/update/send_file.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/send_file.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: send_file.c,v 1.16 2001-09-04 19:46:21 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -20,7 +20,7 @@
 #include <des.h>
 #include <update.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/send_file.c,v 1.16 2001-09-04 19:46:21 zacheiss Exp $");
+RCSID("$Header$");
 
 extern des_cblock session;
 

Modified: trunk/third/moira/update/sendrecv.c
===================================================================
--- trunk/third/moira/update/sendrecv.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/sendrecv.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: sendrecv.c,v 1.5 1999-09-21 17:29:57 danw Exp $
+/* $Id$
  *
  * socket layer for update_server
  *
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/sendrecv.c,v 1.5 1999-09-21 17:29:57 danw Exp $");
+RCSID("$Header$");
 
 #define putlong(cp, l) { ((unsigned char *)cp)[0] = l >> 24; ((unsigned char *)cp)[1] = l >> 16; ((unsigned char *)cp)[2] = l >> 8; ((unsigned char *)cp)[3] = l; }
 #define getlong(cp, l) l = ((((unsigned char *)cp)[0] * 256 + ((unsigned char *)cp)[1]) * 256 + ((unsigned char *)cp)[2]) * 256 + ((unsigned char *)cp)[3]

Modified: trunk/third/moira/update/smskey.c
===================================================================
--- trunk/third/moira/update/smskey.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/smskey.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: smskey.c,v 1.6 1998-02-15 17:49:29 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -15,7 +15,7 @@
 
 #include <des.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/smskey.c,v 1.6 1998-02-15 17:49:29 danw Exp $");
+RCSID("$Header$");
 
 int debug = 0;			/* goddamn des library breakage */
 char string[] = "sms\0\0Athena\0\1";

Modified: trunk/third/moira/update/ticket.c
===================================================================
--- trunk/third/moira/update/ticket.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/ticket.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: ticket.c,v 1.23 2007-07-25 15:39:01 zacheiss Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -17,7 +17,7 @@
 #include <krb5.h>
 #include <update.h>
 
-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 $");
+RCSID("$Header$");
 
 static char realm[REALM_SZ];
 static char master[INST_SZ] = "sms";

Modified: trunk/third/moira/update/update_server.c
===================================================================
--- trunk/third/moira/update/update_server.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/update_server.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: update_server.c,v 1.26 2006-08-22 17:36:26 zacheiss Exp $
+/* $Id$
  *
  * Copyright 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -28,7 +28,7 @@
 #include <des.h>
 #include "update.h"
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/update_server.c,v 1.26 2006-08-22 17:36:26 zacheiss Exp $");
+RCSID("$Header$");
 
 char *whoami, *hostname;
 

Modified: trunk/third/moira/update/update_test.c
===================================================================
--- trunk/third/moira/update/update_test.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/update_test.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: update_test.c,v 1.12 2006-08-22 17:36:26 zacheiss Exp $
+/* $Id$
  *
  * Test client for update_server protocol.
  *

Modified: trunk/third/moira/update/xfer_002.c
===================================================================
--- trunk/third/moira/update/xfer_002.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/xfer_002.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: xfer_002.c,v 1.13 1998-02-15 17:49:31 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -14,7 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/xfer_002.c,v 1.13 1998-02-15 17:49:31 danw Exp $");
+RCSID("$Header$");
 
 /*
  *

Modified: trunk/third/moira/update/xfer_003.c
===================================================================
--- trunk/third/moira/update/xfer_003.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/update/xfer_003.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Id: xfer_003.c,v 1.6 1998-02-15 17:49:31 danw Exp $
+/* $Id$
  *
  * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -14,7 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/update/xfer_003.c,v 1.6 1998-02-15 17:49:31 danw Exp $");
+RCSID("$Header$");
 
 /*
  *

Modified: trunk/third/moira/util/et/Makefile.in
===================================================================
--- trunk/third/moira/util/et/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.2 1998-05-26 18:14:24 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 VPATH=@srcdir@

Modified: trunk/third/moira/util/et/com_err.3
===================================================================
--- trunk/third/moira/util/et/com_err.3	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/com_err.3	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 .\" Copyright (c) 1988 Massachusetts Institute of Technology,
 .\" Student Information Processing Board.  All rights reserved.
 .\"
-.\" $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/util/et/com_err.3,v 1.2 1998-02-05 22:13:00 danw Exp $
+.\" $Header$
 .\"
 .TH COM_ERR 3 "22 Nov 1988" SIPB
 .SH NAME

Modified: trunk/third/moira/util/et/com_err.c
===================================================================
--- trunk/third/moira/util/et/com_err.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/com_err.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -11,7 +11,7 @@
 #include "error_table.h"
 #include "com_err.h"
 
-static const char rcsid[] = "$Id: com_err.c,v 1.2 1998-02-05 22:13:01 danw Exp $";
+static const char rcsid[] = "$Id$";
 
 static void default_com_err_proc(const char *progname, long code,
 				 const char *fmt, va_list args);

Modified: trunk/third/moira/util/et/compile_et.1
===================================================================
--- trunk/third/moira/util/et/compile_et.1	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/compile_et.1	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 .\" Copyright (c) 1988 Massachusetts Institute of Technology,
 .\" Student Information Processing Board.  All rights reserved.
 .\"
-.\" $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/util/et/compile_et.1,v 1.2 1998-02-05 22:13:04 danw Exp $
+.\" $Header$
 .\"
 .TH COMPILE_ET 1 "22 Nov 1988" SIPB
 .SH NAME

Modified: trunk/third/moira/util/et/compile_et.c
===================================================================
--- trunk/third/moira/util/et/compile_et.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/compile_et.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -20,7 +20,7 @@
 static const char copyright[] =
     "Copyright 1987,1988 by MIT Student Information Processing Board";
 
-static const char rcsid[] = "$Id: compile_et.c,v 1.2 1998-02-05 22:13:04 danw Exp $";
+static const char rcsid[] = "$Id$";
 
 enum lang {
     lang_C,			/* ANSI C (default) */

Modified: trunk/third/moira/util/et/error_message.c
===================================================================
--- trunk/third/moira/util/et/error_message.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/error_message.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 /*
- * $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/util/et/error_message.c,v 1.2 1998-02-05 22:13:07 danw Exp $
- * $Source: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/util/et/error_message.c,v $
- * $Locker:  $
+ * $Header$
+ * $Source$
+ * $Locker$
  *
  * Copyright 1987 by the Student Information Processing Board
  * of the Massachusetts Institute of Technology
@@ -14,7 +14,7 @@
 #include "error_table.h"
 #include "mit-sipb-copyright.h"
 
-static const char rcsid[] = "$Id: error_message.c,v 1.2 1998-02-05 22:13:07 danw Exp $";
+static const char rcsid[] = "$Id$";
 static const char copyright[] =
     "Copyright 1986, 1987, 1988 by the Student Information Processing Board\nand the department of Information Systems\nof the Massachusetts Institute of Technology";
 

Modified: trunk/third/moira/util/et/error_table.y
===================================================================
--- trunk/third/moira/util/et/error_table.y	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/error_table.y	2008-09-17 22:23:57 UTC (rev 23178)
@@ -85,7 +85,7 @@
 #include <sys/time.h>
 #include "error_table.h"
 
-static const char rcsid[] = "$Id: error_table.y,v 1.3 1999-04-06 21:35:04 danw Exp $";
+static const char rcsid[] = "$Id$";
 
 #include "et_lex.lex.c"
 

Modified: trunk/third/moira/util/et/et_lex.lex.l
===================================================================
--- trunk/third/moira/util/et/et_lex.lex.l	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/et_lex.lex.l	2008-09-17 22:23:57 UTC (rev 23178)
@@ -28,7 +28,7 @@
 
 .		{ return (*yytext); }
 %%
-static const char l_rcsid[] = "$Id: et_lex.lex.l,v 1.2 1998-02-05 22:13:09 danw Exp $";
+static const char l_rcsid[] = "$Id$";
 
 int yywrap()
 {

Modified: trunk/third/moira/util/et/et_name.c
===================================================================
--- trunk/third/moira/util/et/et_name.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/et_name.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -9,7 +9,7 @@
 
 static const char copyright[] =
     "Copyright 1987,1988 by Student Information Processing Board, Massachusetts Institute of Technology";
-static const char rcsid_et[] = "$Id: et_name.c,v 1.2 1998-02-05 22:13:10 danw Exp $";
+static const char rcsid_et[] = "$Id$";
 
 static const char char_set[] =
 	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";

Modified: trunk/third/moira/util/et/init_et.c
===================================================================
--- trunk/third/moira/util/et/init_et.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/et/init_et.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,7 +1,7 @@
 /*
- * $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/util/et/init_et.c,v 1.2 1998-02-05 22:13:10 danw Exp $
- * $Source: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/util/et/init_et.c,v $
- * $Locker:  $
+ * $Header$
+ * $Source$
+ * $Locker$
  *
  * Copyright 1986, 1987, 1988 by MIT Information Systems and
  *	the MIT Student Information Processing Board.
@@ -15,7 +15,7 @@
 #include "error_table.h"
 #include "mit-sipb-copyright.h"
 
-static const char rcsid[] = "$Id: init_et.c,v 1.2 1998-02-05 22:13:10 danw Exp $";
+static const char rcsid[] = "$Id$";
 
 struct foobar {
     struct et_list etl;

Modified: trunk/third/moira/util/rsaref/Makefile.in
===================================================================
--- trunk/third/moira/util/rsaref/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/util/rsaref/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.2 1999-07-12 16:21:15 danw Exp $
+# $Id$
 
 SHELL=/bin/sh
 

Modified: trunk/third/moira/webmoira/Makefile.in
===================================================================
--- trunk/third/moira/webmoira/Makefile.in	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/webmoira/Makefile.in	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.5 2001-10-21 18:43:58 jis Exp $
+# $Id$
 
 SHELL=/bin/sh
 @SET_MAKE@

Modified: trunk/third/moira/webmoira/moirai.c
===================================================================
--- trunk/third/moira/webmoira/moirai.c	2008-09-12 18:49:24 UTC (rev 23177)
+++ trunk/third/moira/webmoira/moirai.c	2008-09-17 22:23:57 UTC (rev 23178)
@@ -1,4 +1,4 @@
-/* $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/webmoira/moirai.c,v 1.3 2006-08-22 17:36:27 zacheiss Exp $ */
+/* $Header$ */
 #include "mit_moira_MoiraConnectInternal.h"
 #include <moira.h>
 #include <mr_et.h>


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