in string.h was hosed for memmove/memcpy cases.
#include "portable.h"
#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include <ac/string.h>
-#include <ac/time.h>
+#include <ac/ctype.h>
+#include <ac/signal.h>
#include <ac/socket.h>
+#include <ac/string.h>
#include <ac/syslog.h>
+#include <ac/time.h>
#include <ac/unistd.h>
#include <ac/wait.h>
s = set_socket( port );
/* arrange to reap children */
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
} else {
myport = GO500_PORT;
; /* NULL */
#endif
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
}
static
#include "portable.h"
#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include <ac/time.h>
+#include <ac/ctype.h>
+#include <ac/signal.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/syslog.h>
+#include <ac/time.h>
#include <ac/unistd.h>
#include <ac/wait.h>
s = set_socket( port );
/* arrange to reap children */
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
}
if ( inetd ) {
; /* NULL */
#endif
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
}
static do_queries( s )
rc = ldap_entry2text_search( ldp, dn, searchbase, NULLMSG, tmpll,
- defattrs, defvals, (void *)append_text, (void *)reply, "\n",
+ defattrs, defvals, append_text, (void *)reply, "\n",
rdncount, LDAP_DISP_OPT_DOSEARCHACTIONS );
return( rc );
static int valid_tgt();
#endif
+static void set_bound_dn();
+
auth(who, implicit)
char *who;
int implicit;
extern void printbase(); /* used to pretty-print a base */
extern int bind_status;
extern void Free();
- static void set_bound_dn();
#ifdef DEBUG
if (debug & D_TRACE)
extern LDAPMessage *find();
+static int load_editor();
+static int modifiable();
+static int print_attrs_and_values();
+static int ovalues();
+static int write_entry();
+
static char *entry_temp_file;
#ifdef DEBUG
char *dn, **rdns; /* distinguished name */
char name[MED_BUF_SIZE]; /* entry to modify */
extern int bind_status;
- static int load_editor();
- static int write_entry();
#ifdef DEBUG
if (debug & D_TRACE)
static char template[MED_BUF_SIZE];
extern char * mktemp();
extern int isgroup(), fatal();
- static int print_attrs_and_values();
int pid;
int status;
int rc;
struct attribute attrs[];
short flag;
{
- static int modifiable();
register int i, j;
for (i = 0; attrs[i].quipu_name != NULL; i++) {
LDAPMod *mods[MAX_ATTRS + 1];
LDAPMod *modp = NULL;
- static int ovalues();
extern char * code_to_str();
extern void free_mod_struct();
extern void Free();
+static char * bind_and_fetch();
+
void add_group(name)
char *name;
{
char *name;
{
char *dn, tmp[BUFSIZ];
- static char * bind_and_fetch();
#ifdef DEBUG
if (debug & D_TRACE) {
char *values[2], *group_name;
LDAPMod mod, *mods[2];
static char *actions[] = { "join", "resign from", NULL };
- static char * bind_and_fetch();
#ifdef DEBUG
if (debug & D_TRACE) {
extern LDAP *ld;
extern LDAPMessage *find();
+extern void * Malloc();
+
+static char * get_URL();
+static int check_URL();
#ifdef DEBUG
extern int debug;
static char line[LINE_SIZE]; /* raw line from user */
static char buffer[MAX_DESC_LINES * LINE_SIZE]; /* holds ALL of the
lines we get */
- extern void * Malloc();
- static char * get_URL();
-
#ifdef DEBUG
if (debug & D_TRACE)
printf("->get_value(%s, %s)\n", id, prompt);
static char * get_URL()
{
char *rvalue, label[MED_BUF_SIZE], url[MED_BUF_SIZE];
- static int check_URL();
- extern void * Malloc();
if (verbose) {
printf(" First, enter the URL. (Example: http://www.us.itd.umich.edu/users/).\n");
extern void Free();
extern char * my_ldap_dn2ufn();
+static char *time2text();
+static long gtime();
+
/*
* When displaying entries, display only these attributes, and in this
* order.
char is_a_group, **order;
char *sub_list[MAX_VALUES], buf[SMALL_BUF_SIZE];
extern int col_size, isaurl(), isadn();
- static char *time2text();
#ifdef DEBUG
if (debug & D_TRACE)
struct tm t;
char *p, *timestr, zone, *fmterr = "badly formatted time";
time_t gmttime;
- static long gtime();
memset( (char *)&t, 0, sizeof( struct tm ));
if ( strlen( ldtimestr ) < 13 ) {
char *strchr (), *strrchr ();
# ifndef HAVE_MEMCPY
-# define memcpy(d, s, n) bcopy ((s), (d), (n))
-# define memmove(d, s, n) bcopy ((s), (d), (n))
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
# endif
#endif
-#if defined( HAVE_MEMMOVE )
-#define SAFEMEMCPY( d, s, n ) memmove((s), (d), (n))
-#elif defined( HAVE_BCOPY )
-#define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
-#elif defined( MACOS )
-#define SAFEMEMCPY( d, s, n ) BlockMoveData((Ptr)(s), (Ptr)(d), (n))
-#else
-/* nothing left but memcpy() */
-#define SAFEMEMCPY( d, s, n ) memcpy((s), (d), (n))
+#ifndef SAFEMEMCPY
+# if defined( HAVE_MEMMOVE )
+# define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n))
+# elif defined( HAVE_BCOPY )
+# define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
+# elif defined( MACOS )
+# define SAFEMEMCPY( d, s, n ) BlockMoveData((Ptr)(s), (Ptr)(d), (n))
+# else
+ /* nothing left but memcpy() */
+# define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n))
+# endif
#endif
#endif /* _AC_STRING_H */
LDAP_END_DECL
-#endif _LDAP_SHA1_H_
+#endif /* _LDAP_SHA1_H_ */
#endif /* notyet */
Debug( LDAP_DEBUG_TRACE, "sd %d connected to: %s\n",
- s, inet_ntoa( sin.sin_addr ), 0 );
+ s, (char *) inet_ntoa( sin.sin_addr ), 0 );
}
return( rc );
LDAP *ld,
LDAPMessage **chain,
char *attr, /* NULL => sort by DN */
- int (*cmp)()
+ int (*cmp) LDAP_P((char *, char *))
)
{
int i, count;
last = e;
et_cmp_fn = cmp;
- qsort( et, count, sizeof(struct entrything), (void *) et_cmp );
+ qsort( et, count, sizeof(struct entrything), et_cmp );
ep = chain;
for ( i = 0; i < count; i++ ) {
for ( nel = 0; vals[nel] != NULL; nel++ )
; /* NULL */
- qsort( vals, nel, sizeof(char *), (void *) cmp );
+ qsort( vals, nel, sizeof(char *), cmp );
return( 0 );
}
char *userpassword = vals[i]->bv_val + sizeof("{MD5}") - 1;
ldap_MD5Init(&MD5context);
- ldap_MD5Update(&MD5context, cred->bv_val, strlen(cred->bv_val));
+ ldap_MD5Update(&MD5context,
+ (unsigned char *) cred->bv_val,
+ strlen(cred->bv_val));
ldap_MD5Final(MD5digest, &MD5context);
if (b64_ntop(MD5digest, sizeof(MD5digest),
char *userpassword = vals[i]->bv_val + sizeof("{SHA}") - 1;
ldap_SHA1Init(&SHA1context);
- ldap_SHA1Update(&SHA1context, cred->bv_val, strlen(cred->bv_val));
+ ldap_SHA1Update(&SHA1context,
+ (unsigned char *) cred->bv_val,
+ strlen(cred->bv_val));
ldap_SHA1Final(SHA1digest, &SHA1context);
if (b64_ntop(SHA1digest, sizeof(SHA1digest),
* This is a draft 10 or standard pthreads implementation
*/
if ( pthread_create( &arg->co_op->o_tid, &attr,
- (void *) connection_operation, (void *) arg ) != 0 ) {
+ connection_operation, (void *) arg ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 );
} else {
pthread_mutex_lock( &active_threads_mutex );
* This is a draft 4 or earlier pthreads implementation
*/
if ( pthread_create( &arg->co_op->o_tid, attr,
- (void *) connection_operation, (void *) arg ) != 0 ) {
+ connection_operation, (void *) arg ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 );
} else {
pthread_mutex_lock( &active_threads_mutex );
* LinuxThreads are implemented using SIGUSR1/USR2,
* so we'll use SIGSTKFLT and SIGUNUSED
*/
- (void) SIGNAL( SIGSTKFLT, (void *) do_nothing );
- (void) SIGNAL( SIGUNUSED, (void *) set_shutdown );
+ (void) SIGNAL( SIGSTKFLT, do_nothing );
+ (void) SIGNAL( SIGUNUSED, set_shutdown );
#else /* !linux */
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
- (void) SIGNAL( SIGUSR2, (void *) set_shutdown );
+ (void) SIGNAL( SIGUSR1, do_nothing );
+ (void) SIGNAL( SIGUSR2, set_shutdown );
#endif /* !linux */
- (void) SIGNAL( SIGTERM, (void *) set_shutdown );
- (void) SIGNAL( SIGINT, (void *) set_shutdown );
- (void) SIGNAL( SIGHUP, (void *) set_shutdown );
+ (void) SIGNAL( SIGTERM, set_shutdown );
+ (void) SIGNAL( SIGINT, set_shutdown );
+ (void) SIGNAL( SIGHUP, set_shutdown );
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
#ifdef SLAPD_PIDFILE
* so we'll use SIGSTKFLT and SIGUNUSED
*/
pthread_kill( listener_tid, SIGSTKFLT );
- (void) SIGNAL( SIGUNUSED, (void *) set_shutdown );
+ (void) SIGNAL( SIGUNUSED, set_shutdown );
#else /* !linux */
pthread_kill( listener_tid, SIGUSR1 );
- (void) SIGNAL( SIGUSR2, (void *) set_shutdown );
+ (void) SIGNAL( SIGUSR2, set_shutdown );
#endif /* !linux */
- (void) SIGNAL( SIGTERM, (void *) set_shutdown );
- (void) SIGNAL( SIGINT, (void *) set_shutdown );
- (void) SIGNAL( SIGHUP, (void *) set_shutdown );
+ (void) SIGNAL( SIGTERM, set_shutdown );
+ (void) SIGNAL( SIGINT, set_shutdown );
+ (void) SIGNAL( SIGHUP, set_shutdown );
}
static void
* LinuxThreads are implemented using SIGUSR1/USR2,
* so we'll use SIGSTKFLT and SIGUNUSED
*/
- (void) SIGNAL( SIGSTKFLT, (void *) do_nothing );
+ (void) SIGNAL( SIGSTKFLT, do_nothing );
#else /* !linux */
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
+ (void) SIGNAL( SIGUSR1, do_nothing );
#endif /* !linux */
}
/* POSIX_THREADS or compatible
* This is a draft 10 or standard pthreads implementation
*/
- if ( pthread_create( &listener_tid, &attr, (void *) slapd_daemon,
+ if ( pthread_create( &listener_tid, &attr, slapd_daemon,
(void *) port ) != 0 ) {
Debug( LDAP_DEBUG_ANY,
"listener pthread_create failed\n", 0, 0, 0 );
/*
* This is a draft 4 or earlier pthreads implementation
*/
- if ( pthread_create( &listener_tid, attr, (void *) slapd_daemon,
+ if ( pthread_create( &listener_tid, attr, slapd_daemon,
(void *) port ) != 0 ) {
Debug( LDAP_DEBUG_ANY,
"listener pthread_create failed\n", 0, 0, 0 );
p->b_nids = i;
}
- qsort( (void *) p->b_ids, i, sizeof(ID), (void *) dnid_cmp );
+ qsort( (void *) p->b_ids, i, sizeof(ID), dnid_cmp );
}
data->dptr = (char *) p;
* slurpd receives a USR2 signal, it will dump its replication
* queue to the disk file given by SLURPD_DUMPFILE.
*/
-void
+RETSIGTYPE
do_admin()
{
sglob->rq->rq_dump( sglob->rq );
- (void) SIGNAL( SIGUSR2, (void *) do_admin );
+ (void) SIGNAL( SIGUSR2, do_admin );
}
/*
* Externs
*/
-extern void do_admin LDAP_P((void));
+extern RETSIGTYPE do_admin LDAP_P((int));
extern int file_nonempty LDAP_P(( char * ));
extern int acquire_lock LDAP_P((char *, FILE **, FILE ** ));
extern int relinquish_lock LDAP_P((char *, FILE *, FILE * ));
*/
static char *get_record LDAP_P(( FILE * ));
static void populate_queue LDAP_P(( char *f ));
-static void set_shutdown LDAP_P((void));
-void do_nothing LDAP_P((void));
+static RETSIGTYPE set_shutdown LDAP_P((int));
+RETSIGTYPE do_nothing LDAP_P((int));
/*
* (not yet implemented).
*/
#ifdef HAVE_LINUX_THREADS
- (void) SIGNAL( SIGSTKFLT, (void *) do_nothing );
- (void) SIGNAL( SIGUNUSED, (void *) do_admin );
+ (void) SIGNAL( SIGSTKFLT, do_nothing );
+ (void) SIGNAL( SIGUNUSED, do_admin );
#else
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
- (void) SIGNAL( SIGUSR2, (void *) do_admin );
+ (void) SIGNAL( SIGUSR1, do_nothing );
+ (void) SIGNAL( SIGUSR2, do_admin );
#endif
- (void) SIGNAL( SIGTERM, (void *) set_shutdown );
- (void) SIGNAL( SIGINT, (void *) set_shutdown );
- (void) SIGNAL( SIGHUP, (void *) set_shutdown );
+ (void) SIGNAL( SIGTERM, set_shutdown );
+ (void) SIGNAL( SIGINT, set_shutdown );
+ (void) SIGNAL( SIGHUP, set_shutdown );
if ( sglob->one_shot_mode ) {
if ( file_nonempty( sglob->slapd_replogfile )) {
/*
* Set a global flag which signals that we're shutting down.
*/
-static void
-set_shutdown()
+static RETSIGTYPE
+set_shutdown(int x)
{
int i;
(sglob->replicas[ i ])->ri_wake( sglob->replicas[ i ]);
}
sglob->rq->rq_unlock( sglob->rq ); /* unlock queue */
- (void) SIGNAL( SIGTERM, (void *) set_shutdown ); /* reinstall handlers */
- (void) SIGNAL( SIGINT, (void *) set_shutdown );
- (void) SIGNAL( SIGHUP, (void *) set_shutdown );
+ (void) SIGNAL( SIGTERM, set_shutdown ); /* reinstall handlers */
+ (void) SIGNAL( SIGINT, set_shutdown );
+ (void) SIGNAL( SIGHUP, set_shutdown );
}
/*
* A do-nothing signal handler.
*/
-void
-do_nothing()
+RETSIGTYPE
+do_nothing(int i)
{
#ifdef HAVE_LINUX_THREADS
- (void) SIGNAL( SIGSTKFLT, (void *) do_nothing );
+ (void) SIGNAL( SIGSTKFLT, do_nothing );
#else
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
+ (void) SIGNAL( SIGUSR1, do_nothing );
#endif
}
/* POSIX_THREADS or compatible
* This is a draft 10 or standard pthreads implementation
*/
- if ( pthread_create( &(sglob->fm_tid), &attr, (void *) fm, (void *) NULL )
+ if ( pthread_create( &(sglob->fm_tid), &attr, fm, (void *) NULL )
!= 0 ) {
Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
0, 0, 0 );
/*
* This is a draft 4 or earlier pthreads implementation
*/
- if ( pthread_create( &(sglob->fm_tid), attr, (void *) fm, (void *) NULL )
+ if ( pthread_create( &(sglob->fm_tid), attr, fm, (void *) NULL )
!= 0 ) {
Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
0, 0, 0 );
/* POSIX_THREADS or compatible
* This is a draft 10 or standard pthreads implementation
*/
- if ( pthread_create( &(ri->ri_tid), &attr, (void *) replicate,
+ if ( pthread_create( &(ri->ri_tid), &attr, replicate,
(void *) ri ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" pthread_create failed\n",
ri->ri_hostname, ri->ri_port, 0 );
/*
* This is a draft 4 or earlier pthreads implementation
*/
- if ( pthread_create( &(ri->ri_tid), attr, (void *) replicate,
+ if ( pthread_create( &(ri->ri_tid), attr, replicate,
(void *) ri ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" pthread_create failed\n",
ri->ri_hostname, ri->ri_port, 0 );
char *errmsg;
#ifdef HAVE_LINUX_THREADS
- (void) SIGNAL( SIGSTKFLT, (void *) do_nothing );
+ (void) SIGNAL( SIGSTKFLT, do_nothing );
#else
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
+ (void) SIGNAL( SIGUSR1, do_nothing );
#endif
(void) SIGNAL( SIGPIPE, SIG_IGN );
if ( ri == NULL ) {
}
#ifdef HAVE_LINUX_THREADS
pthread_kill( ri->ri_tid, SIGSTKFLT );
- (void) SIGNAL( SIGSTKFLT, (void *) do_nothing );
+ (void) SIGNAL( SIGSTKFLT, do_nothing );
#else
pthread_kill( ri->ri_tid, SIGUSR1 );
- (void) SIGNAL( SIGUSR1, (void *) do_nothing );
+ (void) SIGNAL( SIGUSR1, do_nothing );
#endif
}