+/* $OpenLDAP$ */
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
#include "portable.h"
#include <stdio.h>
-#include <stdlib.h>
+
+#include <ac/stdlib.h>
#include <ac/ctype.h>
#include <ac/errno.h>
+#include <ac/param.h>
#include <ac/signal.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/unistd.h>
#include <ac/wait.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
-#include "lber.h"
-#include "ldap.h"
+#include <ldap.h>
#include "fax500.h"
-
-#include <ldapconfig.h>
+#include "ldap_defaults.h"
#define USER 0
#define GROUP_ERRORS 1
static int isgroup(LDAPMessage *e);
static void add_error(Error **err, int *nerr, int code, char *addr, LDAPMessage *msg);
static void add_group(char *dn, Group **list, int *nlist);
-static void unbind_and_exit(int rc);
+static void unbind_and_exit(int rc) LDAP_GCCATTR((noreturn));
static int group_loop(char *dn);
static void send_group(Group *group, int ngroup);
static int has_attributes(LDAPMessage *e, char *attr1, char *attr2);
#ifdef LOG_MAIL
openlog( myname, OPENLOG_OPTIONS, LOG_MAIL );
-#else
+#elif LOG_DEBUG
openlog( myname, OPENLOG_OPTIONS );
#endif
int sizelimit = FAX_MAXAMBIGUOUS;
int deref = LDAP_DEREF_ALWAYS;
- if ( (ld = ldap_open( NULL, 0 )) == NULL ) {
- syslog( LOG_ALERT, "ldap_open failed" );
+ if ( (ld = ldap_init( NULL, 0 )) == NULL ) {
+ syslog( LOG_ALERT, "ldap_init failed" );
return( -1 );
}
/* no matches - bounce with user unknown */
if ( match == 0 ) {
- add_error( err, nerr, E_USERUNKNOWN, name, NULLMSG );
+ add_error( err, nerr, E_USERUNKNOWN, name, NULL );
return;
}
add_error( err, nerr,
E_JOINMEMBERNOFAXNUM, ndn,
- NULLMSG );
+ NULL );
free( ndn );
}
add_error( err, nerr,
E_JOINMEMBERNOEMAIL, ndn,
- NULLMSG );
+ NULL );
free( ndn );
}
timeout.tv_sec = FAX_TIMEOUT;
timeout.tv_usec = 0;
- if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "(objectclass=*)",
+ if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, NULL,
attrs, 0, &timeout, &res )) != LDAP_SUCCESS ) {
if ( rc == LDAP_NO_SUCH_OBJECT ) {
- add_error( err, nerr, E_BADMEMBER, dn, NULLMSG );
+ add_error( err, nerr, E_BADMEMBER, dn, NULL );
return;
} else {
ldap_value_free( mail );
ldap_msgfree( res );
} else {
- add_error( err, nerr, E_MEMBERNOFAXNUM, ndn, NULLMSG );
+ add_error( err, nerr, E_MEMBERNOFAXNUM, ndn, NULL );
}
break;
case MAIL500 :
/* else generate a bounce */
} else {
- add_error( err, nerr, E_MEMBERNOEMAIL, ndn, NULLMSG );
+ add_error( err, nerr, E_MEMBERNOEMAIL, ndn, NULL );
}
free( ndn );
ldap_value_free( requeststo );
} else {
- add_error( err, nerr, E_NOREQUEST, dn, NULLMSG );
+ add_error( err, nerr, E_NOREQUEST, dn, NULL );
}
}
ldap_value_free( errorsto );
} else {
- add_error( err, nerr, E_NOERRORS, dn, NULLMSG );
+ add_error( err, nerr, E_NOERRORS, dn, NULL );
}
}
!= NULL ) {
for ( i = 0; vals[i]; i++ ) {
last = strlen( vals[i] ) - 1;
- if ( isdigit( vals[i][last] ) ) {
+ if ( isdigit((unsigned char) vals[i][last]) ) {
rdn = strdup( vals[i] );
break;
}
for ( i = 0; vals[0][i] != '\0'; i++ ) {
if ( vals[0][i] == '$' ) {
fprintf( fp, "\n%*s ", namelen, " " );
- while ( isspace( vals[0][i+1] ) )
+ while ( isspace((unsigned char) vals[0][i+1]) )
i++;
} else {
fprintf( fp, "%c", vals[0][i] );
if ( (vals = ldap_get_values( ld, e, "cn" )) != NULL ) {
for ( i = 0; vals[i]; i++ ) {
last = strlen( vals[i] ) - 1;
- if ( isdigit( vals[i][last] ) ) {
+ if ( isdigit((unsigned char) vals[i][last]) ) {
rdn = strdup( vals[i] );
break;
}
for ( i = 0; dnlist[i] != NULL; i++ ) {
if ( (rc = ldap_search_st( ld, dnlist[i],
- LDAP_SCOPE_BASE, "(objectclass=*)", attrs, 0,
+ LDAP_SCOPE_BASE, NULL, attrs, 0,
&timeout, &res )) != LDAP_SUCCESS ) {
if ( rc != LDAP_NO_SUCH_OBJECT ) {
unbind_and_exit( EX_TEMPFAIL );