Subject: bin/3127: /src/usr.sbin/netgroup_mkdb/netgroup_mkdb.c stil uses old stringlist
To: None <gnats-bugs@gnats.netbsd.org>
From: None <frueauf@ira.uka.de>
List: netbsd-bugs
Date: 01/19/1997 13:47:12
>Number:         3127
>Category:       bin
>Synopsis:       /src/usr.sbin/netgroup_mkdb/netgroup_mkdb.c stil uses old stringlist
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 19 04:05:00 1997
>Last-Modified:
>Originator:     Thorsten Frueauf
>Organization:
private
	
>Release:        <NetBSD-current source date> NetBSD current 18.01.1997
>Environment:
	
System: NetBSD cyberlap 1.2B NetBSD 1.2B (CYBERLAP) #0: Thu Jan 16 17:19:36 CET 1997 frueauf@cyberlap:/usr/src/sys/arch/i386/compile/CYBERLAP i386


>Description:
	
/src/usr.sbin/netgroup_mkdb/netgroup_mkdb.c uses stil the _nl_sl_* functions
from "old" libc.so.12.8 which are changed in libc.so.12.9.

>How-To-Repeat:
	
Try to compile /src/usr.sbin/netgroup_mkdb with NetBSD current 18.01.1997
source tree and watch:

cc   -o netgroup_mkdb netgroup_mkdb.o util.o str.o 
netgroup_mkdb.o: Undefined symbol `__ng_sl_find' referenced from text segment
netgroup_mkdb.o: Undefined symbol `__ng_sl_add' referenced from text segment
netgroup_mkdb.o: Undefined symbol `__ng_sl_init' referenced from text segment
netgroup_mkdb.o: Undefined symbol `__ng_sl_free' referenced from text segment
*** Error code 1

>Fix:
	
Apply the following patch to /src/usr.sbin/netgroup_mkdb/netgroup_mkdb.c:


*** netgroup_mkdb.c-orig	Wed Oct 16 05:34:26 1996
--- netgroup_mkdb.c	Sun Jan 19 13:39:07 1997
***************
*** 39,44 ****
--- 39,45 ----
  #include <sys/stat.h>
  #include <stdlib.h>
  #include <stddef.h>
+ #include <stringlist.h>
  #include <unistd.h>
  #include <fcntl.h>
  #include <db.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:
/src/usr.sbin/netgroup_mkdb/netgroup_mkdb.c stil uses old stringlist