summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornalin <nalin>2002-11-19 00:05:07 +0000
committernalin <nalin>2002-11-19 00:05:07 +0000
commitc4ec4f73fed10624c2cb4a9d7f83ba1a5da89128 (patch)
tree18b5bf41268c3c26791657f1d413e32a06fc5def
parent8a360c32bd3350b6be9df7cc8cbdd2da3ab92432 (diff)
downloadnss_directories-c4ec4f73fed10624c2cb4a9d7f83ba1a5da89128.tar.gz
nss_directories-c4ec4f73fed10624c2cb4a9d7f83ba1a5da89128.tar.xz
nss_directories-c4ec4f73fed10624c2cb4a9d7f83ba1a5da89128.zip
- Use more compiler warnings if we're using gcc.
- Declare external parsers so that everything agrees on their signatures.
-rw-r--r--configure.ac18
-rw-r--r--src/generic.c13
-rw-r--r--src/group.c3
-rw-r--r--src/parsers.h33
-rw-r--r--src/passwd.c3
-rw-r--r--src/protocols.c3
-rw-r--r--src/services.c3
-rw-r--r--src/shadow.c3
8 files changed, 50 insertions, 29 deletions
diff --git a/configure.ac b/configure.ac
index 383940d..42ddcfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,8 +21,26 @@ AC_SUBST(moduledir)
nss_files=`ls -1 "$moduledir"/libnss_files-*.so | head -1`
GLIBC_VERSION=`basename "$nss_files" .so | cut -f2 -d-`
+if test -z "$GLIBC_VERSION"
+then
+ GLIBC_VERSION=$PACKAGE_VERSION
+fi
AC_SUBST(GLIBC_VERSION)
+if test x$GCC = xyes ; then
+ CFLAGS="${CFLAGS} -std=c99"
+ CFLAGS="${CFLAGS} -D_GNU_SOURCE"
+ CFLAGS="${CFLAGS} -Wall"
+ CFLAGS="${CFLAGS} -Waggregate-return"
+ CFLAGS="${CFLAGS} -Wcast-align"
+ CFLAGS="${CFLAGS} -Wimplicit"
+ CFLAGS="${CFLAGS} -Wmissing-declarations"
+ CFLAGS="${CFLAGS} -Wmissing-prototypes"
+ CFLAGS="${CFLAGS} -Wpointer-arith"
+ CFLAGS="${CFLAGS} -Wstrict-prototypes"
+ CFLAGS="${CFLAGS} -Wuninitialized"
+fi
+
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile src/Makefile)
diff --git a/src/generic.c b/src/generic.c
index d604da8..a455a62 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.2 2002/11/18 22:08:14 nalin Exp $"
+#ident "$Id: generic.c,v 1.3 2002/11/19 00:05:07 nalin Exp $"
#include "../config.h"
@@ -26,11 +26,12 @@
#include <errno.h>
#include <fnmatch.h>
#include <limits.h>
-#include <nss.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+#include <nss.h>
#define CHUNK_SIZE LINE_MAX
#define FALSE 0
@@ -151,9 +152,9 @@ getgen(struct STRUCTURE *result,
/* Read the next line. */
while ((line = read_line(fp)) != NULL) {
/* If we had trouble parsing it, continue. */
- if (parser(line, &structure,
- (struct parser_data*) buffer, buflen,
- errnop) == 0) {
+ if (parse_line(line, &structure,
+ (void *)buffer, buflen,
+ errnop) == 0) {
free(line);
continue;
}
@@ -362,7 +363,7 @@ getent(struct STRUCTURE *result, char *buffer, size_t buflen, int *errnop)
/* Try to parse the line. */
if (parse_line(line, &structure,
- (struct parser_data*) buffer, buflen,
+ (void *) buffer, buflen,
errnop) != 0) {
free(line);
*result = structure;
diff --git a/src/group.c b/src/group.c
index 5a13a6d..42eb0bf 100644
--- a/src/group.c
+++ b/src/group.c
@@ -16,10 +16,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ident "$Id: group.c,v 1.2 2002/11/18 22:08:14 nalin Exp $"
+#ident "$Id: group.c,v 1.3 2002/11/19 00:05:07 nalin Exp $"
#include <sys/types.h>
#include <grp.h>
+#include "parsers.h"
/* Shared information. */
#define STRUCTURE group
diff --git a/src/parsers.h b/src/parsers.h
index 47e787d..d348f26 100644
--- a/src/parsers.h
+++ b/src/parsers.h
@@ -16,7 +16,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ident "$Id: parsers.h,v 1.1 2002/11/18 19:53:21 nalin Exp $"
+/* External parsers. */
+
+#ident "$Id: parsers.h,v 1.2 2002/11/19 00:05:07 nalin Exp $"
#ifndef parsers_h
#define parsers_h
@@ -25,24 +27,19 @@
#include <pwd.h>
#include <grp.h>
#include <shadow.h>
-#include <netdb.h>
-struct parser_data;
+struct pwent_data;
+struct grent_data;
+struct spent_data;
-extern int _nss_files_parse_pwent(char *line, struct passwd *result,
- struct parser_data *data, size_t datalen,
- int *errnop);
-extern int _nss_files_parse_grent(char *line, struct group *result,
- struct parser_data *data, size_t datalen,
- int *errnop);
-extern int _nss_files_parse_spent(char *line, struct spwd *result,
- struct parser_data *data, size_t datalen,
- int *errnop);
-extern int _nss_files_parse_servent(char *line, struct servent *result,
- struct parser_data *data, size_t datalen,
- int *errnop);
-extern int _nss_files_parse_protoent(char *line, struct protoent *result,
- struct parser_data *data, size_t datalen,
- int *errnop);
+int _nss_directories_parse_pwent(char *line, struct passwd *result,
+ struct pwent_data *data, size_t datalen,
+ int *errnop);
+int _nss_directories_parse_grent(char *line, struct group *result,
+ struct grent_data *data, size_t datalen,
+ int *errnop);
+int _nss_directories_parse_spent(char *line, struct spwd *result,
+ struct spent_data *data, size_t datalen,
+ int *errnop);
#endif
diff --git a/src/passwd.c b/src/passwd.c
index 8075f19..87d81d8 100644
--- a/src/passwd.c
+++ b/src/passwd.c
@@ -16,10 +16,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ident "$Id: passwd.c,v 1.2 2002/11/18 22:08:14 nalin Exp $"
+#ident "$Id: passwd.c,v 1.3 2002/11/19 00:05:07 nalin Exp $"
#include <sys/types.h>
#include <pwd.h>
+#include "parsers.h"
/* Shared information. */
#define STRUCTURE passwd
diff --git a/src/protocols.c b/src/protocols.c
index a7c3074..cdca59f 100644
--- a/src/protocols.c
+++ b/src/protocols.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ident "$Id: protocols.c,v 1.2 2002/11/18 22:08:14 nalin Exp $"
+#ident "$Id: protocols.c,v 1.3 2002/11/19 00:05:07 nalin Exp $"
#include <sys/types.h>
#include <netdb.h>
@@ -27,6 +27,7 @@
/* Parser. */
#define ENTNAME protoent
+#define ENTDATA protoent_data
struct protoent_data {};
#define libc_hidden_def(ignored)
diff --git a/src/services.c b/src/services.c
index 51ceb34..8defa7e 100644
--- a/src/services.c
+++ b/src/services.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ident "$Id: services.c,v 1.2 2002/11/18 22:08:14 nalin Exp $"
+#ident "$Id: services.c,v 1.3 2002/11/19 00:05:07 nalin Exp $"
#include <sys/types.h>
#include <netdb.h>
@@ -27,6 +27,7 @@
/* Parser. */
#define ENTNAME servent
+#define ENTDATA servent_data
struct servent_data {};
#define libc_hidden_def(ignored)
diff --git a/src/shadow.c b/src/shadow.c
index a2e90ee..a9d1304 100644
--- a/src/shadow.c
+++ b/src/shadow.c
@@ -16,10 +16,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ident "$Id: shadow.c,v 1.2 2002/11/18 22:08:14 nalin Exp $"
+#ident "$Id: shadow.c,v 1.3 2002/11/19 00:05:07 nalin Exp $"
#include <sys/types.h>
#include <shadow.h>
+#include "parsers.h"
/* Shared information. */
#define STRUCTURE spwd