merge conflicts

This commit is contained in:
christos 2017-02-09 01:53:50 +00:00
parent 376af7d777
commit 915bea738c
17 changed files with 103 additions and 189 deletions

View File

@ -3,7 +3,7 @@
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2014 The OpenLDAP Foundation.
## Copyright 1998-2016 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
@ -54,7 +54,7 @@ APPLICATION=$1
cat << __EOF__
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -67,7 +67,7 @@ cat << __EOF__
*/
static const char copyright[] =
"Copyright 1998-2014 The OpenLDAP Foundation. All rights reserved.\n"
"Copyright 1998-2016 The OpenLDAP Foundation. All rights reserved.\n"
"COPYING RESTRICTIONS APPLY\n";
$static $const char $SYMBOL[] =

View File

@ -1,10 +1,10 @@
/* $NetBSD: common.c,v 1.5 2016/11/02 13:15:53 joerg Exp $ */
/* $NetBSD: common.c,v 1.6 2017/02/09 01:53:50 christos Exp $ */
/* common.c - common routines for the ldap client tools */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* Portions Copyright 2003 Kurt D. Zeilenga.
* Portions Copyright 2003 IBM Corporation.
* All rights reserved.
@ -24,6 +24,9 @@
* Kurt D. Zeilenga (additional common argument and control support)
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: common.c,v 1.6 2017/02/09 01:53:50 christos Exp $");
#include "portable.h"
#include <stdio.h>
@ -68,7 +71,7 @@ int nocanon = 0;
int referrals = 0;
int verbose = 0;
int ldif = 0;
ber_len_t ldif_wrap = LDIF_LINE_WIDTH;
ber_len_t ldif_wrap = 0;
char *prog = NULL;
/* connection */

View File

@ -2,7 +2,7 @@
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2014 The OpenLDAP Foundation.
## Copyright 1998-2016 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without

View File

@ -1,10 +1,10 @@
/* $NetBSD: ldap_queue.h,v 1.3 2014/05/28 10:12:43 tron Exp $ */
/* $NetBSD: ldap_queue.h,v 1.4 2017/02/09 01:53:50 christos Exp $ */
/* ldap_queue.h -- queue macros */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2001-2014 The OpenLDAP Foundation.
* Copyright 2001-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -4,7 +4,7 @@
/* begin of portable.h.pre */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation
* Copyright 1998-2016 The OpenLDAP Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,10 +1,10 @@
/* $NetBSD: os-ip.c,v 1.6 2014/05/28 10:12:43 tron Exp $ */
/* $NetBSD: os-ip.c,v 1.7 2017/02/09 01:53:51 christos Exp $ */
/* os-ip.c -- platform-specific TCP & UDP related code */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* Portions Copyright 1999 Lars Uffmann.
* All rights reserved.
*
@ -23,6 +23,9 @@
* Lars Uffman
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: os-ip.c,v 1.7 2017/02/09 01:53:51 christos Exp $");
#include "portable.h"
#include <stdio.h>

View File

@ -1,10 +1,10 @@
/* $NetBSD: os-local.c,v 1.7 2014/05/28 10:12:43 tron Exp $ */
/* $NetBSD: os-local.c,v 1.8 2017/02/09 01:53:51 christos Exp $ */
/* os-local.c -- platform-specific domain socket code */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,6 +25,9 @@
* is provided ``as is'' without express or implied warranty.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: os-local.c,v 1.8 2017/02/09 01:53:51 christos Exp $");
#include "portable.h"
#ifdef LDAP_PF_LOCAL

View File

