Browse Source

as I currently have no idea whats the problem I first fixed all warnings...included the ldap warnings that where caused by the use of deprecated ldap_simple_bind_s and ldap_unbind_s.

release0.1.5
Georg Hopp 12 years ago
parent
commit
ac5b20e9ff
  1. 17
      src/auth/ldap.c
  2. 2
      src/hash/each.c
  3. 48
      src/server/read.c
  4. 2
      src/server/run.c
  5. 2
      src/server/write.c
  6. 1
      src/socket/socket.c

17
src/auth/ldap.c

@ -76,6 +76,9 @@ authLdapAuthenticate(void * _this, Credential cred)
char * who_ptr = who; char * who_ptr = who;
int ldap_err; int ldap_err;
struct berval ldap_cred;
struct berval * ldap_servcred;
if (CRED_PASSWORD != cred->type) { if (CRED_PASSWORD != cred->type) {
return FALSE; return FALSE;
} }
@ -91,9 +94,19 @@ authLdapAuthenticate(void * _this, Credential cred)
memcpy(who_ptr, this->base_dn, this->nbase_dn); memcpy(who_ptr, this->base_dn, this->nbase_dn);
who_ptr[this->nbase_dn] = 0; who_ptr[this->nbase_dn] = 0;
ldap_err = ldap_simple_bind_s(this->ldap, who, CRED_PWD(cred).pass);
ldap_cred.bv_val = CRED_PWD(cred).pass;
ldap_cred.bv_len = CRED_PWD(cred).npass;
ldap_err = ldap_sasl_bind_s(
this->ldap,
who,
LDAP_SASL_SIMPLE,
&ldap_cred,
NULL,
NULL,
&ldap_servcred);
if (0 == ldap_err) { if (0 == ldap_err) {
ldap_unbind_s(this->ldap);
ldap_unbind_ext_s(this->ldap, NULL, NULL);
//! \todo here we need to get and return the user id //! \todo here we need to get and return the user id
return TRUE; return TRUE;
} }

2
src/hash/each.c

@ -24,7 +24,7 @@
#include "hash.h" #include "hash.h"
static void (*cb)(void*);
static void (*cb)(const void*);
static static
inline inline

48
src/server/read.c

@ -26,13 +26,11 @@
#include "logger.h" #include "logger.h"
#include "stream.h" #include "stream.h"
void serverCloseConn(Server, unsigned int);
ssize_t ssize_t
serverRead(Server this, unsigned int i) serverRead(Server this, unsigned int i)
{ {
int fd = (this->fds)[i].fd; int fd = (this->fds)[i].fd;
ssize_t size;
if (NULL == (this->conns)[fd].worker) { if (NULL == (this->conns)[fd].worker) {
loggerLog( loggerLog(
@ -42,49 +40,9 @@ serverRead(Server this, unsigned int i)
return -1; return -1;
} }
switch ((size = streamReaderRead(
(this->conns)[fd].worker,
(this->conns)[fd].stream)))
{
case -1:
/*
* read failure
*/
if (errno == EAGAIN || errno == EWOULDBLOCK) {
/* on EGAIN just try again later. */
break;
}
// DROP-THROUGH
case -2:
/**
* normal close: this must be mapped to -2 within the
* underlying read call.
*
* \todo make sure all pending writes will be done before
* close.
*/
/*
* close connection if not EAGAIN, this would also
* remove the filedescriptor from the poll list.
* Else just return indicate
*/
loggerLog(this->logger, LOGGER_INFO,
"connection[%d] closed...%s",
fd,
inet_ntoa((((this->conns)[fd].sock)->addr).sin_addr));
serverCloseConn(this, i);
//case 0:
// break;
default:
// (this->fds)[i].events |= POLLOUT;
break;
}
return size;
return streamReaderRead(
(this->conns)[fd].worker,
(this->conns)[fd].stream);
} }
// vim: set ts=4 sw=4: // vim: set ts=4 sw=4:

2
src/server/run.c

@ -29,6 +29,8 @@ int serverPoll(Server);
int serverHandleAccept(Server, unsigned int); int serverHandleAccept(Server, unsigned int);
ssize_t serverRead(Server, unsigned int); ssize_t serverRead(Server, unsigned int);
ssize_t serverWrite(Server, unsigned int); ssize_t serverWrite(Server, unsigned int);
void serverCloseConn(Server, unsigned int);
void void
serverRun(Server this) serverRun(Server this)

2
src/server/write.c

@ -26,8 +26,6 @@
#include "logger.h" #include "logger.h"
#include "stream.h" #include "stream.h"
void serverCloseConn(Server, unsigned int);
ssize_t ssize_t
serverWrite(Server this, unsigned int i) serverWrite(Server this, unsigned int i)
{ {

1
src/socket/socket.c

@ -35,7 +35,6 @@ socketCtor(void * _this, va_list * params)
Sock this = _this; Sock this = _this;
int reUse = 1; //! \todo make this configurable int reUse = 1; //! \todo make this configurable
int port; int port;
int nonblock;
this->log = va_arg(* params, Logger); this->log = va_arg(* params, Logger);
port = va_arg(* params, int); port = va_arg(* params, int);

Loading…
Cancel
Save