Begin Project Dependency
Project_Dep_Name libavl
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name liblber
+ End Project Dependency
}}}
###############################################################################
{
FILE *fp;
char *cp, *editor = UD_DEFAULT_EDITOR;
- int tmpfd;
#ifndef HAVE_SPAWNLP
int pid;
int status;
#ifdef HAVE_MKSTEMP
strcpy(entry_temp_file, LDAP_TMPDIR LDAP_DIRSEP "udXXXXXX");
- tmpfd = mkstemp(entry_temp_file);
+ {
+ int tmpfd = mkstemp(entry_temp_file);
- if( tmpfd < 0 ) {
- perror("mkstemp");
- return -1;
- }
+ if( tmpfd < 0 ) {
+ perror("mkstemp");
+ return -1;
+ }
- if ((fp = fdopen(tmpfd, "w")) == NULL) {
- perror("fdopen");
- return(-1);
+ if ((fp = fdopen(tmpfd, "w")) == NULL) {
+ perror("fdopen");
+ return(-1);
+ }
}
#else
change_base( int type, char **base, char *s )
{
register char *cp; /* utility pointers */
- char **rdns; /* for parsing */
char *output_string = NULL; /* for nice output */
int num_picked; /* # of selected base */
int j; /* used with num_picked */
LDAP_LUTIL_F( int )
lutil_pair( ber_socket_t sd[2] );
+/* uuid.c */
+LDAP_LUTIL_F( size_t )
+lutil_uuidstr( char *buf, size_t len );
+
+/* csn.c */
+LDAP_LUTIL_F( size_t )
+lutil_csnstr( char *buf, size_t len, unsigned int replica, unsigned int mod );
+
/*
* Sometimes not all declarations in a header file are needed.
* An indicator to this is whether or not the symbol's type has
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
-#include <machine/ansi.h> /* for __offsetof */
+#define __offsetof offsetof
/*
* This file defines five types of data structures: singly-linked lists,
*len = lc;
}
+ /* BER length should be non-negative */
+ if( *len < 0 ) {
+ return LBER_DEFAULT;
+ }
+
/* BER element should have enough data left */
if( *len > ber_pvt_ber_remaining( ber ) ) {
return LBER_DEFAULT;
return LBER_DEFAULT;
}
- if ( (ber_len_t) ber_read( ber, *buf, datalen ) != datalen ) {
+ if ( datalen > 0 && (ber_len_t) ber_read( ber, *buf, datalen ) != datalen ) {
LBER_FREE( *buf );
*buf = NULL;
return LBER_DEFAULT;
# End Source File
# Begin Source File
+SOURCE="..\..\include\queue-compat.h"
+# End Source File
+# Begin Source File
+
SOURCE=.\sockbuf.c
# End Source File
# End Target
aa = (char **) LDAP_REALLOC( (char *) *a, (n + nn + 1) * sizeof(char *) );
- if( aa == NULL )
+ if( aa == NULL ) {
return -1;
+ }
*a = aa;
#include "../liblber/lber-int.h"
+#include <ac/queue.h>
+
#ifdef HAVE_CYRUS_SASL
/* the need for this should be removed */
#include <sasl.h>
#endif
BerElement *lconn_ber; /* ber receiving on this conn. */
- struct ldap_conn *lconn_next;
+ struct ldap_conn *lconn_next;
} LDAPConn;
# End Source File
# Begin Source File
-SOURCE=.\friendly.c
-# End Source File
-# Begin Source File
-
SOURCE=.\getattr.c
# End Source File
# Begin Source File
void
ldap_free_request( LDAP *ld, LDAPRequest *lr )
{
- LDAPRequest *tmplr, *nextlr;
LDAPRequest **ttmplr;
Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n",
*
* Example:
* char *attrs[] = { "mail", "title", 0 };
- * ldap_search_ext( ld, "c=us,o=UM", LDAP_SCOPE_SUBTREE, "cn~=bob",
+ * ldap_search_ext( ld, "dc=example,dc=com", LDAP_SCOPE_SUBTREE, "cn~=bob",
* attrs, attrsonly, sctrls, ctrls, timeout, sizelimit,
* &msgid );
*/
*
* Example:
* char *attrs[] = { "mail", "title", 0 };
- * msgid = ldap_search( ld, "c=us@o=UM", LDAP_SCOPE_SUBTREE, "cn~=bob",
+ * msgid = ldap_search( ld, "dc=example,dc=com", LDAP_SCOPE_SUBTREE, "cn~=bob",
* attrs, attrsonly );
*/
int
/* unescape filter value */
/* support both LDAP v2 and v3 escapes */
-/* output can include nul characters */
+/* output can include nul characters! */
ber_slen_t
ldap_pvt_filter_value_unescape( char *fval )
{
if (( v1 = hex2value( fval[v] )) >= 0 ) {
/* LDAPv3 escape */
-
if (( v2 = hex2value( fval[v+1] )) < 0 ) {
/* must be two digit code */
return -1;
} else {
/* LDAPv2 escape */
- fval[r++] = fval[v];
+ switch( fval[v] ) {
+ case '(':
+ case ')':
+ case '*':
+ case '\\':
+ fval[r++] = fval[v];
+ break;
+ default:
+ /* illegal escape */
+ return -1;
+ }
}
-
break;
default:
* scope is one of these three strings: base one sub (default=base)
* filter is an string-represented filter as in RFC 2254
*
- * e.g., ldap://host:port/dc=com?o,cn?base?o=openldap?extension
+ * e.g., ldap://host:port/dc=com?o,cn?base?(o=openldap)?extension
*
* We also tolerate URLs that look like: <ldapurl> and <URL:ldapurl>
*/
# End Source File
# Begin Source File
-SOURCE=..\libldap\friendly.c
-# End Source File
-# Begin Source File
-
SOURCE=..\libldap\getattr.c
# End Source File
# Begin Source File
int ldbm_initialize( const char* home )
{
+#if DB_VERSION_MAJOR < 3
int err;
u_int32_t envFlags;
+#endif
if(ldbm_initialized++) return 1;
#include <stdio.h>
#include <ac/time.h>
+#include <lutil.h>
+
size_t
lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod)
{
ltm->tm_year + 1900, ltm->tm_mon, ltm->tm_mday, ltm->tm_hour,
ltm->tm_min, ltm->tm_sec, op, replica, mod );
- return ( n < len ) ? n : 0;
+ if( n < 0 ) return 0;
+ return ( (size_t) n < len ) ? n : 0;
}
#ifdef TEST
# End Source File
# Begin Source File
+SOURCE=.\csn.c
+# End Source File
+# Begin Source File
+
SOURCE=.\debug.c
# End Source File
# Begin Source File
SOURCE=.\utils.c
# End Source File
+# Begin Source File
+
+SOURCE=.\uuid.c
+# End Source File
# End Target
# End Project
* This is free software; you can redistribute and use it
* under the same terms as OpenLDAP itself.
*/
-/* Adapted for incorporatation into OpenLDAP by Kurt Zeilenga */
-
/*
* Sorry this file is so scary, but it needs to run on a wide range of
* platforms. The only exported routine is lutil_uuidstr() which is all
#include "portable.h"
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
+
#ifdef HAVE_SYS_UUID_H
# include <sys/uuid.h>
+#elif defined( _WIN32 )
+# include <rpc.h>
#else
# include <ac/socket.h>
# include <ac/time.h>
+
+ /* 100 usec intervals from 10/10/1582 to 1/1/1970 */
+# define UUID_TPLUS 0x01B21DD2138140LL
+
# ifdef HAVE_SYS_SYSCTL_H
# include <net/if.h>
# include <sys/sysctl.h>
#include <lutil.h>
-/* 100 usec intervals from 10/10/1582 to 1/1/1970 */
-#define UUID_TPLUS 0x01B21DD2138140LL
-
#ifndef HAVE_SYS_UUID_H
static unsigned char *
lutil_eaddr( void )
** We use DCE version one, and the DCE variant. Our unique identifier is
** the first ethernet address on the system.
*/
-int
+size_t
lutil_uuidstr( char *buf, size_t len )
{
#ifdef HAVE_SYS_UUID_H
return 0;
}
- strncpy( buf, s, l );
+ strncpy( buf, s, len );
free( s );
return l;
+#elif defined( _WIN32 )
+ UUID uuid;
+ unsigned char *uuidstr;
+ size_t uuidlen;
+
+ if( UuidCreate( &uuid ) != RPC_S_OK ) {
+ return 0;
+ }
+
+ if( UuidToString( &uuid, &uuidstr ) != RPC_S_OK ) {
+ return 0;
+ }
+
+ uuidlen = strlen( uuidstr );
+ if( uuidlen >= len ) {
+ return 0;
+ }
+
+ strncpy( buf, uuidstr, len );
+ free( uuidstr );
+
+ return uuidlen;
+
#else
struct timeval tv;
unsigned long long tl;
continue;
} else if ( a->acl_dn_style == ACL_STYLE_ONE ) {
- char *rdn;
int rdnlen = -1;
if ( dnlen <= patlen )
continue;
} else if ( b->a_dn_style == ACL_STYLE_ONE ) {
- char *rdn;
int rdnlen = -1;
if ( odnlen <= patlen )
# End Source File
# Begin Source File
+SOURCE=.\attr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\attribute.c
+# End Source File
+# Begin Source File
+
SOURCE=".\back-bdb.h"
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\dbcache.c
+# End Source File
+# Begin Source File
+
SOURCE=.\delete.c
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\index.c
+# End Source File
+# Begin Source File
+
SOURCE=.\init.c
# End Source File
# Begin Source File
+SOURCE=.\key.c
+# End Source File
+# Begin Source File
+
SOURCE=.\modify.c
# End Source File
# Begin Source File
#include "back-bdb.h"
#define SLAP_BDB_ALLOW_DBNOTXN
-#define SLAP_BDB_ALLOW_DIRTY_READ
+#ifdef DB_DIRTY_READ
+# define SLAP_BDB_ALLOW_DIRTY_READ
+#endif
int
bdb_db_config(
ID *ids )
{
int rc;
- DBT key, data;
+ DBT key;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
DB *db = bdb->bi_dn2id->bdi_db;
bi->bi_op_abandon = bdb_abandon;
bi->bi_extended = bdb_extended;
-#endif
bi->bi_acl_group = bdb_group;
+#endif
bi->bi_acl_attribute = bdb_attribute;
bi->bi_chk_referrals = bdb_referrals;
/* if candidates exceed to-be-checked entries, abort */
if ( !isroot && limit->lms_s_unchecked != -1 ) {
- if ( ID_BLOCK_NIDS( candidates ) > limit->lms_s_unchecked ) {
+ if ( ID_BLOCK_NIDS( candidates ) > (unsigned) limit->lms_s_unchecked ) {
send_search_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, NULL, NULL, NULL, 0 );
rc = 0;
)
{
int i;
- int len = strlen(suffix);
+ size_t len = strlen(suffix);
for ( i = 0; be->be_nsuffix != NULL && be->be_nsuffix[i] != NULL; i++ ) {
if ( len != be->be_nsuffix[i]->bv_len ) {
int mode
)
{
- int i, rc;
-
/* We don't know which backend to talk to yet, so just
* remember the mode and move on...
*/
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
"do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, dn, ava.aa_desc->ad_cname->bv_val,
+ conn->c_connid, dn, ava.aa_desc->ad_cname.bv_val,
ava.aa_value->bv_val ));
#else
Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
**buf = (unsigned char) len;
} else {
int i;
- **buf = 0x80 | (lenlen - 1);
+ **buf = 0x80 | ((unsigned char) lenlen - 1);
for (i=lenlen-1; i>0; i--) {
(*buf)[i] = (unsigned char) len;
len >>= 8;
# End Source File
# Begin Source File
+SOURCE=.\limits.c
+# End Source File
+# Begin Source File
+
SOURCE=.\lock.c
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\referral.c
+# End Source File
+# Begin Source File
+
SOURCE=.\repl.c
# End Source File
# Begin Source File
case SLAP_LIMITS_ONE:
case SLAP_LIMITS_SUBTREE:
case SLAP_LIMITS_CHILDREN: {
- long d;
+ size_t d;
if ( ndn == NULL || ndn[0] == '\0' ) {
break;
#include <ac/string.h>
#include <ac/time.h>
+#include "lutil.h"
+
#include "ldap_pvt.h"
#include "slap.h"
-
int
do_modify(
Connection *conn,
int rc;
long bytes;
+ if (op->o_response) {
+ op->o_response( conn, op, tag, msgid, err, matched,
+ text, ref, resoid, resdata, sasldata, ctrls );
+ return;
+ }
+
assert( ctrls == NULL ); /* ctrls not implemented */
- if (op->o_response)
- return op->o_response( conn, op, tag, msgid, err, matched,
- text, ref, resoid, resdata, sasldata, ctrls);
-
ber = ber_alloc_t( LBER_USE_DER );
#ifdef NEW_LOGGING
ber_tag_t tag;
ber_int_t msgid;
char *tmp = NULL;
+
assert( !LDAP_API_ERROR( err ) );
- if (op->o_sresult)
- return op->o_sresult(conn, op, err, matched, text, refs,
+ if (op->o_sresult) {
+ op->o_sresult(conn, op, err, matched, text, refs,
ctrls, nentries);
+ return;
+ }
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
int slap_sasl_authorized( char *authcDN, char *authzDN )
{
- int rc;
+ int rc = LDAP_INAPPROPRIATE_AUTH;
#ifdef HAVE_CYRUS_SASL
/* User binding as anonymous */
/* Check source rules */
rc = slap_sasl_check_authz( authcDN, authzDN, SASL_AUTHZ_SOURCE_ATTR,
authcDN );
- if( rc == LDAP_SUCCESS )
+ if( rc == LDAP_SUCCESS ) {
goto DONE;
+ }
/* Check destination rules */
rc = slap_sasl_check_authz( authzDN, authcDN, SASL_AUTHZ_DEST_ATTR,
authcDN );
- if( rc == LDAP_SUCCESS )
+ if( rc == LDAP_SUCCESS ) {
goto DONE;
+ }
-#endif
rc = LDAP_INAPPROPRIATE_AUTH;
DONE:
+#endif
+
#ifdef NEW_LOGGING
LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
"slap_sasl_authorized: return %d\n", rc ));
#include <ac/socket.h>
#include <ac/unistd.h>
+#include <lber.h>
+#include <ldif.h>
+
#include "slapcommon.h"
int