Add support for "foo:< http://localhost/path.

Requires FreeBSD's -lfetch...
Implementations to other URL APIs encouraged.
Probably should be moved to -llutil.
This commit is contained in:
Kurt Zeilenga 1999-07-31 03:23:26 +00:00
parent 9160692ab1
commit 48d5465ab7
12 changed files with 724 additions and 585 deletions

View File

@ -721,6 +721,27 @@ AC_DEFUN(OL_C_VOLATILE,
])dnl
dnl
dnl ====================================================================
dnl Look for fetch(3)
AC_DEFUN([OL_LIB_FETCH],
[ol=$LIBS
LIBS="-lfetch -lcom_err $LIBS"
AC_CACHE_CHECK([fetch(3) library],ol_cv_lib_fetch,[
AC_TRY_LINK([
#include <sys/param.h>
#include <stdio.h>
#include <fetch.h>],
[struct url *u = fetchParseURL("file:///"); ],
[ol_cv_lib_fetch=yes],
[ol_cv_lib_fetch=no])])
LIBS=$ol_LIBS
if test $ol_cv_lib_fetch != no ; then
ol_link_fetch="-lfetch -lcom_err"
AC_DEFINE(HAVE_FETCH,1,
[define if you actually have FreeBSD fetch(3)])
fi
])dnl
dnl
dnl ====================================================================
dnl Define sig_atomic_t if not defined in signal.h
AC_DEFUN(OL_TYPE_SIG_ATOMIC_T,
[AC_CACHE_CHECK(for sig_atomic_t, ol_cv_type_sig_atomic_t,

View File

@ -94,6 +94,7 @@ LDAP_LIBADIR= $(top_builddir)/libraries
LDAP_LIBPATH= -L$(LDAP_LIBADIR)
LUTIL_LIBS = @LUTIL_LIBS@
LDIF_LIBS = @LDIF_LIBS@
LDBM_LIBS = @LDBM_LIBS@
LTHREAD_LIBS = @LTHREAD_LIBS@

View File

@ -8,7 +8,7 @@ LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = -lldif -lldap -llber -llutil
XXLIBS = $(KRB_LIBS) $(TLS_LIBS) $(LUTIL_LIBS)
XXLIBS = $(KRB_LIBS) $(TLS_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
XSRCS = ldsversion.c ldmversion.c lddversion.c ldrversion.c ldpversion.c

1183
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -319,6 +319,7 @@ AC_MSG_RESULT(done)
## Initialize vars
LDAP_LIBS=
LDIF_LIBS=
LDBM_LIBS=
LTHREAD_LIBS=
LUTIL_LIBS=
@ -1696,6 +1697,12 @@ if test $ol_enable_proctitle != no ; then
fi
fi
OL_LIB_FETCH
if test $ol_cv_lib_fetch != no ; then
LDIF_LIBS="$LDIF_LIBS $ol_link_fetch"
fi
dnl ----------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_GETGROUPS dnl requires AC_TYPE_UID_T
@ -1975,6 +1982,7 @@ AC_SUBST(BUILD_SLURPD)
AC_SUBST(LDAP_LIBS)
AC_SUBST(LDAPD_LIBS)
AC_SUBST(LDIF_LIBS)
AC_SUBST(SLAPD_LIBS)
AC_SUBST(SLURPD_LIBS)
AC_SUBST(LDBM_LIBS)

View File

@ -708,6 +708,9 @@
/* define if setproctitle(3) is available */
#undef HAVE_SETPROCTITLE
/* define if you actually have FreeBSD fetch(3) */
#undef HAVE_FETCH
/* Define if system has ptrdiff_t type */
#undef HAVE_PTRDIFF_T

View File

@ -3,8 +3,8 @@
##
LIBRARY = libldif.a
SRCS = line64.c
OBJS = line64.o
SRCS = line64.c fetch.c
OBJS = line64.o fetch.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries

66
libraries/libldif/fetch.c Normal file
View File

@ -0,0 +1,66 @@
/* line64.c - routines for dealing with the slapd line format */
#include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/string.h>
#include <ac/socket.h>
#include <ac/time.h>
#ifdef HAVE_FETCH
#include <fetch.h>
#endif
#include "ldap_log.h"
#include "lber_pvt.h"
#include "ldif.h"
int
ldif_fetch_url(
LDAP_CONST char *urlstr,
char **valuep,
ber_len_t *vlenp
)
{
#ifdef HAVE_FETCH
FILE *url = fetchGetURL( (char*) urlstr, "" );
char buffer[1024];
char *p = NULL;
size_t total;
size_t bytes;
if( url == NULL ) {
return -1;
}
total = 0;
while( bytes = fread( buffer, 1, sizeof(buffer), url ) ) {
char *newp = ber_memrealloc( p, total + bytes );
if( newp == NULL ) {
ber_memfree( p );
fclose( url );
return -1;
}
newp = p;
SAFEMEMCPY( &p[total], buffer, bytes );
total += bytes;
}
fclose( url );
*valuep = p;
*vlenp = total;
return 0;
#else
*valuep = NULL;
*vlenp = NULL;
return -1;
#endif
}

View File

@ -275,18 +275,6 @@ ldif_getline( char **next )
return( line );
}
int
ldif_fetch_url(
LDAP_CONST char *url,
char **valuep,
ber_len_t *vlenp
)
{
*valuep = NULL;
*vlenp = NULL;
return -1;
}
/* compatibility with U-Mich off by one bug */
#define LDIF_KLUDGE 1

View File

@ -30,7 +30,8 @@ XLDFLAGS = $(MODULES_LDFLAGS)
# $(LTHREAD_LIBS) must be last
XLIBS = libbackends.a -lavl -lldbm -lldif -lldap_r -llber -llutil
XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) \
$(PERL_LDFLAGS) $(KRB_LIBS) $(TLS_LIBS) $(LUTIL_LIBS)
$(PERL_LDFLAGS) $(KRB_LIBS) $(TLS_LIBS) \
$(LDIF_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS)
BUILD_OPT = "--enable-slapd"

View File

@ -24,7 +24,8 @@ XLDFLAGS = $(MODULES_LDFLAGS)
XLIBS = -lavl -lldif -lldbm -lldap_r -llber -llutil
XXLIBS = $(LDAPD_LIBS) $(SLAPD_LIBS) \
$(PERL_LDFLAGS) $(LDBM_LIBS) $(KRB_LIBS) $(TLS_LIBS) $(LUTIL_LIBS)
$(PERL_LDFLAGS) $(LDBM_LIBS) $(KRB_LIBS) $(TLS_LIBS) \
$(LDIF_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS)
PROGRAMS=ldif2index ldif2ldbm ldbmcat ldif2id2entry ldif2id2children \

View File

@ -24,7 +24,8 @@ all-local-srv: slurpd
# $(LTHREAD_LIBS) must be last!
XLIBS = -lldif -lldap_r -llber -llutil
XXLIBS = $(SLURPD_LIBS) $(KRB_LIBS) $(TLS_LIBS) $(LUTIL_LIBS)
XXLIBS = $(SLURPD_LIBS) $(KRB_LIBS) $(TLS_LIBS) \
$(LDIF_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS)
slurpd: version.o