Browse Source

everything builds again

release0.1.5
Georg Hopp 12 years ago
parent
commit
06d8f88972
  1. 2
      include/auth/storage.h
  2. 2
      src/Makefile.am
  3. 1
      src/application/Makefile.am
  4. 2
      src/application/adapter/http/update.c
  5. 2
      src/application/application.c
  6. 12
      src/application/signup.c
  7. 6
      src/auth/Makefile.am
  8. 5
      src/auth/storage/hash_pw.c
  9. 6
      src/auth/storage/storage.c
  10. 2
      src/storage/Makefile.am
  11. 7
      src/storage/put.c
  12. 7
      src/storage/update.c

2
include/auth/storage.h

@ -28,6 +28,8 @@
#include <openssl/sha.h>
#include "class.h"
#include <storage.h> // storage must move to storage/storage.h
// to be loadable with "
#define SALT_SIZE 32

2
src/Makefile.am

@ -33,7 +33,7 @@ AM_CFLAGS = -Wall -I ../include/
bin_PROGRAMS = taskrambler
taskrambler_SOURCES = taskrambler.c $(IFACE) $(UTILS)
taskrambler_CFLAGS = $(CFLAGS) -Wall -DPWD=\"$(PWD)\" -I ../include/# $(COVERAGE_CFLAGS)
taskrambler_CFLAGS = $(CFLAGS) -Wall -DPWD=\"$(PWD)\" -I../include/ # $(COVERAGE_CFLAGS)
taskrambler_LDADD = $(LIBS) -lrt -lssl -lldap -lgdbm -luuid
#taskrambler_LDFLAGS = $(COVERAGE_LDFLAGS)

1
src/application/Makefile.am

@ -3,6 +3,7 @@ AUTOMAKE_OPTIONS = subdir-objects
APPLICATION = application.c \
login.c \
signup.c \
session_start.c \
session_stop.c \
session_update.c \

2
src/application/adapter/http/update.c

@ -217,7 +217,7 @@ signupAdapter(Application application, HttpWorker worker, Session session)
(char *)(surname->value), surname->nvalue);
if (! applicationSignup(application, credential, user, session)) {
worker->current_response = httpResonse500();
worker->current_response = httpResponse500();
} else {
loginAdapter(application, worker, session);
}

2
src/application/application.c

@ -57,7 +57,7 @@ applicationCtor(void * _this, va_list * params)
* password database.
*/
this->users = new(Storage, "./run/users.db");
this->passwords = new(Storage, "./run/passwords.db")
this->passwords = new(Storage, "./run/passwords.db");
return 0;
}

12
src/application/signup.c

@ -36,11 +36,13 @@
int
applicationSignup(
Application this,
Credential credential,
Credential cred,
User user,
Session session)
{
unsigned char hash[SALT_SIZE+HASH_SIZE];
unsigned char hash_data[SALT_SIZE+HASH_SIZE];
unsigned char * salt = hash_data;
unsigned char * hash = hash_data + SALT_SIZE;
if (NULL != userLoad(user, this->users)) {
/*
@ -56,8 +58,8 @@ applicationSignup(
if (FALSE == hash_pw(
CRED_PWD(cred).pass,
CRED_PWD(cred).npass,
&hash,
&(hash+SALT_SIZE))) {
hash,
&salt)) {
/*
* @TODO if we come here we have to delete the previously saved
* user again...
@ -69,7 +71,7 @@ applicationSignup(
this->passwords,
CRED_PWD(cred).user,
CRED_PWD(cred).nuser,
hash,
(char *)hash_data,
SALT_SIZE + HASH_SIZE);
return 0;

6
src/auth/Makefile.am

@ -3,5 +3,9 @@ AUTOMAKE_OPTIONS = subdir-objects
noinst_LIBRARIES = libauth.a
libauth_a_SOURCES = interface/auth.c credential.c ldap.c
libauth_a_SOURCES = interface/auth.c \
credential.c \
ldap.c \
storage/storage.c \
storage/hash_pw.c
libauth_a_CFLAGS = $(CFLAGS) -Wall -I ../../include/

5
src/auth/storage/hash_pw.c

@ -26,8 +26,9 @@
#include <openssl/rand.h>
#include "class.h"
#include "storage.h"
#include "auth/storage.h"
#include "utils/memory.h"
#include "commons.h"
/*
* I have to hash the passwords, maybe this will move in
@ -78,7 +79,7 @@ hash_pw(
{
if (NULL == *salt) {
*salt = memMalloc(SALT_SIZE * sizeof(unsigned char));
if (0 > RAND_pseudo_bytes(unsigned char *buf, int num)) {
if (0 > RAND_pseudo_bytes(*salt, SALT_SIZE)) {
MEM_FREE(*salt);
return FALSE;
}

6
src/auth/storage/storage.c

@ -22,9 +22,9 @@
#include "class.h"
#include "storage.h"
#include "auth/storage.h"
#include "auth/credential.h"
#include "auth.h"
#include "commons.h"
#include "utils/memory.h"
static
int
@ -61,7 +61,7 @@ authStorageAuthenticate(void * _this, Credential cred)
this->store,
CRED_PWD(cred).user,
CRED_PWD(cred).nuser,
&found_hash,
(char **)&found_hash,
&nfound_hash);
if (NULL == found_hash || (SALT_SIZE + HASH_SIZE) != nfound_hash) {

2
src/storage/Makefile.am

@ -3,5 +3,5 @@ AUTOMAKE_OPTIONS = subdir-objects
noinst_LIBRARIES = libstorage.a
libstorage_a_SOURCES = storage.c get.c put.c
libstorage_a_SOURCES = storage.c get.c put.c update.c
libstorage_a_CFLAGS = $(CFLAGS) -Wall -I ../../include/

7
src/storage/put.c

@ -29,13 +29,6 @@
#include "utils/memory.h"
typedef enum e_StoragePutResults {
SPR_OK = 0,
SPR_READ_ONLY = 1,
SPR_EXISTS = 2,
SPR_UNKNOWN = -1
} StoragePutResult;
StoragePutResult
storagePut(Storage this, char * _key, size_t nkey, char * data, size_t ndata)

7
src/storage/update.c

@ -30,7 +30,12 @@
#include "utils/memory.h"
StoragePutResult
storagePut(Storage this, char * _key, size_t nkey, char * data, size_t ndata)
storageUpdate(
Storage this,
char * _key,
size_t nkey,
char * data,
size_t ndata)
{
datum key = {_key, nkey};
datum value = {data, ndata};

Loading…
Cancel
Save