Commit 07c7d3c3 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

QUIPU -> Attic

parent acb451a0
......@@ -140,8 +140,9 @@ SLAPD_SQL_LDFLAGS = @SLAPD_SQL_LDFLAGS@
SLAPD_SQL_INCLUDES = @SLAPD_SQL_INCLUDES@
SLAPD_SQL_LIBS = @SLAPD_SQL_LIBS@
QUIPU_LIBS = @QUIPU_LIBS@
SLAPD_LIBS = @SLAPD_LIBS@ @SLAPD_PERL_LDFLAGS@ @SLAPD_SQL_LDFLAGS@ @SLAPD_SQL_LIBS@
SLAPD_LIBS = @SLAPD_LIBS@ \
@SLAPD_PERL_LDFLAGS@ \
@SLAPD_SQL_LDFLAGS@ @SLAPD_SQL_LIBS@
SLURPD_LIBS = @SLURPD_LIBS@
# Our Defaults
......
......@@ -146,7 +146,6 @@ OL_ARG_ENABLE(spasswd,[ --enable-spasswd enable (Cyrus) SASL password verific
OL_ARG_ENABLE(modules,[ --enable-modules enable dynamic module support], no)dnl
OL_ARG_ENABLE(multimaster,[ --enable-multimaster enable multimaster replication], no)dnl
OL_ARG_ENABLE(phonetic,[ --enable-phonetic enable phonetic/soundex], no)dnl
OL_ARG_ENABLE(quipu,[ --enable-quipu build quipu migration tools], no)dnl
OL_ARG_ENABLE(rlookups,[ --enable-rlookups enable reverse lookups], auto)dnl
OL_ARG_ENABLE(aci,[ --enable-aci enable per-object ACIs], no)dnl
OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dnl
......@@ -235,9 +234,6 @@ if test $ol_enable_slapd = no ; then
if test $ol_enable_phonetic = yes ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-phonetic argument])
fi
if test $ol_enable_quipu = yes ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-quipu argument])
fi
if test $ol_enable_rlookups = yes ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-rlookups argument])
fi
......@@ -291,7 +287,6 @@ if test $ol_enable_slapd = no ; then
ol_enable_modules=no
ol_enable_multimaster=no
ol_enable_phonetic=no
ol_enable_quipu=no
ol_enable_rlookups=no
ol_enable_aci=no
ol_enable_wrappers=no
......@@ -393,14 +388,12 @@ LDBM_LIBS=
LTHREAD_LIBS=
LUTIL_LIBS=
QUIPU_LIBS=
SLAPD_LIBS=
SLURPD_LIBS=
BUILD_SLAPD=no
BUILD_SLURPD=no
BUILD_QUIPU=no
BUILD_THREAD=no
BUILD_DNSSRV=no
......@@ -815,20 +808,6 @@ if test "$ol_enable_dnssrv" = yes -a "$ol_link_dnssrv" = no ; then
AC_MSG_ERROR([DNSSRV requires res_query()])
fi
dnl ----------------------------------------------------------------
dnl QUIPU
if test $ol_enable_quipu != no ; then
AC_CHECK_HEADERS(quipu/commonarg.h)
if test $ac_cv_header_quipu_commonarg_h = yes ; then
BUILD_QUIPU=yes
elif test $ol_enable_quipu = auto ; then
AC_MSG_WARN([no quipu for --enable-quipu=auto, disabling])
else
AC_MSG_ERROR(no quipu for --enable-quipu=$ol_enable_quipu)
fi
fi
dnl ----------------------------------------------------------------
dnl Kerberos
ol_link_kbind=no
......@@ -2324,7 +2303,6 @@ AC_SUBST(BUILD_SLAPD)
AC_SUBST(BUILD_LDBM)
AC_SUBST(BUILD_PASSWD)
AC_SUBST(BUILD_PERL)
AC_SUBST(BUILD_QUIPU)
AC_SUBST(BUILD_SHELL)
AC_SUBST(BUILD_SQL)
AC_SUBST(BUILD_TCL)
......@@ -2341,7 +2319,6 @@ AC_SUBST(BUILD_SLURPD)
AC_SUBST(LDAP_LIBS)
AC_SUBST(LDIF_LIBS)
AC_SUBST(SLAPD_LIBS)
AC_SUBST(QUIPU_LIBS)
AC_SUBST(SLURPD_LIBS)
AC_SUBST(LDBM_LIBS)
AC_SUBST(LTHREAD_LIBS)
......
......@@ -16,7 +16,6 @@
#
#-----------------------------------------------------------------------------
BUILD_LDBM = @BUILD_LDBM@
BUILD_QUIPU = @BUILD_QUIPU@
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries
......@@ -27,14 +26,13 @@ XDEFS = $(MODULES_CPPFLAGS)
XLDFLAGS = $(MODULES_LDFLAGS) $(SLAPD_MODULES)
XLIBS = -lavl -lldif -lldbm -llutil -lldap_r -llber
XXLIBS = $(QUIPU_LIBS) $(SLAPD_LIBS) \
XXLIBS = $(SLAPD_LIBS) \
$(LDBM_LIBS) $(SECURITY_LIBS) \
$(LDIF_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS)
PROGRAMS=ldif slappasswd slapadd slapcat slapindex
LDBMPROGRAMS=centipede sizecount
QUIPUPROGRAMS=chlog2replog edb2ldif
# CPPFLAGS will include the defines for dynamic libs in Mingw32.
NT_DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
......@@ -47,7 +45,6 @@ XSRCS = edb2-vers.c
# LDBMSRCS = centipede.c sizecount.c
LDBMSRCS =
QUIPUSRCS = edb2ldif.c ldapsyntax.c chlog2replog.c
SLAPD_OBJS = ../config.o ../ch_malloc.o ../backend.o ../charray.o \
../module.o ../aclparse.o ../filterentry.o \
../schema.o ../schema_check.o ../schema_init.o ../schema_prep.o \
......@@ -62,7 +59,7 @@ SLAPOBJS = $(SLAPD_OBJS) slapcommon.o mimic.o
EDB2LDIFSRCS = edb2ldif.c ldapsyntax.c
EDB2LDIFOBJS = edb2ldif.o ldapsyntax.o
UNIX_PRGS = build-ldbm build-quipu
UNIX_PRGS = build-ldbm
all-local: build-progs $(@PLAT@_PRGS)
......@@ -74,12 +71,6 @@ ldbm-tools-no:
ldbm-tools-yes ldbm-tools-mod: $(LDBMPROGRAMS)
build-quipu: quipu-tools-$(BUILD_QUIPU)
quipu-tools-no:
@echo "run configure with --enable-quipu to build QUIPU tools"
quipu-tools-yes quipu-tools-mod: $(QUIPUPROGRAMS)
#
# SLAP Tools
#
......@@ -107,37 +98,20 @@ centipede: centipede.o $(SLAPD_LIBDEPEND)
sizecount: sizecount.o ../phonetic.o ../ch_malloc.o $(SLAPD_LIBDEPEND)
$(LTLINK) -o $@ sizecount.o ../phonetic.o ../ch_malloc.o $(LIBS)
#
# QUIPU Specific Tools
#
edb2ldif: edb2-vers.o
$(CC) $(LDFLAGS) -o $@ $(EDB2LDIFOBJS) edb2-vers.o $(LIBS)
edb2-vers.c: $(EDB2LDIFOBJS)
@-$(RM) $@
$(MKVERSION) ebd2ldif > $@
chlog2replog: chlog2replog.o ../lock.o ../ch_malloc.o $(SLAPD_LIBDEPEND)
$(LTLINK) -o $@ chlog2replog.o ../lock.o ../ch_malloc.o $(LIBS)
clean-local: FORCE
$(RM) $(PROGRAMS) $(LDBMPROGRAMS) $(QUIPUPROGRAMS) \
$(RM) $(PROGRAMS) $(LDBMPROGRAMS) \
$(XPROGRAMS) $(XSRCS) *.o core .libs/* *.exe
depend-local: FORCE
DEPEND_LDBM= ; DEPEND_QUIPU= ; \
DEPEND_LDBM= ; \
if [ "$(BUILD_LDBM)" != "no" ]; then \
DEPEND_LDBM="$(LDBMSRCS)"; \
fi; \
if [ "$(BUILD_QUIPU)" != "no" ]; then \
DEPEND_QUIPU="$(QUIPUINCLUDEFLAG) $(QUIPUSRCS)"; \
fi; \
$(MKDEP) $(DEFS) $(DEFINES) $(SRCS) $$DEPEND_QUIPU $$DEPEND_LDBM
$(MKDEP) $(DEFS) $(DEFINES) $(SRCS) $$DEPEND_LDBM
install-local: install-ldbm-$(BUILD_LDBM) \
install-quipu-$(BUILD_QUIPU)
install-local: install-ldbm-$(BUILD_LDBM)
install-ldbm-no install-quipu-no:
install-ldbm-no:
install-ldbm-yes install-ldbm-mod: FORCE
-$(MKDIR) $(DESTDIR)$(sbindir)
......@@ -145,10 +119,3 @@ install-ldbm-yes install-ldbm-mod: FORCE
$(LTINSTALL) $(INSTALLFLAGS) -s -m 755 \
$$bin$(EXEEXT) $(DESTDIR)$(sbindir); \
done
install-quipu-yes: FORCE
@-$(MKDIR) $(DESTDIR)$(sbindir)
for bin in edb2ldif chlog2replog; do \
$(LTINSTALL) $(INSTALLFLAGS) -s -m 755 \
$$bin $(DESTDIR)$(sbindir); \
done
/* $OpenLDAP$ */
/*
* Copyright (c) 1990, 1995 Regents of the University of Michigan.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of Michigan at Ann Arbor. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
/*
* chlog2replog - read a quipu-style changelog on stdin and write a
* slapd-style replog on stdout, or write to a file, respecting
* slapd/slurpd locking conventions.
*/
#include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/ctype.h>
#include <ac/string.h>
#include <ac/unistd.h>
#include <quipu/commonarg.h>
#include <quipu/attrvalue.h>
#include "ldif.h"
static int dn2ldif(PS ps, DN dn);
static void de_t61(char *s, int t61mark);
extern FILE *lock_fopen( char *, char *, FILE ** );
extern int lock_fclose( FILE *, FILE * );
extern void *ch_realloc( void *, unsigned long );
short ldap_dn_syntax;
PS rps;
char *progname;
int ldap_syslog = 0;
int ldap_syslog_level = 0;
#define ST_START 0
#define ST_DN 2
#define ST_TYPE 3
#define ST_ARGS 4
#define ST_NL1 5
#define ST_PUNT 6
#define ST_BAD 7
#define ST_CONCAT 8
#define TY_MODIFYTYPE 1
#define TY_ADD 2
#define TY_REMOVE 3
#define TY_NEWRDN 4
#define TY_PUNT 5
#define TY_MODIFYARGS 6
#define MOD_ADDVALUES 1
#define MOD_ADDATTRIBUTE 2
#define MOD_REMOVEATTRIBUTE 3
#define MOD_REMOVEVALUES 4
char *
dn2ldap( char *edbdn )
{
DN dn;
PS str_ps;
char *ldapdn;
int len;
static int inited = 0;
if ( !inited ) {
/* load & initialize quipu syntax handlers */
quipu_syntaxes();
#ifdef LDAP_USE_PP
pp_quipu_init( progname );
#endif
dsap_init( NULL, NULL );
if (( ldap_dn_syntax = str2syntax( "DN" )) == 0 ) {
return( NULL );
}
inited = 1;
}
if (( dn = str2dn( edbdn )) == NULLDN ) {
return( NULL );
}
if (( str_ps = ps_alloc( str_open )) == NULLPS ||
str_setup( str_ps, NULLCP, 0, 0 ) == NOTOK ) {
dn_free( dn );
return( NULL );
}
if ( dn2ldif( str_ps, dn ) != 0 ) {
ps_free( str_ps );
dn_free( dn );
return( NULL );
}
dn_free( dn );
len = ( str_ps->ps_ptr - str_ps->ps_base );
if (( ldapdn = malloc( len + 1 )) == NULL ) {
ps_free( str_ps );
return( NULL );
}
memcpy( ldapdn, str_ps->ps_base, len );
ldapdn[ len ] = '\0';
ps_free( str_ps );
return( ldapdn );
}
#define SEPARATOR(c) ((c) == ',' || (c) == ';')
#define SPACE(c) ((c) == ' ' || (c) == '\n')
static int
dn2ldif( PS ps, DN dn )
{
RDN rdn;
int firstrdn, rc;
char *value;
PS rps;
if ( dn == NULLDN ) {
return( 0 );
}
if ( dn->dn_parent != NULLDN ) {
if (( rc = dn2ldif( ps, dn->dn_parent )) != 0 ) {
return( rc );
}
ps_print( ps, ", " );
}
if ( (rps = ps_alloc( str_open )) == NULLPS ||
str_setup( rps, NULLCP, 0, 0 ) == NOTOK ) {
return( -1 );
}
firstrdn = 1;
for ( rdn = dn->dn_rdn; rdn != NULLRDN; rdn = rdn->rdn_next ) {
if ( firstrdn ) {
firstrdn = 0;
} else {
ps_print( ps, " + " );
}
AttrT_print( ps, rdn->rdn_at, EDBOUT );
ps_print( ps, "=" );
if ( rdn->rdn_at->oa_syntax == ldap_dn_syntax ) {
if (( rc = dn2ldif( rps, (DN) rdn->rdn_av.av_struct )) != 0 ) {
return( rc );
}
*rps->ps_ptr = '\0';
value = rps->ps_base;
} else {
AttrV_print( rps, &rdn->rdn_av, EDBOUT );
*rps->ps_ptr = '\0';
value = rps->ps_base;
de_t61( value, 0 );
}
/*
* ,+="\\\n all go in quotes. " and \\ need to
* be preceeded by \\.
*/
if ( strpbrk( value, ",+=\"\\\n" ) != NULL || SPACE( value[0] )
|| SPACE( value[max( strlen(value) - 1, 0 )] ) ) {
char *p, *t, *tmp;
int specialcount;
ps_print( ps, "\"" );
specialcount = 0;
for ( p = value; *p != '\0'; p++ ) {
if ( *p == '"' || *p == '\\' ) {
specialcount++;
}
}
if ( specialcount > 0 ) {
tmp = smalloc( strlen( value ) + specialcount + 1 );
for ( p = value, t = tmp; *p != '\0'; p++ ) {
switch ( *p ) {
case '"':
case '\\':
*t++ = '\\';
/* FALL THROUGH */
default:
*t++ = *p;
}
}
*t = '\0';
ps_print( ps, tmp );
free( tmp );
} else {
ps_print( ps, value );
}
ps_print( ps, "\"" );
} else {
ps_print( ps, value );
}
rps->ps_ptr = rps->ps_base;
}
ps_free( rps );
return( 0 );
}
#define T61 "{T.61}"
#define T61LEN 6
static void
de_t61(char *s, int t61mark)
{
char *next = s;
unsigned char c;
unsigned int hex;
while ( *s ) {
switch ( *s ) {
case '{' :
if ( strncasecmp( s, T61, T61LEN) == 0 ) {
s += T61LEN;
if ( t61mark )
*next++ = '@';
} else {
*next++ = *s++;
}
break;
case '\\':
c = *(s + 1);
if ( c == '\n' ) {
s += 2;
if ( *s == '\t' )
s++;
break;
}
if ( isdigit( c ) )
hex = c - '0';
else if ( c >= 'A' && c <= 'F' )
hex = c - 'A' + 10;
else if ( c >= 'a' && c <= 'f' )
hex = c - 'a' + 10;
else {
*next++ = *s++;
break;
}
hex <<= 4;
c = *(s + 2);
if ( isdigit( c ) )
hex += c - '0';
else if ( c >= 'A' && c <= 'F' )
hex += c - 'A' + 10;
else if ( c >= 'a' && c <= 'f' )
hex += c - 'a' + 10;
else {
*next++ = *s++;
*next++ = *s++;
break;
}
*next++ = hex;
s += 3;
break;
default:
*next++ = *s++;
break;
}
}
*next = '\0';
}
char *
getattr(char *buf, char sep)
{
char *val;
#define RBSIZE 255
static char retbuf[ RBSIZE ];
if (( val = strchr( buf, sep )) != NULL ) {
strncpy( retbuf, buf, val - buf );
retbuf[ val - buf ] = '\0';
} else {
retbuf[ 0 ] = '\0';
}
return( retbuf );
}
char *
getattr_ldif(char *buf)
{
return( getattr( buf, ':' ));
}
char *
getattr_edb(char *buf)
{
return( getattr( buf, '=' ));
}
char *
getval(char *buf, char sep)
{
char *val;
if (( val = strchr( buf, sep )) != NULL ) {
return( strdup( ++val ));
} else {
return( NULL );
}
}
char *
getval_ldif(char *buf)
{
return( getval( buf, ':' ));
}
char *
getval_edb(char *buf)
{
return( getval( buf, '=' ));
}
int
isDNsyntax(char *attr)
{
oid_table_attr *p, *name2attr(char *);
p = name2attr( attr );
if ( p == ( oid_table_attr * ) 0 ) {
return( -1 );
}
if ( p->oa_syntax == ldap_dn_syntax ) {
return( 1 );
} else {
return( 0 );
}
}
void
print_as(Attr_Sequence as, int modtype, FILE *ofp)
{
Attr_Sequence p;
AV_Sequence av;
char *attrname, *tmpdn, *obuf;
p = as;
for ( p = as; p != NULLATTR; p = p->attr_link) {
rps->ps_ptr = rps->ps_base;
AttrT_print( rps, p->attr_type, EDBOUT );
*rps->ps_ptr = '\0';
attrname = strdup( rps->ps_base );
if ( modtype != 0 ) {
switch ( modtype ) {
case MOD_ADDVALUES:
case MOD_ADDATTRIBUTE:
fprintf( ofp, "add: %s\n", attrname );
break;
case MOD_REMOVEATTRIBUTE:
case MOD_REMOVEVALUES:
fprintf( ofp, "delete: %s\n", attrname );
break;
default:
break;
}
}
for ( av = p->attr_value; av != NULLAV; av = av->avseq_next ) {
rps->ps_ptr = rps->ps_base;
AttrV_print( rps, &av->avseq_av, EDBOUT );
*rps->ps_ptr = '\0';
de_t61( rps->ps_base, 0 );
if ( isDNsyntax( attrname )) {
tmpdn = dn2ldap( rps->ps_base );
obuf = ldif_type_and_value( attrname, tmpdn,
strlen( tmpdn ));
free( tmpdn );
} else {
obuf = ldif_type_and_value( attrname, rps->ps_base,
strlen( rps->ps_base ));
}
if ( obuf != NULL ) {
fputs( obuf, ofp );
ber_memfree( obuf );
}
}
if ( modtype != 0 ) {
fprintf( ofp, "-\n" );
}
free( attrname );
}
}
void
usage( char *name )
{
fprintf( stderr, "usage: %s -d dn-suffix -r replica:port ", name );
fprintf( stderr, "[-r replica:port...] [-o outputfile]\n" );
}