allow zero-length attribute values

non-dietlibc md5 workaround (using openssl)
This commit is contained in:
leitner
2005-03-17 09:46:02 +00:00
parent c92b5180d7
commit a0fc14fd4b
5 changed files with 33 additions and 11 deletions

View File

@@ -41,6 +41,8 @@ CFLAGS=-pipe -I. -Wall -W -g
endif
ifneq ($(DIET),)
LIBS+=-llatin1
else
LIBS+=-lcrypto
endif
%.o: %.c

7
auth.c
View File

@@ -1,7 +1,14 @@
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#ifdef __dietlibc__
#include <md5.h>
#else
#include <openssl/md5.h>
#define MD5Init MD5_Init
#define MD5Update MD5_Update
#define MD5Final MD5_Final
#endif
#include "ldap.h"
#include "auth.h"
#include "str.h"

View File

@@ -144,12 +144,15 @@ lookagain:
} else if (c=='\n') {
struct ldaprec* m;
if (!stralloc_0(&payload)) goto nomem;
if (base64) {
len=unbase64(payload.s);
if (!binary) { payload.s[len]=0; ++len; }
if (payload.len) {
if (!stralloc_0(&payload)) goto nomem;
if (base64) {
len=unbase64(payload.s);
if (!binary) { payload.s[len]=0; ++len; }
} else
len=n+1;
} else
len=n+1;
len=0;
#if 0
buffer_puts(buffer_2,"feld \"");
@@ -199,12 +202,15 @@ lookagain:
// buf[n]=0;
#if 1
if (!stralloc_0(&payload)) goto nomem;
if (base64) {
len=unbase64(payload.s);
if (!binary) { payload.s[len]=0; ++len; }
if (payload.len) {
if (!stralloc_0(&payload)) goto nomem;
if (base64) {
len=unbase64(payload.s);
if (!binary) { payload.s[len]=0; ++len; }
} else
len=n+1;
} else
len=n+1;
len=0;
#if 0
buffer_puts(buffer_2,"feld \"");

View File

@@ -1,7 +1,14 @@
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#ifdef __dietlibc__
#include <md5.h>
#else
#include <openssl/md5.h>
#define MD5Init MD5_Init
#define MD5Update MD5_Update
#define MD5Final MD5_Final
#endif
#include <string.h>
#include "buffer.h"
#include "str.h"

View File

@@ -11,7 +11,7 @@ long mstorage_add_bin(mstorage_t* p,const char* s,unsigned long n) {
static char zero;
long x;
char intbuf[4];
if (n==0) goto encodebinary;
if (n==0 || (n==1 && s[0]==0)) goto encodebinary;
for (i=0; i<n-1; ++i)
if (!s[i]) {
encodebinary: