Remove lint and misc MSVC updates

This commit is contained in:
Kurt Zeilenga 2001-12-09 02:34:45 +00:00
parent b0169858d1
commit abd9be4def
34 changed files with 160 additions and 61 deletions

View file

@ -677,6 +677,9 @@ Package=<4>
Begin Project Dependency
Project_Dep_Name libavl
End Project Dependency
Begin Project Dependency
Project_Dep_Name liblber
End Project Dependency
}}}
###############################################################################

View file

@ -130,7 +130,6 @@ load_editor( void )
{
FILE *fp;
char *cp, *editor = UD_DEFAULT_EDITOR;
int tmpfd;
#ifndef HAVE_SPAWNLP
int pid;
int status;
@ -145,16 +144,18 @@ load_editor( void )
#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

View file

@ -327,7 +327,6 @@ void
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 */

View file

@ -110,6 +110,14 @@ lutil_progname LDAP_P((
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

View file

@ -48,7 +48,7 @@
#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,

View file

@ -137,6 +137,11 @@ ber_skip_tag( BerElement *ber, ber_len_t *len )
*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;
@ -293,7 +298,7 @@ ber_get_stringa( BerElement *ber, char **buf )
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;

View file

@ -219,6 +219,10 @@ SOURCE=.\options.c
# 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

View file

@ -77,8 +77,9 @@ ldap_charray_merge(
aa = (char **) LDAP_REALLOC( (char *) *a, (n + nn + 1) * sizeof(char *) );
if( aa == NULL )
if( aa == NULL ) {
return -1;
}
*a = aa;

View file

@ -18,6 +18,8 @@
#include "../liblber/lber-int.h"
#include <ac/queue.h>
#ifdef HAVE_CYRUS_SASL
/* the need for this should be removed */
#include <sasl.h>
@ -194,7 +196,7 @@ typedef struct ldap_conn {
#endif
BerElement *lconn_ber; /* ber receiving on this conn. */
struct ldap_conn *lconn_next;
struct ldap_conn *lconn_next;
} LDAPConn;

View file

@ -199,10 +199,6 @@ SOURCE=.\free.c
# End Source File
# Begin Source File
SOURCE=.\friendly.c
# End Source File
# Begin Source File
SOURCE=.\getattr.c
# End Source File
# Begin Source File

View file

@ -568,7 +568,6 @@ ldap_free_request_int( LDAP *ld, LDAPRequest *lr )
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",

View file

@ -73,7 +73,7 @@ static int put_filter_list LDAP_P((
*
* 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 );
*/
@ -203,7 +203,7 @@ ldap_search_ext_s(
*
* 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
@ -466,7 +466,7 @@ ldap_pvt_find_wildcard( const char *s )
/* 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 )
{
@ -487,7 +487,6 @@ 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;
@ -498,9 +497,18 @@ ldap_pvt_filter_value_unescape( char *fval )
} 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:

View file

@ -17,7 +17,7 @@
* 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>
*/

View file

@ -196,10 +196,6 @@ SOURCE=..\libldap\free.c
# 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

View file

@ -120,8 +120,10 @@ ldbm_db_errcall( const char *prefix, char *message )
int ldbm_initialize( const char* home )
{
#if DB_VERSION_MAJOR < 3
int err;
u_int32_t envFlags;
#endif
if(ldbm_initialized++) return 1;

View file

@ -32,6 +32,8 @@
#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)
{
@ -55,7 +57,8 @@ 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

View file

@ -140,6 +140,10 @@ SOURCE=..\..\include\ac\bytes.h
# End Source File
# Begin Source File
SOURCE=.\csn.c
# End Source File
# Begin Source File
SOURCE=.\debug.c
# End Source File
# Begin Source File
@ -281,5 +285,9 @@ SOURCE=.\sockpair.c
SOURCE=.\utils.c
# End Source File
# Begin Source File
SOURCE=.\uuid.c
# End Source File
# End Target
# End Project

View file

@ -9,8 +9,6 @@
* 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
@ -20,13 +18,21 @@
#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>
@ -36,9 +42,6 @@
#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 )
@ -175,7 +178,7 @@ 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
@ -200,11 +203,34 @@ lutil_uuidstr( char *buf, size_t len )
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;

View file

@ -346,7 +346,6 @@ acl_get(
continue;
} else if ( a->acl_dn_style == ACL_STYLE_ONE ) {
char *rdn;
int rdnlen = -1;
if ( dnlen <= patlen )
@ -549,7 +548,6 @@ acl_mask(
continue;
} else if ( b->a_dn_style == ACL_STYLE_ONE ) {
char *rdn;
int rdnlen = -1;
if ( odnlen <= patlen )

View file

@ -131,6 +131,14 @@ SOURCE=.\add.c
# 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
@ -147,6 +155,10 @@ SOURCE=.\config.c
# End Source File
# Begin Source File
SOURCE=.\dbcache.c
# End Source File
# Begin Source File
SOURCE=.\delete.c
# End Source File
# Begin Source File
@ -187,10 +199,18 @@ SOURCE=.\idl.h
# 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

View file

@ -13,7 +13,9 @@
#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(

View file

@ -379,7 +379,7 @@ bdb_dn2idl(
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;

View file

@ -432,8 +432,8 @@ bdb_initialize(
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;

View file

@ -214,7 +214,7 @@ searchit:
/* 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;

View file

@ -565,7 +565,7 @@ be_issuffix(
)
{
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 ) {

View file

@ -627,8 +627,6 @@ glue_tool_entry_open (
int mode
)
{
int i, rc;
/* We don't know which backend to talk to yet, so just
* remember the mode and move on...
*/

View file

@ -176,7 +176,7 @@ do_compare(
#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",

View file

@ -438,7 +438,7 @@ entry_putlen(unsigned char **buf, ber_len_t len)
**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;

View file

@ -232,6 +232,10 @@ SOURCE=.\kerberos.c
# End Source File
# Begin Source File
SOURCE=.\limits.c
# End Source File
# Begin Source File
SOURCE=.\lock.c
# End Source File
# Begin Source File
@ -276,6 +280,10 @@ SOURCE=".\proto-slap.h"
# End Source File
# Begin Source File
SOURCE=.\referral.c
# End Source File
# Begin Source File
SOURCE=.\repl.c
# End Source File
# Begin Source File

View file

@ -49,7 +49,7 @@ get_limits(
case SLAP_LIMITS_ONE:
case SLAP_LIMITS_SUBTREE:
case SLAP_LIMITS_CHILDREN: {
long d;
size_t d;
if ( ndn == NULL || ndn[0] == '\0' ) {
break;

View file

@ -23,10 +23,11 @@
#include <ac/string.h>
#include <ac/time.h>
#include "lutil.h"
#include "ldap_pvt.h"
#include "slap.h"
int
do_modify(
Connection *conn,

View file

@ -187,12 +187,14 @@ send_ldap_response(
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
@ -556,11 +558,14 @@ send_search_result(
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,

View file

@ -592,7 +592,7 @@ COMPLETE:
int slap_sasl_authorized( char *authcDN, char *authzDN )
{
int rc;
int rc = LDAP_INAPPROPRIATE_AUTH;
#ifdef HAVE_CYRUS_SASL
/* User binding as anonymous */
@ -619,19 +619,22 @@ int slap_sasl_authorized( char *authcDN, char *authzDN )
/* 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 ));

View file

@ -14,6 +14,9 @@
#include <ac/socket.h>
#include <ac/unistd.h>
#include <lber.h>
#include <ldif.h>
#include "slapcommon.h"
int