@ -1,10 +1,10 @@
/* $NetBSD: tls_o.c,v 1.4 2014/05/28 10:12:43 tron Exp $ */
/* $NetBSD: tls_o.c,v 1.5 2017/02/09 01:53:51 christos Exp $ */
/* tls_o.c - Handle tls/ssl using OpenSSL */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2008-2014 The OpenLDAP Foundation.
* Copyright 2008-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -18,6 +18,9 @@
/* ACKNOWLEDGEMENTS: Rewritten by Howard Chu
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: tls_o.c,v 1.5 2017/02/09 01:53:51 christos Exp $");
#include "portable.h"
#ifdef HAVE_OPENSSL

View File

@ -1,73 +0,0 @@
/* $NetBSD: sample-bdb.c,v 1.1.1.1 2014/05/28 09:58:42 tron Exp $ */
/* sample-bdb.c - BerkeleyDB toy/sample
*
* Do a line-by-line comparison of this and sample-mdb.c
*/
/*
* Copyright 2012 Howard Chu, Symas Corp.
* 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>.
*/
#include <stdio.h>
#include <string.h>
#include <db.h>
int main(int argc,char * argv[])
{
int rc;
DB_ENV *env;
DB *dbi;
DBT key, data;
DB_TXN *txn;
DBC *cursor;
char sval[32], kval[32];
#define FLAGS (DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_INIT_MPOOL|DB_CREATE|DB_THREAD)
rc = db_env_create(&env, 0);
rc = env->open(env, "./testdb", FLAGS, 0664);
rc = db_create(&dbi, env, 0);
rc = env->txn_begin(env, NULL, &txn, 0);
rc = dbi->open(dbi, txn, "test.bdb", NULL, DB_BTREE, DB_CREATE, 0664);
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
key.size = sizeof(int);
key.data = sval;
data.size = sizeof(sval);
data.data = sval;
sprintf(sval, "%03x %d foo bar", 32, 3141592);
rc = dbi->put(dbi, txn, &key, &data, 0);
rc = txn->commit(txn, 0);
if (rc) {
fprintf(stderr, "txn->commit: (%d) %s\n", rc, db_strerror(rc));
goto leave;
}
rc = env->txn_begin(env, NULL, &txn, 0);
rc = dbi->cursor(dbi, txn, &cursor, 0);
key.flags = DB_DBT_USERMEM;
key.data = kval;
key.ulen = sizeof(kval);
data.flags = DB_DBT_USERMEM;
data.data = sval;
data.ulen = sizeof(sval);
while ((rc = cursor->c_get(cursor, &key, &data, DB_NEXT)) == 0) {
printf("key: %p %.*s, data: %p %.*s\n",
key.data, (int) key.size, (char *) key.data,
data.data, (int) data.size, (char *) data.data);
}
rc = cursor->c_close(cursor);
rc = txn->abort(txn);
leave:
rc = dbi->close(dbi, 0);
rc = env->close(env, 0);
return rc;
}

View File

@ -1,62 +0,0 @@
/* $NetBSD: sample-mdb.c,v 1.1.1.1 2014/05/28 09:58:42 tron Exp $ */
/* sample-mdb.c - MDB toy/sample
*
* Do a line-by-line comparison of this and sample-bdb.c
*/
/*
* Copyright 2012 Howard Chu, Symas Corp.
* 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>.
*/
#include <stdio.h>
#include "lmdb.h"
int main(int argc,char * argv[])
{
int rc;
MDB_env *env;
MDB_dbi dbi;
MDB_val key, data;
MDB_txn *txn;
MDB_cursor *cursor;
char sval[32];
rc = mdb_env_create(&env);
rc = mdb_env_open(env, "./testdb", 0, 0664);
rc = mdb_txn_begin(env, NULL, 0, &txn);
rc = mdb_open(txn, NULL, 0, &dbi);
key.mv_size = sizeof(int);
key.mv_data = sval;
data.mv_size = sizeof(sval);
data.mv_data = sval;
sprintf(sval, "%03x %d foo bar", 32, 3141592);
rc = mdb_put(txn, dbi, &key, &data, 0);
rc = mdb_txn_commit(txn);
if (rc) {
fprintf(stderr, "mdb_txn_commit: (%d) %s\n", rc, mdb_strerror(rc));
goto leave;
}
rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
rc = mdb_cursor_open(txn, dbi, &cursor);
while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
printf("key: %p %.*s, data: %p %.*s\n",
key.mv_data, (int) key.mv_size, (char *) key.mv_data,
data.mv_data, (int) data.mv_size, (char *) data.mv_data);
}
mdb_cursor_close(cursor);
mdb_txn_abort(txn);
leave:
mdb_close(env, dbi);
mdb_env_close(env);
return 0;
}

