From: Kurt Zeilenga Date: Thu, 18 Dec 2003 04:25:14 +0000 (+0000) Subject: Update slurpd(8) X-Git-Tag: OPENLDAP_REL_ENG_2_1_26~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8a2eb7f99f2b4b0067594bb93ce87987c0ac58d;p=thirdparty%2Fopenldap.git Update slurpd(8) --- diff --git a/CHANGES b/CHANGES index e89a9d2437..71bbafe8b5 100644 --- 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) diff --git a/build/version.var b/build/version.var index 0bbfc32b8b..afd0915e67 100644 --- a/build/version.var +++ b/build/version.var @@ -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" diff --git a/servers/slurpd/Makefile.in b/servers/slurpd/Makefile.in index 78844afe00..b13400a660 100644 --- a/servers/slurpd/Makefile.in +++ b/servers/slurpd/Makefile.in @@ -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 . ## -## 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 +## . 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 index 0000000000..c8b1ae9163 --- /dev/null +++ b/servers/slurpd/NOTES @@ -0,0 +1,67 @@ +Written by Ganesan Rajagopal 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!). diff --git a/servers/slurpd/admin.c b/servers/slurpd/admin.c index 1de4901e4a..0c1c3dad12 100644 --- a/servers/slurpd/admin.c +++ b/servers/slurpd/admin.c @@ -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 . + * + * 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 + * . */ -/* - * 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 diff --git a/servers/slurpd/args.c b/servers/slurpd/args.c index 485cb2b995..380deeab19 100644 --- a/servers/slurpd/args.c +++ b/servers/slurpd/args.c @@ -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 . + * + * 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 + * . */ -/* - * 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 ); diff --git a/servers/slurpd/ch_malloc.c b/servers/slurpd/ch_malloc.c index 2b42ab2663..33523746a8 100644 --- a/servers/slurpd/ch_malloc.c +++ b/servers/slurpd/ch_malloc.c @@ -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 . + * + * 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 + * . */ -/* - * 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 diff --git a/servers/slurpd/config.c b/servers/slurpd/config.c index 4c3a285347..ad78eda888 100644 --- a/servers/slurpd/config.c +++ b/servers/slurpd/config.c @@ -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 . + * + * 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 + * . */ -/* - * 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; diff --git a/servers/slurpd/fm.c b/servers/slurpd/fm.c index 2547d96408..35352e7d1f 100644 --- a/servers/slurpd/fm.c +++ b/servers/slurpd/fm.c @@ -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 . + * + * 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 + * . */ -/* - * 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 #include #include +#include #include "slurp.h" #include "globals.h" diff --git a/servers/slurpd/globals.c b/servers/slurpd/globals.c index 5ff11118a0..1f7cba7088 100644 --- a/servers/slurpd/globals.c +++ b/servers/slurpd/globals.c @@ -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 . + * + * 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 + * . */ -/* - * 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 ); diff --git a/servers/slurpd/globals.h b/servers/slurpd/globals.h index 86b9c154d7..1f9595f70b 100644 --- a/servers/slurpd/globals.h +++ b/servers/slurpd/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 . + * + * 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 + * . */ -/* - * 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; diff --git a/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c index f56a6acd15..1ce383d84f 100644 --- a/servers/slurpd/ldap_op.c +++ b/servers/slurpd/ldap_op.c @@ -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 . + * + * 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 + * . */ -/* - * 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 #include +#define LDAP_DEPRECATED 1 #include #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 diff --git a/servers/slurpd/lock.c b/servers/slurpd/lock.c index 8a8fa65f98..8b8060d2b5 100644 --- a/servers/slurpd/lock.c +++ b/servers/slurpd/lock.c @@ -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 . + * + * 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 + * . */ -/* - * 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 diff --git a/servers/slurpd/main.c b/servers/slurpd/main.c index 3d659b34dd..1e4a53ffcb 100644 --- a/servers/slurpd/main.c +++ b/servers/slurpd/main.c @@ -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 . + * + * 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 + * . */ -/* - * 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; diff --git a/servers/slurpd/nt_svc.c b/servers/slurpd/nt_svc.c index 9be6d49db8..b0811292cf 100644 --- a/servers/slurpd/nt_svc.c +++ b/servers/slurpd/nt_svc.c @@ -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 . + * + * 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 + * . */ #include "portable.h" diff --git a/servers/slurpd/proto-slurp.h b/servers/slurpd/proto-slurp.h index d91ba66656..fa01c987c1 100644 --- a/servers/slurpd/proto-slurp.h +++ b/servers/slurpd/proto-slurp.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 . + * + * 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 + * . */ +/* 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 */ diff --git a/servers/slurpd/re.c b/servers/slurpd/re.c index 325d462736..4e806abc8f 100644 --- a/servers/slurpd/re.c +++ b/servers/slurpd/re.c @@ -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 . + * + * 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 + * . */ -/* - * 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 ) { diff --git a/servers/slurpd/reject.c b/servers/slurpd/reject.c index 0b4d5ee12e..b147cc2b22 100644 --- a/servers/slurpd/reject.c +++ b/servers/slurpd/reject.c @@ -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 . + * + * 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 + * . */ -/* - * 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). + */ /* diff --git a/servers/slurpd/replica.c b/servers/slurpd/replica.c index d24ba413a7..58408ba663 100644 --- a/servers/slurpd/replica.c +++ b/servers/slurpd/replica.c @@ -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 . + * + * 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 + * . */ -/* - * 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). + */ /* diff --git a/servers/slurpd/replog.c b/servers/slurpd/replog.c index c22bfedee9..71051dee53 100644 --- a/servers/slurpd/replog.c +++ b/servers/slurpd/replog.c @@ -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 . + * + * 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 + * . */ -/* - * 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). + */ /* diff --git a/servers/slurpd/ri.c b/servers/slurpd/ri.c index 090c188531..5c6dc73dea 100644 --- a/servers/slurpd/ri.c +++ b/servers/slurpd/ri.c @@ -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 . + * + * 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 + * . */ -/* - * 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; } diff --git a/servers/slurpd/rq.c b/servers/slurpd/rq.c index f19277017e..9a84bfce2f 100644 --- a/servers/slurpd/rq.c +++ b/servers/slurpd/rq.c @@ -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 . + * + * 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 + * . */ -/* - * 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. diff --git a/servers/slurpd/sanity.c b/servers/slurpd/sanity.c index 0927e597f2..88d77ca9a6 100644 --- a/servers/slurpd/sanity.c +++ b/servers/slurpd/sanity.c @@ -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 . + * + * 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 + * . */ -/* - * 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). + */ /* diff --git a/servers/slurpd/slurp.h b/servers/slurpd/slurp.h index 1178b92ca1..f97d8b8ab9 100644 --- a/servers/slurpd/slurp.h +++ b/servers/slurpd/slurp.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 . + * + * 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 + * . */ -/* - * 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 */ diff --git a/servers/slurpd/st.c b/servers/slurpd/st.c index e2a00299b6..48ad8d0c5b 100644 --- a/servers/slurpd/st.c +++ b/servers/slurpd/st.c @@ -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 . + * + * 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 + * . */ -/* - * 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). + */ /* diff --git a/tests/data/referrals.out b/tests/data/referrals.out index 1ed2e49b5d..4fac149bb5 100644 --- a/tests/data/referrals.out +++ b/tests/data/referrals.out @@ -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