Major overhaul. Now uses DSA signatures rather than the bogus symmetric
[become] / src / userdb.c
index 9151b70..88b1cce 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: userdb.c,v 1.8 1998/06/08 11:21:22 mdw Exp $
+ * $Id: userdb.c,v 1.9 2003/10/12 00:14:55 mdw Exp $
  *
  * User database management
  *
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: userdb.c,v $
+ * Revision 1.9  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.8  1998/06/08 11:21:22  mdw
  * Fixed bug in password and group file reading: strtok doesn't handle
  * double colons nicely.
 #include <pwd.h>
 #include <unistd.h>
 
+/* --- mLib headers --- */
+
+#include <mLib/alloc.h>
+#include <mLib/sym.h>
+#include <mLib/trace.h>
+
 /* --- Local headers --- */
 
 #include "become.h"
-#include "sym.h"
 #include "userdb.h"
-#include "utils.h"
 #include "ypstuff.h"
 
 /*----- Type definitions --------------------------------------------------*/
@@ -131,8 +139,8 @@ static sym_iter userdb__groupi;             /* Iterator for groups */
 
 static void userdb__createMap(userdb__map *m)
 {
-  sym_createTable(&m->nmap);
-  sym_createTable(&m->idmap);
+  sym_create(&m->nmap);
+  sym_create(&m->idmap);
   m->list = 0;
 }
 
@@ -217,8 +225,8 @@ static void userdb__clearMap(userdb__map *m, void (*freerec)(void *rec))
 {
   userdb__node *n, *t;
 
-  sym_destroyTable(&m->nmap);
-  sym_destroyTable(&m->idmap);
+  sym_destroy(&m->nmap);
+  sym_destroy(&m->idmap);
 
   for (n = m->list; n; n = t) {
     t = n->next;
@@ -238,7 +246,7 @@ static void userdb__clearMap(userdb__map *m, void (*freerec)(void *rec))
  * Use:                Writes a user's informationt to a stream.
  */
 
-#ifdef TRACING
+#ifndef NTRACE
 
 static void userdb__dumpUser(const struct passwd *pw)
 {
@@ -382,7 +390,7 @@ void userdb_freeUser(void *rec)
  * Use:                Writes a group's information to a stream.
  */
 
-#ifdef TRACING
+#ifndef NTRACE
 
 static void userdb__dumpGroup(const struct group *gr)
 {
@@ -544,7 +552,7 @@ void userdb_iterateUsers(void)
 { userdb_iterateUsers_r(&userdb__useri); }
 
 void userdb_iterateUsers_r(userdb_iter *i)
-{ sym_createIter(i, &userdb__users.nmap); }
+{ sym_mkiter(i, &userdb__users.nmap); }
 
 /* --- @userdb_nextUser@, @userdb_nextUser_r@ --- *
  *
@@ -593,7 +601,7 @@ void userdb_iterateGroups(void)
 { userdb_iterateGroups_r(&userdb__groupi); }
 
 void userdb_iterateGroups_r(userdb_iter *i)
-{ sym_createIter(i, &userdb__groups.nmap); }
+{ sym_mkiter(i, &userdb__groups.nmap); }
 
 /* --- @userdb_nextGroup@, @userdb_nextGroup_r@ --- *
  *