View File

@ -1,10 +1,10 @@
/* $NetBSD: detach.c,v 1.3 2014/05/28 10:12:43 tron Exp $ */
/* $NetBSD: detach.c,v 1.4 2017/02/09 01:53:51 christos Exp $ */
/* detach.c -- routines to daemonize a process */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -30,6 +30,9 @@
* and distributed as part of U-MICH LDAP.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: detach.c,v 1.4 2017/02/09 01:53:51 christos Exp $");
#include "portable.h"
#include <stdio.h>

View File

@ -1,10 +1,10 @@
/* $NetBSD: md5.c,v 1.3 2014/05/28 10:12:43 tron Exp $ */
/* $NetBSD: md5.c,v 1.4 2017/02/09 01:53:51 christos Exp $ */
/* md5.c -- MD5 message-digest algorithm */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -45,6 +45,9 @@
copyright in any changes I have made; this code remains in the
public domain. */
#include <sys/cdefs.h>
__RCSID("$NetBSD: md5.c,v 1.4 2017/02/09 01:53:51 christos Exp $");
#include "portable.h"
#include <ac/string.h>

View File

@ -1,9 +1,9 @@
/* $NetBSD: passwd.c,v 1.4 2014/05/28 10:12:43 tron Exp $ */
/* $NetBSD: passwd.c,v 1.5 2017/02/09 01:53:51 christos Exp $ */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -28,6 +28,9 @@
* this routine is NOT thread-safe.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: passwd.c,v 1.5 2017/02/09 01:53:51 christos Exp $");
#include "portable.h"
#include <stdio.h>
@ -496,19 +499,19 @@ static int chk_ssha1(
unsigned char SHA1digest[LUTIL_SHA1_BYTES];
int rc;
unsigned char *orig_pass = NULL;
size_t decode_len = LUTIL_BASE64_DECODE_LEN(passwd->bv_len);
/* safety check -- must have some salt */
if (LUTIL_BASE64_DECODE_LEN(passwd->bv_len) <= sizeof(SHA1digest)) {
if (decode_len <= sizeof(SHA1digest)) {
return LUTIL_PASSWD_ERR;
}
/* decode base64 password */
orig_pass = (unsigned char *) ber_memalloc( (size_t) (
LUTIL_BASE64_DECODE_LEN(passwd->bv_len) + 1) );
orig_pass = (unsigned char *) ber_memalloc(decode_len + 1);
if( orig_pass == NULL ) return LUTIL_PASSWD_ERR;
rc = lutil_b64_pton(passwd->bv_val, orig_pass, passwd->bv_len);
rc = lutil_b64_pton(passwd->bv_val, orig_pass, decode_len);
/* safety check -- must have some salt */
if (rc <= (int)(sizeof(SHA1digest))) {
@ -541,19 +544,19 @@ static int chk_sha1(
unsigned char SHA1digest[LUTIL_SHA1_BYTES];
int rc;
unsigned char *orig_pass = NULL;
size_t decode_len = LUTIL_BASE64_DECODE_LEN(passwd->bv_len);
/* safety check */
if (LUTIL_BASE64_DECODE_LEN(passwd->bv_len) < sizeof(SHA1digest)) {
if (decode_len < sizeof(SHA1digest)) {
return LUTIL_PASSWD_ERR;
}
/* base64 un-encode password */
orig_pass = (unsigned char *) ber_memalloc( (size_t) (
LUTIL_BASE64_DECODE_LEN(passwd->bv_len) + 1) );
orig_pass = (unsigned char *) ber_memalloc(decode_len + 1);
if( orig_pass == NULL ) return LUTIL_PASSWD_ERR;
rc = lutil_b64_pton(passwd->bv_val, orig_pass, passwd->bv_len);
rc = lutil_b64_pton(passwd->bv_val, orig_pass, decode_len);
if( rc != sizeof(SHA1digest) ) {
ber_memfree(orig_pass);
@ -583,19 +586,19 @@ static int chk_smd5(
unsigned char MD5digest[LUTIL_MD5_BYTES];
int rc;
unsigned char *orig_pass = NULL;
size_t decode_len = LUTIL_BASE64_DECODE_LEN(passwd->bv_len);
/* safety check */
if (LUTIL_BASE64_DECODE_LEN(passwd->bv_len) <= sizeof(MD5digest)) {
if (decode_len <= sizeof(MD5digest)) {
return LUTIL_PASSWD_ERR;
}
/* base64 un-encode password */
orig_pass = (unsigned char *) ber_memalloc( (size_t) (
LUTIL_BASE64_DECODE_LEN(passwd->bv_len) + 1) );
orig_pass = (unsigned char *) ber_memalloc(decode_len + 1);
if( orig_pass == NULL ) return LUTIL_PASSWD_ERR;
rc = lutil_b64_pton(passwd->bv_val, orig_pass, passwd->bv_len);
rc = lutil_b64_pton(passwd->bv_val, orig_pass, decode_len);
if (rc <= (int)(sizeof(MD5digest))) {
ber_memfree(orig_pass);
@ -628,19 +631,19 @@ static int chk_md5(
unsigned char MD5digest[LUTIL_MD5_BYTES];
int rc;
unsigned char *orig_pass = NULL;
size_t decode_len = LUTIL_BASE64_DECODE_LEN(passwd->bv_len);
/* safety check */
if (LUTIL_BASE64_DECODE_LEN(passwd->bv_len) < sizeof(MD5digest)) {
if (decode_len < sizeof(MD5digest)) {
return LUTIL_PASSWD_ERR;
}
/* base64 un-encode password */
orig_pass = (unsigned char *) ber_memalloc( (size_t) (
LUTIL_BASE64_DECODE_LEN(passwd->bv_len) + 1) );
orig_pass = (unsigned char *) ber_memalloc(decode_len + 1);
if( orig_pass == NULL ) return LUTIL_PASSWD_ERR;
rc = lutil_b64_pton(passwd->bv_val, orig_pass, passwd->bv_len);
rc = lutil_b64_pton(passwd->bv_val, orig_pass, decode_len);
if ( rc != sizeof(MD5digest) ) {
ber_memfree(orig_pass);
return LUTIL_PASSWD_ERR;

View File

@ -1,9 +1,9 @@
/* $NetBSD: session.c,v 1.2 2014/05/28 10:14:13 tron Exp $ */
/* $NetBSD: session.c,v 1.3 2017/02/09 01:53:51 christos Exp $ */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2000-2014 The OpenLDAP Foundation.
* Copyright 2000-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -102,6 +102,9 @@ rewrite_session_init(
session = calloc( sizeof( struct rewrite_session ), 1 );
if ( session == NULL ) {
#ifdef USE_REWRITE_LDAP_PVT_THREADS
ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
return NULL;
}
session->ls_cookie = ( void * )cookie;
@ -110,11 +113,13 @@ rewrite_session_init(
#ifdef USE_REWRITE_LDAP_PVT_THREADS
if ( ldap_pvt_thread_mutex_init( &session->ls_mutex ) ) {
free( session );
ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
return NULL;
}
if ( ldap_pvt_thread_rdwr_init( &session->ls_vars_mutex ) ) {
ldap_pvt_thread_mutex_destroy( &session->ls_mutex );
free( session );
ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
return NULL;
}
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
@ -124,7 +129,7 @@ rewrite_session_init(
info->li_num_cookies++;
#ifdef USE_REWRITE_LDAP_PVT_THREADS
ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
ldap_pvt_thread_rdwr_wunlock( &info->li_cookies_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
if ( rc != 0 ) {

View File

@ -1,10 +1,10 @@
/* $NetBSD: filter.c,v 1.2 2015/02/07 17:56:59 christos Exp $ */
/* $NetBSD: filter.c,v 1.3 2017/02/09 01:53:51 christos Exp $ */
/* filter.c - routines for parsing and dealing with filters */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -26,6 +26,9 @@
* is provided ``as is'' without express or implied warranty.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: filter.c,v 1.3 2017/02/09 01:53:51 christos Exp $");
#include "portable.h"
#include <stdio.h>
@ -1160,10 +1163,17 @@ get_vrFilter( Operation *op, BerElement *ber,
void
vrFilter_free( Operation *op, ValuesReturnFilter *vrf )
{
<<<<<<< filter.c
ValuesReturnFilter *next;
for ( p = vrf; vrf != NULL; vrf = next ) {
next = vrf->vrf_next;
=======
ValuesReturnFilter *next;
for ( ; vrf != NULL; vrf = next ) {
next = vrf->vrf_next;
>>>>>>> 1.1.1.5
switch ( vrf->vrf_choice & SLAPD_FILTER_MASK ) {
case LDAP_FILTER_PRESENT:

View File

@ -1,10 +1,10 @@
/* $NetBSD: deref.c,v 1.2 2015/02/07 17:58:23 christos Exp $ */
/* $NetBSD: deref.c,v 1.3 2017/02/09 01:53:51 christos Exp $ */
/* deref.c - dereference overlay */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2014 The OpenLDAP Foundation.
* Copyright 1998-2016 The OpenLDAP Foundation.
* Portions Copyright 2008 Pierangelo Masarati.
* All rights reserved.
*
@ -21,6 +21,9 @@
* for inclusion in OpenLDAP Software.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: deref.c,v 1.3 2017/02/09 01:53:51 christos Exp $");
#include "portable.h"
#ifdef SLAPD_OVER_DEREF

View File

@ -1,6 +1,6 @@
#! /bin/sh
#
# $NetBSD: openldap2netbsd,v 1.2 2011/10/08 19:28:38 christos Exp $
# $NetBSD: openldap2netbsd,v 1.3 2017/02/09 01:53:50 christos Exp $
#
# Copyright (c) 1998, 1999, 2010 The NetBSD Foundation, Inc.
# All rights reserved.
@ -30,17 +30,27 @@
# netbsd openldap source tree, under src/external/bsd/openldap/dist.
#
d=. #XXX
if [ -z "$1" ]
then
echo "Usage: $0 <dir>" 1>&2
exit 1
fi
d="$1"
### Remove the $'s around RCS tags
cleantags $d
cleantags "$d"
### Add our NetBSD RCS Id
find $d -name '*.[chly]' -print | while read c; do
sed 1q < $c | grep -q '\$NetBSD' || (
echo "/* \$NetBSD\$ */" >/tmp/openldap3n$$
echo "" >>/tmp/openldap3n$$
cat $c >> /tmp/openldap3n$$
mv /tmp/openldap3n$$ $c && echo added NetBSD RCS tag to $c
find "$d" -name '*.[chly]' -print | while read c; do
sed 1q < "$c" | grep -q '\$NetBSD' || (
sed -i -e '1i \
/* $NetBSD: openldap2netbsd,v 1.3 2017/02/09 01:53:50 christos Exp $ */\
' -e '/#include "portable.h"/i \
#include <sys/cdefs.h>\
__RCSID("$NetBSD: openldap2netbsd,v 1.3 2017/02/09 01:53:50 christos Exp $");\
' "$c"
)
done