#include <sys/types.h>
#include <stdio.h>
+#include <stdlib.h>
#include "avl.h"
#define ROTATERIGHT(x) { \
*/
static
-ravl_insert( iroot, data, taller, fcmp, fdup, depth )
+int ravl_insert( iroot, data, taller, fcmp, fdup, depth )
Avlnode **iroot;
caddr_t data;
int *taller;
* NOTE: this routine may malloc memory
*/
-avl_insert( root, data, fcmp, fdup )
+int avl_insert( root, data, fcmp, fdup )
Avlnode **root;
caddr_t data;
IFP fcmp;
* been shortened because of a deletion.
*/
-static
+static int
right_balance( root )
Avlnode **root;
{
- int shorter;
+ int shorter = -1;
Avlnode *r, *l;
switch( (*root)->avl_bf ) {
*/
static
-left_balance( root )
+int left_balance( root )
Avlnode **root;
{
- int shorter;
+ int shorter = -1;
Avlnode *r, *l;
switch( (*root)->avl_bf ) {
}
static
-avl_inapply( root, fn, arg, stopflag )
+int avl_inapply( root, fn, arg, stopflag )
Avlnode *root;
IFP fn;
caddr_t arg;
}
static
-avl_postapply( root, fn, arg, stopflag )
+int avl_postapply( root, fn, arg, stopflag )
Avlnode *root;
IFP fn;
caddr_t arg;
}
static
-avl_preapply( root, fn, arg, stopflag )
+int avl_preapply( root, fn, arg, stopflag )
Avlnode *root;
IFP fn;
caddr_t arg;
* of nodes.
*/
-avl_apply( root, fn, arg, stopflag, type )
+int avl_apply( root, fn, arg, stopflag, type )
Avlnode *root;
IFP fn;
caddr_t arg;
* AVL_NOMORE is returned.
*/
-avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
+int avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
Avlnode *root;
caddr_t data;
IFP fmatch;
* number of items actually freed is returned.
*/
-avl_free( root, dfree )
+int avl_free( root, dfree )
Avlnode *root;
IFP dfree;
{
/* ARGSUSED */
static
-avl_buildlist( data, arg )
+int avl_buildlist( data, arg )
caddr_t data;
int arg;
{
return( avl_list[ avl_nextlist++ ] );
}
-avl_dup_error()
+int avl_dup_error()
{
return( -1 );
}
-avl_dup_ok()
+int avl_dup_ok()
{
return( 0 );
}
*/
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
+#include <unistd.h>
#if defined( DOS ) || defined( _WIN32 )
#include "msdos.h"
#endif /* DOS || _WIN32 */
#ifdef MACOS
-#include <stdlib.h>
#include "macos.h"
#else /* MACOS */
-#if defined(NeXT) || defined(VMS)
-#include <stdlib.h>
-#else /* next || vms */
-#ifndef __FreeBSD__
-#include <malloc.h>
-#endif
-#endif /* next || vms */
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifdef LDAP_DEBUG
if ( lber_debug ) {
fprintf( stderr, "ber_flush: %ld bytes to sd %ld%s\n", towrite,
- sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)"
+ (long) sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)"
: "" );
if ( lber_debug > 1 )
lber_bprint( ber->ber_rwptr, towrite );
ber_dump( BerElement *ber, int inout )
{
fprintf( stderr, "ber_dump: buf 0x%lx, ptr 0x%lx, end 0x%lx\n",
- ber->ber_buf, ber->ber_ptr, ber->ber_end );
+ (long) ber->ber_buf,
+ (long) ber->ber_ptr,
+ (long) ber->ber_end );
if ( inout == 1 ) {
fprintf( stderr, " current len %ld, contents:\n",
- ber->ber_end - ber->ber_ptr );
+ (long) (ber->ber_end - ber->ber_ptr) );
lber_bprint( ber->ber_ptr, ber->ber_end - ber->ber_ptr );
} else {
fprintf( stderr, " current len %ld, contents:\n",
- ber->ber_ptr - ber->ber_buf );
+ (long) (ber->ber_ptr - ber->ber_buf) );
lber_bprint( ber->ber_buf, ber->ber_ptr - ber->ber_buf );
}
}
fprintf( stderr, "*** sos dump ***\n" );
while ( sos != NULLSEQORSET ) {
fprintf( stderr, "ber_sos_dump: clen %ld first 0x%lx ptr 0x%lx\n",
- sos->sos_clen, sos->sos_first, sos->sos_ptr );
+ (long) sos->sos_clen, (long) sos->sos_first, (long) sos->sos_ptr );
fprintf( stderr, " current len %ld contents:\n",
- sos->sos_ptr - sos->sos_first );
+ (long) (sos->sos_ptr - sos->sos_first) );
lber_bprint( sos->sos_first, sos->sos_ptr - sos->sos_first );
sos = sos->sos_next;
unsigned long
ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
{
- unsigned long tag, netlen, toread;
+ unsigned long tag = 0, netlen, toread;
unsigned char lc;
long rc;
int noctets, diff;
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#if !defined( MACOS ) && !defined( DOS )
#include <sys/types.h>
#endif /* DOS */
#ifdef MACOS
-#include <stdlib.h>
#include "macos.h"
#endif /* MACOS */
#include <stdio.h>
#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
+
+#ifdef MACOS
#include <time.h>
#include "macos.h"
#else /* MACOS */
#include <sys/socket.h>
#endif /* DOS */
#endif /* MACOS */
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
void
ldap_uncache_request( LDAP *ld, int msgid )
{
- Debug( LDAP_DEBUG_TRACE, "ldap_uncache_request %d ld_cache %x\n",
- msgid, ld->ld_cache, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_uncache_request %d ld_cache %lx\n",
+ msgid, (long) ld->ld_cache, 0 );
uncache_entry_or_req( ld, NULL, msgid );
}
void
ldap_uncache_entry( LDAP *ld, char *dn )
{
- Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %x\n",
- dn, ld->ld_cache, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %lx\n",
+ dn, (long) ld->ld_cache, 0 );
uncache_entry_or_req( ld, dn, 0 );
}
LDAPMessage *m, *prev, *next;
Debug( LDAP_DEBUG_TRACE,
- "ldap_uncache_entry_or_req dn %s msgid %d ld_cache %x\n",
- dn, msgid, ld->ld_cache );
+ "ldap_uncache_entry_or_req dn %s msgid %d ld_cache %lx\n",
+ dn, msgid, (long) ld->ld_cache );
if ( ld->ld_cache == NULLLDCACHE ) {
return;
ldap_init_templates_buf( char *buf, long buflen,
struct ldap_disptmpl **tmpllistp )
{
- int rc, version;
+ int rc=-1, version;
char **toks;
struct ldap_disptmpl *prevtmpl, *tmpl;
int i, j, tokcnt, samerow, adsource;
char **toks, *itemopts;
struct ldap_disptmpl *tmpl;
- struct ldap_oclist *ocp, *prevocp;
- struct ldap_adddeflist *adp, *prevadp;
- struct ldap_tmplitem *rowp, *ip, *previp;
+ struct ldap_oclist *ocp, *prevocp = NULL;
+ struct ldap_adddeflist *adp, *prevadp = NULL;
+ struct ldap_tmplitem *rowp = NULL, *ip, *previp = NULL;
*tmplp = NULL;
#include <stdio.h>
#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#else /* MACOS */
+
#if defined( DOS ) || defined( _WIN32 )
#include <malloc.h>
#include "msdos.h"
#include <sys/types.h>
#include <sys/socket.h>
#endif /* DOS */
-#endif /* MACOS */
+
#include "lber.h"
#include "ldap.h"
};
static struct ldaperror ldap_errlist[] = {
- LDAP_SUCCESS, "Success",
- LDAP_OPERATIONS_ERROR, "Operations error",
- LDAP_PROTOCOL_ERROR, "Protocol error",
- LDAP_TIMELIMIT_EXCEEDED, "Timelimit exceeded",
- LDAP_SIZELIMIT_EXCEEDED, "Sizelimit exceeded",
- LDAP_COMPARE_FALSE, "Compare false",
- LDAP_COMPARE_TRUE, "Compare true",
- LDAP_STRONG_AUTH_NOT_SUPPORTED, "Strong authentication not supported",
- LDAP_STRONG_AUTH_REQUIRED, "Strong authentication required",
- LDAP_PARTIAL_RESULTS, "Partial results and referral received",
- LDAP_NO_SUCH_ATTRIBUTE, "No such attribute",
- LDAP_UNDEFINED_TYPE, "Undefined attribute type",
- LDAP_INAPPROPRIATE_MATCHING, "Inappropriate matching",
- LDAP_CONSTRAINT_VIOLATION, "Constraint violation",
- LDAP_TYPE_OR_VALUE_EXISTS, "Type or value exists",
- LDAP_INVALID_SYNTAX, "Invalid syntax",
- LDAP_NO_SUCH_OBJECT, "No such object",
- LDAP_ALIAS_PROBLEM, "Alias problem",
- LDAP_INVALID_DN_SYNTAX, "Invalid DN syntax",
- LDAP_IS_LEAF, "Object is a leaf",
- LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem",
- LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication",
- LDAP_INVALID_CREDENTIALS, "Invalid credentials",
- LDAP_INSUFFICIENT_ACCESS, "Insufficient access",
- LDAP_BUSY, "DSA is busy",
- LDAP_UNAVAILABLE, "DSA is unavailable",
- LDAP_UNWILLING_TO_PERFORM, "DSA is unwilling to perform",
- LDAP_LOOP_DETECT, "Loop detected",
- LDAP_NAMING_VIOLATION, "Naming violation",
- LDAP_OBJECT_CLASS_VIOLATION, "Object class violation",
- LDAP_NOT_ALLOWED_ON_NONLEAF, "Operation not allowed on nonleaf",
- LDAP_NOT_ALLOWED_ON_RDN, "Operation not allowed on RDN",
- LDAP_ALREADY_EXISTS, "Already exists",
- LDAP_NO_OBJECT_CLASS_MODS, "Cannot modify object class",
- LDAP_RESULTS_TOO_LARGE, "Results too large",
- LDAP_OTHER, "Unknown error",
- LDAP_SERVER_DOWN, "Can't contact LDAP server",
- LDAP_LOCAL_ERROR, "Local error",
- LDAP_ENCODING_ERROR, "Encoding error",
- LDAP_DECODING_ERROR, "Decoding error",
- LDAP_TIMEOUT, "Timed out",
- LDAP_AUTH_UNKNOWN, "Unknown authentication method",
- LDAP_FILTER_ERROR, "Bad search filter",
- LDAP_USER_CANCELLED, "User cancelled operation",
- LDAP_PARAM_ERROR, "Bad parameter to an ldap routine",
- LDAP_NO_MEMORY, "Out of memory",
- -1, 0
+ {LDAP_SUCCESS, "Success" },
+ {LDAP_OPERATIONS_ERROR, "Operations error" },
+ {LDAP_PROTOCOL_ERROR, "Protocol error" },
+ {LDAP_TIMELIMIT_EXCEEDED, "Timelimit exceeded" },
+ {LDAP_SIZELIMIT_EXCEEDED, "Sizelimit exceeded" },
+ {LDAP_COMPARE_FALSE, "Compare false" },
+ {LDAP_COMPARE_TRUE, "Compare true" },
+ {LDAP_STRONG_AUTH_NOT_SUPPORTED, "Strong authentication not supported" },
+ {LDAP_STRONG_AUTH_REQUIRED, "Strong authentication required" },
+ {LDAP_PARTIAL_RESULTS, "Partial results and referral received" },
+ {LDAP_NO_SUCH_ATTRIBUTE, "No such attribute" },
+ {LDAP_UNDEFINED_TYPE, "Undefined attribute type" },
+ {LDAP_INAPPROPRIATE_MATCHING, "Inappropriate matching" },
+ {LDAP_CONSTRAINT_VIOLATION, "Constraint violation" },
+ {LDAP_TYPE_OR_VALUE_EXISTS, "Type or value exists" },
+ {LDAP_INVALID_SYNTAX, "Invalid syntax" },
+ {LDAP_NO_SUCH_OBJECT, "No such object" },
+ {LDAP_ALIAS_PROBLEM, "Alias problem" },
+ {LDAP_INVALID_DN_SYNTAX, "Invalid DN syntax" },
+ {LDAP_IS_LEAF, "Object is a leaf" },
+ {LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem" },
+ {LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication" },
+ {LDAP_INVALID_CREDENTIALS, "Invalid credentials" },
+ {LDAP_INSUFFICIENT_ACCESS, "Insufficient access" },
+ {LDAP_BUSY, "DSA is busy" },
+ {LDAP_UNAVAILABLE, "DSA is unavailable" },
+ {LDAP_UNWILLING_TO_PERFORM, "DSA is unwilling to perform" },
+ {LDAP_LOOP_DETECT, "Loop detected" },
+ {LDAP_NAMING_VIOLATION, "Naming violation" },
+ {LDAP_OBJECT_CLASS_VIOLATION, "Object class violation" },
+ {LDAP_NOT_ALLOWED_ON_NONLEAF, "Operation not allowed on nonleaf" },
+ {LDAP_NOT_ALLOWED_ON_RDN, "Operation not allowed on RDN" },
+ {LDAP_ALREADY_EXISTS, "Already exists" },
+ {LDAP_NO_OBJECT_CLASS_MODS, "Cannot modify object class" },
+ {LDAP_RESULTS_TOO_LARGE, "Results too large" },
+ {LDAP_OTHER, "Unknown error" },
+ {LDAP_SERVER_DOWN, "Can't contact LDAP server" },
+ {LDAP_LOCAL_ERROR, "Local error" },
+ {LDAP_ENCODING_ERROR, "Encoding error" },
+ {LDAP_DECODING_ERROR, "Decoding error" },
+ {LDAP_TIMEOUT, "Timed out" },
+ {LDAP_AUTH_UNKNOWN, "Unknown authentication method" },
+ {LDAP_FILTER_ERROR, "Bad search filter" },
+ {LDAP_USER_CANCELLED, "User cancelled operation" },
+ {LDAP_PARAM_ERROR, "Bad parameter to an ldap routine" },
+ {LDAP_NO_MEMORY, "Out of memory" },
+ {-1, 0 }
};
char *
#include <stdio.h>
#include <ctype.h>
#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
+
+#ifdef MACOS
#include "macos.h"
#else /* MACOS */
#if defined( DOS ) || defined( _WIN32 )
int dx_pref[ MAX_TO_SORT ];
#ifdef LDAP_DEBUG
+#ifdef notdef
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
-/* __p_query( answer ); /* */
+ __p_query( answer );
}
+#endif
#endif /* LDAP_DEBUG */
dxs = NULL;
#include <stdio.h>
#include <ctype.h>
#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
+
+#ifdef MACOS
#include "macos.h"
#else /* MACOS */
#if defined( DOS ) || defined( _WIN32 )
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#ifdef MACOS
-#include <stdlib.h>
#include "macos.h"
#else /* MACOS */
#ifdef DOS
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#ifdef MACOS
-#include <stdlib.h>
#include "macos.h"
#endif /* MACOS */
#if defined( DOS ) || defined( _WIN32 )
#include "msdos.h"
-#include <stdlib.h>
#endif /* DOS */
#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 )
open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport,
char **krbinstancep, int async )
{
- int rc, port;
+ int rc = -1;
+ int port;
char *p, *q, *r;
char *curhost, hostname[ 2*MAXHOSTNAMELEN ];
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netdb.h>
+#include <unistd.h>
#endif /* _WIN32 */
#ifdef _AIX
#include <sys/select.h>
#ifdef VMS
#include "ucx_select.h"
#endif /* VMS */
+
#include "portable.h"
#include "lber.h"
#include "ldap.h"
* XXX async is not used yet!
*/
{
- int rc, i, s, connected, use_hp;
+ int rc, i, s = 0;
+ int connected, use_hp;
struct sockaddr_in sin;
- struct hostent *hp;
+ struct hostent *hp = NULL;
#ifdef notyet
#ifdef LDAP_REFERRALS
int status; /* for ioctl call */
#include <stdio.h>
#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
+
+#ifdef MACOS
#include <time.h>
#include "macos.h"
#else /* MACOS */
#if defined( DOS ) || defined( _WIN32 )
#include "msdos.h"
#include <time.h>
-#include <stdlib.h>
#ifdef PCNFS
#include <tklib.h>
#include <tk_errno.h>
#include <stdio.h>
#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
+
+#ifdef MACOS
#include <time.h>
#include "macos.h"
#else /* MACOS */
#ifdef _AIX
#include <sys/select.h>
#endif /* _AIX */
-#include "portable.h"
#endif /* DOS */
#endif /* MACOS */
#ifdef VMS
#include "ucx_select.h"
#endif
+
+#include "portable.h"
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
{
int rc;
struct timeval tv, *tvp;
- long start_time, tmp_time;
+ time_t start_time = 0;
+ time_t tmp_time;
#ifdef LDAP_REFERRALS
LDAPConn *lc, *nextlc;
#endif /* LDAP_REFERRALS */
} else {
tv = *timeout;
tvp = &tv;
- start_time = (long)time( NULL );
+ start_time = time( NULL );
}
rc = -2;
#endif /* !LDAP_REFERRALS */
if ( rc == -2 && tvp != NULL ) {
- tmp_time = (long)time( NULL );
+ tmp_time = time( NULL );
if (( tv.tv_sec -= ( tmp_time - start_time )) <= 0 ) {
rc = 0; /* timed out */
ld->ld_errno = LDAP_TIMEOUT;
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <stdlib.h>
#ifdef MACOS
-#include <stdlib.h>
#include "macos.h"
#endif /* MACOS */
#include <sys/types.h>
#include <sys/socket.h>
#endif
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
+
#ifdef MACOS
#include "macos.h"
#else /* MACOS */
ldap_init_searchprefs_buf( char *buf, long buflen,
struct ldap_searchobj **solistp )
{
- int rc, version;
+ int rc = -1, version;
char **toks;
struct ldap_searchobj *prevso, *so;
#include <stdio.h>
#include <ctype.h>
#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
+
+#ifdef MACOS
#ifdef THINK_C
#include <console.h>
#include <unix.h>
#endif /* WINSOCK */
int argc, char **argv )
{
- LDAP *ld;
+ LDAP *ld = NULL;
int i, c, port, cldapflg, errflg, method, id, msgtype;
char line[256], command1, command2, command3;
char passwd[64], dn[256], rdn[64], attr[64], value[256];
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
+
#ifdef MACOS
#include "macos.h"
#else /* MACOS */
struct ldap_tmplitem *tip, int labelwidth, int rdncount,
writeptype writeproc, void *writeparm, char *eol, char *urlprefix )
{
- int err, lderr, i, count, html;
+ int err = 0, lderr, i, count, html;
char **vals, **members;
char *value, *filtpattern, *attr, *selectname;
char *retattrs[2], filter[ 256 ];
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
-#include "lber.h"
-#include "ldap.h"
-#include "disptmpl.h"
-#include "srchpref.h"
#ifdef MACOS
-#include <stdlib.h>
#include <console.h>
#endif /* MACOS */
+#include "lber.h"
+#include "ldap.h"
+#include "disptmpl.h"
+#include "srchpref.h"
+
#ifdef NEEDPROTOS
void dump_tmpl( struct ldap_disptmpl *tmpl );
void dump_srchpref( struct ldap_searchobj *sp );
void dump_srchpref();
#endif /* NEEDPROTOS */
-
#define NULLSTRINGIFNULL( s ) ( s == NULL ? "(null)" : s )
-
int
main( int argc, char **argv )
{
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <stdlib.h>
#ifdef MACOS
-#include <stdlib.h>
#include "macos.h"
#else /* MACOS */
#if defined( DOS ) || defined( _WIN32 )
char **attrs, int attrsonly, LDAPMessage **res, cancelptype cancelproc,
void *cancelparm, char *tag1, char *tag2, char *tag3 )
{
- char *dn, *ftag;
- char **dns;
- int max, i, err, scope, phase, tries;
+ char *dn, *ftag = NULL;
+ char **dns = NULL;
+ int max, i, err, scope = 0, phase, tries;
LDAPFiltInfo *fi;
LDAPMessage *tmpcand;
LDAPMessage *candidates;
{
char **ufncomp, **prefixcomp;
char *pbuf;
- int ncomp, pcomp, i, err;
+ int ncomp, pcomp, i, err = 0;
/* initialize the getfilter stuff if it's not already */
if ( ld->ld_filtd == NULL && ldap_ufn_setfilter( ld, FILTERFILE )
#include <stdio.h>
#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
+
+#ifdef MACOS
#include "macos.h"
#else /* MACOS */
#if defined( DOS ) || defined( _WIN32 )
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <stdlib.h>
#ifdef MACOS
-#include <stdlib.h>
#include "macos.h"
#endif /* MACOS */
#if defined( DOS ) || defined( _WIN32 )
-#include <stdlib.h>
#include <malloc.h>
#include "msdos.h"
#endif /* DOS || _WIN32 */