]> git.sur5r.net Git - openldap/commitdiff
Update slurpd(8)
authorKurt Zeilenga <kurt@openldap.org>
Thu, 18 Dec 2003 04:25:14 +0000 (04:25 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 18 Dec 2003 04:25:14 +0000 (04:25 +0000)
26 files changed:
CHANGES
build/version.var
servers/slurpd/Makefile.in
servers/slurpd/NOTES [new file with mode: 0644]
servers/slurpd/admin.c
servers/slurpd/args.c
servers/slurpd/ch_malloc.c
servers/slurpd/config.c
servers/slurpd/fm.c
servers/slurpd/globals.c
servers/slurpd/globals.h
servers/slurpd/ldap_op.c
servers/slurpd/lock.c
servers/slurpd/main.c
servers/slurpd/nt_svc.c
servers/slurpd/proto-slurp.h
servers/slurpd/re.c
servers/slurpd/reject.c
servers/slurpd/replica.c
servers/slurpd/replog.c
servers/slurpd/ri.c
servers/slurpd/rq.c
servers/slurpd/sanity.c
servers/slurpd/slurp.h
servers/slurpd/st.c
tests/data/referrals.out

diff --git a/CHANGES b/CHANGES
index e89a9d243774dc2df03bbd0766a49ea3b5815043..71bbafe8b5182f063508f0b454dae545b61a1de2 100644 (file)
--- a/CHANGES
+++ b/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)
 
index 0bbfc32b8b53781750fe991b6ccc9fef5148f77d..afd0915e670d3baafa7d8885ce45d977a282685e 100644 (file)
@@ -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"
index 78844afe00f84a76750423475b235b674dbda97c..b13400a660d7f8c5b78837364ad5be77937adcb6 100644 (file)
@@ -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)
 
diff --git a/servers/slurpd/NOTES b/servers/slurpd/NOTES
new file mode 100644 (file)
index 0000000..c8b1ae9
--- /dev/null
@@ -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!).
index 1de4901e4a562ec26e91b889263e238cd89aa143..0c1c3dad12ddaf18dc9a68d4f2a245f36f1a4196 100644 (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
  * 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
index 485cb2b9953465f43db91a6c8ff79961e71201b3..380deeab19040980bcdf5ca296a2f2dc96b1175d 100644 (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
  * 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 );
index 2b42ab266329b1023ddcfe053e37423f789e78c6..33523746a8ead8ef40f3a3e0229e5df03e7399ec 100644 (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
  * 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
 
index 4c3a285347fcd652a4a507ae1504ccca581650d5..ad78eda888aad82ef5b6c829c12e6ea08cf11969 100644 (file)
@@ -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
  * 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;
index 2547d9640804857440ec3c25a637cc407eb4ebed..35352e7d1f411b0987a7e59320a418b6168f51cd 100644 (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
  * 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"
index 5ff11118a0c2a8ba5dbbbb25ce804f2242ec8e5e..1f7cba70880d82cf2dd19c74ea6801b890d4b3b9 100644 (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
  * 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 );
index 86b9c154d7638da1ddda6b8d9c8cd5c724a1896a..1f9595f70b2b7def700fec9a6a933c075d126c0b 100644 (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
  * 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;
 
 
index f56a6acd157e6023f6e01a4fed75c8145f56bd62..1ce383d84fee736f7d5a8d579b569f925ba68b48 100644 (file)
@@ -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
  * 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
 #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
index 8a8fa65f98c447193addb3ad8e5a61dd6883ce52..8b8060d2b5a151d2ab2d897a7242f5bcea4bdef9 100644 (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
  * 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
index 3d659b34dd6b5daea6a130171dd2a77787066b45..1e4a53ffcb2d322734d56b1477f043015a3e1301 100644 (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
  * 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
+ */
 
 
 /* 
 #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;
index 9be6d49db8c192e5fb525f35908f88a8e2e9655c..b0811292cf96daad202689f44ef02a19ddeb0cd4 100644 (file)
@@ -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"
index d91ba666569c725f0d2892b077ba9c0caba9b794..fa01c987c1c0ee11a039028db97d6d2b98ae352c 100644 (file)
@@ -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 */
index 325d4627361f01b3c7710f13b193d46add6496fc..4e806abc8f7bd542f6b110243e48ed16c675d945 100644 (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
  * 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 ) {
index 0b4d5ee12e04f1de9d7c49cebc909464f0cc6baf..b147cc2b220636f10b434e0799ec9fd30dd73973 100644 (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
  * 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).
+ */
 
 
 /*
index d24ba413a76bfe8e21cbd192a14abb8466bb592a..58408ba663ae34b531762581e265fe1948b815cc 100644 (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
  * 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).
+ */
 
 
 /*
index c22bfedee94c0f14edccfb6c031a3ffbad9864d7..71051dee538ad504a402cae69ba5adce997c3cce 100644 (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
  * 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).
+ */
 
 
 /*
index 090c188531b1e85ffe779cc3c4c9553d0b612f02..5c6dc73dea4f97728abdbcfe78e0d20cdbf658b4 100644 (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
  * 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;
            }
index f19277017e9359b0c0cab9982db2fc7687698973..9a84bfce2f6c911eccfcda8046e4b5699410bdc2 100644 (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
  * 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.
index 0927e597f2982b8986231bfe63cfc6c85edd4a57..88d77ca9a6fe05a18d190bcb7cd5851bde62d74d 100644 (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
  * 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).
+ */
 
 
 /*
index 1178b92ca1743091e4cf495d989c41c21e04f082..f97d8b8ab9919728a98f17f0d0d19749244d773c 100644 (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
  * 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
 
 #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"
 
 #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"
 #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 */
index e2a00299b6ea444204a39ce7557b840f4ab5b6e4..48ad8d0c5be63a4610399c97836ae80844764863 100644 (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
  * 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).
+ */
 
 
 /*
index 1ed2e49b5d6733746476ca86d1afdffc572a806f..4fac149bb5cab4bbbe2758f3cad6fbe9d20ab758 100644 (file)
@@ -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,21 +118,21 @@ result: 0 Success
 # requesting: 1.1 
 #
 
-# search reference
-ref: ldap://hostA/o=abc,c=us??sub
-ref: ldap://hostB/o=ABC,c=US??sub
+# Manager, University of Michigan, US
+dn: cn=Manager,o=University of Michigan,c=US
 
-# search reference
-ref: ldap://hostC/o=xyz,c=us??sub
+# University of Michigan, US
+dn: o=University of Michigan,c=US
 
 # US
 dn: c=US
 
-# University of Michigan, US
-dn: o=University of Michigan,c=US
+# search reference
+ref: ldap://hostA/o=abc,c=us??sub
+ref: ldap://hostB/o=ABC,c=US??sub
 
-# Manager, University of Michigan, US
-dn: cn=Manager,o=University of Michigan,c=US
+# search reference
+ref: ldap://hostC/o=xyz,c=us??sub
 
 # search result
 search: 2