/* -*-c-*-
*
- * $Id: netg.c,v 1.4 1998/04/23 13:24:49 mdw Exp $
+ * $Id: netg.c,v 1.6 2003/10/12 00:39:16 mdw Exp $
*
* A local database of netgroups
*
/*----- Revision history --------------------------------------------------*
*
* $Log: netg.c,v $
+ * Revision 1.6 2003/10/12 00:39:16 mdw
+ * Light fixes for strange building.
+ *
+ * Revision 1.5 2003/10/12 00:14:55 mdw
+ * Major overhaul. Now uses DSA signatures rather than the bogus symmetric
+ * encrypt-and-hope thing. Integrated with mLib and Catacomb.
+ *
* Revision 1.4 1998/04/23 13:24:49 mdw
* Switch to using the ypstuff interface to YP server.
*
#include <netdb.h>
#include <unistd.h>
+/* --- mLib headers --- */
+
+#include <mLib/alloc.h>
+#include <mLib/report.h>
+#include <mLib/sym.h>
+#include <mLib/trace.h>
+
/* --- Local headers --- */
#include "become.h"
#include "config.h"
#include "netg.h"
-#include "sym.h"
#include "userdb.h"
-#include "utils.h"
#include "ypstuff.h"
/*----- Type definitions --------------------------------------------------*/
* Use: Dumps the netgroup given.
*/
-#ifdef TRACING
+#ifndef NTRACE
static void netg__dumpGroup(netg__cons *c, int lev)
{
* Use: Dumps the netgroups table.
*/
-#ifdef TRACING
+#ifndef NTRACE
static void netg__dump(void)
{
netg__sym *sng;
trace(TRACE_DEBUG, "debug: dumping netgroups file");
- for (sym_createIter(&i, &netg__table); (sng = sym_next(&i)) != 0; ) {
+ for (sym_mkiter(&i, &netg__table); (sng = sym_next(&i)) != 0; ) {
trace(TRACE_DEBUG, "debug: netgroup `%s'...", sng->_base.name);
sng->cons->f &= ~f_visit;
netg__dumpGroup(sng->cons, 1);
*/
void netg_iterate(void) { netg_iterate_r(&netg__iter); }
-void netg_iterate_r(netg_iter *i) { sym_createIter(i, &netg__table); }
+void netg_iterate_r(netg_iter *i) { sym_mkiter(i, &netg__table); }
/* --- @netg_next@, @netg_next_r@ --- *
*
{
/* --- Initialise my symbol table --- */
- sym_createTable(&netg__table);
+ sym_create(&netg__table);
/* --- Bind myself unto a YP server --- */
netg__cons *c;
netg__atom *a;
- for (sym_createIter(&i, &netg__table); (sng = sym_next(&i)) != 0; ) {
+ for (sym_mkiter(&i, &netg__table); (sng = sym_next(&i)) != 0; ) {
for (c = sng->cons; c; c = c->cdr) {
if ((c->f & f_cons) == 0 && c->car.atom->n) {
a = c->car.atom;
sym_iter i;
netg__sym *sng;
- for (sym_createIter(&i, &netg__table); (sng = sym_next(&i)) != 0; )
+ for (sym_mkiter(&i, &netg__table); (sng = sym_next(&i)) != 0; )
sng->cons->f &= ~f_uncycled;
- for (sym_createIter(&i, &netg__table); (sng = sym_next(&i)) != 0; )
+ for (sym_mkiter(&i, &netg__table); (sng = sym_next(&i)) != 0; )
netg__breakCycle(sng->cons);
}
/* --- Remove all the old netgroups rubbish --- */
- for (sym_createIter(&i, &netg__table); (sng = sym_next(&i)) != 0; ) {
+ for (sym_mkiter(&i, &netg__table); (sng = sym_next(&i)) != 0; ) {
c = sng->cons;
while (c) {
cc = c->cdr;
sym_remove(&netg__table, sng);
}
- sym_destroyTable(&netg__table);
+ sym_destroy(&netg__table);
}
/*----- Test driver -------------------------------------------------------*/
{
netg *n;
ego("netg-test");
- traceon(stderr, TRACE_ALL);
+ trace_on(stderr, TRACE_ALL);
netg_init();
for (netg_iterate(); (n = netg_next()) != 0; ) {
fprintf(stderr, "netgroup %s\n", netg_name(n));