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

Initial Merge of REGEX/ACLGROUP code from Allan Stuart

parent b7fb7518
......@@ -28,8 +28,9 @@
# man pages are put under MANDIR
# programs end-users will run are put in BINDIR
#
INSTROOT=/usr/local
ETCDIR= $(INSTROOT)/etc
PREFIX?=/usr/local
INSTROOT=${PREFIX}
ETCDIR= $(INSTROOT)/etc/ldap
INCLUDEDIR= $(INSTROOT)/include
LIBDIR= $(INSTROOT)/lib
MANDIR= $(INSTROOT)/man
......@@ -44,9 +45,12 @@ RUNTIMEETCDIR= $(ETCDIR)
## General compiler options ##
#############################################################################
# Passed to every compile (cc or gcc). This is where you put -O or -g, etc.
#EXTRACFLAGS=-g
# EXTRACFLAGS=-O -g # -DACLGROUP
# EXTRACFLAGS=-O
# Passed to every link (ld). Include -g here if you did in EXTRACFLAGS.
#EXTRALDFLAGS=-g
EXTRALDFLAGS=-g
REGEXLIB?=
#############################################################################
## If you are NOT using Kerberos authentication, you can skip this section.##
......@@ -120,10 +124,11 @@ SLAPD_BACKENDS= -DLDAP_LDBM -DLDAP_SHELL -DLDAP_PASSWD
# If you have included -DLDAP_LDBM in the SLAPD_BACKENDS line you need
# to specify which low-level database package to use. There are
# four choices: Berkeley db b-tree, Berkeley db hash, GNU dbm, or ndbm.
# You will also need to edit the include and lib strings appropriately.
#
# berkeley db btree package
#LDBMBACKEND=-DLDBM_USE_DBBTREE
#LDBMINCLUDE=-I/usr/local/db/include
LDBMBACKEND=-DLDBM_USE_DBBTREE
LDBMINCLUDE=-I/usr/include
#LDBMLIB=-ldb
# berkeley db hash package
#LDBMBACKEND=-DLDBM_USE_DBHASH
......@@ -134,11 +139,11 @@ SLAPD_BACKENDS= -DLDAP_LDBM -DLDAP_SHELL -DLDAP_PASSWD
#LDBMINCLUDE=-I/usr/local/gdbm/include
#LDBMLIB=-lgdbm
# standard unix ndbm
LDBMBACKEND=-DLDBM_USE_NDBM
#LDBMBACKEND=-DLDBM_USE_NDBM
#
# if you want to use a non-default threads package change these lines
#THREADS=-DNO_THREADS
#THREADSLIB=
#THREADS=-DPOSIX_THREADS
#THREADSLIB= -pthread
#############################################################################
## The following options are used by the xax500 client. If you haven't ##
......@@ -195,6 +200,15 @@ LDAP_DEBUG=-DLDAP_DEBUG
# uncomment this line to enable support for LDAP referrals in libldap
LDAP_REFERRALS=-DLDAP_REFERRALS
# uncomment these lines to enable support for CRYPT passwords in LDBM.
#LDAP_CRYPT=-DLDAP_CRYPT
#LDAP_CRYPT_LIB=-lcrypt
# uncomment these lines to enable support fro tcp_wrappers in servers.
# Requires tcp_wrappers.
#LDAP_TCP_WRAPPERS=-DTCP_WRAPPERS -I/usr/local/include
#LDAP_TCP_WRAPPERS_LIB=-L/usr/local/lib -lwrap
# uncomment this line to use soundex for approximate matches in slapd.
# the default is to use the metaphone algorithm.
#PHONETIC=-DSOUNDEX
......@@ -14,5 +14,4 @@
CC = cc
PLATFORMCFLAGS= -Dfreebsd
PLATFORMLIBS= -lcompat
......@@ -17,13 +17,13 @@ LDAPSRC = ../..
SRCS = bind.c open.c result.c error.c compare.c search.c \
modify.c add.c modrdn.c delete.c abandon.c ufn.c cache.c \
getfilter.c regex.c sbind.c kbind.c unbind.c friendly.c cldap.c \
getfilter.c sbind.c kbind.c unbind.c friendly.c cldap.c \
free.c disptmpl.c srchpref.c dsparse.c tmplout.c sort.c \
getdn.c getentry.c getattr.c getvalues.c addentry.c \
request.c getdxbyname.c os-ip.c url.c charset.c
OBJS = bind.o open.o result.o error.o compare.o search.o \
modify.o add.o modrdn.o delete.o abandon.o ufn.o cache.o \
getfilter.o regex.o sbind.o kbind.o unbind.o friendly.o cldap.o \
getfilter.o sbind.o kbind.o unbind.o friendly.o cldap.o \
free.o disptmpl.o srchpref.o dsparse.o tmplout.o sort.o \
getdn.o getentry.o getattr.o getvalues.o addentry.o \
request.o getdxbyname.o os-ip.o url.o charset.o
......@@ -96,48 +96,43 @@ links:
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
bind.o: bind.c ../../include/lber.h ../../include/ldap.h
open.o: open.c ../../include/lber.h ../../include/ldap.h ldap-int.h
result.o: result.c ../../include/portable.h ../../include/lber.h
result.o: ../../include/ldap.h ldap-int.h
error.o: error.c ../../include/lber.h ../../include/ldap.h
compare.o: compare.c ../../include/lber.h ../../include/ldap.h ldap-int.h
search.o: search.c ../../include/lber.h ../../include/ldap.h ldap-int.h
modify.o: modify.c ../../include/lber.h ../../include/ldap.h ldap-int.h
add.o: add.c ../../include/lber.h ../../include/ldap.h ldap-int.h
modrdn.o: modrdn.c ../../include/lber.h ../../include/ldap.h ldap-int.h
delete.o: delete.c ../../include/lber.h ../../include/ldap.h ldap-int.h
abandon.o: abandon.c ../../include/lber.h ../../include/ldap.h ldap-int.h
ufn.o: ufn.c ../../include/lber.h ../../include/ldap.h
cache.o: cache.c ../../include/lber.h ../../include/ldap.h ldap-int.h
getfilter.o: getfilter.c ../../include/lber.h ../../include/ldap.h
getfilter.o: ../../include/regex.h
regex.o: regex.c ../../include/portable.h
sbind.o: sbind.c ../../include/lber.h ../../include/ldap.h ldap-int.h
kbind.o: kbind.c ../../include/lber.h ../../include/ldap.h ldap-int.h
unbind.o: unbind.c ../../include/lber.h ../../include/ldap.h ldap-int.h
friendly.o: friendly.c ../../include/lber.h ../../include/ldap.h
cldap.o: cldap.c ../../include/lber.h ../../include/ldap.h ldap-int.h
free.o: free.c ../../include/lber.h ../../include/ldap.h
disptmpl.o: disptmpl.c ../../include/lber.h ../../include/ldap.h
disptmpl.o: ../../include/disptmpl.h
srchpref.o: srchpref.c ../../include/lber.h ../../include/ldap.h
srchpref.o: ../../include/srchpref.h
dsparse.o: dsparse.c ../../include/lber.h ../../include/ldap.h
tmplout.o: tmplout.c ../../include/lber.h ../../include/ldap.h
tmplout.o: ../../include/disptmpl.h
sort.o: sort.c ../../include/lber.h ../../include/ldap.h
getdn.o: getdn.c ../../include/lber.h ../../include/ldap.h
getentry.o: getentry.c ../../include/lber.h ../../include/ldap.h
getattr.o: getattr.c ../../include/lber.h ../../include/ldap.h ldap-int.h
getvalues.o: getvalues.c ../../include/lber.h ../../include/ldap.h
addentry.o: addentry.c ../../include/lber.h ../../include/ldap.h
request.o: request.c ../../include/portable.h ../../include/lber.h
request.o: ../../include/ldap.h ldap-int.h
bind.o: bind.c ../../include/lber.h ../../include/proto-ldap.h
open.o: open.c ../../include/proto-lber.h ../../include/proto-ldap.h
result.o: result.c ../../include/portable.h ../../include/proto-lber.h
result.o: ../../include/proto-ldap.h
error.o: error.c ../../include/lber.h ../../include/proto-ldap.h
compare.o: compare.c ../../include/lber.h ../../include/proto-ldap.h
search.o: search.c ../../include/lber.h ../../include/proto-ldap.h
modify.o: modify.c ../../include/lber.h ../../include/proto-ldap.h
add.o: add.c ../../include/lber.h ../../include/proto-ldap.h
modrdn.o: modrdn.c ../../include/lber.h ../../include/proto-ldap.h
delete.o: delete.c ../../include/lber.h ../../include/proto-ldap.h
abandon.o: abandon.c ../../include/lber.h ../../include/proto-ldap.h
ufn.o: ufn.c ../../include/lber.h ../../include/proto-ldap.h
cache.o: cache.c ../../include/lber.h ../../include/proto-ldap.h
getfilter.o: getfilter.c ../../include/lber.h ../../include/proto-ldap.h
regex.o: regex.c
sbind.o: sbind.c ../../include/lber.h ../../include/proto-ldap.h
kbind.o: kbind.c
unbind.o: unbind.c ../../include/proto-lber.h ../../include/proto-ldap.h
friendly.o: friendly.c ../../include/lber.h ../../include/proto-ldap.h
cldap.o: cldap.c
free.o: free.c ../../include/ldap.h
disptmpl.o: disptmpl.c ../../include/proto-lber.h ../../include/disptmpl.h
srchpref.o: srchpref.c ../../include/proto-lber.h ../../include/srchpref.h
dsparse.o: dsparse.c ../../include/proto-lber.h
tmplout.o: tmplout.c ../../include/proto-lber.h ../../include/proto-ldap.h
sort.o: sort.c ../../include/proto-lber.h ../../include/proto-ldap.h
getdn.o: getdn.c ../../include/lber.h ../../include/proto-ldap.h
getentry.o: getentry.c ../../include/lber.h ../../include/proto-ldap.h
getattr.o: getattr.c ../../include/lber.h ../../include/proto-ldap.h
getvalues.o: getvalues.c ../../include/lber.h ../../include/proto-ldap.h
addentry.o: addentry.c ../../include/lber.h ../../include/proto-ldap.h
request.o: request.c ../../include/portable.h ../../include/proto-lber.h
request.o: ../../include/proto-ldap.h
getdxbyname.o: getdxbyname.c
os-ip.o: os-ip.c ../../include/portable.h ../../include/lber.h
os-ip.o: ../../include/ldap.h
url.o: url.c ../../include/lber.h ../../include/ldap.h ldap-int.h
os-ip.o: os-ip.c ../../include/proto-lber.h ../../include/proto-ldap.h
url.o: url.c ../../include/lber.h ../../include/proto-ldap.h
charset.o: charset.c
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
......@@ -10,13 +10,13 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#if defined(NeXT)
#include <sys/types.h>
#include <regex.h>
#endif
#ifdef MACOS
#include <stdlib.h>
#include "macos.h"
#else /* MACOS */
#ifdef DOS
......@@ -25,7 +25,6 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
#else /* DOS */
#include <sys/types.h>
#include <sys/file.h>
#include <stdlib.h>
#include <sys/errno.h>
#ifndef VMS
#include <unistd.h>
......@@ -35,7 +34,6 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
#include "lber.h"
#include "ldap.h"
#include "regex.h"
#ifdef NEEDPROTOS
static int break_into_words( char *str, char *delims, char ***wordsp );
......@@ -49,7 +47,6 @@ void free_strarray();
#if !defined( MACOS ) && !defined( DOS )
extern int errno;
extern char *re_comp();
#endif
#define FILT_MAX_LINE_LEN 1024
......@@ -107,8 +104,10 @@ ldap_init_getfilter_buf( char *buf, long buflen )
LDAPFiltDesc *lfdp;
LDAPFiltList *flp, *nextflp;
LDAPFiltInfo *fip, *nextfip;
char *tag, **tok;
int tokcnt, i;
char *tag, **tok;
int tokcnt, i;
int rc;
regex_t re;
if (( lfdp = (LDAPFiltDesc *)calloc( 1, sizeof( LDAPFiltDesc))) == NULL ) {
return( NULL );
......@@ -138,11 +137,13 @@ ldap_init_getfilter_buf( char *buf, long buflen )
}
nextflp->lfl_tag = strdup( tag );
nextflp->lfl_pattern = tok[ 0 ];
if ( re_comp( nextflp->lfl_pattern ) != NULL ) {
if ( (rc = regcomp( &re, nextflp->lfl_pattern, 0 )) != 0 ) {
#ifndef NO_USERINTERFACE
char error[512];
regerror(rc, &re, error, sizeof(error));
ldap_getfilter_free( lfdp );
fprintf( stderr, "bad regular expresssion %s\n",
nextflp->lfl_pattern );
fprintf( stderr, "bad regular expresssion %s, %s\n",
nextflp->lfl_pattern, error );
#if !defined( MACOS ) && !defined( DOS )
errno = EINVAL;
#endif
......@@ -150,6 +151,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
free_strarray( tok );
return( NULL );
}
regfree(&re);
nextflp->lfl_delims = tok[ 1 ];
nextflp->lfl_ilist = NULL;
......@@ -247,6 +249,8 @@ LDAPFiltInfo *
ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
{
LDAPFiltList *flp;
int rc;
regex_t re;
if ( lfdp->lfd_curvalcopy != NULL ) {
free( lfdp->lfd_curvalcopy );
......@@ -256,13 +260,30 @@ ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
lfdp->lfd_curval = value;
lfdp->lfd_curfip = NULL;
for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) {
if ( re_comp( tagpat ) == NULL && re_exec( flp->lfl_tag ) == 1
&& re_comp( flp->lfl_pattern ) == NULL
&& re_exec( lfdp->lfd_curval ) == 1 ) {
lfdp->lfd_curfip = flp->lfl_ilist;
break;
}
for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) {
/* compile tagpat, continue if we fail */
if (regcomp(&re, tagpat, 0) != 0)
continue;
/* match tagpatern and tag, continue if we fail */
rc = regexec(&re, flp->lfl_tag, 0, NULL, 0);
regfree(&re);
if (rc != 0)
continue;
/* compile flp->ifl_pattern, continue if we fail */
if (regcomp(&re, flp->lfl_pattern, 0) != 0)
continue;
/* match ifl_pattern and lfd_curval, continue if we fail */
rc = regexec(&re, lfdp->lfd_curval, 0, NULL, 0);
regfree(&re);
if (rc != 0)
continue;
/* we successfully compiled both patterns and matched both values */
lfdp->lfd_curfip = flp->lfl_ilist;
break;
}
if ( lfdp->lfd_curfip == NULL ) {
......
This diff is collapsed.
......@@ -21,23 +21,24 @@ SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \
attr.c entry.c config.c backend.c result.c operation.c \
dn.c compare.c modify.c delete.c modrdn.c ch_malloc.c \
value.c ava.c bind.c unbind.c abandon.c filterentry.c \
phonetic.c regex.c acl.c str2filter.c aclparse.c init.c \
phonetic.c acl.c str2filter.c aclparse.c init.c \
detach.c strdup.c tempnam.c repl.c lock.c \
schema.c schemaparse.c monitor.c configinfo.c
OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \
attr.o entry.o config.o backend.o result.o operation.o \
dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o \
value.o ava.o bind.o unbind.o abandon.o filterentry.o \
phonetic.o regex.o acl.o str2filter.o aclparse.o init.o \
phonetic.o acl.o str2filter.o aclparse.o init.o \
detach.o strdup.o tempnam.o repl.o lock.o \
schema.o schemaparse.o monitor.o configinfo.o
INCLUDES= -I. -I$(HDIR) $(KRBINCLUDEFLAG)
DEFINES = $(DEFS) $(SERVERDEFS)
DEFINES = $(DEFS) $(LDAP_CRYPT) $(LDAP_TCP_WRAPPERS) $(SERVERDEFS)
CFLAGS = $(INCLUDES) $(THREADSINCLUDE) $(DEFINES) $(ACFLAGS) $(THREADS)
LDFLAGS = -L$(LDIR) $(KRBLIBFLAG)
LIBS = $(KRBLIBS) -llber -lldbm -lavl -llthread -lldif $(THREADSLIB) \
$(LDBMLIB) $(ALIBS)
LIBS = $(KRBLIBS) -llber -lldbm -lavl -llthread -lldif \
$(REGEXLIB) $(THREADSLIB) \
$(LDBMLIB) $(LDAP_CRYPT_LIB) $(LDAP_TCP_WRAPPERS_LIB) $(ALIBS)
all: FORCE
@if [ -z "$(MAKESLAPD)" ]; then \
......@@ -168,99 +169,79 @@ links:
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
main.o: main.c ../../include/portable.h slap.h ../../include/avl.h
main.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
main.o: ../../include/ldif.h ../../include/ldapconfig.h
daemon.o: daemon.c slap.h ../../include/avl.h ../../include/lber.h
daemon.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
daemon.o: ../../include/portable.h ../../include/ldapconfig.h
connection.o: connection.c ../../include/portable.h slap.h ../../include/avl.h
connection.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
connection.o: ../../include/ldif.h
search.o: search.c slap.h ../../include/avl.h ../../include/lber.h
search.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
search.o: ../../include/ldapconfig.h
filter.o: filter.c slap.h ../../include/avl.h ../../include/lber.h
filter.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
add.o: add.c slap.h ../../include/avl.h ../../include/lber.h
add.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
charray.o: charray.c slap.h ../../include/avl.h ../../include/lber.h
charray.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
attr.o: attr.c ../../include/portable.h slap.h ../../include/avl.h
attr.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
main.o: main.c ../../include/portable.h ../../include/avl.h
main.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldapconfig.h
daemon.o: daemon.c ../../include/avl.h ../../include/ldap.h
daemon.o: ../../include/lthread.h ../../include/portable.h
connection.o: connection.c ../../include/portable.h ../../include/avl.h
connection.o: ../../include/ldap.h ../../include/lthread.h
search.o: search.c ../../include/proto-lber.h ../../include/proto-ldap.h
search.o: ../../include/ldif.h
filter.o: filter.c ../../include/proto-lber.h ../../include/proto-ldap.h
filter.o: ../../include/ldif.h
add.o: add.c ../../include/avl.h ../../include/ldap.h
add.o: ../../include/proto-ldap.h ../../include/ldif.h
charray.o: charray.c ../../include/proto-lber.h ../../include/proto-ldap.h
charray.o: ../../include/ldif.h
attr.o: attr.c ../../include/proto-lber.h ../../include/proto-ldap.h
attr.o: ../../include/ldif.h
entry.o: entry.c slap.h ../../include/avl.h ../../include/lber.h
entry.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
config.o: config.c slap.h ../../include/avl.h ../../include/lber.h
config.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
config.o: ../../include/ldapconfig.h
backend.o: backend.c slap.h ../../include/avl.h ../../include/lber.h
backend.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
result.o: result.c ../../include/portable.h slap.h ../../include/avl.h
result.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
result.o: ../../include/ldif.h
operation.o: operation.c slap.h ../../include/avl.h ../../include/lber.h
operation.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
dn.o: dn.c ../../include/portable.h slap.h ../../include/avl.h
dn.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
dn.o: ../../include/ldif.h
compare.o: compare.c slap.h ../../include/avl.h ../../include/lber.h
compare.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
modify.o: modify.c slap.h ../../include/avl.h ../../include/lber.h
modify.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
delete.o: delete.c slap.h ../../include/avl.h ../../include/lber.h
delete.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
modrdn.o: modrdn.c slap.h ../../include/avl.h ../../include/lber.h
modrdn.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
ch_malloc.o: ch_malloc.c slap.h ../../include/avl.h ../../include/lber.h
ch_malloc.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
value.o: value.c ../../include/portable.h slap.h ../../include/avl.h
value.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
value.o: ../../include/ldif.h
ava.o: ava.c slap.h ../../include/avl.h ../../include/lber.h
ava.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
bind.o: bind.c slap.h ../../include/avl.h ../../include/lber.h
bind.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
unbind.o: unbind.c slap.h ../../include/avl.h ../../include/lber.h
unbind.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
abandon.o: abandon.c slap.h ../../include/avl.h ../../include/lber.h
abandon.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
filterentry.o: filterentry.c ../../include/regex.h slap.h ../../include/avl.h
filterentry.o: ../../include/lber.h ../../include/ldap.h
filterentry.o: ../../include/lthread.h ../../include/ldif.h
phonetic.o: phonetic.c ../../include/portable.h slap.h ../../include/avl.h
phonetic.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
phonetic.o: ../../include/ldif.h
regex.o: regex.c ../../include/portable.h
acl.o: acl.c ../../include/regex.h slap.h ../../include/avl.h
acl.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
entry.o: entry.c ../../include/avl.h ../../include/ldap.h
entry.o: ../../include/lthread.h
config.o: config.c ../../include/proto-lber.h ../../include/proto-ldap.h
config.o: ../../include/ldif.h
backend.o: backend.c ../../include/avl.h ../../include/ldap.h
backend.o: ../../include/lthread.h
result.o: result.c ../../include/portable.h ../../include/avl.h
result.o: ../../include/ldap.h ../../include/lthread.h
operation.o: operation.c ../../include/proto-lber.h ../../include/proto-ldap.h
operation.o: ../../include/ldif.h
dn.o: dn.c ../../include/portable.h ../../include/avl.h ../../include/ldap.h
dn.o: ../../include/lthread.h
compare.o: compare.c ../../include/avl.h ../../include/ldap.h
compare.o: ../../include/lthread.h
modify.o: modify.c ../../include/avl.h ../../include/ldap.h
modify.o: ../../include/proto-ldap.h ../../include/ldif.h
delete.o: delete.c ../../include/proto-lber.h ../../include/proto-ldap.h
delete.o: ../../include/ldif.h
modrdn.o: modrdn.c ../../include/proto-lber.h ../../include/proto-ldap.h
modrdn.o: ../../include/ldif.h
ch_malloc.o: ch_malloc.c ../../include/avl.h ../../include/ldap.h
ch_malloc.o: ../../include/lthread.h
value.o: value.c ../../include/portable.h ../../include/avl.h
value.o: ../../include/ldap.h ../../include/lthread.h
ava.o: ava.c ../../include/proto-lber.h ../../include/proto-ldap.h
ava.o: ../../include/ldif.h
bind.o: bind.c ../../include/proto-lber.h ../../include/proto-ldap.h
bind.o: ../../include/ldif.h
unbind.o: unbind.c ../../include/avl.h ../../include/ldap.h
unbind.o: ../../include/lthread.h
abandon.o: abandon.c ../../include/avl.h ../../include/ldap.h
abandon.o: ../../include/lthread.h
filterentry.o: filterentry.c ../../include/proto-lber.h
filterentry.o: ../../include/proto-ldap.h ../../include/ldif.h
phonetic.o: phonetic.c ../../include/portable.h ../../include/avl.h
phonetic.o: ../../include/ldap.h ../../include/lthread.h
regex.o: regex.c
acl.o: acl.c slap.h ../../include/proto-lber.h ../../include/proto-ldap.h
acl.o: ../../include/ldif.h
str2filter.o: str2filter.c slap.h ../../include/avl.h ../../include/lber.h
str2filter.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
aclparse.o: aclparse.c ../../include/regex.h slap.h ../../include/avl.h
aclparse.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
aclparse.o: ../../include/ldif.h ../../include/portable.h
init.o: init.c ../../include/portable.h slap.h ../../include/avl.h
init.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
init.o: ../../include/ldif.h
detach.o: detach.c ../../include/portable.h
str2filter.o: str2filter.c ../../include/avl.h ../../include/ldap.h
str2filter.o: ../../include/lthread.h
aclparse.o: aclparse.c slap.h ../../include/proto-lber.h
aclparse.o: ../../include/proto-ldap.h ../../include/ldif.h
init.o: init.c ../../include/portable.h ../../include/avl.h
init.o: ../../include/ldap.h ../../include/lthread.h
detach.o: detach.c
strdup.o: strdup.c
tempnam.o: tempnam.c
repl.o: repl.c slap.h ../../include/avl.h ../../include/lber.h
repl.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
lock.o: lock.c ../../include/portable.h slap.h ../../include/avl.h
lock.o: ../../include/lber.h ../../include/ldap.h ../../include/lthread.h
lock.o: ../../include/ldif.h
schema.o: schema.c slap.h ../../include/avl.h ../../include/lber.h
schema.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
schemaparse.o: schemaparse.c slap.h ../../include/avl.h ../../include/lber.h
schemaparse.o: ../../include/ldap.h ../../include/lthread.h
schemaparse.o: ../../include/ldif.h
monitor.o: monitor.c slap.h ../../include/avl.h ../../include/lber.h
monitor.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
monitor.o: ../../include/ldapconfig.h
configinfo.o: configinfo.c slap.h ../../include/avl.h ../../include/lber.h
configinfo.o: ../../include/ldap.h ../../include/lthread.h ../../include/ldif.h
configinfo.o: ../../include/ldapconfig.h
repl.o: repl.c ../../include/proto-lber.h ../../include/lthread.h
lock.o: lock.c ../../include/avl.h ../../include/ldap.h ../../include/lthread.h
schema.o: schema.c ../../include/proto-lber.h ../../include/proto-ldap.h
schema.o: ../../include/ldif.h
schemaparse.o: schemaparse.c ../../include/avl.h ../../include/ldap.h
schemaparse.o: ../../include/lthread.h
monitor.o: monitor.c ../../include/avl.h ../../include/ldap.h
monitor.o: ../../include/proto-ldap.h ../../include/ldif.h
configinfo.o: configinfo.c ../../include/avl.h ../../include/ldap.h
configinfo.o: ../../include/lthread.h ../../include/ldapconfig.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
This diff is collapsed.
......@@ -7,14 +7,8 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#ifdef sunos5
#include "regexpr.h"
#else
#include "regex.h"
#endif
#include <regex.h>
#include "slap.h"
#include "portable.h"
......@@ -33,7 +27,6 @@ static void print_acl();
static void print_access();
#endif
#ifdef USEREGEX
int
regtest(char *fname, int lineno, char *pat) {
int e;
......@@ -51,7 +44,7 @@ regtest(char *fname, int lineno, char *pat) {
size = 0;
buf[0] = '\0';
for (size = 0, flag = 0; (size < 512) && *sp; sp++) {
for (size = 0, flag = 0; (size < sizeof(buf)) && *sp; sp++) {
if (flag) {
if (*sp == '$'|| (*sp >= '0' && *sp <= '9')) {
*dp++ = *sp;
......@@ -70,7 +63,7 @@ regtest(char *fname, int lineno, char *pat) {
}
*dp = '\0';
if (size >= 511) {
if ( size >= (sizeof(buf)-1) ) {
fprintf( stderr,
"%s: line %d: regular expression \"%s\" too large\n",
fname, lineno, pat, 0 );
......@@ -78,18 +71,17 @@ regtest(char *fname, int lineno, char *pat) {
}
if ((e = regcomp(&re, buf, REG_EXTENDED|REG_ICASE))) {
char buf[512];
regerror(e, &re, buf, 512);
char error[512];
regerror(e, &re, error, sizeof(error));
fprintf( stderr,
"%s: line %d: regular expression \"%s\" bad because of %s\n",
fname, lineno, pat, buf );
fname, lineno, pat, error );
acl_usage();
return(0);
}
regfree(&re);
return(1);
}
#endif
void
parse_acl(
......@@ -123,19 +115,17 @@ parse_acl(
}
if ( strcasecmp( argv[i], "*" ) == 0 ) {
#ifdef USEREGEX
int e;
if ((e = regcomp( &a->acl_dnre, ".*",
REG_EXTENDED|REG_ICASE)))
{
char buf[512];
regerror(e, &a->acl_dnre, buf, 512);
regerror(e, &a->acl_dnre, buf, sizeof(buf));
fprintf( stderr,
"%s: line %d: regular expression \"%s\" bad because of %s\n",
fname, lineno, right, buf );
acl_usage();
}
#endif
a->acl_dnpat = strdup( ".*" );
continue;
}
......@@ -157,31 +147,19 @@ parse_acl(
acl_usage();
}
} else if ( strcasecmp( left, "dn" ) == 0 ) {
#ifdef USEREGEX
int e;
if ((e = regcomp(&a->acl_dnre, right,
REG_EXTENDED|REG_ICASE))) {
char buf[512];
regerror(e, &a->acl_dnre, buf, 512);
regerror(e, &a->acl_dnre, buf, sizeof(buf));
fprintf( stderr,
"%s: line %d: regular expression \"%s\" bad because of %s\n",
"%s: line %d: regular expression \"%s\" bad because of %s\n",
fname, lineno, right, buf );
acl_usage();
} else {
a->acl_dnpat = dn_upcase(strdup( right ));
}
#else
if ( (e = re_comp( right )) != NULL ) {
fprintf( stderr,
"%s: line %d: regular expression \"%s\" bad because of %s\n",
fname, lineno, right, e );
acl_usage();
} else {
a->acl_dnpat = dn_upcase( strdup( right ) );
}
#endif
} else if ( strncasecmp( left, "attr", 4 )
== 0 ) {
char **alist;
......@@ -191,7 +169,7 @@ parse_acl(
free( alist );
} else {
fprintf( stderr,
"%s: line %d: expecting <what> got \"%s\"\n",
"%s: line %d: expecting <what> got \"%s\"\n",
fname, lineno, left );
acl_usage();
}
......@@ -201,7 +179,7 @@ parse_acl(
} else if ( strcasecmp( argv[i], "by" ) == 0 ) {
if ( a == NULL ) {
fprintf( stderr,