Commit abd9be4d authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Remove lint and misc MSVC updates

parent b0169858
......@@ -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
}}}
###############################################################################
......
......@@ -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
......
......@@ -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 */
......
......@@ -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
......
......@@ -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,
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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",
......
......@@ -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:
......
......@@ -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>
*/
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......@@ -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;
......
......@@ -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 )
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment