[25731] in Source-Commits
/svn/athena r25198 - in trunk/third/moira: . clients/chsh clients/eunice clients/moira clients/regapplet/regapplet clients/stella db debian gen incremental/ldap man regtape server
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Thu Jun 30 12:16:19 2011
Date: Thu, 30 Jun 2011 12:16:13 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201106301616.p5UGGDJi023898@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-06-30 12:16:12 -0400 (Thu, 30 Jun 2011)
New Revision: 25198
Added:
trunk/third/moira/clients/chsh/shells.moira
trunk/third/moira/gen/asa-db.gen
trunk/third/moira/gen/print-accounting.gen
Modified:
trunk/third/moira/clients/chsh/Makefile.in
trunk/third/moira/clients/chsh/chsh.c
trunk/third/moira/clients/eunice/eunice.c
trunk/third/moira/clients/moira/cluster.c
trunk/third/moira/clients/moira/f_defs.h
trunk/third/moira/clients/moira/menu.c
trunk/third/moira/clients/moira/menus.c
trunk/third/moira/clients/moira/pobox.c
trunk/third/moira/clients/moira/printer.c
trunk/third/moira/clients/regapplet/regapplet/TextBlock.java
trunk/third/moira/clients/stella/stella.c
trunk/third/moira/db/dbopt.sql
trunk/third/moira/db/schema.sql
trunk/third/moira/debian/changelog
trunk/third/moira/gen/Makefile.in
trunk/third/moira/gen/acl.pc
trunk/third/moira/gen/cups-cluster.pc
trunk/third/moira/gen/cups-cluster.sh
trunk/third/moira/gen/cups-print.pc
trunk/third/moira/gen/cups-print.sh
trunk/third/moira/gen/dhcp.pc
trunk/third/moira/gen/directory.pc
trunk/third/moira/gen/hesiod.pc
trunk/third/moira/gen/nagios-cluster.gen
trunk/third/moira/gen/nagios-wsh.gen
trunk/third/moira/gen/print.pc
trunk/third/moira/gen/sapprint.gen
trunk/third/moira/gen/spwatch.gen
trunk/third/moira/incremental/ldap/winad.c
trunk/third/moira/libtool
trunk/third/moira/man/blanche.1
trunk/third/moira/man/eunice.1
trunk/third/moira/man/moira.1
trunk/third/moira/man/stella.1
trunk/third/moira/regtape/common.h
trunk/third/moira/regtape/staff.pc
trunk/third/moira/regtape/stellar.pl
trunk/third/moira/regtape/student.pc
trunk/third/moira/regtape/student.sql
trunk/third/moira/server/increment.pc
trunk/third/moira/server/mr_server.h
trunk/third/moira/server/qaccess.pc
trunk/third/moira/server/qsetup.pc
trunk/third/moira/server/qsupport.pc
trunk/third/moira/server/queries2.c
Log:
In moira:
* Snapshot moira@r4042 (6/28/11)
* Update version number to include moira revision number
Modified: trunk/third/moira/clients/chsh/Makefile.in
===================================================================
--- trunk/third/moira/clients/chsh/Makefile.in 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/chsh/Makefile.in 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,10 +1,10 @@
-# $Id: Makefile.in 3956 2010-01-05 20:56:56Z zacheiss $
+# $Id: Makefile.in 4009 2010-06-22 05:50:47Z zacheiss $
SHELL=/bin/sh
@SET_MAKE@
CC=@CC@
-CPPFLAGS=@CPPFLAGS@
+CPPFLAGS=@CPPFLAGS@ -DSHELLS_LIST=\"$(sysconfdir)/shells.moira\"
CFLAGS=@CFLAGS@
DEFS=@DEFS@
ALL_CFLAGS=$(CPPFLAGS) $(CFLAGS) $(DEFS)
@@ -23,6 +23,7 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
+sysconfdir=@sysconfdir@
TARGET=chsh
@@ -45,6 +46,7 @@
install: all
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(bindir)
+ $(INSTALL) shells.moira $(DESTDIR)$(sysconfdir)
$(TARGET): $(OBJS) ../lib/libmrclient.la $(MR_LIBDEP)
$(LIBTOOL) --mode=link $(CC) -o $@ $(LDFLAGS) $@.o $(LIBS)
Modified: trunk/third/moira/clients/chsh/chsh.c
===================================================================
--- trunk/third/moira/clients/chsh/chsh.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/chsh/chsh.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: chsh.c 3981 2010-02-16 21:13:05Z zacheiss $
+/* $Id: chsh.c 4009 2010-06-22 05:50:47Z zacheiss $
*
* 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
@@ -27,7 +27,7 @@
#define argis(a, b) (!strcmp(*arg + 1, a) || !strcmp(*arg + 1, b))
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/chsh/chsh.c $ $Id: chsh.c 3981 2010-02-16 21:13:05Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/chsh/chsh.c $ $Id: chsh.c 4009 2010-06-22 05:50:47Z zacheiss $");
void usage(void);
int get_shell(int argc, char **argv, void *username);
@@ -343,7 +343,9 @@
if (!shells)
{
- shells = fopen("/etc/shells", "r");
+ shells = fopen(SHELLS_LIST, "r");
+ if (!shells && errno == ENOENT)
+ shells = fopen("/etc/shells", "r");
if (!shells)
{
fprintf(stderr, "%s: Can't open /etc/shells. Unable to determine if "
Added: trunk/third/moira/clients/chsh/shells.moira
===================================================================
--- trunk/third/moira/clients/chsh/shells.moira (rev 0)
+++ trunk/third/moira/clients/chsh/shells.moira 2011-06-30 16:16:12 UTC (rev 25198)
@@ -0,0 +1,4 @@
+# /etc/shells.moira: valid Athena shells
+/bin/sh
+/bin/athena/bash
+/bin/athena/tcsh
Modified: trunk/third/moira/clients/eunice/eunice.c
===================================================================
--- trunk/third/moira/clients/eunice/eunice.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/eunice/eunice.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: eunice.c 3977 2010-02-12 21:12:04Z zacheiss $
+/* $Id: eunice.c 4030 2011-03-04 21:01:14Z zacheiss $
*
* Command line oriented Moira print queue tool.
*
@@ -21,13 +21,18 @@
#include <stdlib.h>
#include <string.h>
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/eunice/eunice.c $ $Id: eunice.c 3977 2010-02-12 21:12:04Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/eunice/eunice.c $ $Id: eunice.c 4030 2011-03-04 21:01:14Z zacheiss $");
struct member {
int type;
char *name, *tag;
};
+struct string_list {
+ char *string;
+ struct string_list *next;
+};
+
const char *deflogserver = "WSLOGGER.MIT.EDU";
/* legacy variables that we need to set regardless */
@@ -39,28 +44,31 @@
/* flags from command line */
int info_flag, verbose, noauth, duplex_default, hold_default;
-int create_flag, setmac, delete_flag, rename_flag, ka, banner, update_flag;
+int create_flag, delete_flag, rename_flag, ka, banner, update_flag, update_hwaddr_flag;
char *lpracl, *lpcacl, *report_list;
char *contact, *newname, *printserver, *type, *hwtype, *mac, *hostname, *queuename;
char *duplexname, *logserver, *location, *realname, *pr_status;
char *queuename, *whoami, *testqueue;
+struct string_list *hwaddr_add_queue, *hwaddr_remove_queue;
+
void usage(char **argv);
int show_printer_info(char *queuename);
int save_printer_info(int argc, char **argv, void *hint);
-int save_hwaddr(int argc, char **argv, void *hint);
+int show_hwaddrs(int argc, char **argv, void *hint);
void recursive_display_list_members(void);
char *get_username(void);
int wrap_mr_query(char *handle, int argc, char **argv,
int (*callback)(int, char **, void *), void *callarg);
void print_query(char *query_name, int argc, char **argv);
int CountArgs(char **info);
+struct string_list *add_to_string_list(struct string_list *old_list, char *s);
static char *states[] = {
"Reserved (0)",
"Active (1)",
- "None (2)",
+ "Active, No IP ACL (2)",
"Deleted (3)"
};
@@ -89,13 +97,13 @@
/* clear all flags & lists */
i = info_flag = verbose = noauth = 0;
- setmac = create_flag = delete_flag = update_flag = 0;
+ create_flag = delete_flag = update_flag = update_hwaddr_flag = 0;
ka = duplex_default = hold_default = banner = -1;
location = lpracl = lpcacl = report_list = pr_status = NULL;
logserver = duplexname = realname = newname = printserver = type = hwtype = mac = hostname = NULL;
+ hwaddr_add_queue = hwaddr_remove_queue = NULL;
+ contact = NULL;
-
- contact = NULL;
whoami = argv[0];
success = 1;
@@ -285,17 +293,28 @@
else
usage(argv);
}
- else if (argis("m", "mac"))
+ else if (argis("ahw", "addhwaddr"))
{
if (arg - argv < argc - 1)
{
++arg;
- setmac++;
- mac = *arg;
+ hwaddr_add_queue=add_to_string_list(hwaddr_add_queue, *arg);
}
else
usage(argv);
+ update_hwaddr_flag++;
}
+ else if (argis("dhw", "delhwaddr"))
+ {
+ if (arg - argv < argc - 1)
+ {
+ ++arg;
+ hwaddr_remove_queue=add_to_string_list(hwaddr_remove_queue, *arg);
+ }
+ else
+ usage(argv);
+ update_hwaddr_flag++;
+ }
else if (argis("b", "banner"))
{
update_flag++;
@@ -352,7 +371,7 @@
usage(argv);
- if (!update_flag && !rename_flag && !delete_flag && !create_flag && !setmac)
+ if (!update_flag && !rename_flag && !delete_flag && !create_flag && !update_hwaddr_flag)
info_flag++;
/* fire up Moira */
@@ -582,25 +601,68 @@
if (info_flag)
show_printer_info(queuename);
- if (setmac)
- {
- status = wrap_mr_query("get_printer", 1, &queuename, save_printer_info, pargv);
+ /* add hwaddrs if necessary */
+ if (hwaddr_add_queue) {
+ struct string_list *q = hwaddr_add_queue;
+
+ status = wrap_mr_query("get_printer", 1, &queuename, save_printer_info, pargv);
+ if (status)
+ {
+ com_err(whoami, status, "while getting printer information");
+ exit(1);
+ }
+
+ if (hostname == NULL)
+ uargv[0] = pargv[PRN_HOSTNAME + 1];
+ else
+ uargv[0] = hostname;
+
+ while(q) {
+
+ uargv[1] = q->string;
+
+ status = wrap_mr_query("add_host_hwaddr", 2, uargv, NULL, NULL);
if (status)
{
- com_err(whoami, status, "while getting printer information");
+ com_err(whoami, status, "while adding host hardware address");
exit(1);
}
- if (hostname == NULL)
- uargv[0] = (char *) strdup (pargv[PRN_HOSTNAME + 1]);
- else
- uargv[0] = (char *) strdup (hostname);
- uargv[1] = (char *) strdup (mac);
- if ((status = wrap_mr_query("update_host_hwaddr", 2, uargv, NULL, NULL)))
- com_err(whoami, status, "updating ethernet address.");
+ q = q->next;
}
+ }
+ /* delete hwaddrs if necessary */
+ if (hwaddr_remove_queue) {
+ struct string_list *q = hwaddr_remove_queue;
+ status = wrap_mr_query("get_printer", 1, &queuename, save_printer_info, pargv);
+ if (status)
+ {
+ com_err(whoami, status, "while getting printer information");
+ exit(1);
+ }
+
+ if (hostname == NULL)
+ uargv[0] = pargv[PRN_HOSTNAME + 1];
+ else
+ uargv[0] = hostname;
+
+ while(q) {
+
+ uargv[1] = q->string;
+
+ status = wrap_mr_query("delete_host_hwaddr", 2, uargv, NULL, NULL);
+ if (status)
+ {
+ com_err(whoami, status, "while deleting host hardware address");
+ exit(1);
+ }
+
+ q = q->next;
+ }
+ }
+
if (delete_flag)
{
status = wrap_mr_query("delete_printer", 1, &queuename,
@@ -624,48 +686,59 @@
#define USAGE_OPTIONS_FORMAT " %-39s%s\n"
fprintf(stderr, "Usage: %s queue [options]\n", argv[0]);
fprintf(stderr, "Options are\n");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-v | -verbose",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-v | -verbose",
"-C | -create");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-D | -delete",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-D | -delete",
"-R | -rename newname");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-i | -info",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-i | -info",
"-L | -location location");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-H | -hostname host",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-H | -hostname host",
"-c | -contact contact");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-r | -remotename name",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-r | -remotename name",
"-T | -type printer_type");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-M | -model model",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-M | -model model",
"-s | -printserver print_server");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-K | -kerbauth",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-K | -kerbauth",
"-b | -banner");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-NK | -nokerbauth",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-NK | -nokerbauth",
"-nb | -nobanner");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-DD | -duplexdefault",
- "-HD | -holddefault");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-ND | -noduplexdefault",
- "-NH | -noholddefault");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-S | -status status",
- "-rl | -reportlist list");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-l | -lpcacl list",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-DD | -duplexdefault",
+ "-HD | -holddefault");
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-ND | -noduplexdefault",
+ "-NH | -noholddefault");
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-S | -status status",
+ "-rl | -reportlist list");
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-l | -lpcacl list",
"-ac | -lpracl list");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-d | -duplex name",
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-d | -duplex name",
"-n | -noauth");
- fprintf(stderr, USAGE_OPTIONS_FORMAT, "-m | -mac hwaddr",
- "-db | -database host[:port]");
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-ahw | -addhwaddr hwaddr",
+ "-dhw | -delhwaddr hwaddr");
+ fprintf(stderr, " %-39s\n" , "-db | -database host[:port]");
exit(1);
}
+static int show_has_hwaddrs;
+
+int show_hwaddrs(int argc, char **argv, void *hint)
+{
+ if(!show_has_hwaddrs++)
+ printf("Hardware Addresses: %s", argv[1]);
+ else
+ printf(", %s", argv[1]);
+
+ return MR_CONT;
+}
+
int show_printer_info(char *queuename)
{
- char hwaddr[20];
char *pargv[PRN_END + 1];
int status, banner, i;
+ struct mqelem *elem = NULL;
for (i = 0; i < PRN_END + 1; i++)
pargv[i] = NULL;
- memset (hwaddr,'\0',sizeof(hwaddr));
-
status = wrap_mr_query("get_printer", 1, &queuename, save_printer_info, pargv);
if (status)
{
@@ -673,23 +746,30 @@
exit (1);
}
- status = wrap_mr_query("get_host_hwaddr", 1, &pargv[PRN_HOSTNAME + 1],
- save_hwaddr, &hwaddr);
-
- if (status)
- sprintf (hwaddr,"none");
-
banner = atoi(pargv[PRN_BANNER + 1]);
- printf("Printer: %-18s Duplex queue: %-18s\n", pargv[PRN_NAME + 1],
- *pargv[PRN_DUPLEXNAME + 1] ? pargv[PRN_DUPLEXNAME + 1] : "[none]");
- printf("Status: %-10s\n", PrnState(atoi(pargv[PRN_STATUS + 1])));
+ printf("Printer: %-18s Duplex queue: %-17s Status: %-10s\n", pargv[PRN_NAME + 1],
+ *pargv[PRN_DUPLEXNAME + 1] ? pargv[PRN_DUPLEXNAME + 1] : "[none]",
+ PrnState(atoi(pargv[PRN_STATUS + 1])));
printf("Duplex by Default: %-8s Hold by Default: %-18s\n",
atoi(pargv[PRN_DUPLEXDEFAULT + 1]) ? "yes" : "no",
atoi(pargv[PRN_HOLDDEFAULT + 1]) ? "yes" : "no");
- printf("Type: %-10s Hardware type: %-10s Hardware address: %s\n",
- pargv[PRN_TYPE + 1], pargv[PRN_HWTYPE + 1], hwaddr);
+ printf("Type: %-10s Hardware type: %-10s\n",
+ pargv[PRN_TYPE + 1], pargv[PRN_HWTYPE + 1]);
printf("Printer hostname: %s\n", pargv[PRN_HOSTNAME + 1]);
+
+ show_has_hwaddrs = 0;
+ status = wrap_mr_query("get_host_hwaddr_mapping", 1, &pargv[PRN_HOSTNAME + 1], show_hwaddrs, &elem);
+ if (status)
+ {
+ if (status != MR_NO_MATCH)
+ com_err(whoami, status, "while getting hardware addresses");
+ else
+ printf("Hardware Addresses: none\n");
+ }
+ else
+ printf("\n");
+
printf("Printer log host: %s\n", pargv[PRN_LOGHOST + 1]);
printf("Spool host: %s\n", pargv[PRN_RM + 1]);
printf("Remote Printer Name: %-10s Banner page: %s\n", pargv[PRN_RP + 1],
@@ -719,13 +799,6 @@
return MR_CONT;
}
-int save_hwaddr(int argc, char **argv, void *hint)
-{
- char *p = hint;
- strcpy(p,argv[0]);
- return MR_CONT;
-}
-
int wrap_mr_query(char *handle, int argc, char **argv,
int (*callback)(int, char **, void *), void *callarg)
{
@@ -785,3 +858,13 @@
return number;
}
+
+struct string_list *add_to_string_list(struct string_list *old_list, char *s) {
+ struct string_list *new_list;
+
+ new_list = (struct string_list *)malloc(sizeof(struct string_list *));
+ new_list->next = old_list;
+ new_list->string = s;
+
+ return new_list;
+}
Modified: trunk/third/moira/clients/moira/cluster.c
===================================================================
--- trunk/third/moira/clients/moira/cluster.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/moira/cluster.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: cluster.c 3968 2010-01-27 23:00:11Z zacheiss $
+/* $Id: cluster.c 4001 2010-04-21 20:38:45Z zacheiss $
*
* This is the file cluster.c for the Moira Client, which allows users
* to quickly and easily maintain most parts of the Moira database.
@@ -40,7 +40,7 @@
#include <stdlib.h>
#include <string.h>
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/cluster.c $ $Id: cluster.c 3968 2010-01-27 23:00:11Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/cluster.c $ $Id: cluster.c 4001 2010-04-21 20:38:45Z zacheiss $");
void PrintAliases(char **info);
static void PrintMachine(char **info);
@@ -217,20 +217,28 @@
/* -------------------- General Functions -------------------- */
-static char aliasbuf[BUFSIZ * 2];
+char *aliases = NULL;
void PrintAliases(char **info)
{
- if (strlen(aliasbuf) == 0)
- sprintf(aliasbuf, "Aliases: %s", info[0]);
+ if (aliases == NULL)
+ {
+ aliases = malloc((strlen("Aliases: ") + strlen(info[0]) + 1));
+ if (!aliases)
+ {
+ com_err(program_name, 0, "Out of memory allocating host aliases");
+ exit(1);
+ }
+ sprintf(aliases, "Aliases: %s", info[0]);
+ }
else
{
- strcat(aliasbuf, ", ");
- strcat(aliasbuf, info[0]);
+ aliases = realloc(aliases, strlen(aliases) + strlen(info[0]) + 3);
+ strcat(aliases, ", ");
+ strcat(aliases, info[0]);
}
}
-
/* Function Name: PrintMachInfo
* Description: This function Prints out the Machine info in
* a coherent form.
@@ -257,10 +265,11 @@
}
else
{
- aliasbuf[0] = 0;
Loop(QueueTop(elem), (void (*)(char **)) PrintAliases);
FreeQueue(elem);
- Put_message(aliasbuf);
+ Put_message(aliases);
+ free(aliases);
+ aliases = NULL;
}
sprintf(tbuf, "%s %s", info[M_OWNER_TYPE],
strcmp(info[M_OWNER_TYPE], "NONE") ? info[M_OWNER_NAME] : "");
@@ -1287,7 +1296,6 @@
return DM_NORMAL;
}
-
/* Function Name: ShowCname
* Description: This function shows machine aliases
* Arguments: argc, argv - the alias argv[1], the real name in argv[2]
@@ -2604,3 +2612,67 @@
FreeQueue(elem);
return DM_NORMAL;
}
+
+void PrintHWAddr(char **info)
+{
+ char buf[BUFSIZ];
+
+ sprintf(buf, "Machine: %-30s Hardware Address: %-20s",
+ info[0], info[1]);
+ Put_message(buf);
+}
+
+/* Function Name: ShowHWAddrs
+ * Description: This function shows machine hardware addresses
+ * Arguments: argc, argv - the hostname in argv[1]
+ * Returns: DM_NORMAL.
+ */
+
+int ShowHWAddrs(int argc, char **argv)
+{
+ char *args[1];
+ int stat;
+ struct mqelem *elem = NULL;
+
+ args[0] = canonicalize_hostname(strdup(argv[1]));
+ if ((stat = do_mr_query("get_host_hwaddr_mapping", 1, args, StoreInfo, &elem)))
+ {
+ com_err(program_name, stat, " in get_host_hwaddr_mapping.");
+ return DM_NORMAL;
+ }
+
+ Put_message("");
+ Loop(QueueTop(elem), (void (*)(char **)) PrintHWAddr);
+ FreeQueue(elem);
+ return DM_NORMAL;
+}
+
+int AddHWAddr(int argc, char **argv)
+{
+ int stat;
+ char *args[2];
+
+ args[0] = canonicalize_hostname(strdup(argv[1]));
+ args[1] = argv[2];
+
+ stat = do_mr_query("add_host_hwaddr", 2, args, NULL, NULL);
+ if (stat != MR_SUCCESS)
+ com_err(program_name, stat, " in add_host_hwaddr");
+
+ return DM_NORMAL;
+}
+
+int DeleteHWAddr(int argc, char **argv)
+{
+ int stat;
+ char *args[2];
+
+ args[0] = canonicalize_hostname(strdup(argv[1]));
+ args[1] = argv[2];
+
+ stat = do_mr_query("delete_host_hwaddr", 2, args, NULL, NULL);
+ if (stat != MR_SUCCESS)
+ com_err(program_name, stat, " in delete_host_hwaddr");
+
+ return DM_NORMAL;
+}
Modified: trunk/third/moira/clients/moira/f_defs.h
===================================================================
--- trunk/third/moira/clients/moira/f_defs.h 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/moira/f_defs.h 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: f_defs.h 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: f_defs.h 4001 2010-04-21 20:38:45Z zacheiss $
*
* 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.
@@ -89,6 +89,10 @@
int GetMachinesOfContainer(int argc, char **argv);
int GetTopLevelCont(int argc, char **argv);
+int ShowHWAddrs(int argc, char **argv);
+int AddHWAddr(int argc, char **argv);
+int DeleteHWAddr(int argc, char **argv);
+
/* delete.c */
int DeleteList(int argc, char **argv);
@@ -178,7 +182,6 @@
int DeletePrn(int argc, char **argv);
int AddPrn(int argc, char **argv);
int ChngPrn(int argc, char **argv);
-int UpdateHWAddr(int argc, char **argv);
int GetPrintSrv(int argc, char **argv);
int AddPrintSrv(int argc, char **argv);
int DelPrintSrv(int argc, char **argv);
Modified: trunk/third/moira/clients/moira/menu.c
===================================================================
--- trunk/third/moira/clients/moira/menu.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/moira/menu.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: menu.c 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: menu.c 4024 2010-11-29 20:20:25Z zacheiss $
*
* Generic menu system module.
*
@@ -34,7 +34,7 @@
#define getpid _getpid
#endif /* _WIN32 */
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/menu.c $ $Id: menu.c 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/menu.c $ $Id: menu.c 4024 2010-11-29 20:20:25Z zacheiss $");
#ifdef MAX
#undef MAX
@@ -802,13 +802,16 @@
int toggle_logging(int argc, char *argv[])
{
char buf[BUFSIZ];
+ mode_t oldmask;
if (!log_file)
{
sprintf(buf, "%s/%s-log.%d", get_tmp_dir(), whoami, getpid());
/* open the file */
+ oldmask = umask(077);
log_file = fopen(buf, "a");
+ umask(oldmask);
if (!log_file)
Put_message("Open of log file failed. Logging is not on.");
Modified: trunk/third/moira/clients/moira/menus.c
===================================================================
--- trunk/third/moira/clients/moira/menus.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/moira/menus.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: menus.c 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: menus.c 4001 2010-04-21 20:38:45Z zacheiss $
*
* 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("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/menus.c $ $Id: menus.c 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/menus.c $ $Id: menus.c 4001 2010-04-21 20:38:45Z zacheiss $");
/* ------------------------- Second Tier Menus ------------------------- */
@@ -502,6 +502,30 @@
}
};
+Menu hwaddr_menu = {
+ NULLFUNC,
+ NULLFUNC,
+ "Hardware Address Menu",
+ 4,
+ {
+ { ShowHWAddrs, NULLMENU, 2, {
+ {"show", "Get Host hardware address information"},
+ {"name", "Machine's Name: "},
+ } },
+ { AddHWAddr, NULLMENU, 3, {
+ {"add", "Add Host hardware address"},
+ {"name", "Machine's Name: "},
+ {"hwaddr", "Hardware Address: "},
+ } },
+ { DeleteHWAddr, NULLMENU, 3, {
+ {"delete", "Delete Host hardware address"},
+ {"name", "Machine's Name: "},
+ {"hwaddr", "Hardware Address: "},
+ } },
+ SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
+ }
+};
+
/*
* Machine Menu
*/
@@ -510,7 +534,7 @@
NULLFUNC,
NULLFUNC,
"Machine Menu",
- 9,
+ 10,
{
{ ShowMachineInfo, NULLMENU, 2, {
{"show", "Get machine information"},
@@ -540,6 +564,7 @@
} },
SUBMENU("cnames", "Alias names for machines", &cname_menu),
SUBMENU("mappings", "Machine To Cluster Mappings Menu", &mappings_menu),
+ SUBMENU("hwaddrs", "Hardware Addresses for machines", &hwaddr_menu),
}
};
@@ -776,10 +801,7 @@
{"delete", "Delete Printer"},
{"name", "Printer Name: "}
} },
- { UpdateHWAddr, NULLMENU, 2, {
- {"hwaddr", "Update Printer Hardware Address"},
- {"name", "Printer hostname: "}
- } },
+ SUBMENU("hwaddrs", "Hardware Addresses for machines", &hwaddr_menu),
SUBMENU("server", "Print Servers Menu", &printserver_menu),
}
};
Modified: trunk/third/moira/clients/moira/pobox.c
===================================================================
--- trunk/third/moira/clients/moira/pobox.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/moira/pobox.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: pobox.c 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: pobox.c 4038 2011-05-09 01:13:59Z zacheiss $
*
* 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("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/pobox.c $ $Id: pobox.c 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/pobox.c $ $Id: pobox.c 4038 2011-05-09 01:13:59Z zacheiss $");
/* Function Name: PrintPOBox
* Description: Yet another specialized print function.
@@ -480,7 +480,7 @@
{
free(type);
type = "EXCHANGE";
- box = "EXCHANGE.MIT.EDU";
+ box = strdup("EXCHANGE.MIT.EDU");
}
else
{
Modified: trunk/third/moira/clients/moira/printer.c
===================================================================
--- trunk/third/moira/clients/moira/printer.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/moira/printer.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: printer.c 3977 2010-02-12 21:12:04Z zacheiss $
+/* $Id: printer.c 4030 2011-03-04 21:01:14Z zacheiss $
*
* 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,14 +23,14 @@
#include <stdlib.h>
#include <string.h>
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/printer.c $ $Id: printer.c 3977 2010-02-12 21:12:04Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/moira/printer.c $ $Id: printer.c 4030 2011-03-04 21:01:14Z zacheiss $");
void RealDeletePrn(char **info, Bool one_item);
void ChangePrn(char **info, Bool one_item);
void ChangePrintSrvLoop(char **info, Bool one);
extern int GetAliasValue(int argc, char **argv, void *retval);
-int StoreHWAddr(int argc, char **argv, void *retval);
+void PrintHWAddrs(char **info);
static char *PrintPrintSrvInfo(char **info);
static char **SetPrintSrvDefaults(char **info, char *name);
static char **AskPrintSrvInfo(char **info);
@@ -47,7 +47,7 @@
static char *states[] = {
"Reserved (0)",
"Active (1)",
- "None (2)",
+ "Active, No IP ACL (2)",
"Deleted (3)"
};
@@ -63,13 +63,6 @@
return states[state];
}
-int StoreHWAddr(int argc, char **argv, void *retval)
-{
- char **p = retval;
- *p = strdup(argv[0]);
- return MR_CONT;
-}
-
/* Function Name: SetDefaults
* Description: sets the default values for filesystem additions.
* Arguments: info - an array of char pointers to recieve defaults.
@@ -160,6 +153,19 @@
return QueueTop(elem);
}
+static char hwaddrbuf[BUFSIZ * 2];
+
+void PrintHWAddrs(char **info)
+{
+ if (strlen(hwaddrbuf) == 0)
+ sprintf(hwaddrbuf, "Hardware Addresses: %s", info[1]);
+ else
+ {
+ strcat(hwaddrbuf, ", ");
+ strcat(hwaddrbuf, info[1]);
+ }
+}
+
/* Function Name: PrintPrnInfo
* Description: Yet another specialized print function.
* Arguments: info - all info about this Printer.
@@ -168,8 +174,9 @@
static char *PrintPrnInfo(char **info)
{
- char buf[BUFSIZ], *hwaddr;
+ char buf[BUFSIZ];
int status, banner = atoi(info[PRN_BANNER]);
+ struct mqelem *elem = NULL;
if (!info) /* If no informaion */
{
@@ -177,29 +184,37 @@
return NULL;
}
Put_message("");
- sprintf(buf, "Printer: %-18s Duplex queue: %-18s", info[PRN_NAME],
- *info[PRN_DUPLEXNAME] ? info[PRN_DUPLEXNAME] : "[none]");
+ sprintf(buf, "Printer: %-18s Duplex queue: %-17s Status: %-10s",
+ info[PRN_NAME], *info[PRN_DUPLEXNAME] ? info[PRN_DUPLEXNAME] : "[none]",
+ PrnState(atoi(info[PRN_STATUS])));
Put_message(buf);
- sprintf(buf, "Status: %-10s", PrnState(atoi(info[PRN_STATUS])));
- Put_message(buf);
sprintf(buf, "Duplex by Default: %-8s Hold by Default: %-18s",
atoi(info[PRN_DUPLEXDEFAULT]) ? "yes" : "no",
atoi(info[PRN_HOLDDEFAULT]) ? "yes" : "no");
Put_message(buf);
- sprintf(buf, "Type: %-10s Hardware type: %-10s Hardware address: ",
+ sprintf(buf, "Type: %-10s Hardware type: %-10s",
info[PRN_TYPE], info[PRN_HWTYPE]);
- status = do_mr_query("get_host_hwaddr", 1, &info[PRN_HOSTNAME],
- StoreHWAddr, &hwaddr);
- if (status == MR_SUCCESS)
- {
- strcat(buf, hwaddr);
- free(hwaddr);
- }
- else
- strcat(buf, "none");
Put_message(buf);
sprintf(buf, "Printer hostname: %s", info[PRN_HOSTNAME]);
Put_message(buf);
+
+ status = do_mr_query("get_host_hwaddr_mapping", 1, &info[PRN_HOSTNAME],
+ StoreInfo, &elem);
+ if (status)
+ {
+ if (status != MR_NO_MATCH)
+ com_err(program_name, status, " looking up hardware addresses");
+ else
+ Put_message("Hardware Addresses: none");
+ }
+ else
+ {
+ hwaddrbuf[0] = 0;
+ Loop(QueueTop(elem), (void (*)(char **)) PrintHWAddrs);
+ FreeQueue(elem);
+ Put_message(hwaddrbuf);
+ }
+
sprintf(buf, "Printer log host: %s", info[PRN_LOGHOST]);
Put_message(buf);
sprintf(buf, "Spool host: %s", info[PRN_RM]);
@@ -476,8 +491,29 @@
com_err(program_name, stat, " in AddPrn");
if (stat == MR_SUCCESS && strcasecmp(info[PRN_HOSTNAME], "[NONE]"))
- UpdateHWAddr(2, &info[PRN_HOSTNAME - 1]);
+ {
+ char *hwargv[2], *hwaddr, *s, *d;
+ hwaddr = strdup("");
+ if (GetValueFromUser("Hardware ethernet address", &hwaddr) == SUB_ERROR)
+ return DM_NORMAL;
+
+ s = d = hwaddr;
+ do
+ {
+ if (*s != ':')
+ *d++ = *s;
+ }
+ while (*s++);
+
+ hwargv[0] = info[PRN_HOSTNAME];
+ hwargv[1] = hwaddr;
+
+ stat = do_mr_query("add_host_hwaddr", 2, hwargv, NULL, NULL);
+ if (stat != MR_SUCCESS)
+ com_err(program_name, stat, " in add_host_hwaddr");
+ }
+
FreeInfo(info);
return DM_NORMAL;
}
@@ -519,46 +555,6 @@
return DM_NORMAL;
}
-
-int UpdateHWAddr(int argc, char **argv)
-{
- int stat;
- char *name, *hwaddr, *s, *d, *uargv[2];
-
- name = canonicalize_hostname(strdup(argv[1]));
- stat = do_mr_query("get_host_hwaddr", 1, &name, StoreHWAddr, &hwaddr);
- if (stat != MR_SUCCESS)
- {
- free(name);
- com_err(program_name, stat, " checking host ethernet address");
- return DM_NORMAL;
- }
-
- if (GetValueFromUser("Hardware ethernet address", &hwaddr) == SUB_ERROR)
- {
- free(name);
- return DM_NORMAL;
- }
-
- s = d = hwaddr;
- do
- {
- if (*s != ':')
- *d++ = *s;
- }
- while (*s++);
-
- uargv[0] = name;
- uargv[1] = hwaddr;
- if ((stat = do_mr_query("update_host_hwaddr", 2, uargv, NULL, NULL)))
- com_err(program_name, stat, " updating ethernet address.");
-
- free(name);
- free(hwaddr);
- return DM_NORMAL;
-}
-
-
int GetPrintSrv(int argc, char **argv)
{
int stat;
Modified: trunk/third/moira/clients/regapplet/regapplet/TextBlock.java
===================================================================
--- trunk/third/moira/clients/regapplet/regapplet/TextBlock.java 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/regapplet/regapplet/TextBlock.java 2011-06-30 16:16:12 UTC (rev 25198)
@@ -11,6 +11,7 @@
super();
width = x;
height = y;
+ text = "<undefined>";
}
public Dimension minimumSize() {
System.err.println("TextBlock: minimumSize called " + width + " " + height);
Modified: trunk/third/moira/clients/stella/stella.c
===================================================================
--- trunk/third/moira/clients/stella/stella.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/clients/stella/stella.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: stella.c 3968 2010-01-27 23:00:11Z zacheiss $
+/* $Id: stella.c 4001 2010-04-21 20:38:45Z zacheiss $
*
* Command line oriented Moira host tool.
*
@@ -32,7 +32,7 @@
#include <arpa/inet.h>
#endif
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/stella/stella.c $ $Id: stella.c 3968 2010-01-27 23:00:11Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/clients/stella/stella.c $ $Id: stella.c 4001 2010-04-21 20:38:45Z zacheiss $");
struct owner_type {
int type;
@@ -63,10 +63,12 @@
int info_flag, update_flag, create_flag, delete_flag, list_map_flag;
int update_alias_flag, update_map_flag, verbose, noauth;
int list_container_flag, update_container_flag, unformatted_flag;
+int list_hwaddr_flag, update_hwaddr_flag;
struct string_list *alias_add_queue, *alias_remove_queue;
struct string_list *map_add_queue, *map_remove_queue;
struct string_list *container_add_queue, *container_remove_queue;
+struct string_list *hwaddr_add_queue, *hwaddr_remove_queue;
char *hostname, *whoami;
@@ -83,6 +85,7 @@
void show_host_info_unformatted(char **argv);
int show_machine_in_cluster(int argc, char **argv, void *hint);
int show_machine_in_container(int argc, char **argv, void *hint);
+int show_host_hwaddrs(int argc, char **argv, void *hint);
struct owner_type *parse_member(char *s);
struct string_list *add_to_string_list(struct string_list *old_list, char *s);
int wrap_mr_query(char *handle, int argc, char **argv,
@@ -99,6 +102,7 @@
info_flag = update_flag = create_flag = list_map_flag = update_map_flag = 0;
update_alias_flag = verbose = noauth = 0;
list_container_flag = update_container_flag = 0;
+ list_hwaddr_flag = update_hwaddr_flag = 0;
newname = address = network = h_status = vendor = model = NULL;
os = location = contact = billing_contact = account_number = adm_cmt = NULL;
op_cmt = NULL;
@@ -106,6 +110,7 @@
alias_add_queue = alias_remove_queue = NULL;
map_add_queue = map_remove_queue = NULL;
container_add_queue = container_remove_queue = NULL;
+ hwaddr_add_queue = hwaddr_remove_queue = NULL;
whoami = argv[0];
success = 1;
@@ -298,6 +303,24 @@
}
else if (argis("lcn", "listcontainer"))
list_container_flag++;
+ else if (argis("ahw", "addhwaddr")) {
+ if (arg - argv < argc - 1) {
+ arg++;
+ hwaddr_add_queue = add_to_string_list(hwaddr_add_queue, *arg);
+ } else
+ usage(argv);
+ update_hwaddr_flag++;
+ }
+ else if (argis("dhw", "delhwaddr")) {
+ if (arg - argv < argc - 1) {
+ arg++;
+ hwaddr_remove_queue = add_to_string_list(hwaddr_remove_queue, *arg);
+ } else
+ usage(argv);
+ update_hwaddr_flag++;
+ }
+ else if (argis("lhw", "listhwaddr"))
+ list_hwaddr_flag++;
else if (argis("u", "unformatted"))
unformatted_flag++;
else if (argis("n", "noauth"))
@@ -329,7 +352,8 @@
if(!(info_flag || update_flag || create_flag || \
delete_flag || list_map_flag || update_map_flag || \
update_alias_flag || update_container_flag || \
- list_container_flag)) {
+ list_container_flag || update_hwaddr_flag || \
+ list_hwaddr_flag)) {
info_flag++;
}
@@ -678,6 +702,50 @@
}
}
+ /* add hwaddrs */
+ if (hwaddr_add_queue) {
+ struct string_list *q = hwaddr_add_queue;
+
+ while (q) {
+ char *hwaddr = q->string;
+ char *args[2];
+
+ args[0] = canonicalize_hostname(strdup(hostname));
+ args[1] = hwaddr;
+ status = wrap_mr_query("add_host_hwaddr", 2, args,
+ NULL, NULL);
+
+ if (status) {
+ com_err(whoami, status, "while adding host hardware address");
+ exit(1);
+ }
+
+ q = q->next;
+ }
+ }
+
+ /* delete hwaddrs */
+ if (hwaddr_remove_queue) {
+ struct string_list *q = hwaddr_remove_queue;
+
+ while (q) {
+ char *hwaddr = q->string;
+ char *args[2];
+
+ args[0] = canonicalize_hostname(strdup(hostname));
+ args[1] = hwaddr;
+ status = wrap_mr_query("delete_host_hwaddr", 2, args,
+ NULL, NULL);
+
+ if (status) {
+ com_err(whoami, status, "while deleting host hardware address");
+ exit(1);
+ }
+
+ q = q->next;
+ }
+ }
+
/* display list info if requested to */
if (info_flag) {
struct mqelem *elem = NULL;
@@ -749,6 +817,21 @@
}
}
+ /* list hwaddr mappings if needed */
+ if (list_hwaddr_flag) {
+ char *argv[1];
+
+ argv[0] = canonicalize_hostname(strdup(hostname));
+ status = wrap_mr_query("get_host_hwaddr_mapping", 1, argv,
+ show_host_hwaddrs, NULL);
+
+ if (status)
+ if (status != MR_NO_MATCH) {
+ com_err(whoami, status, "while getting host hardware addresses");
+ exit(1);
+ }
+ }
+
if (delete_flag) {
char *argv[1];
@@ -797,7 +880,10 @@
"-u | -unformatted");
fprintf(stderr, USAGE_OPTIONS_FORMAT, "-v | -verbose",
"-n | -noauth");
- fprintf(stderr, " %-39s\n" , "-db | -database host[:port]");
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-ahw | -addhwaddr hwaddr",
+ "-dhw | -delhwaddr hwaddr");
+ fprintf(stderr, USAGE_OPTIONS_FORMAT, "-lhw | -listhwaddr",
+ "-db | -database host[:port]");
exit(1);
}
@@ -953,6 +1039,13 @@
return MR_CONT;
}
+int show_host_hwaddrs(int argc, char **argv, void *hint)
+{
+ printf("Machine: %-30s Hardware Address: %-25s\n", argv[0], argv[1]);
+
+ return MR_CONT;
+}
+
/* Parse a line of input, fetching a member. NULL is returned if a member
* is not found. ';' is a comment character.
*/
Modified: trunk/third/moira/db/dbopt.sql
===================================================================
--- trunk/third/moira/db/dbopt.sql 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/db/dbopt.sql 2011-06-30 16:16:12 UTC (rev 25198)
@@ -94,3 +94,6 @@
create unique index i_mcntmap_machid on mcntmap (mach_id);
create index i_mcntmap_cntid on mcntmap (cnt_id);
+
+create index i_hwaddrmap_machid on hwaddrmap (mach_id);
+create index i_hwaddrmap_hwaddr on hwaddrmap (hwaddr);
Modified: trunk/third/moira/db/schema.sql
===================================================================
--- trunk/third/moira/db/schema.sql 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/db/schema.sql 2011-06-30 16:16:12 UTC (rev 25198)
@@ -487,3 +487,9 @@
winprofiledir VARCHAR(260) DEFAULT '[DFS]' NOT NULL,
purged DATE DEFAULT SYSDATE NOT NULL
);
+
+create table hwaddrmap
+(
+ mach_id INTEGER DEFAULT 0 NOT NULL,
+ hwaddr VARCHAR(12) DEFAULT CHR(0) NOT NULL
+);
Modified: trunk/third/moira/debian/changelog
===================================================================
--- trunk/third/moira/debian/changelog 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/debian/changelog 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,3 +1,10 @@
+debathena-moira (4.0.0+svn20110628-r4042-0debathena1) unstable; urgency=low
+
+ * Snapshot moira@r4042 (6/28/11)
+ * Update version number to include moira revision number
+
+ -- Jonathan Reed <jdreed@mit.edu> Thu, 30 Jun 2011 12:04:02 -0400
+
debathena-moira (4.0.0+svn20100405-0debathena4) unstable; urgency=low
* Don't turn off the daemon on workstations that previously had enabled it
Modified: trunk/third/moira/gen/Makefile.in
===================================================================
--- trunk/third/moira/gen/Makefile.in 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/Makefile.in 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in 3990 2010-03-11 16:44:43Z zacheiss $
+# $Id: Makefile.in 4040 2011-06-15 21:51:11Z zacheiss $
SHELL=/bin/sh
@SET_MAKE@
@@ -32,25 +32,25 @@
LIB_CFILES=genacl.c
LIB_TARGET=libdcm.a
-OBJS= acl.lo boot.lo confluence.lo cups-print.lo cups-cluster.lo dhcp.lo directory.lo events.lo \
+OBJS= acl.lo confluence.lo cups-print.lo cups-cluster.lo dhcp.lo directory.lo events.lo \
hesiod.lo hosts.lo mailhub.lo ndb.lo network.lo nfs.lo pobox.lo \
postoffice.lo print.lo warehouse-lists.lo winad.lo www.lo zephyr.lo
-CFILES= acl.c boot.c confluence.c cups-print.c cups-cluster.c dhcp.c directory.c events.c \
+CFILES= acl.c confluence.c cups-print.c cups-cluster.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 warehouse-lists.c winad.c www.c zephyr.c
-TARGET= acl.gen boot.gen confluence.gen cups-print.gen cups-cluster.gen dhcp.gen directory.gen \
+TARGET= acl.gen confluence.gen cups-print.gen cups-cluster.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 \
warehouse-lists.gen winad.gen www.gen zephyr.gen
-SCRIPTS=access.gen access.sh acl.sh aliases.sh boot.sh ca.gen calendar.gen \
+SCRIPTS=access.gen access.sh acl.sh aliases.sh asa-db.gen ca.gen calendar.gen \
cups-print.sh cups-cluster.sh dhcp.sh events.sh hesiod.sh ip-billing.gen \
ip-billing.sh ldap.gen mailhosts.gen mailhub.sh mailman.gen mailman.sh \
nagios-cluster.gen nagios-cluster.sh nagios-colo.gen nagios-colo.sh \
nagios-printers.gen nagios-printers.sh nagios-wsh.gen nagios-wsh.sh \
- ndb.sh nfs.sh null.sh postoffice.sh print.sh rt.sh sapprint.gen \
+ ndb.sh nfs.sh null.sh postoffice.sh print.sh print-accounting.gen sapprint.gen \
sapprint.sh spwatch.gen tsm.gen tsm.sh ua-elect.gen warehouse.gen warehouse.sh \
winstats.gen winstats.sh www.sh zephyr.sh install_dirs \
install_quotas zero_quotas
@@ -120,12 +120,6 @@
print.gen: print.lo libdcm.a $(MR_LIBDEP)
$(LIBTOOL) --mode=link $(CC) -static -o $@ $(LDFLAGS) print.lo libdcm.a $(SQL_LIBS) $(LIBS)
-printng.gen: printng.lo libdcm.a $(MR_LIBDEP)
- $(LIBTOOL) --mode=link $(CC) -static -o $@ $(LDFLAGS) printng.lo libdcm.a $(SQL_LIBS) $(LIBS)
-
-boot.gen: boot.lo libdcm.a $(MR_LIBDEP)
- $(LIBTOOL) --mode=link $(CC) -static -o $@ $(LDFLAGS) boot.lo libdcm.a $(SQL_LIBS) $(LIBS)
-
acl.gen: acl.lo libdcm.a $(MR_LIBDEP)
$(LIBTOOL) --mode=link $(CC) -static -o $@ $(LDFLAGS) acl.lo libdcm.a $(SQL_LIBS) $(LIBS)
Modified: trunk/third/moira/gen/acl.pc
===================================================================
--- trunk/third/moira/gen/acl.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/acl.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: acl.pc 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: acl.pc 4034 2011-03-15 16:34:23Z zacheiss $
*
* This generates acl files for various servers.
*
@@ -25,7 +25,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/acl.pc $ $Id: acl.pc 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/acl.pc $ $Id: acl.pc 4034 2011-03-15 16:34:23Z zacheiss $");
char *whoami = "acl.gen";
char *db = "moira/moira";
@@ -266,7 +266,7 @@
struct imember *m;
EXEC SQL BEGIN DECLARE SECTION;
char shell[USERS_SHELL_SIZE], fullname[USERS_FULLNAME_SIZE];
- char nickname[USERS_NICKNAME_SIZE], oa[USERS_OFFICE_ADDR_SIZE];
+ char oa[USERS_OFFICE_ADDR_SIZE];
char op[USERS_OFFICE_PHONE_SIZE], hp[USERS_HOME_PHONE_SIZE];
int uid, i = 0;
char *name, *n, *lasts = NULL;
@@ -279,9 +279,9 @@
case 'U':
name = m->name;
- EXEC SQL SELECT unix_uid, shell, fullname, nickname,
+ EXEC SQL SELECT unix_uid, shell, fullname,
office_addr, office_phone, home_phone
- INTO :uid, :shell, :fullname, :nickname, :oa, :op, :hp
+ INTO :uid, :shell, :fullname, :oa, :op, :hp
FROM users
WHERE login = :name AND status != 3;
if (sqlca.sqlcode)
@@ -289,13 +289,12 @@
strtrim(shell);
strtrim(fullname);
- strtrim(nickname);
strtrim(op);
strtrim(oa);
strtrim(hp);
- fprintf(out, "%s:*:%d:101:%s,%s,%s,%s,%s:/mit/%s:%s\n",
- name, uid, fullname, nickname, oa, op, hp, name, shell);
+ fprintf(out, "%s:*:%d:101:%s,%s,%s,%s:/mit/%s:%s\n",
+ name, uid, fullname, oa, op, hp, name, shell);
break;
case 'K':
@@ -305,9 +304,9 @@
login = :name and status != 3;
if (i == 1)
{
- EXEC SQL SELECT unix_uid, shell, fullname, nickname,
+ EXEC SQL SELECT unix_uid, shell, fullname,
office_addr, office_phone, home_phone
- INTO :uid, :shell, :fullname, :nickname, :oa, :op, :hp
+ INTO :uid, :shell, :fullname, :oa, :op, :hp
FROM users
WHERE login = :name AND status != 3;
if (sqlca.sqlcode)
@@ -315,13 +314,12 @@
strtrim(shell);
strtrim(fullname);
- strtrim(nickname);
strtrim(op);
strtrim(oa);
strtrim(hp);
- fprintf(out, "%s:*:%d:101:%s,%s,%s,%s,%s:/mit/%s:%s\n",
- name, uid, fullname, nickname, oa, op, hp, name, shell);
+ fprintf(out, "%s:*:%d:101:%s,%s,%s,%s:/mit/%s:%s\n",
+ name, uid, fullname, oa, op, hp, name, shell);
}
break;
}
Added: trunk/third/moira/gen/asa-db.gen
===================================================================
--- trunk/third/moira/gen/asa-db.gen (rev 0)
+++ trunk/third/moira/gen/asa-db.gen 2011-06-30 16:16:12 UTC (rev 25198)
@@ -0,0 +1,33 @@
+#!/moira/bin/perl -Tw
+# $Id: ua-elect.gen 3990 2010-03-11 16:44:43Z zacheiss $
+
+# The following exit codes are defined and MUST BE CONSISTENT with the
+# error codes the library uses:
+$MR_DBMS_ERR = 47836421;
+$MR_OCONFIG = 47836460;
+
+$outfile = '/moira/dcm/asa-db.out';
+
+umask 022;
+open(OUT, ">$outfile") || exit $MR_OCONFIG;
+
+use DBI;
+
+$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
+ || exit $MR_DBMS_ERR;
+
+$sth = $dbh->prepare("SELECT login, clearid, first, last, type FROM users WHERE status = 1 ORDER BY login")
+ || exit $MR_DBMS_ERR;
+
+$sth->execute || exit $MR_DBMS_ERR;
+
+while (($login, $clearid, $first, $last, $type) = $sth->fetchrow_array) {
+ $row = "$login\t$clearid\t$first\t$last\t$type\n";
+ $row =~ s/\0//g;
+ print OUT $row;
+}
+
+close(OUT);
+$dbh->disconnect;
+
+exit 0;
Property changes on: trunk/third/moira/gen/asa-db.gen
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/third/moira/gen/cups-cluster.pc
===================================================================
--- trunk/third/moira/gen/cups-cluster.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/cups-cluster.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: cups-cluster.pc 3996 2010-03-30 15:40:58Z zacheiss $
+/* $Id: cups-cluster.pc 4033 2011-03-15 16:33:20Z zacheiss $
*
* This generates printcaps and other files for Athena print servers
*
@@ -28,7 +28,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/cups-cluster.pc $ $Id: cups-cluster.pc 3996 2010-03-30 15:40:58Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/cups-cluster.pc $ $Id: cups-cluster.pc 4033 2011-03-15 16:33:20Z zacheiss $");
char *whoami = "cups-print.gen";
char *db = "moira/moira";
@@ -156,7 +156,7 @@
pr.ac, pr.lpc_acl, pr.duplexdefault, pr.holddefault
FROM printers pr, machine m
WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
- AND pr.status = 1 AND m.status != 3
+ AND (pr.status = 1 OR pr.status = 2) AND m.status != 3
AND (pr.type = 'DORM' or pr.type = 'CLUSTER');
EXEC SQL OPEN csr_printers;
while (1)
@@ -193,7 +193,7 @@
fprintf(out, "State Idle\n"); /* Always with the Idle */
fprintf(out, "StateTime %ld\n", (long)time(NULL));
if (holddefault)
- fprintf(out, "Reason hold-new-jobs\n");
+ fprintf(out, "Option job-hold-until indefinite\n");
fprintf(out, "Accepting Yes\n");
fprintf(out, "Shared Yes\n");
fprintf(out, "QuotaPeriod 0\n");
@@ -241,8 +241,8 @@
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.ac, pr.lpc_acl, m.name as cupshosts
FROM printers pr, machine m, machine m2, serverhosts sh
- WHERE pr.rm = m.mach_id
- AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
+ WHERE pr.rm = m.mach_id AND pr.rm <> :rm
+ AND (pr.status = 1 OR pr.status = 2) AND pr.mach_id = m2.mach_id AND m2.status !=3
AND (pr.type = 'CLUSTER' or pr.type = 'DORM') AND m.name <> :spoolhost AND
m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER') AND
sh.enable = 1 AND m.mach_id = sh.mach_id;
@@ -308,10 +308,8 @@
printer_user_list(out, "LIST", ac, "AllowUser", 0);
}
- if (banner == PRN_BANNER_NONE)
- fprintf(out, "JobSheets none none\n");
- else
- fprintf(out, "JobSheets athena none\n");
+ /* Never try to prepend a banner */
+ fprintf(out, "JobSheets none none\n");
fprintf(out, "</Printer>\n");
}
@@ -321,13 +319,12 @@
EXEC SQL DECLARE csr_lprng_printers CURSOR FOR
SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
m.name, pr.banner, pr.location, pr.contact, pr.ka,
- pr.ac, pr.lpc_acl, m.name as cupshosts, pr.duplexdefault
+ pr.ac, pr.lpc_acl, m.name, pr.duplexdefault as cupshosts
FROM printers pr, machine m, machine m2, serverhosts sh
- WHERE pr.rm = m.mach_id
- AND pr.status = 1 and pr.mach_id = m2.mach_id AND m2.status !=3
- AND (pr.type = 'DORM' or pr.type = 'CLUSTER') AND m.name <> :spoolhost AND
- m.mach_id = sh.mach_id AND sh.service = 'PRINT' AND
- sh.enable = 1;
+ WHERE pr.rm = m.mach_id
+ AND (pr.status = 1 OR pr.status = 2) AND pr.mach_id = m2.mach_id AND m2.status != 3
+ AND sh.service = 'PRINT' AND m.mach_id = sh.mach_id
+ AND (pr.type = 'DORM' or pr.type = 'CLUSTER');
EXEC SQL OPEN csr_lprng_printers;
while (1)
@@ -394,7 +391,7 @@
pr.type as prtype, pr.ac, sh.service, pr.duplexdefault
FROM printers pr, machine m, machine m2, serverhosts sh
WHERE pr.rm = m.mach_id
- AND pr.status = 1 and pr.mach_id = m2.mach_id AND m2.status !=3
+ AND (pr.status = 1 OR pr.status = 2) and pr.mach_id = m2.mach_id AND m2.status !=3
AND m.mach_id = sh.mach_id AND sh.enable = 1
AND (pr.type = 'DORM' or pr.type = 'CLUSTER')
AND (sh.service = 'CUPS-PRINT' OR sh.service = 'PRINT' OR sh.service = 'CUPS-CLUSTER');
@@ -603,7 +600,7 @@
SELECT UNIQUE pr.rp, pr.ka, pr.ac, pr.lpc_acl
FROM printers pr, machine m
WHERE (pr.ac != 0 OR pr.lpc_acl != 0)
- AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3
+ AND (pr.status = 1 OR pr.status = 2) and pr.mach_id = m.mach_id AND m.status !=3
AND pr.rm in (SELECT m.mach_id FROM machine m, serverhosts sh
WHERE m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' or sh.service = 'CUPS-CLUSTER')
AND sh.enable = 1 and m.status != 3);
@@ -621,6 +618,7 @@
fprintf (out, "AuthType Default\n");
fprintf (out, "Require user @OWNER @SYSTEM\n");
printer_user_list(out, "LIST", lpc_acl, "Require user", 1);
+ printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
fprintf (out, "Order deny,allow\n");
fprintf (out, "Allow from all\n");
fprintf (out, "</Limit>\n");
Modified: trunk/third/moira/gen/cups-cluster.sh
===================================================================
--- trunk/third/moira/gen/cups-cluster.sh 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/cups-cluster.sh 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,5 +1,5 @@
#! /bin/sh
-# $Id: cups-cluster.sh 3974 2010-02-03 18:46:16Z zacheiss $
+# $Id: cups-cluster.sh 4027 2011-01-21 03:45:40Z zacheiss $
if [ -d /var/athena ] && [ -w /var/athena ]; then
exec >/var/athena/moira_update.log 2>&1
@@ -13,20 +13,21 @@
MR_MKCRED=47836474
MR_TARERR=47836476
-PATH=/bin
+PATH=/usr/local/samba/bin:/usr/bin:/bin; export PATH
TARFILE=/var/tmp/cups-cluster.out
CUPSLOCAL=/etc/cups
+SAMBAPASSWD=`cat /etc/cups/sambapasswd`
-/etc/init.d/cups stop
-
# Alert if the tar file or other needed files do not exist
test -r $TARFILE || exit $MR_MISSINGFILE
test -d $CUPSLOCAL || exit $MR_MISSINGFILE
+# We need to kill off CUPS to prevent it from overwriting
+# state data whilst updating
+/etc/init.d/cups stop
+
/etc/cups/bin/check-disabled.pl 2>/dev/null
-# Unpack the tar file, getting only files that are newer than the
-# on-disk copies (-u).
cd /
tar xf $TARFILE || exit $MR_TARERR
@@ -37,18 +38,48 @@
/etc/init.d/cups start
-/etc/cups/bin/gen-ppd.pl 2>/dev/null
+# Now, make a stab at the PPD file. This is okay to run after
+# because CUPS will pick up the new PPDs later
+/etc/cups/bin/gen-ppd.pl
+if [ $? != 0 ]; then
+ exit $MR_MKCRED
+fi
+
# if Samba-enabled, then restart it too to have it pick up
# new definitions
if [ -x /etc/init.d/smb ]; then
/etc/init.d/smb restart
fi
-if [ $? != 0 ]; then
- exit $MR_MKCRED
-fi
+test -r /etc/cups/all-queues || exit $MR_MISSINGFILE
+# Generate list of all queues.
+rm -f /etc/cups/all-queues.new
+rm -f /etc/cups/all-queues.tmp
+grep "<Printer" /etc/cups/printers.conf | awk '{print $2}' | sed -e 's/>//' > /etc/cups/all-queues.tmp
+grep '^Printer' /etc/cups/classes.conf | awk '{print $2}' >> /etc/cups/all-queues.tmp
+sort -u /etc/cups/all-queues.tmp > /etc/cups/all-queues.new
+
+# Sanity check that the file isn't empty.
+test -s /etc/cups/all-queues.new || exit $MR_MKCRED
+
+rm -f /etc/cups/all-queues.tmp
+mv /etc/cups/all-queues /etc/cups/all-queues.old && mv /etc/cups/all-queues.new /etc/cups/all-queues
+
+# Generate list of new queues since the last time we ran.
+newqueues=`comm -13 /etc/cups/all-queues.old /etc/cups/all-queues`
+for queue in $newqueues; do
+ # If PPD file doesn't exist, cupsaddsmb will bomb out.
+ if [ -f /etc/cups/ppd/$queue.ppd ]; then
+ # Add this queue to SMB service advertisements.
+ /usr/sbin/cupsaddsmb -v -U root%$SAMBAPASSWD -W PRINTERS $queue
+ if [ $? != 0 ]; then
+ echo "Failed to configure $queue for SMB printing."
+ fi
+ fi
+done
+
# cleanup
test -f $TARFILE && rm -f $TARFILE
test -f $0 && rm -f $0
Modified: trunk/third/moira/gen/cups-print.pc
===================================================================
--- trunk/third/moira/gen/cups-print.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/cups-print.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: cups-print.pc 3996 2010-03-30 15:40:58Z zacheiss $
+/* $Id: cups-print.pc 4033 2011-03-15 16:33:20Z zacheiss $
*
* This generates printcaps and other files for Athena print servers
*
@@ -28,7 +28,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/cups-print.pc $ $Id: cups-print.pc 3996 2010-03-30 15:40:58Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/cups-print.pc $ $Id: cups-print.pc 4033 2011-03-15 16:33:20Z zacheiss $");
char *whoami = "cups-print.gen";
char *db = "moira/moira";
@@ -159,7 +159,7 @@
pr.ac, pr.lpc_acl, pr.duplexdefault, pr.holddefault
FROM printers pr, machine m
WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
- AND pr.status = 1 AND m.status !=3
+ AND (pr.status = 1 OR pr.status = 2) AND m.status !=3
AND pr.type != 'ALIAS';
EXEC SQL OPEN csr_printers;
while (1)
@@ -196,7 +196,7 @@
fprintf(out, "State Idle\n"); /* Always with the Idle */
fprintf(out, "StateTime %ld\n", (long)time(NULL));
if (holddefault)
- fprintf(out, "Reason hold-new-jobs\n");
+ fprintf(out, "Option job-hold-until indefinite\n");
fprintf(out, "Accepting Yes\n");
fprintf(out, "Shared Yes\n");
fprintf(out, "QuotaPeriod 0\n");
@@ -244,8 +244,8 @@
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.ac, pr.lpc_acl, m.name as cupshosts, pr.duplexdefault
FROM printers pr, machine m, machine m2, serverhosts sh
- WHERE pr.rm = m.mach_id
- AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
+ WHERE pr.rm = m.mach_id AND pr.rm <> :rm
+ AND (pr.status = 1 OR pr.status = 2) AND pr.mach_id = m2.mach_id AND m2.status !=3
AND pr.type != 'ALIAS' AND m.name <> :spoolhost AND
m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER')
AND sh.enable = 1 AND m.mach_id = sh.mach_id;
@@ -312,10 +312,8 @@
printer_user_list(out, "LIST", ac, "AllowUser", 0);
}
- if (banner == PRN_BANNER_NONE)
- fprintf(out, "JobSheets none none\n");
- else
- fprintf(out, "JobSheets athena none\n");
+ /* Never try to prepend a banner */
+ fprintf(out, "JobSheets none none\n");
fprintf(out, "</Printer>\n");
}
@@ -326,12 +324,10 @@
SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.ac, pr.lpc_acl, m.name, pr.duplexdefault as cupshosts
- FROM printers pr, machine m, machine m2, serverhosts sh
- WHERE pr.rm = m.mach_id
- AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status != 3
- AND pr.type != 'ALIAS' AND m.name <> :spoolhost AND
- m.mach_id = sh.mach_id AND sh.service = 'PRINT' AND
- sh.enable = 1;
+ FROM printers pr, machine m, machine m2, printservers ps
+ WHERE pr.rm = m.mach_id AND ps.kind <> 'CUPS' AND m.mach_id = ps.mach_id
+ AND (pr.status = 1 OR pr.status = 2) AND pr.mach_id = m2.mach_id AND m2.status != 3
+ AND pr.type != 'ALIAS';
EXEC SQL OPEN csr_lprng_printers;
while (1)
@@ -398,7 +394,7 @@
pr.type as prtype, pr.ac, sh.service, pr.duplexdefault
FROM printers pr, machine m, machine m2, serverhosts sh
WHERE pr.rm = m.mach_id
- AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
+ AND (pr.status = 1 OR pr.status = 2) AND pr.mach_id = m2.mach_id AND m2.status !=3
AND m.mach_id = sh.mach_id AND sh.enable = 1
AND (sh.service = 'CUPS-PRINT' OR sh.service = 'PRINT' OR sh.service = 'CUPS-CLUSTER');
EXEC SQL OPEN csr_duplexqs;
@@ -607,7 +603,7 @@
SELECT UNIQUE pr.rp, pr.ka, pr.ac, pr.lpc_acl
FROM printers pr, machine m
WHERE (pr.ac != 0 OR pr.lpc_acl != 0)
- AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3
+ AND (pr.status = 1 OR pr.status = 2) and pr.mach_id = m.mach_id AND m.status !=3
AND pr.rm in (SELECT m.mach_id FROM machine m, serverhosts sh
WHERE m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER')
AND sh.enable = 1);
@@ -625,6 +621,7 @@
fprintf (out, "AuthType Default\n");
fprintf (out, "Require user @OWNER @SYSTEM\n");
printer_user_list(out, "LIST", lpc_acl, "Require user", 1);
+ printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
fprintf (out, "Order deny,allow\n");
fprintf (out, "Allow from all\n");
fprintf (out, "</Limit>\n");
Modified: trunk/third/moira/gen/cups-print.sh
===================================================================
--- trunk/third/moira/gen/cups-print.sh 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/cups-print.sh 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,5 +1,5 @@
#! /bin/sh
-# $Id: cups-print.sh 3956 2010-01-05 20:56:56Z zacheiss $
+# $Id: cups-print.sh 4027 2011-01-21 03:45:40Z zacheiss $
if [ -d /var/athena ] && [ -w /var/athena ]; then
exec >/var/athena/moira_update.log 2>&1
@@ -13,9 +13,10 @@
MR_MKCRED=47836474
MR_TARERR=47836476
-PATH=/bin
+PATH=/usr/local/samba/bin:/usr/bin:/bin; export PATH
TARFILE=/var/tmp/cups-print.out
CUPSLOCAL=/etc/cups
+SAMBAPASSWD=`cat /etc/cups/sambapasswd`
# Alert if the tar file or other needed files do not exist
test -r $TARFILE || exit $MR_MISSINGFILE
@@ -27,8 +28,6 @@
/etc/cups/bin/check-disabled.pl 2>/dev/null
-# Unpack the tar file, getting only files that are newer than the
-# on-disk copies (-u).
cd /
tar xf $TARFILE || exit $MR_TARERR
@@ -53,6 +52,34 @@
/etc/init.d/smb restart
fi
+test -r /etc/cups/all-queues || exit $MR_MISSINGFILE
+
+# Generate list of all queues.
+rm -f /etc/cups/all-queues.new
+rm -f /etc/cups/all-queues.tmp
+grep "<Printer" /etc/cups/printers.conf | awk '{print $2}' | sed -e 's/>//' > /etc/cups/all-queues.tmp
+grep '^Printer' /etc/cups/classes.conf | awk '{print $2}' >> /etc/cups/all-queues.tmp
+sort -u /etc/cups/all-queues.tmp > /etc/cups/all-queues.new
+
+# Sanity check that the file isn't empty.
+test -s /etc/cups/all-queues.new || exit $MR_MKCRED
+
+rm -f /etc/cups/all-queues.tmp
+mv /etc/cups/all-queues /etc/cups/all-queues.old && mv /etc/cups/all-queues.new /etc/cups/all-queues
+
+# Generate list of new queues since the last time we ran.
+newqueues=`comm -13 /etc/cups/all-queues.old /etc/cups/all-queues`
+for queue in $newqueues; do
+ # If PPD file doesn't exist, cupsaddsmb will bomb out.
+ if [ -f /etc/cups/ppd/$queue.ppd ]; then
+ # Add this queue to SMB service advertisements.
+ /usr/sbin/cupsaddsmb -v -U root%$SAMBAPASSWD -W PRINTERS $queue
+ if [ $? != 0 ]; then
+ echo "Failed to configure $queue for SMB printing."
+ fi
+ fi
+done
+
# cleanup
test -f $TARFILE && rm -f $TARFILE
test -f $0 && rm -f $0
Modified: trunk/third/moira/gen/dhcp.pc
===================================================================
--- trunk/third/moira/gen/dhcp.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/dhcp.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: dhcp.pc 3988 2010-02-27 06:24:35Z zacheiss $
+/* $Id: dhcp.pc 4032 2011-03-15 16:32:48Z zacheiss $
*
* This generates the dhcpd.conf.print and associated files.
*
@@ -20,11 +20,11 @@
#include "util.h"
-#define MACHINE_CHWADDR_SIZE 18
+#define HWADDRMAP_CHWADDR_SIZE 18
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/dhcp.pc $ $Id: dhcp.pc 3988 2010-02-27 06:24:35Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/dhcp.pc $ $Id: dhcp.pc 4032 2011-03-15 16:32:48Z zacheiss $");
char *whoami = "dhcp.gen";
char *db = "moira/moira";
@@ -36,15 +36,15 @@
int main(int argc, char **argv)
{
EXEC SQL BEGIN DECLARE SECTION;
- char name[MACHINE_NAME_SIZE], hwaddr[MACHINE_HWADDR_SIZE];
- char chwaddr[MACHINE_CHWADDR_SIZE];
- char ohwaddr[MACHINE_HWADDR_SIZE], hwtype[PRINTERS_HWTYPE_SIZE];
+ char name[MACHINE_NAME_SIZE];
+ char hwaddr[HWADDRMAP_HWADDR_SIZE], chwaddr[HWADDRMAP_CHWADDR_SIZE];
+ char ohwaddr[HWADDRMAP_HWADDR_SIZE], hwtype[PRINTERS_HWTYPE_SIZE];
char addr[MACHINE_ADDRESS_SIZE], location[PRINTERS_LOCATION_SIZE];
char contact[PRINTERS_CONTACT_SIZE], logaddr[MACHINE_ADDRESS_SIZE];
char modtime[PRINTERS_MODTIME_SIZE], type[PRINTERS_TYPE_SIZE];
char *unixtime_fmt = UNIXTIME_FMT;
char host[MACHINE_ADDRESS_SIZE], types[SERVERHOSTS_VALUE3_SIZE];
- int mid, alcount;
+ int mid, alcount, status;
EXEC SQL END DECLARE SECTION;
char shortname[MACHINE_NAME_SIZE], net[MACHINE_ADDRESS_SIZE];
char filename[MAXPATHLEN];
@@ -100,13 +100,13 @@
"root", "root", now);
ohwaddr[0] = '\0';
EXEC SQL DECLARE csr_boot CURSOR FOR
- SELECT LOWER(m.name), m.hwaddr, m.address, m2.address,
+ SELECT LOWER(m.name), hw.hwaddr, m.address, m2.address,
pr.location, pr.contact, pr.hwtype
- FROM printers pr, machine m, machine m2, machine m3
+ FROM printers pr, machine m, machine m2, hwaddrmap hw
WHERE pr.type != 'ALIAS' AND pr.mach_id != 0
- AND pr.mach_id = m.mach_id AND pr.loghost = m2.mach_id
- AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3
- ORDER BY m.hwaddr;
+ AND pr.mach_id = m.mach_id AND m.mach_id = hw.mach_id AND m.status != 3
+ AND pr.loghost = m2.mach_id AND (pr.status = 1 OR pr.status = 2)
+ ORDER BY hw.hwaddr, m.name;
EXEC SQL OPEN csr_boot;
while (1)
{
@@ -147,7 +147,7 @@
fprintf(out, "# %s: %s\n# contact: %s\nhost %s {\n\t"
"hardware ethernet %s;\n\tfixed-address %s;\n",
- shortname, location, contact, name, chwaddr, addr);
+ shortname, location, contact, hwaddr, chwaddr, addr);
if (strlen(logaddr) != 0)
fprintf(out, "\toption log-servers %s;\n", logaddr);
@@ -161,17 +161,18 @@
/* Now generate /var/boot/hp/ files */
EXEC SQL DECLARE csr_boot2 CURSOR FOR
- SELECT LOWER(m.name), m.hwaddr, m2.address, m3.address, pr.type,
- pr.location, pr.contact, TO_CHAR(pr.modtime, :unixtime_fmt)
- FROM printers pr, machine m, machine m2, machine m3
+ SELECT LOWER(m.name), hw.hwaddr, m2.address, m3.address, pr.type,
+ pr.location, pr.contact, TO_CHAR(pr.modtime, :unixtime_fmt), pr.status
+ FROM printers pr, machine m, machine m2, machine m3, hwaddrmap hw
WHERE pr.hwtype LIKE 'HP%' AND pr.mach_id != 0
- AND pr.mach_id = m.mach_id AND m.status != 3 AND pr.rm = m2.mach_id
- AND pr.loghost = m3.mach_id AND pr.type != 'ALIAS' AND pr.status = 1;
+ AND pr.mach_id = m.mach_id AND m.mach_id = hw.mach_id AND m.status != 3
+ AND pr.rm = m2.mach_id AND pr.loghost = m3.mach_id AND pr.type != 'ALIAS'
+ AND (pr.status = 1 OR pr.status = 2);
EXEC SQL OPEN csr_boot2;
while (1)
{
EXEC SQL FETCH csr_boot2 INTO :name, :hwaddr, :addr, :logaddr,
- :type, :location, :contact, :modtime;
+ :type, :location, :contact, :modtime, :status;
if (sqlca.sqlcode)
break;
@@ -199,34 +200,43 @@
fprintf(out, "name: %s\nlocation: %s\ncontact: %s\n\n", shortname,
*location ? location : "unknown",
*contact ? contact : "unknown");
+
if (*logaddr)
- fprintf(out, "trap-dest: %s\nallow: %s\n", logaddr, logaddr);
- fprintf(out, "allow: %s\n", addr);
- typelen = strlen(type);
- for (i = allows = 0; i < alcount && allows < 9; i++)
+ fprintf(out, "trap-dest: %s\n", logaddr);
+
+ /* Don't output any allow: lines for status 2 printers; they should be unrestricted. */
+ if (status == 1)
{
- char *p;
-
- /* Don't list the spoolhost twice. */
- if (!strcmp(allowlist[i].host, addr))
- continue;
-
- p = strstr(allowlist[i].types, type);
- if (!p)
- continue;
-
- /* Make sure the match was real, and not just because one type
- * is a substring of another type.
- */
- if (p != allowlist[i].types && *(p - 1) != ',' && *(p - 1) != ' ')
- continue;
- p += typelen;
- if (*p && *p != ',' && *p != ' ')
- continue;
-
- fprintf(out, "allow: %s\n", allowlist[i].host);
- allows++;
+ if (*logaddr)
+ fprintf(out, "allow: %s\n", logaddr);
+ fprintf(out, "allow: %s\n", addr);
+ typelen = strlen(type);
+ for (i = allows = 0; i < alcount && allows < 9; i++)
+ {
+ char *p;
+
+ /* Don't list the spoolhost twice. */
+ if (!strcmp(allowlist[i].host, addr))
+ continue;
+
+ p = strstr(allowlist[i].types, type);
+ if (!p)
+ continue;
+
+ /* Make sure the match was real, and not just because one type
+ * is a substring of another type.
+ */
+ if (p != allowlist[i].types && *(p - 1) != ',' && *(p - 1) != ' ')
+ continue;
+ p += typelen;
+ if (*p && *p != ',' && *p != ' ')
+ continue;
+
+ fprintf(out, "allow: %s\n", allowlist[i].host);
+ allows++;
+ }
}
+
/* Rest of data is same for all printers and is appended from a
* a file on the boot server.
*/
@@ -244,7 +254,7 @@
int f = 0, t = 0;
int mod = 2;
- for (f = 0 ; f < MACHINE_HWADDR_SIZE - 1 ; )
+ for (f = 0 ; f < HWADDRMAP_HWADDR_SIZE - 1 ; )
{
to[t++] = from[f++];
if (f % mod == 0)
Modified: trunk/third/moira/gen/directory.pc
===================================================================
--- trunk/third/moira/gen/directory.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/directory.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: directory.pc 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: directory.pc 4042 2011-06-28 15:57:24Z zacheiss $
*
* This generates a master /etc/passwd containing all active (status != 0)
* accounts.
@@ -20,7 +20,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/directory.pc $ $Id: directory.pc 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/directory.pc $ $Id: directory.pc 4042 2011-06-28 15:57:24Z zacheiss $");
char *whoami = "directory.gen";
char *db = "moira/moira";
@@ -64,7 +64,7 @@
login, last, first, middle, office_addr, office_phone,
home_addr, home_phone, clearid, type
FROM users WHERE status = 1 AND type != 'SYSTEM' AND type != 'STAFF'
- AND type != 'TEST' and type != 'REGTEST' AND type NOT LIKE 'GUES%';
+ AND type != 'TEST' AND type != 'REGTEST' AND type != 'SHARED' AND type NOT LIKE 'GUES%';
EXEC SQL OPEN x;
while (1)
{
Modified: trunk/third/moira/gen/hesiod.pc
===================================================================
--- trunk/third/moira/gen/hesiod.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/hesiod.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: hesiod.pc 3994 2010-03-24 04:20:51Z zacheiss $
+/* $Id: hesiod.pc 4034 2011-03-15 16:34:23Z zacheiss $
*
* 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("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/hesiod.pc $ $Id: hesiod.pc 3994 2010-03-24 04:20:51Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/hesiod.pc $ $Id: hesiod.pc 4034 2011-03-15 16:34:23Z zacheiss $");
#ifndef HTYPE
#define HTYPE "TXT"
@@ -203,7 +203,7 @@
char login[USERS_LOGIN_SIZE], shell[USERS_SHELL_SIZE];
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];
+ char potype[USERS_POTYPE_SIZE];
int uid, id, pid, iid, eid, mid, status;
EXEC SQL END DECLARE SECTION;
@@ -238,7 +238,7 @@
users = create_hash(12001);
EXEC SQL DECLARE u_cursor CURSOR FOR
- SELECT login, unix_uid, shell, fullname, nickname, office_addr,
+ SELECT login, unix_uid, shell, fullname, office_addr,
office_phone, home_phone, users_id, potype, pop_id, imap_id, exchange_id,
status
FROM users
@@ -247,13 +247,12 @@
EXEC SQL OPEN u_cursor;
while (1)
{
- EXEC SQL FETCH u_cursor INTO :login, :uid, :shell, :fullname, :nn,
+ EXEC SQL FETCH u_cursor INTO :login, :uid, :shell, :fullname,
:oa, :op, :hp, :id, :potype, :pid, :iid, :eid, :status;
if (sqlca.sqlcode)
break;
strtrim(login);
dequote(fullname);
- dequote(nn);
dequote(oa);
dequote(op);
dequote(hp);
@@ -265,8 +264,8 @@
hash_store(users, id, u);
if (status == 1 || status == 2)
{
- fprintf(pout, "%s.passwd\t%s %s \"%s:*:%d:101:%s,%s,%s,%s,%s:/mit/%s:%s\"\n",
- login, HCLASS, HTYPE, login, uid, fullname, nn, oa,
+ fprintf(pout, "%s.passwd\t%s %s \"%s:*:%d:101:%s,%s,%s,%s:/mit/%s:%s\"\n",
+ login, HCLASS, HTYPE, login, uid, fullname, oa,
op, hp, login, shell);
fprintf(uout, "%d.uid\t%s CNAME %s.passwd\n", uid, HCLASS, login);
}
@@ -880,7 +879,7 @@
EXEC SQL DECLARE p_cursor2 CURSOR FOR
SELECT p.name, p.duplexname, p.type, p.rp, p.rm, p.ka, p.mc, ps.kind
FROM printers p, printservers ps, machine m
- WHERE p.rm = ps.mach_id AND p.status = 1 AND p.mach_id = m.mach_id
+ WHERE p.rm = ps.mach_id AND (p.status = 1 OR p.status = 2) AND p.mach_id = m.mach_id
AND m.status != 3;
EXEC SQL OPEN p_cursor2;
while (1)
Modified: trunk/third/moira/gen/nagios-cluster.gen
===================================================================
--- trunk/third/moira/gen/nagios-cluster.gen 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/nagios-cluster.gen 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,6 +1,6 @@
#!/moira/bin/perl -Tw
-# $Id: nagios-cluster.gen 3956 2010-01-05 20:56:56Z zacheiss $
+# $Id: nagios-cluster.gen 4031 2011-03-04 21:09:08Z jweiss $
# The following exit codes are defined and MUST BE CONSISTENT with the
# error codes the library uses:
$MR_DBMS_ERR = 47836421;
@@ -76,6 +76,18 @@
use public-service
}
+define service{
+ host_name $name
+ contact_groups noone
+ use update-service
+ }
+
+define service{
+ host_name $name
+ contact_groups noone
+ use modules-service
+ }
+
END
}
Modified: trunk/third/moira/gen/nagios-wsh.gen
===================================================================
--- trunk/third/moira/gen/nagios-wsh.gen 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/nagios-wsh.gen 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,13 +1,18 @@
#!/moira/bin/perl -Tw
-# $Id: nagios-wsh.gen 3956 2010-01-05 20:56:56Z zacheiss $
+# $Id: nagios-wsh.gen 4023 2010-09-22 21:12:18Z jweiss $
# The following exit codes are defined and MUST BE CONSISTENT with the
# error codes the library uses:
$MR_DBMS_ERR = 47836421;
$MR_OCONFIG = 47836460;
-$outdir = '/moira/dcm/nagios-wsh';
+$outdir = '/moira/dcm/nagios3-wsh';
+%default_services = ('WINDOWS-CPU', 'WINDOWS-CPU',
+ 'WINDOWS-DISK-C', 'WINDOWS-DISK-C',
+ 'WINDOWS-MEMORY', 'WINDOWS-MEMORY',
+ 'WINDOWS-UPTIME', 'WINDOWS-UPTIME');
+
use DBI;
$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
@@ -16,7 +21,7 @@
$sth0 = $dbh->prepare("SELECT l.list_id, m.name " .
"FROM list l, machine m, serverhosts sh " .
"WHERE sh.value3 = l.name AND sh.service = " .
- "'NAGIOS-WSH' AND m.mach_id = sh.mach_id")
+ "'NAGIOS3-WSH' AND m.mach_id = sh.mach_id")
|| exit $MR_DBMS_ERR;
$sth0->execute;
@@ -32,40 +37,42 @@
$sth->execute;
while (($name, $tag) = $sth->fetchrow_array) {
+ my (%defaults) = %default_services;
next if $name eq "[NONE]";
$name = lc($name);
push(@allwshhosts, $name);
print OUT <<END;
+
define host{
host_name $name
alias $name
address $name
- contact_groups wsh
+ contact_groups wsh
use generic-host
}
define service{
- host_name $name
+ host_name $name
contact_groups wsh
use ping-service
}
define hostescalation{
- host_name $name
- contact_groups wsh,wsh-mail
- first_notification 2
- last_notification 0
- notification_interval 0
- }
+ host_name $name
+ contact_groups wsh,wsh-mail
+ first_notification 2
+ last_notification 0
+ notification_interval 0
+ }
define serviceescalation{
- host_name $name
- contact_groups wsh,wsh-mail
- service_description PING
- first_notification 2
- last_notification 0
- notification_interval 0
- }
+ host_name $name
+ contact_groups wsh,wsh-mail
+ service_description PING
+ first_notification 2
+ last_notification 0
+ notification_interval 0
+ }
END
@@ -81,7 +88,11 @@
while (<@tags>) {
my $service = $_;
chomp $service;
- if ($service =~ /^(FTP|NFS|HTTP|HTTPS|SMTP|SSHD|TELNET|TNS|WINDOWS-UPTIME)$/i) {
+ if ($service =~ /^-DEFAULTS$/) {
+ %defaults = ();
+ } elsif ($service =~ /^WINDOWS-UPTIME$/i) {
+ next; # this is now a default service
+ } elsif ($service =~ /^(FTP|NFS|HTTP|HTTPS|SMTP|SSHD|TELNET|TNS|WINDOWS-DISK-\w)$/i) {
my $ucservice = $service;
$ucservice =~ tr/a-z/A-Z/;
my $lcservice = $service;
@@ -203,6 +214,32 @@
END
}
+ # add default services
+ for (keys %defaults) {
+ chomp;
+ my $service = $_;
+ my $ucservice = $service;
+ $ucservice =~ tr/a-z/A-Z/;
+ my $lcservice = $service;
+ $lcservice =~ tr/A-Z/a-z/;
+ print OUT <<END;
+define service{
+ host_name $name
+ contact_groups wsh
+ use $lcservice-service
+ }
+
+define serviceescalation{
+ host_name $name
+ contact_groups wsh,wsh-mail
+ service_description $ucservice
+ first_notification 2
+ last_notification 0
+ notification_interval 0
+ }
+
+END
+ }
} # while $sth->fetchrow_array
print OUT <<END;
Added: trunk/third/moira/gen/print-accounting.gen
===================================================================
--- trunk/third/moira/gen/print-accounting.gen (rev 0)
+++ trunk/third/moira/gen/print-accounting.gen 2011-06-30 16:16:12 UTC (rev 25198)
@@ -0,0 +1,37 @@
+#!/moira/bin/perl -Tw
+
+# $Id: print-accounting.gen 4030 2011-03-04 21:01:14Z zacheiss $
+# The following exit codes are defined and MUST BE CONSISTENT with the
+# error codes the library uses:
+$MR_DBMS_ERR = 47836421;
+$MR_OCONFIG = 47836460;
+
+$outfile = '/moira/dcm/print-accounting.out';
+
+use DBI;
+
+$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
+ || exit $MR_DBMS_ERR;
+
+
+$sth = $dbh->prepare("SELECT p.name, l.name FROM list l, printers p " .
+ "WHERE (p.status = 1 OR p.status = 2) AND p.report_list = l.list_id AND l.maillist = 1 AND l.active = 1 " .
+ "ORDER BY p.name")
+ || exit $MR_DBMS_ERR;
+
+$sth->execute || exit $MR_DBMS_ERR;
+
+umask 022;
+open(OUT, ">$outfile") || exit $MR_OCONFIG;
+print OUT "# This File is automatically generated by Moira. Do not edit.\n";
+
+while (($name, $mailinglist) = $sth->fetchrow_array) {
+ next if $name eq "[NONE]";
+ $name = lc($name);
+ print OUT "$name $mailinglist\@mit.edu\n";
+}
+
+close(OUT);
+$dbh->disconnect;
+
+exit 0;
Property changes on: trunk/third/moira/gen/print-accounting.gen
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/third/moira/gen/print.pc
===================================================================
--- trunk/third/moira/gen/print.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/print.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: print.pc 3988 2010-02-27 06:24:35Z zacheiss $
+/* $Id: print.pc 4030 2011-03-04 21:01:14Z zacheiss $
*
* This generates printcaps and other files for Athena print servers
*
@@ -22,7 +22,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/print.pc $ $Id: print.pc 3988 2010-02-27 06:24:35Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/print.pc $ $Id: print.pc 4030 2011-03-04 21:01:14Z zacheiss $");
char *whoami = "print.gen";
char *db = "moira/moira";
@@ -94,7 +94,7 @@
m.name, pr.banner, pr.location, pr.contact
FROM printers pr, machine m
WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
- AND pr.status = 1 AND m.status != 3
+ AND (pr.status = 1 OR pr.status = 2) AND m.status != 3
AND pr.type != 'ALIAS'
AND ( pr.hwtype LIKE 'HP%' OR pr.hwtype LIKE 'LPR%' );
EXEC SQL OPEN csr_printcap;
@@ -177,7 +177,7 @@
EXEC SQL DECLARE csr_lpc CURSOR FOR
SELECT pr.rp, pr.duplexname FROM printers pr, machine m
WHERE pr.rm = :rm AND pr.lpc_acl != 0
- AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3;
+ AND (pr.status = 1 OR pr.status = 2) and pr.mach_id = m.mach_id AND m.status !=3;
EXEC SQL OPEN csr_lpc;
while (1)
{
@@ -198,7 +198,7 @@
EXEC SQL DECLARE csr_ac CURSOR FOR
SELECT pr.rp, pr.duplexname, pr.ka FROM printers pr, machine m
WHERE pr.rm = :rm AND pr.ac != 0
- AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3;
+ AND (pr.status = 1 OR pr.status = 2) and pr.mach_id = m.mach_id AND m.status !=3;
EXEC SQL OPEN csr_ac;
while (1)
{
@@ -244,7 +244,7 @@
EXEC SQL DECLARE csr_kq CURSOR FOR
SELECT pr.rp, pr.duplexname FROM printers pr, machine m
WHERE pr.rm = :rm AND pr.ka = 1
- AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3;
+ AND (pr.status = 1 OR pr.status = 2) AND pr.mach_id = m.mach_id AND m.status !=3;
EXEC SQL OPEN csr_kq;
while (1)
{
@@ -265,7 +265,7 @@
SELECT UNIQUE pr.rp, pr.ka, pr.ac, pr.lpc_acl
FROM printers pr, machine m
WHERE pr.rm = :rm AND ( pr.ac != 0 OR pr.lpc_acl != 0)
- AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3;
+ AND (pr.status = 1 OR pr.status = 2) AND pr.mach_id = m.mach_id AND m.status !=3;
EXEC SQL OPEN csr_spool;
while (1)
{
Modified: trunk/third/moira/gen/sapprint.gen
===================================================================
--- trunk/third/moira/gen/sapprint.gen 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/sapprint.gen 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,6 +1,6 @@
#!/moira/bin/perl -Tw
-# $Id: sapprint.gen 3956 2010-01-05 20:56:56Z zacheiss $
+# $Id: sapprint.gen 4030 2011-03-04 21:01:14Z zacheiss $
# The following exit codes are defined and MUST BE CONSISTENT with the
# error codes the library uses:
@@ -16,7 +16,8 @@
$sth = $dbh->prepare("SELECT p.name, p.hwtype, p.location, p.duplexname, p.rp, m.name ".
"FROM printers p, machine m ".
- "WHERE p.rm=m.mach_id AND p.type='SAP'")
+ "WHERE p.rm=m.mach_id AND p.type='SAP' AND m.status !=3 AND " .
+ "(p.status = 1 OR p.status = 2)")
|| exit $MR_DBMS_ERR;
$sth->execute || exit $MR_DBMS_ERR;
Modified: trunk/third/moira/gen/spwatch.gen
===================================================================
--- trunk/third/moira/gen/spwatch.gen 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/gen/spwatch.gen 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,5 +1,5 @@
#!/moira/bin/perl -Tw
-# $Id: spwatch.gen 3956 2010-01-05 20:56:56Z zacheiss $
+# $Id: spwatch.gen 4030 2011-03-04 21:01:14Z zacheiss $
#
# The following exit codes are defined and MUST BE CONSISTENT with the
# error codes the library uses:
@@ -15,7 +15,8 @@
$sth = $dbh->prepare("SELECT m.name FROM printers p, ".
"machine m WHERE p.type = 'SAP' AND p.mach_id = ".
- "m.mach_id ORDER BY m.name") || exit $MR_DBMS_ERR;
+ "m.mach_id AND (p.status = 1 OR p.status = 2) AND m.status != 3 " .
+ "ORDER BY m.name") || exit $MR_DBMS_ERR;
$sth->execute || exit $MR_DBMS_ERR;
Modified: trunk/third/moira/incremental/ldap/winad.c
===================================================================
--- trunk/third/moira/incremental/ldap/winad.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/incremental/ldap/winad.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/incremental/ldap/winad.c $ $Id: winad.c 3992 2010-03-15 02:52:24Z zacheiss $ */
+/* $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/incremental/ldap/winad.c $ $Id: winad.c 4020 2010-09-02 13:46:09Z zacheiss $ */
/* ldap.incr arguments example
*
* arguments when moira creates the account - ignored by ldap.incr since the
@@ -2570,6 +2570,10 @@
ADD_ATTR("mitMoiraId", mitMoiraId_v, LDAP_MOD_REPLACE);
ADD_ATTR("groupType", groupTypeControl_v, LDAP_MOD_REPLACE);
+ if(!ActiveDirectory) {
+ ADD_ATTR("name", name_v, LDAP_MOD_REPLACE);
+ }
+
if (Exchange)
{
if(atoi(maillist) && !MailDisabled && email_isvalid(mail))
@@ -4394,8 +4398,8 @@
} else if(rc==MR_NO_MATCH) {
n = 0;
- ADD_ATTR("mitMoiraIMAPServer", mit_moira_imap_address_v,
- LDAP_MOD_REPLACE);
+ ADD_ATTR("mitMoiraIMAPAddress", mit_moira_imap_address_v,
+ LDAP_MOD_REPLACE);
mods[n] = NULL;
rc = ldap_modify_s(ldap_handle, distinguished_name, mods);
@@ -4407,8 +4411,8 @@
"Unable to set the mitMoiraIMAPAddress for %s : %s",
user_name, ldap_err2string(rc));
- }
-
+ }
+
argv[0] = user_name;
if (!(rc = mr_query("get_pobox", 1, argv, save_query_info, save_argv)))
@@ -5162,6 +5166,7 @@
sprintf(userAccountControlStr, "%ld", userAccountControl);
userAccountControl_v[0] = userAccountControlStr;
userPrincipalName_v[0] = upn;
+ sprintf(mail,"%s@%s", user_name, lowercase(ldap_domain));
if(ActiveDirectory)
cn_v[0] = user_name;
@@ -5195,7 +5200,6 @@
else
sprintf(new_dn, "uid=%s,%s,%s", user_name, user_ou, call_args[1]);
- sprintf(mail,"%s@%s", user_name, lowercase(ldap_domain));
if(Exchange)
sprintf(contact_mail, "%s@exchange-forwarding.mit.edu", user_name);
else
@@ -5359,7 +5363,7 @@
{
mitMoiraId_v[0] = call_args[2];
ADD_ATTR("mitMoiraId", mitMoiraId_v, LDAP_MOD_ADD);
- }
+ }
ADD_ATTR("altSecurityIdentities", altSecurityIdentities_v, LDAP_MOD_ADD);
@@ -9202,7 +9206,8 @@
while(gPtr) {
if (((s = strstr(gPtr->dn, "Public")) != (char *) NULL) ||
((s = strstr(gPtr->dn, "Recover")) != (char *) NULL) ||
- ((s = strstr(gPtr->dn, "Reserve")) != (char *) NULL))
+ ((s = strstr(gPtr->dn, "Reserve")) != (char *) NULL) ||
+ ((s = strstr(gPtr->dn, "PF")) != (char *) NULL))
{
gPtr = gPtr->next;
continue;
@@ -9517,6 +9522,7 @@
ULONG rc;
int Max_wait_time = 1000;
int Max_size_limit = LDAP_NO_LIMIT;
+ sasl_ssf_t max_ssf = 0;
LDAPControl **ctrls = NULL;
if (strlen(ldap_domain) == 0)
@@ -9551,6 +9557,8 @@
(void *)&Max_size_limit);
rc = ldap_set_option((*ldap_handle), LDAP_OPT_REFERRALS,
LDAP_OPT_OFF);
+ rc = ldap_set_option((*ldap_handle), LDAP_OPT_X_SASL_SSF_MAX,
+ &max_ssf);
rc = ldap_sasl_interactive_bind_ext_s((*ldap_handle), "", sasl_mech,
NULL, NULL, sasl_flags,
Modified: trunk/third/moira/libtool
===================================================================
--- trunk/third/moira/libtool 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/libtool 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
# libtoolT - Provide generalized library-building support services.
# Generated automatically by (GNU )
@@ -30,10 +30,10 @@
# the same distribution terms that you use for the rest of that program.
# A sed program that does not truncate output.
-SED="/bin/sed"
+SED="/usr/athena/bin/sed"
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="/bin/sed -e s/^X//"
+Xsed="/usr/athena/bin/sed -e s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
@@ -44,10 +44,10 @@
# ### BEGIN LIBTOOL CONFIG
-# Libtool was configured on host red-herring.mit.edu:
+# Libtool was configured on host brad-majors.mit.edu:
# Shell to use when invoking shell scripts.
-SHELL="/bin/sh"
+SHELL="/bin/bash"
# Whether or not to build shared libraries.
build_libtool_libs=yes
@@ -56,17 +56,17 @@
build_old_libs=yes
# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=no
+build_libtool_need_lc=yes
# Whether or not to disallow shared libs when runtime libs are static
allow_libtool_libs_with_static_runtimes=no
# Whether or not to optimize for fast installation.
-fast_install=yes
+fast_install=needless
# The host system.
host_alias=
-host=i686-redhat-linux-gnu
+host=sparc-sun-solaris2.10
# An echo program that does not interpret backslashes.
echo="echo"
@@ -85,16 +85,16 @@
with_gcc=yes
# An ERE matcher.
-EGREP="grep -E"
+EGREP="egrep"
# The linker used to build libraries.
-LD="/usr/bin/ld"
+LD="/usr/ccs/bin/ld"
# Whether we need hard or soft links.
LN_S="ln -s"
# A BSD-compatible nm program.
-NM="/usr/bin/nm -B"
+NM="/usr/ccs/bin/nm -p"
# A symbol stripping program
STRIP="strip"
@@ -138,7 +138,7 @@
pic_mode=default
# What is the maximum length of a command?
-max_cmd_len=32768
+max_cmd_len=262144
# Does compiler simultaneously support -c and -o options?
compiler_c_o="yes"
@@ -168,10 +168,10 @@
no_builtin_flag=" -fno-builtin"
# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="\${wl}--export-dynamic"
+export_dynamic_flag_spec=""
# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
+whole_archive_flag_spec="-z allextract\$convenience -z defaultextract"
# Compiler flag to generate thread-safe objects.
thread_safe_flag_spec=""
@@ -202,12 +202,10 @@
old_archive_from_expsyms_cmds=""
# Commands used to build and install a shared archive.
-archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
-archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
-cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
-\$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
- \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
-postinstall_cmds=""
+archive_cmds="\$CC -shared \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags"
+archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$lib.exp~cat \$export_symbols | \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$lib.exp~\$echo \\\"local: *; };\\\" >> \$lib.exp~
+ \$CC -shared \${wl}-M \${wl}\$lib.exp \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags~\$rm \$lib.exp"
+postinstall_cmds="chmod +x \$lib"
postuninstall_cmds=""
# Commands used to build a loadable module (assumed same as above if empty)
@@ -215,8 +213,8 @@
module_expsym_cmds=""
# Commands to strip libraries.
-old_striplib="strip --strip-debug"
-striplib="strip --strip-unneeded"
+old_striplib=""
+striplib=""
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -248,16 +246,16 @@
allow_undefined_flag=""
# Flag that forces no undefined symbols.
-no_undefined_flag=""
+no_undefined_flag=" -z text"
# Commands used to finish a libtool library installation in a directory.
-finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
+finish_cmds=""
# Same as above, but a single script fragment to be evaled but not shown.
finish_eval=""
# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
+global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BDRT][BDRT]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
# Transform the output of nm in a proper C declaration
global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
@@ -266,13 +264,13 @@
global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
# This is the shared library runtime path variable.
-runpath_var=LD_RUN_PATH
+runpath_var=
# This is the shared library path variable.
shlibpath_var=LD_LIBRARY_PATH
# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=no
+shlibpath_overrides_runpath=yes
# How to hardcode a shared library path into an executable.
hardcode_action=immediate
@@ -282,7 +280,7 @@
# Flag to hardcode $libdir into a binary during linking.
# This must work even if $libdir does not exist.
-hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
+hardcode_libdir_flag_spec="-R\$libdir"
# If ld is used when linking, flag to hardcode $libdir into
# a binary during linking. This must work even if $libdir does
@@ -302,7 +300,7 @@
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
# the resulting binary.
-hardcode_shlibpath_var=unsupported
+hardcode_shlibpath_var=no
# Set to yes if building a shared library automatically hardcodes DIR into the library
# and all subsequent libraries and executables linked against it.
@@ -310,16 +308,16 @@
# Variables whose values should be saved in libtool wrapper scripts and
# restored at relink time.
-variables_saved_for_relink="PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+variables_saved_for_relink="PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=unknown
+link_all_deplibs=yes
# Compile-time system search path for libraries
-sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../ /lib/i386-redhat-linux/3.4.6/ /lib/ /usr/lib/i386-redhat-linux/3.4.6/ /usr/lib/"
+sys_lib_search_path_spec=" /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/ /usr/lib/gcc/sparc-sun-solaris2.10/3.4.3/ /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../sparc-sun-solaris2.10/lib/sparc-sun-solaris2.10/3.4.3/ /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../sparc-sun-solaris2.10/lib/ /usr/ccs/lib/sparc-sun-solaris2.10/3.4.3/ /usr/ccs/lib/ /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../sparc-sun-solaris2.10/3.4.3/ /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../ /lib/sparc-sun-solaris2.10/3.4.3/ /lib/ /usr/lib/sparc-sun-solaris2.10/3.4.3/ /usr/lib/"
# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf /usr/i486-linux-libc5/lib /usr/athena/lib "
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
# Fix the shell variable $srcfile for the compiler.
fix_srcfile_path=""
@@ -6769,10 +6767,10 @@
# End:
# ### BEGIN LIBTOOL TAG CONFIG: CXX
-# Libtool was configured on host red-herring.mit.edu:
+# Libtool was configured on host brad-majors.mit.edu:
# Shell to use when invoking shell scripts.
-SHELL="/bin/sh"
+SHELL="/bin/bash"
# Whether or not to build shared libraries.
build_libtool_libs=yes
@@ -6787,11 +6785,11 @@
allow_libtool_libs_with_static_runtimes=no
# Whether or not to optimize for fast installation.
-fast_install=yes
+fast_install=needless
# The host system.
host_alias=
-host=i686-redhat-linux-gnu
+host=sparc-sun-solaris2.10
# An echo program that does not interpret backslashes.
echo="echo"
@@ -6810,16 +6808,16 @@
with_gcc=yes
# An ERE matcher.
-EGREP="grep -E"
+EGREP="egrep"
# The linker used to build libraries.
-LD="/usr/bin/ld"
+LD="/usr/ccs/bin/ld"
# Whether we need hard or soft links.
LN_S="ln -s"
# A BSD-compatible nm program.
-NM="/usr/bin/nm -B"
+NM="/usr/ccs/bin/nm -p"
# A symbol stripping program
STRIP="strip"
@@ -6863,7 +6861,7 @@
pic_mode=default
# What is the maximum length of a command?
-max_cmd_len=32768
+max_cmd_len=262144
# Does compiler simultaneously support -c and -o options?
compiler_c_o="yes"
@@ -6893,10 +6891,10 @@
no_builtin_flag=" -fno-builtin"
# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="\${wl}--export-dynamic"
+export_dynamic_flag_spec=""
# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
+whole_archive_flag_spec=""
# Compiler flag to generate thread-safe objects.
thread_safe_flag_spec=""
@@ -6927,9 +6925,10 @@
old_archive_from_expsyms_cmds=""
# Commands used to build and install a shared archive.
-archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
-archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
-postinstall_cmds=""
+archive_cmds="\$CC -shared -nostdlib \$LDFLAGS \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-h \$wl\$soname -o \$lib"
+archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$lib.exp~cat \$export_symbols | \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$lib.exp~\$echo \\\"local: *; };\\\" >> \$lib.exp~
+ \$CC -shared -nostdlib \${wl}-M \$wl\$lib.exp -o \$lib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags~\$rm \$lib.exp"
+postinstall_cmds="chmod +x \$lib"
postuninstall_cmds=""
# Commands used to build a loadable module (assumed same as above if empty)
@@ -6937,16 +6936,16 @@
module_expsym_cmds=""
# Commands to strip libraries.
-old_striplib="strip --strip-debug"
-striplib="strip --strip-unneeded"
+old_striplib=""
+striplib=""
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects="/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../crti.o /usr/lib/gcc/i386-redhat-linux/3.4.6/crtbeginS.o"
+predep_objects="/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/crti.o /usr/ccs/lib/values-Xa.o /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/crtbegin.o"
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects="/usr/lib/gcc/i386-redhat-linux/3.4.6/crtendS.o /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../crtn.o"
+postdep_objects="/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/crtend.o /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/crtn.o"
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -6954,11 +6953,11 @@
# Dependencies to place after the objects being linked to create a
# shared library.
-postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
+postdeps="-lstdc++ -lm -R/usr/sfw/lib -lgcc_s -R/usr/sfw/lib -lgcc_s"
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path="-L/usr/lib/gcc/i386-redhat-linux/3.4.6 -L/usr/lib/gcc/i386-redhat-linux/3.4.6 -L/usr/lib/gcc/i386-redhat-linux/3.4.6/../../.."
+compiler_lib_search_path="-R/usr/sfw/lib -L/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3 -L/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../sparc-sun-solaris2.10/lib -L/usr/ccs/lib -L/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../.."
# Method to check whether dependent libraries are shared objects.
deplibs_check_method="pass_all"
@@ -6970,16 +6969,16 @@
allow_undefined_flag=""
# Flag that forces no undefined symbols.
-no_undefined_flag=""
+no_undefined_flag=" \${wl}-z \${wl}defs"
# Commands used to finish a libtool library installation in a directory.
-finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
+finish_cmds=""
# Same as above, but a single script fragment to be evaled but not shown.
finish_eval=""
# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
+global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BDRT][BDRT]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
# Transform the output of nm in a proper C declaration
global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
@@ -6988,13 +6987,13 @@
global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
# This is the shared library runtime path variable.
-runpath_var=LD_RUN_PATH
+runpath_var=
# This is the shared library path variable.
shlibpath_var=LD_LIBRARY_PATH
# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=no
+shlibpath_overrides_runpath=yes
# How to hardcode a shared library path into an executable.
hardcode_action=immediate
@@ -7004,7 +7003,7 @@
# Flag to hardcode $libdir into a binary during linking.
# This must work even if $libdir does not exist.
-hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
+hardcode_libdir_flag_spec="\${wl}-R \$wl\$libdir"
# If ld is used when linking, flag to hardcode $libdir into
# a binary during linking. This must work even if $libdir does
@@ -7032,16 +7031,16 @@
# Variables whose values should be saved in libtool wrapper scripts and
# restored at relink time.
-variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+variables_saved_for_relink="PATH LD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
# Whether libtool must link a program against all its dependency libraries.
link_all_deplibs=unknown
# Compile-time system search path for libraries
-sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../ /lib/i386-redhat-linux/3.4.6/ /lib/ /usr/lib/i386-redhat-linux/3.4.6/ /usr/lib/"
+sys_lib_search_path_spec=" /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/ /usr/lib/gcc/sparc-sun-solaris2.10/3.4.3/ /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../sparc-sun-solaris2.10/lib/sparc-sun-solaris2.10/3.4.3/ /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../sparc-sun-solaris2.10/lib/ /usr/ccs/lib/sparc-sun-solaris2.10/3.4.3/ /usr/ccs/lib/ /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../sparc-sun-solaris2.10/3.4.3/ /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../ /lib/sparc-sun-solaris2.10/3.4.3/ /lib/ /usr/lib/sparc-sun-solaris2.10/3.4.3/ /usr/lib/"
# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf /usr/i486-linux-libc5/lib /usr/athena/lib "
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
# Fix the shell variable $srcfile for the compiler.
fix_srcfile_path=""
@@ -7065,10 +7064,10 @@
# ### BEGIN LIBTOOL TAG CONFIG: F77
-# Libtool was configured on host red-herring.mit.edu:
+# Libtool was configured on host brad-majors.mit.edu:
# Shell to use when invoking shell scripts.
-SHELL="/bin/sh"
+SHELL="/bin/bash"
# Whether or not to build shared libraries.
build_libtool_libs=yes
@@ -7083,11 +7082,11 @@
allow_libtool_libs_with_static_runtimes=no
# Whether or not to optimize for fast installation.
-fast_install=yes
+fast_install=needless
# The host system.
host_alias=
-host=i686-redhat-linux-gnu
+host=sparc-sun-solaris2.10
# An echo program that does not interpret backslashes.
echo="echo"
@@ -7100,22 +7099,22 @@
LTCC="gcc"
# A language-specific compiler.
-CC="g77"
+CC="f77"
# Is the compiler the GNU C compiler?
-with_gcc=yes
+with_gcc=
# An ERE matcher.
-EGREP="grep -E"
+EGREP="egrep"
# The linker used to build libraries.
-LD="/usr/bin/ld"
+LD="/usr/ccs/bin/ld"
# Whether we need hard or soft links.
LN_S="ln -s"
# A BSD-compatible nm program.
-NM="/usr/bin/nm -B"
+NM="/usr/ccs/bin/nm -p"
# A symbol stripping program
STRIP="strip"
@@ -7155,14 +7154,14 @@
exeext=""
# Additional compiler flags for building library objects.
-pic_flag=" -fPIC"
+pic_flag=""
pic_mode=default
# What is the maximum length of a command?
-max_cmd_len=32768
+max_cmd_len=262144
# Does compiler simultaneously support -c and -o options?
-compiler_c_o="yes"
+compiler_c_o="no"
# Must we lock files when doing compilation ?
need_locks="no"
@@ -7189,10 +7188,10 @@
no_builtin_flag=""
# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="\${wl}--export-dynamic"
+export_dynamic_flag_spec=""
# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
+whole_archive_flag_spec="-z allextract\$convenience -z defaultextract"
# Compiler flag to generate thread-safe objects.
thread_safe_flag_spec=""
@@ -7223,12 +7222,10 @@
old_archive_from_expsyms_cmds=""
# Commands used to build and install a shared archive.
-archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
-archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
-cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
-\$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
- \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
-postinstall_cmds=""
+archive_cmds="\$CC -shared \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags"
+archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$lib.exp~cat \$export_symbols | \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$lib.exp~\$echo \\\"local: *; };\\\" >> \$lib.exp~
+ \$CC -shared \${wl}-M \${wl}\$lib.exp \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags~\$rm \$lib.exp"
+postinstall_cmds="chmod +x \$lib"
postuninstall_cmds=""
# Commands used to build a loadable module (assumed same as above if empty)
@@ -7236,8 +7233,8 @@
module_expsym_cmds=""
# Commands to strip libraries.
-old_striplib="strip --strip-debug"
-striplib="strip --strip-unneeded"
+old_striplib=""
+striplib=""
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -7269,16 +7266,16 @@
allow_undefined_flag=""
# Flag that forces no undefined symbols.
-no_undefined_flag=""
+no_undefined_flag=" -z text"
# Commands used to finish a libtool library installation in a directory.
-finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
+finish_cmds=""
# Same as above, but a single script fragment to be evaled but not shown.
finish_eval=""
# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
+global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BDRT][BDRT]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
# Transform the output of nm in a proper C declaration
global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
@@ -7287,13 +7284,13 @@
global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
# This is the shared library runtime path variable.
-runpath_var=LD_RUN_PATH
+runpath_var=
# This is the shared library path variable.
shlibpath_var=LD_LIBRARY_PATH
# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=no
+shlibpath_overrides_runpath=yes
# How to hardcode a shared library path into an executable.
hardcode_action=immediate
@@ -7303,7 +7300,7 @@
# Flag to hardcode $libdir into a binary during linking.
# This must work even if $libdir does not exist.
-hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
+hardcode_libdir_flag_spec="-R\$libdir"
# If ld is used when linking, flag to hardcode $libdir into
# a binary during linking. This must work even if $libdir does
@@ -7323,7 +7320,7 @@
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
# the resulting binary.
-hardcode_shlibpath_var=unsupported
+hardcode_shlibpath_var=no
# Set to yes if building a shared library automatically hardcodes DIR into the library
# and all subsequent libraries and executables linked against it.
@@ -7331,16 +7328,16 @@
# Variables whose values should be saved in libtool wrapper scripts and
# restored at relink time.
-variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+variables_saved_for_relink="PATH LD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=unknown
+link_all_deplibs=yes
# Compile-time system search path for libraries
-sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../ /lib/i386-redhat-linux/3.4.6/ /lib/ /usr/lib/i386-redhat-linux/3.4.6/ /usr/lib/"
+sys_lib_search_path_spec=""
# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf /usr/i486-linux-libc5/lib /usr/athena/lib "
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
# Fix the shell variable $srcfile for the compiler.
fix_srcfile_path=""
Modified: trunk/third/moira/man/blanche.1
===================================================================
--- trunk/third/moira/man/blanche.1 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/man/blanche.1 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,5 +1,5 @@
.TH BLANCHE 1 "14 Sep 1988" "Project Athena"
-\" RCSID: $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/man/blanche.1 $ $Id: blanche.1 3956 2010-01-05 20:56:56Z zacheiss $
+\" RCSID: $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/man/blanche.1 $ $Id: blanche.1 4035 2011-04-18 06:17:33Z zacheiss $
.SH NAME
blanche \- examine and modify memberships in Moira lists
.SH SYNOPSIS
@@ -122,7 +122,7 @@
.IP \fB-group\ \fR(\fB-G\fR)\ \fRor\ \fB-notgroup\ \fR(\fB-NG\fR)
Toggle whether or not the list is a group. (Groups can be used on the
ACLs of directories in AFS.)
-.IP \fB-nfsgroup\ \fR(\fB-N\fR)\ \fRor\ \fB-notnfs\ \fR(\fB-NN\fR)
+.IP \fB-nfs\ \fR(\fB-N\fR)\ \fRor\ \fB-notnfs\ \fR(\fB-NN\fR)
Toggle whether or not the list is an NFS group. (NFS groups are
included in a user's hesiod group list and in Moira-generated NFS
credentials file, and can be used for controlling access to NFS exported
Modified: trunk/third/moira/man/eunice.1
===================================================================
--- trunk/third/moira/man/eunice.1 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/man/eunice.1 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-.TH MITCH 1 "6 Jan 2010" "MIT Athena"
+.TH EUNICE 1 "17 Mar 2010" "MIT Athena"
\" RCSID: $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/man/mitch.1 $ $Id: mitch.1 3956 2010-01-05 20:56:56Z zacheiss $
.SH NAME
eunice \- examine and modify informtion about printers in Moira
@@ -63,6 +63,13 @@
.IP \fB-lpracl\ \fIlist\ \fRor\ \fB-ac\ \fIlist\fR
Set the restrict list for the specified printer to \fIlist\fR.
+.IP \fB-addhwaddr\ \fIhwaddr\ \fRor\ \fB-ahw\ \fIhwaddr\fR
+This will associated the hardware address \fIhwaddr\fR with the
+host record for the specified printer.
+.IP \fB-delhwaddr\ \fIhwaddr\fRor \ \fB-dhw\ \fIhwaddr\fR
+This will disassociate the hardware address \fIhwaddr\fR from the
+host record for the specified printer.
+
.IP \fB-verbose\ \fRor\ \fB-v\fR
Give more information. With this flag, mitch will display the
queries it is making to the moira server.
Modified: trunk/third/moira/man/moira.1
===================================================================
--- trunk/third/moira/man/moira.1 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/man/moira.1 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,5 +1,5 @@
.TH MOIRA 1 "29 Nov 1988" "Project Athena"
-\" RCSID: $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/man/moira.1 $ $Id: moira.1 3956 2010-01-05 20:56:56Z zacheiss $
+\" RCSID: $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/man/moira.1 $ $Id: moira.1 4025 2010-11-30 17:17:02Z zacheiss $
.SH NAME
moira, listmaint, usermaint, dcmmaint \- maintain information stored in moira
.SH SYNOPSIS
@@ -90,5 +90,6 @@
Jean Marie Diaz, Mark Roman, Chris Peterson, Mark Rosenstein and a
cast of thousands
.SH "SEE ALSO"
-chfn(1), chpobox(1), chsh(1), mailmaint(1), blanche(1),
+chfn(1), chpobox(1), chsh(1), mailmaint(1), listmaint(1),
+blanche(1), eunice(1), mitch(1), stanley(1), stella(1),
Moira section of the Project Athena Technical Plan
Modified: trunk/third/moira/man/stella.1
===================================================================
--- trunk/third/moira/man/stella.1 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/man/stella.1 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,5 +1,5 @@
-.TH STELLA 1 "10 Feb 2000" "MIT Athena"
-\" RCSID: $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/man/stella.1 $ $Id: stella.1 3956 2010-01-05 20:56:56Z zacheiss $
+.TH STELLA 1 "17 Mar 2010" "MIT Athena"
+\" RCSID: $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/man/stella.1 $ $Id: stella.1 4001 2010-04-21 20:38:45Z zacheiss $
.SH NAME
stella \- examine and modify information about hosts in Moira
.SH SYNOPSIS
@@ -45,6 +45,16 @@
.IP \fB-deletecontainer\ \fIcontainer\fRor \ \fB-dcn\ \fIcontainer\fR
This will delete the specified host from \fIcontainer\fR.
+.IP \fB-listhwaddr\ \fRor\ \fB-lhw\fR
+This will list the Ethernet hardware addresses associated with the
+specified host.
+.IP \fB-addhwaddr\ \fIhwaddr\ \fRor\ \fB-ahw\ \fIhwaddr\fR
+This will associated the hardware address \fIhwaddr\fR with the
+specified host.
+.IP \fB-delhwaddr\ \fIhwaddr\fRor \ \fB-dhw\ \fIhwaddr\fR
+This will disassociate the hardware address \fIhwaddr\fR from the
+specified host.
+
.IP \fB-vendor\ \fIvendor\ \fRor\ \fB-V\ \fIvendor\fR
Update the vendor field for the specified host to \fIvendor\fR.
.IP \fB-model\ \fImodel\ \fRor\ \fB-M\ \fImodel\fR
Modified: trunk/third/moira/regtape/common.h
===================================================================
--- trunk/third/moira/regtape/common.h 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/regtape/common.h 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: common.h 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: common.h 4041 2011-06-23 22:09:46Z zacheiss $
*
* Copyright (C) 1987-1999 by the Massachusetts Institute of Technology
*
@@ -22,6 +22,9 @@
char *xaddress;
char *xphone1;
char *xphone2;
+
+ /* Only used by student load */
+ char *school_code;
};
void fixphone(char *phone);
Modified: trunk/third/moira/regtape/staff.pc
===================================================================
--- trunk/third/moira/regtape/staff.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/regtape/staff.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: staff.pc 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: staff.pc 4041 2011-06-23 22:09:46Z zacheiss $
*
* Load data into Moira from Personnel Office data file
*
@@ -19,7 +19,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/regtape/staff.pc $ $Id: staff.pc 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/regtape/staff.pc $ $Id: staff.pc 4041 2011-06-23 22:09:46Z zacheiss $");
/* File format is:
*
@@ -184,6 +184,9 @@
e.id = id;
e.haddr = e.hphone = "";
+ /* Not used for employees. */
+ e.school_code = "";
+
/* The following is really gross, but it happens to successfully convert
* new-style Warehouse office descriptions into (more-readable) old-style
* Personnel Office office descriptions.
@@ -239,7 +242,8 @@
e.xtitle = strtrim(title);
e.type = "MITS";
- if (strstr(uppercase(e.xtitle), "PROF") ||
+ if ((strstr(uppercase(e.xtitle), "PROF") &&
+ !strstr(uppercase(e.xtitle), "PROFESSION")) ||
strstr(uppercase(e.xtitle), "LECTURE"))
e.type = "FACULTY";
if (!strcmp(e.dept, "LINCOLN LAB"))
Modified: trunk/third/moira/regtape/stellar.pl
===================================================================
--- trunk/third/moira/regtape/stellar.pl 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/regtape/stellar.pl 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,5 +1,5 @@
#!/moira/bin/perl -Tw
-# $Id: stellar.pl 3956 2010-01-05 20:56:56Z zacheiss $
+# $Id: stellar.pl 4037 2011-04-21 16:18:33Z zacheiss $
$db = "";
$mrtest = "mrtest";
@@ -68,7 +68,7 @@
}
# Create list if it doesn't exist.
- &check_list($stellargroup, "stellar-group-admin", 0, "Automatically imported from Stellar");
+ &check_list($stellargroup, "stellar-group-admin", 1, "Automatically imported from Stellar");
# Now fill in lists.
%mrmembers = ();
Modified: trunk/third/moira/regtape/student.pc
===================================================================
--- trunk/third/moira/regtape/student.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/regtape/student.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: student.pc 3956 2010-01-05 20:56:56Z zacheiss $
+/* $id: student.pc 3956 2010-01-05 20:56:56Z zacheiss $
*
* Load data into Moira from Registrar's Office data file
*
@@ -21,7 +21,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/regtape/student.pc $ $Id: student.pc 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/regtape/student.pc $ $Id: student.pc 4041 2011-06-23 22:09:46Z zacheiss $");
/* File format is:
@@ -67,6 +67,8 @@
#define LEN_OADDR 30
#define LOC_OPHONE (LOC_OADDR + LEN_OADDR)
#define LEN_OPHONE 20
+#define LOC_SCHOOL_CODE (LOC_OPHONE + LEN_OPHONE)
+#define LEN_SCHOOL_CODE 2
EXEC SQL BEGIN DECLARE SECTION;
int who;
@@ -136,7 +138,11 @@
while ((e = get_next_entry(in)))
{
- process_entry(e, 1);
+ /* Don't require secure registration for cross-registered students. */
+ if (!strcmp(e->school_code, "Z"))
+ process_entry(e, 0);
+ else
+ process_entry(e, 1);
EXEC SQL COMMIT WORK;
if (sqlca.sqlcode)
{
@@ -168,6 +174,7 @@
static char state[LEN_STATE + 1], phone[LEN_PHONE + 1];
static char ophone[LEN_OPHONE + 1], title[128];
static char zip[LEN_ZIP + 1], oaddr[LEN_OADDR + 1];
+ static char school_code[LEN_SCHOOL_CODE + 1];
static int nyear = 0;
int ends_jr, ends_iii, ends_iv, ends_sr, ends_ii, ends_v;
char *p;
@@ -213,6 +220,8 @@
strtrim(oaddr);
strlcpy(ophone, &buf[LOC_OPHONE], LEN_OPHONE + 1);
strtrim(ophone);
+ strlcpy(school_code, &buf[LOC_SCHOOL_CODE], LEN_SCHOOL_CODE + 1);
+ strtrim(school_code);
e.first = first;
e.last = last;
@@ -245,6 +254,9 @@
e.dept = course;
+ /* Used to detect cross-registered students. */
+ e.school_code = school_code;
+
e.oaddr = oaddr;
fixaddress(e.oaddr);
e.ophone = e.xphone2 = ophone;
Modified: trunk/third/moira/regtape/student.sql
===================================================================
--- trunk/third/moira/regtape/student.sql 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/regtape/student.sql 2011-06-30 16:16:12 UTC (rev 25198)
@@ -3,6 +3,6 @@
set pagesize 0
set linesize 256
spool /moira/load/student.input.unsorted
-select rpad(nvl(mit_id, ' '), 9, ' ') || rpad(nvl(last_name, ' '), 30, ' ') || rpad(nvl(first_name, ' '), 30, ' ') || rpad(nvl(middle_name, ' '), 30, ' ') || rpad(nvl(student_year, ' '), 1, ' ') || rpad(nvl(department, ' '), 4, ' ') || rpad(nvl(term_street1, ' '), 30, ' ') || rpad(nvl(term_city, ' '), 40, ' ') || rpad(nvl(term_state, ' '), 2, ' ') || rpad(nvl(term_zip, ' '), 9, ' ') || rpad(nvl(term_phone1, ' '), 20, ' ') || rpad(nvl(office_location, ' '), 30, ' ') || rpad(nvl(office_phone, ' '), 20, ' ') from wareuser.moira_student4;
+select rpad(nvl(mit_id, ' '), 9, ' ') || rpad(nvl(last_name, ' '), 30, ' ') || rpad(nvl(first_name, ' '), 30, ' ') || rpad(nvl(middle_name, ' '), 30, ' ') || rpad(nvl(student_year, ' '), 1, ' ') || rpad(nvl(department, ' '), 4, ' ') || rpad(nvl(term_street1, ' '), 30, ' ') || rpad(nvl(term_city, ' '), 40, ' ') || rpad(nvl(term_state, ' '), 2, ' ') || rpad(nvl(term_zip, ' '), 9, ' ') || rpad(nvl(term_phone1, ' '), 20, ' ') || rpad(nvl(office_location, ' '), 30, ' ') || rpad(nvl(office_phone, ' '), 20, ' ') || rpad(nvl(school_code, ' '), 1, ' ') from wareuser.moira_student;
spool off
quit
Modified: trunk/third/moira/server/increment.pc
===================================================================
--- trunk/third/moira/server/increment.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/server/increment.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: increment.pc 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: increment.pc 4021 2010-09-02 15:07:00Z zacheiss $
*
* Deal with incremental updates
*
@@ -21,7 +21,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/increment.pc $ $Id: increment.pc 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/increment.pc $ $Id: increment.pc 4021 2010-09-02 15:07:00Z zacheiss $");
extern char *whoami;
extern char *table_name[];
@@ -103,11 +103,46 @@
beforec = 14;
break;
case MACHINE_TABLE:
- sprintf(stmt_buf, "SELECT m.name, m.vendor, m.mach_id FROM machine m "
+ sprintf(stmt_buf, "SELECT m.name, m.mach_id, m.vendor, m.model, m.os, m.location, "
+ "m.contact, m.billing_contact, m.account_number, m.status, m.address,"
+ "m.owner_type, m.owner_id, m.acomment, m.ocomment FROM machine m "
"WHERE %s", qual);
dosql(before);
- beforec = 3;
+ beforec = 15;
+ name = xmalloc(0);
+ id = atoi(before[12]);
+ if (!strncmp(before[11], "USER", 4))
+ {
+ id_to_name(id, USERS_TABLE, &name);
+ strcpy(before[12], name);
+ }
+ else if (!strncmp(before[11], "LIST", 4))
+ {
+ id_to_name(id, LIST_TABLE, &name);
+ strcpy(before[12], name);
+ }
+ else if (!strncmp(before[11], "KERBEROS", 8))
+ {
+ id_to_name(id, STRINGS_TABLE, &name);
+ strcpy(before[12], name);
+ }
+ id = atoi(before[13]);
+ id_to_name(id, STRINGS_TABLE, &name);
+ strcpy(before[13], name);
+ id = atoi(before[14]);
+ id_to_name(id, STRINGS_TABLE, &name);
+ strcpy(before[14], name);
break;
+ case HOSTALIAS_TABLE:
+ strcpy(before[0], argv[0]);
+ strcpy(before[1], argv[1]);
+ beforec = 2;
+ break;
+ case HWADDRMAP_TABLE:
+ strcpy(before[0], argv[0]);
+ strcpy(before[1], argv[1]);
+ beforec = 2;
+ break;
case CLUSTERS_TABLE:
sprintf(stmt_buf, "SELECT c.name, c.description, c.location, "
"c.clu_id FROM clusters c WHERE %s", qual);
@@ -287,11 +322,46 @@
afterc = 14;
break;
case MACHINE_TABLE:
- sprintf(stmt_buf, "SELECT m.name, m.vendor, m.mach_id FROM machine m "
- "WHERE %s", qual);
+ sprintf(stmt_buf, "SELECT m.name, m.mach_id, m.vendor, m.model, m.os, m.location, "
+ "m.contact, m.billing_contact, m.account_number, m.status, m.address,"
+ "m.owner_type, m.owner_id, m.acomment, m.ocomment FROM machine m "
+ "WHERE %s", qual);
dosql(after);
- afterc = 3;
+ afterc = 15;
+ name = xmalloc(0);
+ id = atoi(after[12]);
+ if (!strncmp(after[11], "USER", 4))
+ {
+ id_to_name(id, USERS_TABLE, &name);
+ strcpy(after[12], name);
+ }
+ else if (!strncmp(after[11], "LIST", 4))
+ {
+ id_to_name(id, LIST_TABLE, &name);
+ strcpy(after[12], name);
+ }
+ else if (!strncmp(after[11], "KERBEROS", 8))
+ {
+ id_to_name(id, STRINGS_TABLE, &name);
+ strcpy(after[12], name);
+ }
+ id = atoi(after[13]);
+ id_to_name(id, STRINGS_TABLE, &name);
+ strcpy(after[13], name);
+ id = atoi(after[14]);
+ id_to_name(id, STRINGS_TABLE, &name);
+ strcpy(after[14], name);
break;
+ case HOSTALIAS_TABLE:
+ strcpy(after[0], argv[0]);
+ strcpy(after[1], argv[1]);
+ afterc = 2;
+ break;
+ case HWADDRMAP_TABLE:
+ strcpy(after[0], argv[0]);
+ strcpy(after[1], argv[1]);
+ afterc = 2;
+ break;
case CLUSTERS_TABLE:
sprintf(stmt_buf, "SELECT c.name, c.description, c.location, "
"c.clu_id FROM clusters c WHERE %s", qual);
@@ -552,7 +622,7 @@
return;
if (inc_running)
- com_err(whoami, 0, "incremental timeout on pid %d", inc_pid);
+ critical_alert(whoami, "moirad", "incremental timeout on pid %d", inc_pid);
sq_remove_data(incremental_exec, &iu);
argv[1] = iu->table;
@@ -579,7 +649,7 @@
execv(prog, argv);
_exit(1);
case -1:
- com_err(whoami, 0, "Failed to start incremental update");
+ critical_alert(whoami, "moirad", "Failed to start incremental update %s", prog);
break;
default:
inc_running = 1;
Modified: trunk/third/moira/server/mr_server.h
===================================================================
--- trunk/third/moira/server/mr_server.h 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/server/mr_server.h 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: mr_server.h 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: mr_server.h 4001 2010-04-21 20:38:45Z zacheiss $
*
* Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
* For copying and distribution information, please see the file
@@ -252,7 +252,7 @@
int setup_ghst(struct query *q, char *argv[], client *cl);
int setup_ahst(struct query *q, char *argv[], client *cl);
int setup_ahal(struct query *q, char *argv[], client *cl);
-int setup_uhha(struct query *q, char *argv[], client *cl);
+int setup_ahha(struct query *q, char *argv[], client *cl);
int setup_aprn(struct query *q, char *argv[], client *cl);
int setup_dpsv(struct query *q, char *argv[], client *cl);
int setup_dcon(struct query *q, char *argv[], client *cl);
Modified: trunk/third/moira/server/qaccess.pc
===================================================================
--- trunk/third/moira/server/qaccess.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/server/qaccess.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: qaccess.pc 3979 2010-02-16 20:26:57Z zacheiss $
+/* $Id: qaccess.pc 4016 2010-08-26 02:49:36Z zacheiss $
*
* Check access to queries
*
@@ -25,7 +25,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/qaccess.pc $ $Id: qaccess.pc 3979 2010-02-16 20:26:57Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/qaccess.pc $ $Id: qaccess.pc 4016 2010-08-26 02:49:36Z zacheiss $");
extern char *whoami;
extern int dbms_errno, mr_errcode;
@@ -101,7 +101,7 @@
if (q->version >= 12)
{
if (strcmp(argv[16], strtrim(sponsor_type)) ||
- (sponsor_id != atoi(argv[17])) ||
+ (sponsor_id != *(int *)argv[17]) ||
strcmp(argv[18], strtrim(expiration)))
return MR_PERM;
}
Modified: trunk/third/moira/server/qsetup.pc
===================================================================
--- trunk/third/moira/server/qsetup.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/server/qsetup.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: qsetup.pc 3985 2010-02-23 21:00:36Z zacheiss $
+/* $Id: qsetup.pc 4011 2010-07-06 15:55:47Z zacheiss $
*
* Query setup routines
*
@@ -21,7 +21,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/qsetup.pc $ $Id: qsetup.pc 3985 2010-02-23 21:00:36Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/qsetup.pc $ $Id: qsetup.pc 4011 2010-07-06 15:55:47Z zacheiss $");
extern char *whoami;
extern int dbms_errno, mr_errcode;
@@ -1290,10 +1290,10 @@
return MR_SUCCESS;
}
-/* setup_uhha(): Check characters in hwaddr, and make sure it's not
+/* setup_ahha(): Check characters in hwaddr, and make sure it's not
* a duplicate.
*/
-int setup_uhha(struct query *q, char **argv, client *cl)
+int setup_ahha(struct query *q, char **argv, client *cl)
{
EXEC SQL BEGIN DECLARE SECTION;
char *hwaddr = argv[1];
@@ -1301,6 +1301,9 @@
EXEC SQL END DECLARE SECTION;
char *p;
+ if (strlen(hwaddr) == 0)
+ return MR_BAD_CHAR;
+
if (*hwaddr && strcasecmp(hwaddr, "unknown"))
{
for (p = hwaddr; *p; p++)
@@ -1314,7 +1317,7 @@
return MR_ADDRESS;
EXEC SQL SELECT COUNT(hwaddr) INTO :count
- FROM machine WHERE hwaddr = :hwaddr;
+ FROM hwaddrmap WHERE hwaddr = :hwaddr;
if (count)
return MR_NOT_UNIQUE;
}
@@ -1396,10 +1399,8 @@
mid = *(int *)argv[6 + row + idx];
if (mid == -1)
{
- if (!strcasecmp(argv[PRN_TYPE + row], "SAP"))
- service = "PRINT";
- else if (!strcasecmp(argv[PRN_TYPE + row], "DORM") ||
- !strcasecmp(argv[PRN_TYPE + row], "CLUSTER"))
+ if (!strcasecmp(argv[PRN_TYPE + row], "DORM") ||
+ !strcasecmp(argv[PRN_TYPE + row], "CLUSTER"))
service = "CUPS-CLUSTER";
else
service = "CUPS-PRINT";
Modified: trunk/third/moira/server/qsupport.pc
===================================================================
--- trunk/third/moira/server/qsupport.pc 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/server/qsupport.pc 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: qsupport.pc 3956 2010-01-05 20:56:56Z zacheiss $
+/* $Id: qsupport.pc 4017 2010-08-26 19:09:55Z zacheiss $
*
* Special query routines
*
@@ -19,7 +19,7 @@
EXEC SQL INCLUDE sqlca;
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/qsupport.pc $ $Id: qsupport.pc 3956 2010-01-05 20:56:56Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/qsupport.pc $ $Id: qsupport.pc 4017 2010-08-26 19:09:55Z zacheiss $");
extern char *whoami, *table_name[];
extern int dbms_errno, mr_errcode;
@@ -824,8 +824,7 @@
rargv[0] = "LIST";
EXEC SQL DECLARE csr113 CURSOR FOR
SELECT name FROM list
- WHERE (acl_type = :type AND acl_id = :id)
- OR (memacl_type = :type AND memacl_id = :id);
+ WHERE (acl_type = :type AND acl_id = :id);
if (dbms_errno)
return mr_errcode;
EXEC SQL OPEN csr113;
Modified: trunk/third/moira/server/queries2.c
===================================================================
--- trunk/third/moira/server/queries2.c 2011-06-30 05:35:52 UTC (rev 25197)
+++ trunk/third/moira/server/queries2.c 2011-06-30 16:16:12 UTC (rev 25198)
@@ -1,4 +1,4 @@
-/* $Id: queries2.c 3989 2010-03-10 18:18:16Z zacheiss $
+/* $Id: queries2.c 4001 2010-04-21 20:38:45Z zacheiss $
*
* This file defines the query dispatch table
*
@@ -13,7 +13,7 @@
#include "mr_et.h"
-RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/queries2.c $ $Id: queries2.c 3989 2010-03-10 18:18:16Z zacheiss $");
+RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/queries2.c $ $Id: queries2.c 4001 2010-04-21 20:38:45Z zacheiss $");
/* VALOBJS
* These are commonly used validation objects, defined here so that they
@@ -1351,6 +1351,11 @@
"hwaddr",
};
+static char *ghhm_fields[] = {
+ "name",
+ "name", "hwaddr",
+};
+
static char *ahst2_fields[] = {
"name", "vendor", "model", "os", "location", "contact", "use",
"status", "subnet", "address", "ace_type", "ace_name",
@@ -1570,28 +1575,48 @@
set_modtime_by_id,
};
-static char *uhha_fields[] = {
- "name",
- "hwaddr"
+static char *ahha_fields[] = {
+ "name", "hwaddr",
};
-static struct valobj uhha_valobj[] = {
+static struct valobj ahha_valobj[] = {
{V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
- {V_CHAR, 1, MACHINE_TABLE, "hwaddr"},
+ {V_CHAR, 1, HWADDRMAP_TABLE, "hwaddr"},
};
-static struct validate uhha_validate = {
- uhha_valobj,
+static struct validate ahha_validate = {
+ ahha_valobj,
2,
0,
0,
0,
"mach_id",
0,
- setup_uhha,
- set_modtime_by_id,
+ setup_ahha,
+ set_mach_modtime_by_id,
};
+static char *dhha_fields[] = {
+ "name", "hwaddr",
+};
+
+static struct valobj dhha_valobj[] = {
+ {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
+ {V_CHAR, 1, HWADDRMAP_TABLE, "hwaddr"},
+};
+
+static struct validate dhha_validate = {
+ dhha_valobj,
+ 2,
+ 0,
+ 0,
+ 0,
+ "mach_id",
+ 0,
+ 0,
+ set_mach_modtime_by_id,
+};
+
static char *dhst_fields[] = {
"name",
};
@@ -5719,10 +5744,10 @@
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",
+ "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, hwaddrmap hw",
ghbh2_fields,
21,
- "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
+ "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m.mach_id AND m.mach_id != 0 AND s.snet_id = m.snet_id",
1,
"m.name",
&ghst_validate,
@@ -5736,10 +5761,10 @@
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",
+ "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, hwaddrmap hw",
ghbh6_fields,
22,
- "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
+ "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m.mach_id AND m.mach_id != 0 AND s.snet_id = m.snet_id",
1,
"m.name",
&ghst_validate,
@@ -5753,10 +5778,10 @@
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",
+ "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, hwaddrmap hw",
ghbh_fields,
23,
- "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
+ "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m.mach_id AND m.mach_id != 0 AND s.snet_id = m.snet_id",
1,
"m.name",
&ghst_validate,
@@ -5785,18 +5810,35 @@
"ghha",
2,
MR_Q_RETRIEVE,
- "m",
- MACHINE_TABLE,
- "m.hwaddr FROM machine m",
+ "hw",
+ HWADDRMAP_TABLE,
+ "hw.hwaddr FROM machine m, hwaddrmap hw",
ghha_fields,
1,
- "m.name LIKE UPPER('%s')",
+ "m.name LIKE UPPER('%s') AND m.mach_id = hw.mach_id AND rownum < 2",
1,
+ "hw.hwaddr",
NULL,
- NULL,
},
{
+ /* Q_GHHM - GET_HOST_HWADDR_MAPPING */
+ "get_host_hwaddr_mapping",
+ "ghhm",
+ 2,
+ MR_Q_RETRIEVE,
+ "hw",
+ HWADDRMAP_TABLE,
+ "m.name, hw.hwaddr FROM machine m, hwaddrmap hw",
+ ghhm_fields,
+ 2,
+ "m.name LIKE UPPER('%s') AND m.mach_id = hw.mach_id",
+ 1,
+ "m.name",
+ NULL,
+ },
+
+ {
/* Q_AHST - ADD_HOST, v2 */ /* uses prefetch_value() for mach_id */
"add_host",
"ahst",
@@ -5903,19 +5945,53 @@
"update_host_hwaddr",
"uhha",
2,
- MR_Q_UPDATE,
- "m",
- MACHINE_TABLE,
- "machine SET hwaddr = NVL('%s', CHR(0))",
- uhha_fields,
- 1,
- "mach_id = %d",
- 1,
+ MR_Q_APPEND,
+ "hw",
+ HWADDRMAP_TABLE,
+ "INTO hwaddrmap (mach_id, hwaddr) VALUES (%d, NVL('%s', CHR(0)))",
+ ahha_fields,
+ 2,
+ 0,
+ 0,
NULL,
- &uhha_validate,
+ &ahha_validate,
},
{
+ /* Q_AHHA - ADD_HOST_HWADDR */
+ "add_host_hwaddr",
+ "ahha",
+ 2,
+ MR_Q_APPEND,
+ "hw",
+ HWADDRMAP_TABLE,
+ "INTO hwaddrmap (mach_id, hwaddr) VALUES (%d, NVL('%s', CHR(0)))",
+ ahha_fields,
+ 2,
+ 0,
+ 0,
+ NULL,
+ &ahha_validate,
+ },
+
+ {
+ /* Q_DHHA - DELETE_HOST_HWADDR */
+ "delete_host_hwaddr",
+ "dhha",
+ 2,
+ MR_Q_DELETE,
+ "hw",
+ HWADDRMAP_TABLE,
+ 0,
+ dhha_fields,
+ 0,
+ "mach_id = %d AND hwaddr = LOWER('%s')",
+ 2,
+ NULL,
+ &dhha_validate,
+ },
+
+ {
/* Q_DHST - DELETE_HOST */
"delete_host",
"dhst",
@@ -7785,7 +7861,6 @@
&VDfix_modby,
},
-
{
/* Q_GPBD - GET_PRINTER_BY_DUPLEXNAME, v2 */
"get_printer_by_duplexname",
@@ -7828,10 +7903,10 @@
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",
+ "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, hwaddrmap hw",
gpbd2_fields,
19,
- "m1.hwaddr LIKE LOWER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
+ "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m1.mach_id AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
1,
"pr.name",
&VDfix_modby,
@@ -7848,7 +7923,7 @@
"pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.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, list l3",
gpbd_fields,
23,
- "m1.hwaddr LIKE LOWER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
+ "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m1.mach_id AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
1,
"pr.name",
&VDfix_modby,