Subject: bin/3125: netgroup_mkdb not updated to public stringlist implementation
To: None <gnats-bugs@gnats.netbsd.org>
From: Klaus Klein <kleink@layla.inka.de>
List: netbsd-bugs
Date: 01/18/1997 19:03:18
>Number:         3125
>Category:       bin
>Synopsis:       netgroup_mkdb not updated to public stringlist implementation
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 18 10:20:01 1997
>Last-Modified:
>Originator:     Klaus Klein
>Organization:
private site
>Release:        970118
>Environment:
(mi)

>Description:
After making the previously netgroup-only private stringlist
implementation public, netgroup_mkdb was not updated to reflect the
new interface.

>How-To-Repeat:

>Fix:

Index: netgroup_mkdb.c
===================================================================
RCS file: /cvsroot/netbsd/src/usr.sbin/netgroup_mkdb/netgroup_mkdb.c,v
retrieving revision 1.1.1.1
diff -b -c -r1.1.1.1 netgroup_mkdb.c
*** netgroup_mkdb.c	1996/12/20 13:32:52	1.1.1.1
--- netgroup_mkdb.c	1997/01/18 18:00:04
***************
*** 46,51 ****
--- 46,52 ----
  #include <errno.h>
  #include <stdio.h>
  #include <string.h>
+ #include <stringlist.h>
  #define _NETGROUP_PRIVATE
  #include <netgroup.h>
  #include <assert.h>
***************
*** 72,78 ****
  
  static DB       *ng_insert __P((DB *, const char *));
  static void	 ng_reventry __P((DB *, DB *, struct nentry *, char *,
! 				  size_t, struct stringlist *));
  
  static void	 ng_print __P((struct nentry *, struct string *));
  static void	 ng_rprint __P((DB *, struct string *));
--- 73,79 ----
  
  static DB       *ng_insert __P((DB *, const char *));
  static void	 ng_reventry __P((DB *, DB *, struct nentry *, char *,
! 				  size_t, StringList *));
  
  static void	 ng_print __P((struct nentry *, struct string *));
  static void	 ng_rprint __P((DB *, struct string *));
***************
*** 361,367 ****
  	struct nentry  *fe;
  	char           *name;
  	size_t          s;
! 	struct stringlist *ss;
  {
  	DBT             key, data;
  	struct nentry  *e;
--- 362,368 ----
  	struct nentry  *fe;
  	char           *name;
  	size_t          s;
! 	StringList	*ss;
  {
  	DBT             key, data;
  	struct nentry  *e;
***************
*** 369,379 ****
  	char           *p;
  	DB             *xdb;
  
! 	if (_ng_sl_find(ss, name) != NULL) {
  		warnx("Cycle in netgroup `%s'", name);
  		return;
  	}
! 	_ng_sl_add(ss, name);
  
  	for (e = fe->n_next; e != NULL; e = e->n_next)
  		switch (e->n_type) {
--- 370,380 ----
  	char           *p;
  	DB             *xdb;
  
! 	if (sl_find(ss, name) != NULL) {
  		warnx("Cycle in netgroup `%s'", name);
  		return;
  	}
! 	sl_add(ss, name);
  
  	for (e = fe->n_next; e != NULL; e = e->n_next)
  		switch (e->n_type) {
***************
*** 440,446 ****
  	size_t          s;
  {
  	int             pos;
! 	struct stringlist *sl;
  	DBT             key, data;
  	struct nentry  *fe;
  	DB             *udb = dbopen(NULL, O_RDWR | O_CREAT | O_EXCL, 0,
--- 441,447 ----
  	size_t          s;
  {
  	int             pos;
! 	StringList	*sl;
  	DBT             key, data;
  	struct nentry  *fe;
  	DB             *udb = dbopen(NULL, O_RDWR | O_CREAT | O_EXCL, 0,
***************
*** 452,461 ****
  	for (pos = R_FIRST;; pos = R_NEXT)
  		switch ((db->seq)(db, &key, &data, pos)) {
  		case 0:
! 			sl = _ng_sl_init();
  			memcpy(&fe, data.data, sizeof(fe));
  			ng_reventry(db, udb, fe, (char *) key.data, s, sl);
! 			_ng_sl_free(sl, 0);
  			break;
  
  		case 1:
--- 453,462 ----
  	for (pos = R_FIRST;; pos = R_NEXT)
  		switch ((db->seq)(db, &key, &data, pos)) {
  		case 0:
! 			sl = sl_init();
  			memcpy(&fe, data.data, sizeof(fe));
  			ng_reventry(db, udb, fe, (char *) key.data, s, sl);
! 			sl_free(sl, 0);
  			break;
  
  		case 1:
>Audit-Trail:
>Unformatted: