- update to 20080425

better ACL support
This commit is contained in:
Dirk Meyer 2008-04-25 20:23:03 +00:00
parent 46398f6ab8
commit 615fb92797
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=211982
10 changed files with 67 additions and 140 deletions

View file

@ -17,17 +17,18 @@ COMMENT= A small LDAP implementation
BUILD_DEPENDS+= ${LOCALBASE}/lib/libowfat.a:${PORTSDIR}/${LIBOWFAT_PORT}
SNAPSHOT= 20040323
SNAPSHOT= 20080425
USE_BZIP2= yes
USE_GMAKE= yes
WRKSRC= ${WRKDIR}/${PORTNAME}
CFLAGS+= -DATTRIBS=512
LIBOWFAT_PORT?= devel/libowfat
TINYLDAP_DATA?= ${PREFIX}/tinyldap/data
SBINFILES= dumpidx idx2ldif addindex parse tinyldap_debug \
tinyldap_standalone
BINFILES= ldapclient ldapclient_str md5password
DOCFILES= FORMAT GETTING.STARTED README RFCs THANKS TODO
SBINFILES= acl addindex bindrequest dumpacls dumpidx idx2ldif parse \
tinyldap_debug tinyldap_standalone
BINFILES= ldapclient ldapclient_str ldapdelete md5password mysql2ldif
DOCFILES= ACL FORMAT GETTING.STARTED README README.security RFCs \
THANKS TODO
post-patch:
${TOUCH} ${WRKSRC}/alloca.h

View file

@ -1,3 +1,3 @@
MD5 (tinyldap-20040323.tar.bz2) = 0153fa998499f0e21dab26f29e82eed9
SHA256 (tinyldap-20040323.tar.bz2) = 217d5d5f8da1c44a1541eac0b1a0e618dbfed0081509edb43edc0d55471ee0cf
SIZE (tinyldap-20040323.tar.bz2) = 33993
MD5 (tinyldap-20080425.tar.bz2) = d6f93d93fb2db25d2681db3beb9d4e7c
SHA256 (tinyldap-20080425.tar.bz2) = 1511d1e940fb32cc0f06e25a63841e6954d153fb1539c17e690b0dc2408d4a79
SIZE (tinyldap-20080425.tar.bz2) = 53652

View file

@ -1,27 +1,39 @@
--- Makefile.orig Sat Mar 13 00:21:24 2004
+++ Makefile Tue Mar 23 15:49:03 2004
@@ -32,16 +32,19 @@
--- Makefile.orig 2008-04-25 13:09:33.000000000 +0200
+++ Makefile 2008-04-25 21:51:06.000000000 +0200
@@ -35,18 +35,22 @@
auth.a: auth.o
-DIET=/opt/diet/bin/diet -Os
-CC=gcc
-CFLAGS=-pipe -I. -Wall -W
+DIET=
+CC?=gcc
+CFLAGS?=-pipe -I. -Wall -W
CFLAGS=-pipe -I. -Wall -W -Wextra
ifneq ($(DEBUG),)
-DIET=/opt/diet/bin/diet
-CFLAGS=-pipe -I. -Wall -W -g
-CFLAGS=-pipe -I. -Wall -W -g -fstack-protector
+DIET=
+CFLAGS+=-g
+CFLAGS?=-pipe -I. -Wall -W -g -fstack-protector
endif
ifneq ($(DIET),)
LIBS+=-llatin1
ifeq ($(COVERAGE),1)
DIET=
-CFLAGS=-pipe -I. -g -fprofile-arcs -ftest-coverage
+CFLAGS?=-pipe -I. -g -fprofile-arcs -ftest-coverage
endif
+CFLAGS+=-I. -I${LOCALBASE}/include/libowfat
+CFLAGS+=-I. -I${LOCALBASE}/include/libowfat -Os
+LDFLAGS+=-L${LOCALBASE}/lib
+LIBS+=-lmd
+
ifneq ($(DIET),)
LIBS+=-llatin1
else
@@ -79,7 +83,7 @@
$(DIET) $(CC) $(CFLAGS) -DSTANDALONE -DDEBUG -o $@ $^ $(LDFLAGS) -lowfat $(LIBS)
%.o: %.c
$(DIET) $(CC) $(CFLAGS) -c $<
acl: acl.c ldap.a asn1.a
- $(DIET) $(CC) $(CFLAGS) -o acl acl.c -I. ldap.a asn1.a -lowfat $(LIBS)
+ $(DIET) $(CC) $(CFLAGS) -o acl acl.c -I. ldap.a asn1.a $(LDFLAGS) -lowfat $(LIBS)
.PHONY: clean tar

View file

@ -1,9 +0,0 @@
--- auth.c.orig Tue May 14 22:26:20 2002
+++ auth.c Thu Feb 26 16:03:58 2004
@@ -1,3 +1,6 @@
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#endif
#include <md5.h>
#include "ldap.h"
#include "auth.h"

View file

