mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-18 15:20:35 +08:00
Update slurpd(8)
This commit is contained in:
parent
4f8a48893e
commit
e8a2eb7f99
9
CHANGES
9
CHANGES
@ -1,7 +1,12 @@
|
||||
OpenLDAP 2.1 Change Log
|
||||
|
||||
OpenLDAP 2.1.25 Release
|
||||
Update librewrite (misc bug fixes)
|
||||
OpenLDAP 2.1.26 Engineering
|
||||
Fixed libldap sort references bug
|
||||
Updated lutil_passwd
|
||||
Updated librewrite (misc bug fixes)
|
||||
Updated slurpd (misc bug fixes)
|
||||
|
||||
OpenLDAP 2.1.25 Engineering
|
||||
Build Environment
|
||||
Fix LDBM link bug (ITS#2863)
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
ol_package=OpenLDAP
|
||||
ol_major=2
|
||||
ol_minor=1
|
||||
ol_patch=25
|
||||
ol_patch=X
|
||||
ol_api_inc=20124
|
||||
ol_api_lib=2:124:0
|
||||
ol_release_date="2003-12-05"
|
||||
|
@ -1,9 +1,17 @@
|
||||
# Makefile.in for slurpd
|
||||
# $OpenLDAP$
|
||||
## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
##
|
||||
## Makefile.in for slurpd
|
||||
## Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
## All rights reserved.
|
||||
##
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted only as authorized by the OpenLDAP
|
||||
## Public License.
|
||||
##
|
||||
## A copy of this license is available in the file LICENSE in the
|
||||
## top-level directory of the distribution or, alternatively, at
|
||||
## <http://www.OpenLDAP.org/license.html>.
|
||||
|
||||
PROGRAMS = slurpd
|
||||
XPROGRAMS = sslurpd
|
||||
@ -44,7 +52,7 @@ sslurpd: version.o
|
||||
|
||||
version.c: Makefile
|
||||
@-$(RM) $@
|
||||
$(MKVERSION) slurpd > $@
|
||||
$(MKVERSION) -s -n Versionstr slurpd > $@
|
||||
|
||||
version.o: version.c $(OBJS) $(SLURPD_L)
|
||||
|
||||
|
67
servers/slurpd/NOTES
Normal file
67
servers/slurpd/NOTES
Normal file
@ -0,0 +1,67 @@
|
||||
Written by Ganesan Rajagopal <rganesan@debian.org> and placed in the public
|
||||
domain.
|
||||
|
||||
Replication in OpenLDAP
|
||||
-----------------------
|
||||
|
||||
Please read "Section 10. Replication with slurpd" in the OpenLDAP guide for
|
||||
an overview and configuration of single-master replication. This document
|
||||
describes the internals of the replication mechanism.
|
||||
|
||||
slapd/repl.c contains routines add_replica_info() and
|
||||
add_replica_suffix(). add_replica_info() adds a new host to the list of
|
||||
replicas for a backend. add_replica_info() returns a number for the
|
||||
replica. add_replica_suffix() must then be called with the replica number to
|
||||
add a suffix that is hosted on this replica. add_replica_info() and add_replica_suffix() do not lock the
|
||||
replog_mutex.
|
||||
|
||||
Replicas are specified in the slapd.conf file. When slapd/config.c sees a
|
||||
"replica" line in slapd.conf, it calls add_replica_info() with the host
|
||||
specified in the "host=" directive and then calls add_replica_suffix() with
|
||||
the replica number and and the suffix specified in the "suffix="
|
||||
directive.
|
||||
|
||||
slapd writes out a replication log file containing LDIF change records for
|
||||
each configured replica for a suffix. The change records are generated for
|
||||
add, modify, delete and modrdn operations. A function called replog() is
|
||||
called at the end of the routines do_add (slapd/add.c),
|
||||
do_modify(slapd/modify.c), do_delete(slapd/delete.c) and
|
||||
do_modrdn(slapd/modrnd.c) to write out the change records.
|
||||
|
||||
In master/slave replication, updates are not allowed on slave
|
||||
replicas. Therefore replog() is not called if the suffix is configured with
|
||||
a updatedn (which indicates that this is a slave replica), instead a
|
||||
referral is returned back to the client. If multi-master replication is
|
||||
enabled, replog() is always called whenever any of the above updates happen
|
||||
unless the dn which is making the change is the updatedn. When the dn making
|
||||
the change is the same as the updatedn, it is assumed that this entry is
|
||||
being replicated by a slurpd instance on another host. (Note: For this
|
||||
reason, the updatedn must not be a "regular" admin/user object in
|
||||
multi-master replication).
|
||||
|
||||
The function replog() in slapd/repl.c generates the actual change
|
||||
records. Each change record is preceded by the list of replicas to which
|
||||
this change record needs to be replicated, the time when this change
|
||||
happened and the dn this change applies to. The pseudo code for replog() is
|
||||
follows
|
||||
|
||||
1. Check that a replog exists.
|
||||
2. Lock the replog mutex.
|
||||
3. Open and lock the replog file.
|
||||
4. Normalize the dn for the entry and write out a "replica:" entry for each
|
||||
replica with a matching suffix.
|
||||
5. Write out the the timestamp and the dn for the entry.
|
||||
6. Depending on the type of change, write out an appropriate changetype
|
||||
record.
|
||||
7. Close the replication log
|
||||
8. Unlock the replog mutex
|
||||
|
||||
slurpd has a file manager routine (function fm()) which watches for any
|
||||
change in the replication log. Whenever fm() detects a change in the
|
||||
replication log it locks the log, appends the records to slurpd's private
|
||||
copy of the replication log and truncates the log. See the slurpd/DESIGN
|
||||
file for a description of how slurpd works.
|
||||
|
||||
slapd can be configured to write out a replication log even if no replicas
|
||||
are configured. In this case the administrator has to truncate the
|
||||
replication log manually (under a lock!).
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/*
|
||||
* admin.c - routines for performing administrative tasks, e.g. on-the-fly
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/*
|
||||
* args.c - process command-line arguments, and set appropriate globals.
|
||||
@ -68,7 +80,7 @@ doargs(
|
||||
g->myname = strdup( g->myname + 1 );
|
||||
}
|
||||
|
||||
while ( (i = getopt( argc, argv, "d:f:n:or:t:" )) != EOF ) {
|
||||
while ( (i = getopt( argc, argv, "d:f:n:or:t:V" )) != EOF ) {
|
||||
switch ( i ) {
|
||||
case 'd': /* set debug level and 'do not detach' flag */
|
||||
g->no_detach = 1;
|
||||
@ -128,6 +140,9 @@ doargs(
|
||||
snprintf(g->slurpd_rdir, sz,
|
||||
"%s" LDAP_DIRSEP "replica", optarg);
|
||||
} break;
|
||||
case 'V':
|
||||
(g->version)++;
|
||||
break;
|
||||
default:
|
||||
usage( g->myname );
|
||||
return( -1 );
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
#define CH_FREE 1
|
||||
|
||||
|
@ -1,10 +1,20 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* Portions Copyright 2003 Mark Benson.
|
||||
* Portions Copyright 2002 John Morrissey.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +24,13 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP). Additional signficant contributors
|
||||
* include:
|
||||
* John Morrissey
|
||||
* Mark Benson
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
@ -64,8 +81,10 @@ slurpd_read_config(
|
||||
FILE *fp;
|
||||
char *line;
|
||||
|
||||
if ( cargv == NULL ) {
|
||||
cargv = ch_calloc( ARGS_STEP + 1, sizeof(*cargv) );
|
||||
cargv_size = ARGS_STEP + 1;
|
||||
}
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CONFIG, ARGS,
|
||||
@ -442,9 +461,16 @@ parse_replica_line(
|
||||
int gots = 0;
|
||||
int i;
|
||||
char *hp, *val;
|
||||
LDAPURLDesc *ludp;
|
||||
|
||||
for ( i = 1; i < cargc; i++ ) {
|
||||
if ( !strncasecmp( cargv[ i ], HOSTSTR, sizeof( HOSTSTR ) - 1 ) ) {
|
||||
if ( gots & GOT_HOST ) {
|
||||
fprintf( stderr, "Error: Malformed \"replica\" line in slapd config " );
|
||||
fprintf( stderr, "file, too many host or uri names specified, line %d\n",
|
||||
lineno );
|
||||
return -1;
|
||||
}
|
||||
val = cargv[ i ] + sizeof( HOSTSTR ); /* '\0' string terminator accounts for '=' */
|
||||
if (( hp = strchr( val, ':' )) != NULL ) {
|
||||
*hp = '\0';
|
||||
@ -456,15 +482,46 @@ parse_replica_line(
|
||||
}
|
||||
ri->ri_hostname = strdup( val );
|
||||
gots |= GOT_HOST;
|
||||
} else if ( !strncasecmp( cargv[ i ], URISTR, sizeof( URISTR ) - 1 ) ) {
|
||||
if ( gots & GOT_HOST ) {
|
||||
fprintf( stderr, "Error: Malformed \"replica\" line in slapd config " );
|
||||
fprintf( stderr, "file, too many host or uri names specified, line %d\n",
|
||||
lineno );
|
||||
return -1;
|
||||
}
|
||||
if ( ldap_url_parse( cargv[ i ] + sizeof( URISTR ), &ludp ) != LDAP_SUCCESS ) {
|
||||
fprintf( stderr, "Error: Malformed \"replica\" line in slapd config " );
|
||||
fprintf( stderr, "file, bad uri format specified, line %d\n",
|
||||
lineno );
|
||||
return -1;
|
||||
}
|
||||
if (ludp->lud_host == NULL) {
|
||||
fprintf( stderr, "Error: Malformed \"replica\" line in slapd config " );
|
||||
fprintf( stderr, "file, missing uri hostname, line %d\n",
|
||||
lineno );
|
||||
return -1;
|
||||
}
|
||||
ri->ri_hostname = strdup ( ludp->lud_host );
|
||||
ri->ri_port = ludp->lud_port;
|
||||
ri->ri_uri = strdup ( cargv[ i ] + sizeof( URISTR ) );
|
||||
ldap_free_urldesc( ludp );
|
||||
gots |= GOT_HOST;
|
||||
} else if ( !strncasecmp( cargv[ i ],
|
||||
ATTRSTR, sizeof( ATTRSTR ) - 1 ) ) {
|
||||
/* ignore it */ ;
|
||||
} else if ( !strncasecmp( cargv[ i ],
|
||||
SUFFIXSTR, sizeof( SUFFIXSTR ) - 1 ) ) {
|
||||
/* ignore it */ ;
|
||||
} else if ( !strncasecmp( cargv[i], STARTTLSSTR, sizeof(STARTTLSSTR)-1 )) {
|
||||
val = cargv[ i ] + sizeof( STARTTLSSTR );
|
||||
if( !strcasecmp( val, CRITICALSTR ) ) {
|
||||
ri->ri_tls = TLS_CRITICAL;
|
||||
} else {
|
||||
ri->ri_tls = TLS_ON;
|
||||
}
|
||||
} else if ( !strncasecmp( cargv[ i ], TLSSTR, sizeof( TLSSTR ) - 1 ) ) {
|
||||
val = cargv[ i ] + sizeof( TLSSTR );
|
||||
if( !strcasecmp( val, TLSCRITICALSTR ) ) {
|
||||
if( !strcasecmp( val, CRITICALSTR ) ) {
|
||||
ri->ri_tls = TLS_CRITICAL;
|
||||
} else {
|
||||
ri->ri_tls = TLS_ON;
|
||||
@ -483,10 +540,10 @@ parse_replica_line(
|
||||
fprintf( stderr, "slurpd no longer supports Kerberos.\n" );
|
||||
exit( EXIT_FAILURE );
|
||||
} else if ( !strcasecmp( val, SIMPLESTR )) {
|
||||
ri->ri_bind_method = AUTH_SIMPLE;
|
||||
ri->ri_bind_method = LDAP_AUTH_SIMPLE;
|
||||
gots |= GOT_METHOD;
|
||||
} else if ( !strcasecmp( val, SASLSTR )) {
|
||||
ri->ri_bind_method = AUTH_SASL;
|
||||
ri->ri_bind_method = LDAP_AUTH_SASL;
|
||||
gots |= GOT_METHOD;
|
||||
} else {
|
||||
ri->ri_bind_method = -1;
|
||||
@ -535,14 +592,13 @@ parse_replica_line(
|
||||
}
|
||||
}
|
||||
|
||||
if ( ri->ri_bind_method == AUTH_SASL) {
|
||||
if ( ri->ri_bind_method == LDAP_AUTH_SASL) {
|
||||
if ((gots & GOT_MECH) == 0) {
|
||||
fprintf( stderr, "Error: \"replica\" line needs SASLmech flag in " );
|
||||
fprintf( stderr, "slapd config file, line %d\n", lineno );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if ( gots != GOT_ALL ) {
|
||||
} else if ( gots != GOT_ALL ) {
|
||||
fprintf( stderr, "Error: Malformed \"replica\" line in slapd " );
|
||||
fprintf( stderr, "config file, line %d\n", lineno );
|
||||
return -1;
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/*
|
||||
* fm.c - file management routines.
|
||||
@ -27,6 +39,7 @@
|
||||
#include <ac/string.h>
|
||||
#include <ac/signal.h>
|
||||
#include <ac/socket.h>
|
||||
#include <ac/unistd.h>
|
||||
|
||||
#include "slurp.h"
|
||||
#include "globals.h"
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/*
|
||||
* globals.c - initialization code for global data
|
||||
@ -72,6 +84,7 @@ init_globals( void )
|
||||
g->myname = NULL;
|
||||
g->serverName = NULL;
|
||||
g->srpos = 0L;
|
||||
g->version = 0;
|
||||
if ( St_init( &(g->st)) < 0 ) {
|
||||
fprintf( stderr, "Cannot initialize status data\n" );
|
||||
exit( EXIT_FAILURE );
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
#ifndef SLURPD_GLOBALS_H
|
||||
#define SLURPD_GLOBALS_H 1
|
||||
@ -69,6 +81,8 @@ typedef struct globals {
|
||||
/* Default name of kerberos srvtab file */
|
||||
char *default_srvtab;
|
||||
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */
|
||||
/* Non-zero if we shall print the version */
|
||||
int version;
|
||||
} Globals;
|
||||
|
||||
|
||||
|
@ -1,10 +1,19 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* Portions Copyright 2003 Mark Benson.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +23,12 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP). Additional significant contributors
|
||||
* include:
|
||||
* Mark Benson
|
||||
*/
|
||||
|
||||
/*
|
||||
* ldap_op.c - routines to perform LDAP operations
|
||||
@ -31,16 +46,17 @@
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
|
||||
#define LDAP_DEPRECATED 1
|
||||
#include <ldap.h>
|
||||
#include "lutil_ldap.h"
|
||||
#include "slurp.h"
|
||||
|
||||
/* Forward references */
|
||||
static struct berval **make_singlevalued_berval LDAP_P(( char *, int ));
|
||||
static int op_ldap_add LDAP_P(( Ri *, Re *, char ** ));
|
||||
static int op_ldap_modify LDAP_P(( Ri *, Re *, char ** ));
|
||||
static int op_ldap_delete LDAP_P(( Ri *, Re *, char ** ));
|
||||
static int op_ldap_modrdn LDAP_P(( Ri *, Re *, char ** ));
|
||||
static int op_ldap_add LDAP_P(( Ri *, Re *, char **, int * ));
|
||||
static int op_ldap_modify LDAP_P(( Ri *, Re *, char **, int * ));
|
||||
static int op_ldap_delete LDAP_P(( Ri *, Re *, char **, int * ));
|
||||
static int op_ldap_modrdn LDAP_P(( Ri *, Re *, char **, int * ));
|
||||
static LDAPMod *alloc_ldapmod LDAP_P(( void ));
|
||||
static void free_ldapmod LDAP_P(( LDAPMod * ));
|
||||
static void free_ldmarr LDAP_P(( LDAPMod ** ));
|
||||
@ -64,11 +80,13 @@ int
|
||||
do_ldap(
|
||||
Ri *ri,
|
||||
Re *re,
|
||||
char **errmsg
|
||||
char **errmsg,
|
||||
int *errfree
|
||||
)
|
||||
{
|
||||
int retry = 2;
|
||||
*errmsg = NULL;
|
||||
*errfree = 0;
|
||||
|
||||
do {
|
||||
int lderr;
|
||||
@ -82,7 +100,7 @@ do_ldap(
|
||||
|
||||
switch ( re->re_changetype ) {
|
||||
case T_ADDCT:
|
||||
lderr = op_ldap_add( ri, re, errmsg );
|
||||
lderr = op_ldap_add( ri, re, errmsg, errfree );
|
||||
if ( lderr != LDAP_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ERR, "do_ldap: "
|
||||
@ -99,7 +117,7 @@ do_ldap(
|
||||
break;
|
||||
|
||||
case T_MODIFYCT:
|
||||
lderr = op_ldap_modify( ri, re, errmsg );
|
||||
lderr = op_ldap_modify( ri, re, errmsg, errfree );
|
||||
if ( lderr != LDAP_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ERR, "do_ldap: "
|
||||
@ -116,7 +134,7 @@ do_ldap(
|
||||
break;
|
||||
|
||||
case T_DELETECT:
|
||||
lderr = op_ldap_delete( ri, re, errmsg );
|
||||
lderr = op_ldap_delete( ri, re, errmsg, errfree );
|
||||
if ( lderr != LDAP_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ERR, "do_ldap: "
|
||||
@ -133,7 +151,7 @@ do_ldap(
|
||||
break;
|
||||
|
||||
case T_MODRDNCT:
|
||||
lderr = op_ldap_modrdn( ri, re, errmsg );
|
||||
lderr = op_ldap_modrdn( ri, re, errmsg, errfree );
|
||||
if ( lderr != LDAP_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ERR, "do_ldap: "
|
||||
@ -192,7 +210,8 @@ static int
|
||||
op_ldap_add(
|
||||
Ri *ri,
|
||||
Re *re,
|
||||
char **errmsg
|
||||
char **errmsg,
|
||||
int *errfree
|
||||
)
|
||||
{
|
||||
Mi *mi;
|
||||
@ -235,6 +254,8 @@ op_ldap_add(
|
||||
rc = ldap_add_s( ri->ri_ldp, re->re_dn, ldmarr );
|
||||
|
||||
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
|
||||
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
|
||||
*errfree = 1;
|
||||
|
||||
} else {
|
||||
*errmsg = "No modifications to do";
|
||||
@ -261,7 +282,8 @@ static int
|
||||
op_ldap_modify(
|
||||
Ri *ri,
|
||||
Re *re,
|
||||
char **errmsg
|
||||
char **errmsg,
|
||||
int *errfree
|
||||
)
|
||||
{
|
||||
Mi *mi;
|
||||
@ -331,6 +353,18 @@ op_ldap_modify(
|
||||
nvals = 0;
|
||||
nops++;
|
||||
break;
|
||||
#ifdef LDAP_MOD_INCREMENT
|
||||
case T_MODOPINCREMENT:
|
||||
state = T_MODOPINCREMENT;
|
||||
ldmarr = ( LDAPMod ** )
|
||||
ch_realloc(ldmarr, (( nops + 2 ) * ( sizeof( LDAPMod * ))));
|
||||
ldmarr[ nops ] = ldm = alloc_ldapmod();
|
||||
ldm->mod_op = LDAP_MOD_INCREMENT | LDAP_MOD_BVALUES;
|
||||
ldm->mod_type = value;
|
||||
nvals = 0;
|
||||
nops++;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if ( state == AWAITING_OP ) {
|
||||
#ifdef NEW_LOGGING
|
||||
@ -387,6 +421,8 @@ op_ldap_modify(
|
||||
ri->ri_hostname, ri->ri_port, re->re_dn );
|
||||
#endif
|
||||
rc = ldap_modify_s( ri->ri_ldp, re->re_dn, ldmarr );
|
||||
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
|
||||
*errfree = 1;
|
||||
}
|
||||
free_ldmarr( ldmarr );
|
||||
return( rc );
|
||||
@ -402,7 +438,8 @@ static int
|
||||
op_ldap_delete(
|
||||
Ri *ri,
|
||||
Re *re,
|
||||
char **errmsg
|
||||
char **errmsg,
|
||||
int *errfree
|
||||
)
|
||||
{
|
||||
int rc;
|
||||
@ -416,6 +453,8 @@ op_ldap_delete(
|
||||
ri->ri_hostname, ri->ri_port, re->re_dn );
|
||||
#endif
|
||||
rc = ldap_delete_s( ri->ri_ldp, re->re_dn );
|
||||
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
|
||||
*errfree = 1;
|
||||
|
||||
return( rc );
|
||||
}
|
||||
@ -436,7 +475,8 @@ static int
|
||||
op_ldap_modrdn(
|
||||
Ri *ri,
|
||||
Re *re,
|
||||
char **errmsg
|
||||
char **errmsg,
|
||||
int *errfree
|
||||
)
|
||||
{
|
||||
int rc = 0;
|
||||
@ -593,6 +633,8 @@ op_ldap_modrdn(
|
||||
rc = ldap_rename2_s( ri->ri_ldp, re->re_dn, newrdn, newsup, drdnflag );
|
||||
|
||||
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr);
|
||||
ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_STRING, errmsg);
|
||||
*errfree = 1;
|
||||
return( lderr );
|
||||
}
|
||||
|
||||
@ -696,6 +738,9 @@ char *type )
|
||||
if ( !strcmp( type, T_MODOPDELETESTR )) {
|
||||
return( T_MODOPDELETE );
|
||||
}
|
||||
if ( !strcmp( type, T_MODOPINCREMENTSTR )) {
|
||||
return( T_MODOPINCREMENT );
|
||||
}
|
||||
return( T_ERR );
|
||||
}
|
||||
|
||||
@ -874,8 +919,7 @@ retry:
|
||||
ldap_set_option(ri->ri_ldp, LDAP_OPT_RESTART, LDAP_OPT_ON);
|
||||
|
||||
if( do_tls ) {
|
||||
int err;
|
||||
err = ldap_start_tls_s(ri->ri_ldp, NULL, NULL);
|
||||
int err = ldap_start_tls_s(ri->ri_ldp, NULL, NULL);
|
||||
|
||||
if( err != LDAP_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
@ -891,6 +935,7 @@ retry:
|
||||
#endif
|
||||
|
||||
if( ri->ri_tls == TLS_CRITICAL ) {
|
||||
*lderr = err;
|
||||
ldap_unbind( ri->ri_ldp );
|
||||
ri->ri_ldp = NULL;
|
||||
return BIND_ERR_TLS_FAILED;
|
||||
@ -901,7 +946,7 @@ retry:
|
||||
}
|
||||
|
||||
switch ( ri->ri_bind_method ) {
|
||||
case AUTH_SIMPLE:
|
||||
case LDAP_AUTH_SIMPLE:
|
||||
/*
|
||||
* Bind with a plaintext password.
|
||||
*/
|
||||
@ -932,7 +977,7 @@ retry:
|
||||
}
|
||||
break;
|
||||
|
||||
case AUTH_SASL:
|
||||
case LDAP_AUTH_SASL:
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ARGS,
|
||||
"do_bind: bind to %s as %s via %s (SASL)\n",
|
||||
@ -948,9 +993,8 @@ retry:
|
||||
|
||||
#ifdef HAVE_CYRUS_SASL
|
||||
if( ri->ri_secprops != NULL ) {
|
||||
int err;
|
||||
err = ldap_set_option(ri->ri_ldp, LDAP_OPT_X_SASL_SECPROPS,
|
||||
ri->ri_secprops);
|
||||
int err = ldap_set_option(ri->ri_ldp,
|
||||
LDAP_OPT_X_SASL_SECPROPS, ri->ri_secprops);
|
||||
|
||||
if( err != LDAP_OPT_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/*
|
||||
* lock.c - routines to open and apply an advisory lock to a file
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,12 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP). Additional significant contributors
|
||||
* include:
|
||||
* Howard Chu
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
@ -46,6 +60,11 @@
|
||||
#define MAIN_RETURN(x) return(x)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MKVERSION
|
||||
const char Versionstr[] =
|
||||
OPENLDAP_PACKAGE " " OPENLDAP_VERSION " Standalone LDAP Replicator (slurpd)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NT_SERVICE_MANAGER
|
||||
void WINAPI ServiceMain( DWORD argc, LPTSTR *argv )
|
||||
#else
|
||||
@ -125,6 +144,20 @@ int main( int argc, char **argv )
|
||||
goto stop;
|
||||
}
|
||||
|
||||
if ( sglob->version ) {
|
||||
fprintf(stderr, "%s\n", Versionstr);
|
||||
if (sglob->version > 1 ) {
|
||||
rc = 1;
|
||||
goto stop;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( SLURPD, INFO, "%s\n", Versionstr, 0, 0 );
|
||||
#else
|
||||
Debug ( LDAP_DEBUG_ANY, "%s\n", Versionstr, 0, 0 );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read slapd config file and initialize Re (per-replica) structs.
|
||||
*/
|
||||
@ -161,7 +194,7 @@ int main( int argc, char **argv )
|
||||
*/
|
||||
if ( sglob->st->st_read( sglob->st )) {
|
||||
fprintf( stderr, "Malformed slurpd status file \"%s\"\n",
|
||||
sglob->slurpd_status_file, 0, 0 );
|
||||
sglob->slurpd_status_file );
|
||||
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 17 );
|
||||
rc = 1;
|
||||
goto stop;
|
||||
|
@ -1,7 +1,16 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
@ -1,8 +1,32 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/* Portions Copyright (c) 1996 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.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
#ifndef _PROTO_SLURP
|
||||
#define _PROTO_SLURP
|
||||
|
||||
@ -53,7 +77,7 @@ extern int ldap_debug;
|
||||
extern struct globals *init_globals LDAP_P((void));
|
||||
|
||||
/* ldap_op.c */
|
||||
int do_ldap LDAP_P((Ri *ri, Re *re, char **errmsg));
|
||||
int do_ldap LDAP_P((Ri *ri, Re *re, char **errmsg, int *errfree));
|
||||
|
||||
/* lock.c */
|
||||
FILE *lock_fopen LDAP_P((const char *fname, const char *type, FILE **lfp));
|
||||
@ -83,4 +107,7 @@ int tsleep LDAP_P((time_t interval));
|
||||
void start_lwp_scheduler LDAP_P(( void ));
|
||||
#endif
|
||||
|
||||
/*main.c */
|
||||
extern const char Versionstr[];
|
||||
|
||||
#endif /* _PROTO_SLURP */
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/*
|
||||
* re.c - routines which deal with Re (Replication entry) structures.
|
||||
@ -221,14 +233,12 @@ Re_parse(
|
||||
type, 0, 0 );
|
||||
#endif
|
||||
free( type );
|
||||
if ( value != NULL )
|
||||
free( value );
|
||||
free( value );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
free( type );
|
||||
if ( value != NULL )
|
||||
free( value );
|
||||
free( value );
|
||||
}
|
||||
|
||||
if ( state != GOT_ALL ) {
|
||||
@ -367,8 +377,7 @@ get_repl_hosts(
|
||||
free( type );
|
||||
if ( !repl_ok ) {
|
||||
warn_unknown_replica( value, port );
|
||||
if ( value != NULL )
|
||||
free( value );
|
||||
free( value );
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -387,8 +396,7 @@ get_repl_hosts(
|
||||
rh[ nreplicas ].rh_port = port;
|
||||
nreplicas++;
|
||||
|
||||
if ( value != NULL )
|
||||
free( value );
|
||||
free( value );
|
||||
}
|
||||
|
||||
if ( nreplicas == 0 ) {
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/*
|
||||
* ri.c - routines used to manipulate Ri structures. An Ri (Replica
|
||||
@ -51,6 +63,7 @@ Ri_process(
|
||||
Re *re = NULL, *new_re = NULL;
|
||||
int rc ;
|
||||
char *errmsg;
|
||||
int errfree;
|
||||
|
||||
(void) SIGNAL( LDAP_SIGUSR1, do_nothing );
|
||||
#ifdef SIGPIPE
|
||||
@ -113,7 +126,7 @@ Ri_process(
|
||||
ri->ri_hostname, ri->ri_port, re->re_dn );
|
||||
#endif
|
||||
} else {
|
||||
rc = do_ldap( ri, re, &errmsg );
|
||||
rc = do_ldap( ri, re, &errmsg, &errfree );
|
||||
switch ( rc ) {
|
||||
case DO_LDAP_ERR_RETRYABLE:
|
||||
ldap_pvt_thread_sleep( RETRY_SLEEP_TIME );
|
||||
@ -145,6 +158,9 @@ Ri_process(
|
||||
(void) sglob->st->st_write( sglob->st );
|
||||
break;
|
||||
}
|
||||
if ( errfree && errmsg ) {
|
||||
ch_free( errmsg );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef NEW_LOGGING
|
||||
@ -169,7 +185,7 @@ Ri_process(
|
||||
re = new_re;
|
||||
rq->rq_unlock( rq );
|
||||
if ( sglob->slurpd_shutdown ) {
|
||||
if ( ri->ri_ldp ) {
|
||||
if ( ri->ri_ldp ) {
|
||||
ldap_unbind( ri->ri_ldp );
|
||||
ri->ri_ldp = NULL;
|
||||
}
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/*
|
||||
* rq.c - routines used to manage the queue of replication entries.
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
/* slurp.h - Standalone Ldap Update Replication Daemon (slurpd) */
|
||||
|
||||
@ -43,6 +55,7 @@
|
||||
#include "ldif.h"
|
||||
|
||||
#ifdef HAVE_WINSOCK
|
||||
/* should be moved to portable.h.nt */
|
||||
#define ftruncate(a,b) _chsize(a,b)
|
||||
#define truncate(a,b) _lclose( _lcreat(a, 0))
|
||||
#define S_IRGRP 0
|
||||
@ -64,9 +77,6 @@
|
||||
/* slurpd dump file - contents of rq struct are written here (debugging) */
|
||||
#define SLURPD_DUMPFILE LDAP_TMPDIR LDAP_DIRSEP "slurpd.dump"
|
||||
|
||||
/* default srvtab file. Can be overridden */
|
||||
#define SRVTAB "/etc/srvtab"
|
||||
|
||||
/* Amount of time to sleep if no more work to do */
|
||||
#define DEFAULT_NO_WORK_INTERVAL 3
|
||||
|
||||
@ -84,11 +94,6 @@
|
||||
#define TLS_ON 1
|
||||
#define TLS_CRITICAL 2
|
||||
|
||||
/* We support simple (plaintext password) and SASL authentication */
|
||||
#define AUTH_SIMPLE 1
|
||||
#define AUTH_KERBEROS 2
|
||||
#define AUTH_SASL 3
|
||||
|
||||
/* Rejection records are prefaced with this string */
|
||||
#define ERROR_STR "ERROR"
|
||||
|
||||
@ -117,8 +122,10 @@
|
||||
#define T_MODOPREPLACE 9
|
||||
#define T_MODOPDELETESTR "delete"
|
||||
#define T_MODOPDELETE 10
|
||||
#define T_MODOPINCREMENTSTR "increment"
|
||||
#define T_MODOPINCREMENT 11
|
||||
#define T_MODSEPSTR "-"
|
||||
#define T_MODSEP 11
|
||||
#define T_MODSEP 12
|
||||
|
||||
#define T_NEWRDNSTR "newrdn"
|
||||
#define T_DELOLDRDNSTR "deleteoldrdn"
|
||||
@ -144,8 +151,9 @@
|
||||
#define SASLMECHSTR "saslmech"
|
||||
#define REALMSTR "realm"
|
||||
#define SECPROPSSTR "secprops"
|
||||
#define STARTTLSSTR "starttls"
|
||||
#define TLSSTR "tls"
|
||||
#define TLSCRITICALSTR "critical"
|
||||
#define CRITICALSTR "critical"
|
||||
|
||||
#define REPLICA_SLEEP_TIME ( 10 )
|
||||
|
||||
@ -236,7 +244,6 @@ struct ri {
|
||||
int (*ri_process) LDAP_P(( Ri * )); /* process the next repl entry */
|
||||
void (*ri_wake) LDAP_P(( Ri * )); /* wake up a sleeping thread */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@ -245,12 +252,10 @@ struct ri {
|
||||
* be considered private to routines in re.c, and to routines in ri.c.
|
||||
*/
|
||||
typedef struct mi {
|
||||
|
||||
/* Private data */
|
||||
char *mi_type; /* attr or type */
|
||||
char *mi_val; /* value */
|
||||
int mi_len; /* length of mi_val */
|
||||
|
||||
} Mi;
|
||||
|
||||
|
||||
@ -262,7 +267,6 @@ typedef struct mi {
|
||||
*/
|
||||
typedef struct re Re;
|
||||
struct re {
|
||||
|
||||
/* Private data */
|
||||
ldap_pvt_thread_mutex_t
|
||||
re_mutex; /* mutex for this Re */
|
||||
|
@ -1,10 +1,18 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 Regents of the University of Michigan.
|
||||
/* Portions Copyright (c) 1996 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -14,6 +22,10 @@
|
||||
* software without specific prior written permission. This software
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
/* ACKNOWLEDGEMENTS:
|
||||
* This work was originally developed by the University of Michigan
|
||||
* (as part of U-MICH LDAP).
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -93,6 +93,9 @@ result: 0 Success
|
||||
# requesting: 1.1
|
||||
#
|
||||
|
||||
# University of Michigan, US
|
||||
dn: o=University of Michigan,c=US
|
||||
|
||||
# search reference
|
||||
ref: ldap://hostA/o=abc,c=us??base
|
||||
ref: ldap://hostB/o=ABC,c=US??base
|
||||
@ -100,9 +103,6 @@ ref: ldap://hostB/o=ABC,c=US??base
|
||||
# search reference
|
||||
ref: ldap://hostC/o=xyz,c=us??base
|
||||
|
||||
# University of Michigan, US
|
||||
dn: o=University of Michigan,c=US
|
||||
|
||||
# search result
|
||||
search: 2
|
||||
result: 0 Success
|
||||
@ -118,6 +118,15 @@ result: 0 Success
|
||||
# requesting: 1.1
|
||||
#
|
||||
|
||||
# Manager, University of Michigan, US
|
||||
dn: cn=Manager,o=University of Michigan,c=US
|
||||
|
||||
# University of Michigan, US
|
||||
dn: o=University of Michigan,c=US
|
||||
|
||||
# US
|
||||
dn: c=US
|
||||
|
||||
# search reference
|
||||
ref: ldap://hostA/o=abc,c=us??sub
|
||||
ref: ldap://hostB/o=ABC,c=US??sub
|
||||
@ -125,15 +134,6 @@ ref: ldap://hostB/o=ABC,c=US??sub
|
||||
# search reference
|
||||
ref: ldap://hostC/o=xyz,c=us??sub
|
||||
|
||||
# US
|
||||
dn: c=US
|
||||
|
||||
# University of Michigan, US
|
||||
dn: o=University of Michigan,c=US
|
||||
|
||||
# Manager, University of Michigan, US
|
||||
dn: cn=Manager,o=University of Michigan,c=US
|
||||
|
||||
# search result
|
||||
search: 2
|
||||
result: 0 Success
|
||||
|
Loading…
x
Reference in New Issue
Block a user