summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornalin <nalin>2003-10-23 01:44:42 +0000
committernalin <nalin>2003-10-23 01:44:42 +0000
commite4dd57ea3d4c8c81d11f6e91f5d95452d7618c04 (patch)
tree67b5598296796d6cfb1dc9338775ae527e815e8a
parent969d4f74b472f70b05b3abaa20347bb592d5462e (diff)
downloadnss_directories-e4dd57ea3d4c8c81d11f6e91f5d95452d7618c04.tar.gz
nss_directories-e4dd57ea3d4c8c81d11f6e91f5d95452d7618c04.tar.xz
nss_directories-e4dd57ea3d4c8c81d11f6e91f5d95452d7618c04.zip
- Stop referencing previously-freed memory, doh.
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac8
-rw-r--r--nss_directories.spec9
-rw-r--r--src/generic.c17
4 files changed, 28 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am
index 65d89e7..378cd15 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,8 @@ EXTRA_DIST = ChangeLog COPYING README nss_directories.spec
DISTCHECK_CONFIGURE_FLAGS = --with-moduledir=$$dc_install_base/modules
NAME = nss_directories
-VERSION = $(shell rpm -q --specfile --qf '%{version}' $(top_srcdir)/$(NAME).spec)
+VERSION=@VERSION@
+RELEASE=@RELEASE@
CVSTAG = $(shell echo $(NAME)-$(VERSION) | sed -e s,\\.,_,g -e s,-,_,g)
tag:
@@ -12,9 +13,10 @@ tag:
force-tag:
cvs tag -cF $(CVSTAG)
+distdir = $(NAME)-$(VERSION)-$(RELEASE)
archive:
$(RM) -fr /tmp/$(NAME)-$(VERSION)
- cd /tmp ; cvs -d $(shell cat $(top_srcdir)/CVS/Root) export -r $(CVSTAG) -d $(NAME)-$(VERSION) $(NAME)
+ cd /tmp ; cvs -d $(shell cat $(top_srcdir)/CVS/Root) export -r $(CVSTAG) -d $(NAME)-$(VERSION)-$(RELEASE) $(NAME)
cd /tmp/$(NAME)-$(VERSION) ; ./autogen.sh ; make distcheck
mv -v /tmp/$(NAME)-$(VERSION)/$(NAME)-*.*.tar.* $(top_srcdir)/
$(RM) -fr /tmp/$(NAME)-$(VERSION)
diff --git a/configure.ac b/configure.ac
index 9338ab5..0ccbe60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,11 @@
AC_INIT(README)
-AM_INIT_AUTOMAKE(nss_directories,0.1)
+VERSION=`awk '/^Version:/ {print $NF}' ${srcdir}/nss_directories.spec`
+RELEASE=`awk '/^Release:/ {print $NF}' ${srcdir}/nss_directories.spec`
+AM_INIT_AUTOMAKE(nss_directories, $VERSION)
AM_PROG_LIBTOOL
+AC_SYS_LARGEFILE
+
MYPREFIX=`eval echo $prefix`
if test "$MYPREFIX" = NONE ; then
MYPREFIX="$ac_default_prefix"
@@ -39,6 +43,8 @@ if test x$GCC = xyes ; then
CFLAGS="${CFLAGS} -Wuninitialized"
fi
+AC_SUBST(VERSION)
+AC_SUBST(RELEASE)
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile src/Makefile)
diff --git a/nss_directories.spec b/nss_directories.spec
index ecfa497..a48b27f 100644
--- a/nss_directories.spec
+++ b/nss_directories.spec
@@ -1,7 +1,7 @@
Name: nss_directories
-Version: 0.3
+Version: 0.4
Release: 1
-Source: %{name}-%{version}.tar.gz
+Source: %{name}-%{version}-%{release}.tar.gz
License: LGPL
Group: System Environment/Libraries
Summary: An NSS library which searches directories.
@@ -14,7 +14,7 @@ services, and shadow passwords (instead of or in addition to using flat
files or NIS).
%prep
-%setup -q
+%setup -q -n %{name}-%{version}-%{release}
%configure --with-moduledir=/%{_lib}
%build
@@ -37,6 +37,9 @@ rm -fr $RPM_BUILD_ROOT
%postun -p /sbin/ldconfig
%changelog
+* Wed Oct 22 2003 Nalin Dahyabhai <nalin@redhat.com> 0.4-1
+- stop referencing previously-freed memory
+
* Mon Nov 18 2002 Nalin Dahyabhai <nalin@redhat.com> 0.2-1
- swallow parsing functions from glibc to avoid dependencies on private symbols
diff --git a/src/generic.c b/src/generic.c
index 44795a6..13df056 100644
--- a/src/generic.c
+++ b/src/generic.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ident "$Id: generic.c,v 1.4 2002/11/19 01:01:49 nalin Exp $"
+#ident "$Id: generic.c,v 1.5 2003/10/23 01:44:42 nalin Exp $"
#include "../config.h"
@@ -39,6 +39,8 @@
/* Array of file name patterns we ignore. */
static const char *skip_names[] = {
+ ".*",
+ "*#",
"*~",
"*.rpmsave",
"*.rpmorig",
@@ -67,7 +69,7 @@ read_line(FILE *fp)
buflen = CHUNK_SIZE;
length = 0;
- buffer = malloc(CHUNK_SIZE);
+ buffer = malloc(buflen);
if (buffer == NULL) {
return NULL;
}
@@ -88,8 +90,9 @@ read_line(FILE *fp)
}
}
}
+ length = strlen(buffer);
- if (strlen(buffer) == 0) {
+ if (length == 0) {
free(buffer);
return NULL;
}
@@ -162,8 +165,10 @@ getgen(struct STRUCTURE *result,
errno = ERANGE;
return NSS_STATUS_TRYAGAIN;
}
+ /* Save it. */
+ strcpy(buffer, line);
/* If we had trouble parsing it, continue. */
- switch (parse_line(line, &structure,
+ switch (parse_line(buffer, &structure,
(void *)buffer, buflen,
errnop)) {
case 0:
@@ -245,7 +250,7 @@ getnam(const char *name,
static int
compare_number(const void *compare_data, struct STRUCTURE *structure)
{
- return (structure->getnum_field != (getnum_type) compare_data);
+ return (structure->getnum_field != (getnum_type) (long) compare_data);
}
enum nss_status
getnum(getnum_type number,
@@ -259,7 +264,7 @@ getnum(getnum_type number,
EXTRA_CRITERIA_NAMES,
#endif
buffer, buflen, errnop,
- compare_number, (const void*) number);
+ compare_number, (const void*) (long) number);
}
#endif
#if defined(setent) && defined(getent) && defined(endent)