[1856] in Moira Commits
/svn/moira r4001 - in trunk/moira: . clients/eunice clients/moira clients/stella db gen man server
daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Wed Apr 21 16:38:52 2010
Date: Wed, 21 Apr 2010 16:38:45 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>
Message-Id: <201004212038.o3LKcjhY020228@drugstore.mit.edu>
To: moira-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: zacheiss
Date: 2010-04-21 16:38:45 -0400 (Wed, 21 Apr 2010)
New Revision: 4001
Removed:
trunk/moira/gen/boot.pc
trunk/moira/gen/boot.sh
Modified:
trunk/moira/clients/eunice/eunice.c
trunk/moira/clients/moira/cluster.c
trunk/moira/clients/moira/f_defs.h
trunk/moira/clients/moira/menus.c
trunk/moira/clients/moira/printer.c
trunk/moira/clients/stella/stella.c
trunk/moira/db/dbopt.sql
trunk/moira/db/schema.sql
trunk/moira/gen/Makefile.in
trunk/moira/gen/dhcp.pc
trunk/moira/libtool
trunk/moira/man/eunice.1
trunk/moira/man/stella.1
trunk/moira/server/increment.pc
trunk/moira/server/mr_server.h
trunk/moira/server/qsetup.pc
trunk/moira/server/queries2.c
Log:
Rototill how we handle hardware addresses. We now allow a host to be associated with an arbitrary number of hardware addresses. Generate incrementals for the machine, hostalias, and hwaddrmap tables.
Modified: trunk/moira/clients/eunice/eunice.c
===================================================================
--- trunk/moira/clients/eunice/eunice.c 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/clients/eunice/eunice.c 2010-04-21 20:38:45 UTC (rev 4001)
@@ -28,6 +28,11 @@
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,23 +44,26 @@
/* 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)",
@@ -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/moira/clients/moira/cluster.c
===================================================================
--- trunk/moira/clients/moira/cluster.c 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/clients/moira/cluster.c 2010-04-21 20:38:45 UTC (rev 4001)
@@ -1296,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]
@@ -2613,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/moira/clients/moira/f_defs.h
===================================================================
--- trunk/moira/clients/moira/f_defs.h 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/clients/moira/f_defs.h 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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/moira/clients/moira/menus.c
===================================================================
--- trunk/moira/clients/moira/menus.c 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/clients/moira/menus.c 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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/moira/clients/moira/printer.c
===================================================================
--- trunk/moira/clients/moira/printer.c 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/clients/moira/printer.c 2010-04-21 20:38:45 UTC (rev 4001)
@@ -29,8 +29,8 @@
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);
@@ -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/moira/clients/stella/stella.c
===================================================================
--- trunk/moira/clients/stella/stella.c 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/clients/stella/stella.c 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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/moira/db/dbopt.sql
===================================================================
--- trunk/moira/db/dbopt.sql 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/db/dbopt.sql 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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/moira/db/schema.sql
===================================================================
--- trunk/moira/db/schema.sql 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/db/schema.sql 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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/moira/gen/Makefile.in
===================================================================
--- trunk/moira/gen/Makefile.in 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/gen/Makefile.in 2010-04-21 20:38:45 UTC (rev 4001)
@@ -32,20 +32,20 @@
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 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 \
@@ -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/moira/gen/dhcp.pc
===================================================================
--- trunk/moira/gen/dhcp.pc 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/gen/dhcp.pc 2010-04-21 20:38:45 UTC (rev 4001)
@@ -20,7 +20,7 @@
#include "util.h"
-#define MACHINE_CHWADDR_SIZE 18
+#define HWADDRMAP_CHWADDR_SIZE 18
EXEC SQL INCLUDE sqlca;
@@ -36,9 +36,9 @@
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];
@@ -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
+ 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,12 +161,13 @@
/* 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,
+ SELECT LOWER(m.name), hw.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
+ 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;
EXEC SQL OPEN csr_boot2;
while (1)
{
Modified: trunk/moira/libtool
===================================================================
--- trunk/moira/libtool 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/libtool 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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/moira/man/eunice.1
===================================================================
--- trunk/moira/man/eunice.1 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/man/eunice.1 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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/moira/man/stella.1
===================================================================
--- trunk/moira/man/stella.1 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/man/stella.1 2010-04-21 20:38:45 UTC (rev 4001)
@@ -1,4 +1,4 @@
-.TH STELLA 1 "10 Feb 2000" "MIT Athena"
+.TH STELLA 1 "17 Mar 2010" "MIT Athena"
\" RCSID: $HeadURL$ $Id$
.SH NAME
stella \- examine and modify information about hosts in Moira
@@ -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/moira/server/increment.pc
===================================================================
--- trunk/moira/server/increment.pc 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/server/increment.pc 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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);
Modified: trunk/moira/server/mr_server.h
===================================================================
--- trunk/moira/server/mr_server.h 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/server/mr_server.h 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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/moira/server/qsetup.pc
===================================================================
--- trunk/moira/server/qsetup.pc 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/server/qsetup.pc 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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;
}
Modified: trunk/moira/server/queries2.c
===================================================================
--- trunk/moira/server/queries2.c 2010-04-12 20:42:56 UTC (rev 4000)
+++ trunk/moira/server/queries2.c 2010-04-21 20:38:45 UTC (rev 4001)
@@ -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,