@ -1,12 +1,12 @@
--- ldif.h.orig Mon Jul 8 22:57:42 2002
+++ ldif.h Mon Mar 1 12:19:54 2004
@@ -2,7 +2,9 @@
--- ldif.h.orig 2008-04-25 13:09:34.000000000 +0200
+++ ldif.h 2008-04-25 21:36:30.000000000 +0200
@@ -4,7 +4,9 @@
#include <ldap.h>
/* how many attributes do we allow per record? */
+#ifndef ATTRIBS
#define ATTRIBS 32
#define ATTRIBS 100
+#endif
struct attribute {
long name, value;
uint32_t name, value;

View file

@ -1,9 +0,0 @@
--- md5password.c.orig Thu Feb 5 01:08:49 2004
+++ md5password.c Thu Feb 26 16:03:58 2004
@@ -1,3 +1,6 @@
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#endif
#include <md5.h>
#include <string.h>
#include "buffer.h"

View file

@ -0,0 +1,11 @@
--- mstorage_add.c.orig 2008-04-25 13:09:34.000000000 +0200
+++ mstorage_add.c 2008-04-25 21:46:42.000000000 +0200
@@ -19,7 +19,7 @@
/* Sadly, mremap is only available on Linux */
/* Please petition your congressman^Woperating system vendor to include it! */
-long mstorage_add(mstorage_t* p,const char* s,unsigned long n) {
+long mstorage_add(mstorage_t* p,const char* s,size_t n) {
if (p->mapped-p->used<n) {
if (!p->root) {
/* nothing allocated. mmap /dev/zero */

View file

@ -0,0 +1,11 @@
--- mstorage_add_bin.c.orig 2008-04-25 13:09:34.000000000 +0200
+++ mstorage_add_bin.c 2008-04-25 21:47:27.000000000 +0200
@@ -6,7 +6,7 @@
* char 0;
* uint32 len;
* char data[len] */
-long mstorage_add_bin(mstorage_t* p,const char* s,unsigned long n) {
+long mstorage_add_bin(mstorage_t* p,const char* s,size_t n) {
unsigned int i;
static char zero;
long x;

View file

@ -1,97 +0,0 @@
--- tinyldap.c.orig Sat Mar 13 00:21:25 2004
+++ tinyldap.c Fri Apr 2 13:15:39 2004
@@ -448,6 +448,83 @@
}
}
+static void answerall(uint32 ofs,long messageid,int out) {
+ struct SearchResultEntry sre;
+ struct PartialAttributeList** pal=&sre.attributes;
+
+ sre.objectName.l=bstrlen(sre.objectName.s=map+uint32_read(map+ofs+8));
+ sre.attributes=0;
+ /* now go through list of requested attributes */
+ {
+ uint32 adl=1,last=0;
+ struct string attr_key;
+
+ attr_key.s = NULL;
+ attr_key.l = 0;
+ uint32_unpack(map+ofs,&last);
+ while (adl < last) {
+ const char* att=0;
+ const char* val=0;
+ uint32 i=adl,j=last;
+
+ if (adl == 1) {
+ att="objectClass";
+ val=map+uint32_read(map+ofs+12);
+ } else {
+ att=map+uint32_read(map+ofs+i*8);
+ if (matchstring(&attr_key,att)) {
+ val=map+uint32_read(map+ofs+i*8+4);
+ ++i;
+ }
+ }
+ if (val) {
+ *pal=malloc(sizeof(struct PartialAttributeList));
+ if (!*pal) {
+nomem:
+ buffer_putsflush(buffer_2,"out of virtual memory!\n");
+ exit(1);
+ }
+ attr_key.s = att;
+ attr_key.l = strlen(att);
+ (*pal)->type=attr_key;
+ {
+ struct AttributeDescriptionList** a=&(*pal)->values;
+add_attribute:
+ *a=malloc(sizeof(struct AttributeDescriptionList));
+ if (!*a) goto nomem;
+ (*a)->a.s=bstrfirst(val);
+ (*a)->a.l=bstrlen(val);
+ for (;i<j; ++i)
+ if (!matchstring(&attr_key,map+uint32_read(map+ofs+i*8))) {
+ val=map+uint32_read(map+ofs+i*8+4);
+ ++i;
+ a=&(*a)->next;
+ goto add_attribute;
+ }
+ (*a)->next=0;
+ }
+ (*pal)->next=0;
+ pal=&(*pal)->next;
+ }
+ adl++;
+ }
+ }
+ {
+ long l=fmt_ldapsearchresultentry(0,&sre);
+ char *buf=alloca(l+300); /* you never know ;) */
+ long tmp;
+ if (verbose) {
+ buffer_puts(buffer_2,"sre len ");
+ buffer_putulong(buffer_2,l);
+ buffer_putsflush(buffer_2,".\n");
+ }
+ tmp=fmt_ldapmessage(buf,messageid,SearchResultEntry,l);
+ fmt_ldapsearchresultentry(buf+tmp,&sre);
+ write(out,buf,l+tmp);
+ }
+ free_ldappal(sre.attributes);
+}
+
static void answerwith(uint32 ofs,struct SearchRequest* sr,long messageid,int out) {
struct SearchResultEntry sre;
struct PartialAttributeList** pal=&sre.attributes;
@@ -483,6 +560,10 @@
/* now go through list of requested attributes */
{
struct AttributeDescriptionList* adl=sr->attributes;
+ if ( adl == NULL ) {
+ answerall(ofs,messageid,out);
+ return;
+ }
while (adl) {
const char* val=0;
uint32 i=2,j;

View file

@ -1,16 +1,23 @@
bin/ldapclient
bin/ldapclient_str
bin/ldapdelete
bin/md5password
bin/mysql2ldif
libexec/tinyldap
sbin/acl
sbin/addindex
sbin/bindrequest
sbin/dumpacls
sbin/dumpidx
sbin/idx2ldif
sbin/parse
sbin/tinyldap_debug
sbin/tinyldap_standalone
%%PORTDOCS%%%%DOCSDIR%%/ACL
%%PORTDOCS%%%%DOCSDIR%%/FORMAT
%%PORTDOCS%%%%DOCSDIR%%/GETTING.STARTED
%%PORTDOCS%%%%DOCSDIR%%/README
%%PORTDOCS%%%%DOCSDIR%%/README.security
%%PORTDOCS%%%%DOCSDIR%%/RFCs
%%PORTDOCS%%%%DOCSDIR%%/THANKS
%%PORTDOCS%%%%DOCSDIR%%/TODO