+/* $OpenLDAP$ */
/*
* query.c: for rcpt500 (X.500 email query responder)
*
#include "portable.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
+#include <ac/stdlib.h>
+#include <ac/ctype.h>
#include <ac/string.h>
#include <ac/syslog.h>
#include <ac/time.h>
-extern int strcasecmp(const char *, const char *);
-#include "lber.h"
-#include "ldap.h"
+#include <stdio.h>
-#include "disptmpl.h"
+#include <ldap.h>
+#include <disptmpl.h>
#include "rcpt500.h"
-#include "ldapconfig.h"
+#include "ldap_defaults.h"
static char buf[ MAXSIZE ];
static char *errpreface = "Your query failed: ";
static void close_ldap(LDAP *ld);
static void append_entry_list(char *rep, char *qu, LDAP *ld, LDAPMessage *msg);
-static int append_text(void *reply, char *text, int len);
+static int append_text(void *reply, char *text, ber_len_t len);
static int do_read (LDAP *ld, char *dn, char *rep, struct ldap_disptmpl *tmp);
static void report_ldap_err (LDAP *ldp, char *reply);
static void remove_trailing_space (char *s);
{
LDAP *ldp;
LDAPMessage *ldmsgp, *entry;
- char *s, *dn;
+ char *dn;
int matches, rc, ld_errno, ufn;
LDAPFiltDesc *lfdp;
LDAPFiltInfo *lfi;
ldp = cldap_open( ldaphost, ldapport );
else
#endif /* LDAP_CONNECTIONLESS */
- ldp = ldap_open( ldaphost, ldapport );
+ ldp = ldap_init( ldaphost, ldapport );
if ( ldp == NULL ) {
strcat( reply, errpreface );
if (( cn = ldap_get_values( ldp, e, "cn" )) != NULL ) {
for ( i = 0; cn[i] != NULL; i++ ) {
- if ( isdigit( *( cn[i] + strlen( cn[i] ) - 1 ))) {
+ if ( isdigit((unsigned char) cn[i][strlen( cn[i] ) - 1])) {
rdn = strdup( cn[i] );
free_rdn = 1;
break;
static int
-append_text( void *reply, char *text, int len )
+append_text( void *reply, char *text, ber_len_t len )
{
strcat( (char *) reply, text );
return( len );
static char **defvals[] = { maildefvals, NULL };
- rc = ldap_entry2text_search( ldp, dn, searchbase, NULLMSG, tmpll,
+ rc = ldap_entry2text_search( ldp, dn, searchbase, NULL, tmpll,
defattrs, defvals, append_text, (void *)reply, "\n",
rdncount, LDAP_DISP_OPT_DOSEARCHACTIONS );
{
char *p = s + strlen( s ) - 1;
- while ( isspace( *p ) && p > s ) {
+ while ( isspace( (unsigned char) *p ) && p > s ) {
--p;
}
*(++p) = '\0';