summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/eurephia_admin_common.c223
-rw-r--r--common/eurephia_admin_common.h57
-rw-r--r--common/eurephia_admin_struct.h33
-rw-r--r--database/eurephiadb_driver.h11
-rw-r--r--database/sqlite/CMakeLists.txt1
-rw-r--r--database/sqlite/administration.c9
-rw-r--r--eurephiadm/CMakeLists.txt1
-rw-r--r--eurephiadm/commands/users.c1
8 files changed, 10 insertions, 326 deletions
diff --git a/common/eurephia_admin_common.c b/common/eurephia_admin_common.c
deleted file mode 100644
index 3661f11..0000000
--- a/common/eurephia_admin_common.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* eurephia_admin_common.c -- Common functions used for the admin API
- *
- * GPLv2 - Copyright (C) 2008 David Sommerseth <dazo@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2
- * of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <eurephia_nullsafe.h>
-#include <passwd.h>
-
-#define EUREPHIA_ADMIN_COMMON_C
-#include "eurephia_admin_struct.h"
-#include "eurephia_admin_common.h"
-
-
-eurephiaUSERINFO *eAdminPopulateUSERINFO(int uid, const char *uname, const char *pwd,
- const char *activated, const char *deactivd, const char *lastacc)
-{
- eurephiaUSERINFO *newrec = NULL;
-
- newrec = (eurephiaUSERINFO *) malloc(sizeof(eurephiaUSERINFO)+2);
- assert( newrec != NULL );
- memset(newrec, 0, sizeof(eurephiaUSERINFO)+2);
-
- newrec->uid = uid;
- newrec->username = strdup_nullsafe(uname);
- newrec->password = (pwd == NULL ? NULL : passwdhash(pwd));
- newrec->activated = strdup_nullsafe(activated);
- newrec->deactivated = strdup_nullsafe(deactivd);
- newrec->last_accessed = strdup_nullsafe(lastacc);
- newrec->account_flags = 0;
- newrec->setnull_flags = 0;
- newrec->next = NULL;
-
- return newrec;
-}
-
-
-void _eAdminFreeUSERINFO_func(eurephiaUSERINFO *p) {
- if( p == NULL ) {
- return;
- }
- eAdminFreeCERTLIST(p->certlist);
- eAdminFreeUSERINFO(p->next);
- free_nullsafe(p->username);
- free_nullsafe(p->password);
- free_nullsafe(p->activated);
- free_nullsafe(p->deactivated);
- free_nullsafe(p->last_accessed);
- p->next = NULL;
- free(p);
-}
-
-void _eAdminFreeUSERLIST_func(eurephiaUSERLIST *p) {
- if( p == NULL ) {
- return;
- }
-
- eAdminFreeUSERINFO(p->users);
- free(p);
-}
-
-
-eurephiaCERTLIST *eAdminCreateCERTLIST() {
- eurephiaCERTLIST *lst = NULL;
-
- lst = (eurephiaCERTLIST *) malloc(sizeof(eurephiaCERTLIST)+2);
- memset(lst, 0, sizeof(eurephiaCERTLIST)+2);
- lst->num_certs = 0;
- return lst;
-}
-
-eurephiaCERTINFO *eAdminPopulateCERTINFO(int certid, int depth, const char *digest,
- const char *cname, const char *org, const char *email, const char *reg)
-{
- eurephiaCERTINFO *newrec = NULL;
-
- newrec = (eurephiaCERTINFO *) malloc(sizeof(eurephiaCERTINFO)+2);
- assert( newrec != NULL );
- memset(newrec, 0, sizeof(eurephiaCERTINFO)+2);
-
- newrec->certid = certid;
- newrec->depth = depth;
- newrec->digest = strdup_nullsafe(digest);
- newrec->common_name = strdup_nullsafe(cname);
- newrec->organisation = strdup_nullsafe(org);
- newrec->email = strdup_nullsafe(email);
- newrec->registered = strdup_nullsafe(reg);
- newrec->next = NULL;
-
- return newrec;
-}
-
-void eAdminInsertCERTINFO(eurephiaCERTLIST *list, eurephiaCERTINFO *cert) {
- assert( list != NULL );
-
- if( list->certs != NULL ) {
- cert->next = list->certs;
- list->certs = cert;
- list->num_certs++;
- } else {
- list->certs = cert;
- list->num_certs = 1;
- }
-}
-
-void _eAdminFreeCERTINFO_func(eurephiaCERTINFO *p) {
- if( p == NULL ) {
- return;
- }
- eAdminFreeCERTINFO(p->next);
- free_nullsafe(p->digest);
- free_nullsafe(p->common_name);
- free_nullsafe(p->organisation);
- free_nullsafe(p->email);
- free_nullsafe(p->registered);
- p->access = NULL;
- p->next = NULL;
- free(p);
-}
-
-void _eAdminFreeCERTLIST_func(eurephiaCERTLIST *p) {
-#ifdef FIREWALL
- eurephiaACCESSLIST *aclst = NULL;
-#endif
- if( p == NULL ) {
- return;
- }
-
-#ifdef FIREWALL
- aclst = ((p->certs != NULL) && (p->certs->access != NULL)) ? p->certs->access->_head : NULL;
- eAdminFreeACCESSLIST(aclst);
-#endif
- eAdminFreeCERTINFO(p->certs);
- free(p);
-}
-
-#ifdef FIREWALL
-eurephiaACCESSINFO *eAdminRegisterACCESSINFO(eurephiaACCESSLIST *aclst, int accprofid,
- const char *fwprofile, const char *accdescr) {
- eurephiaACCESSINFO *ptr = NULL;
-
- assert( aclst != NULL );
-
- for( ptr = aclst->profiles; ptr != NULL; ptr = ptr->next) {
- if( ptr->accessprofile == accprofid ) {
- return ptr;
- }
- }
-
- // If no record was found, register it automatically
- if( ptr == NULL ) {
- ptr = (eurephiaACCESSINFO *) malloc(sizeof(eurephiaACCESSINFO)+2);
- assert(ptr != NULL);
- memset(ptr, 0, sizeof(eurephiaACCESSINFO)+2);
-
- ptr->accessprofile = accprofid;
- ptr->fwprofile = strdup_nullsafe(fwprofile);
- ptr->access_descr = strdup_nullsafe(accdescr);
- ptr->_head = aclst;
-
- if( aclst->profiles == NULL ) {
- aclst->profiles = ptr;
- aclst->num_profiles = 1;
- } else {
- ptr->next = aclst->profiles;
- aclst->profiles = ptr;
- aclst->num_profiles++;
- }
- }
- return ptr;
-}
-
-
-eurephiaACCESSLIST *eAdminCreateACCESSLIST() {
- eurephiaACCESSLIST *ptr = NULL;
-
- ptr = (eurephiaACCESSLIST *) malloc(sizeof(eurephiaACCESSLIST)+2);
- assert(ptr != NULL);
- memset(ptr, 0, sizeof(eurephiaACCESSLIST)+2);
- return ptr;
-}
-
-
-void _eAdminFreeACCESSINFO_func(eurephiaACCESSINFO *p) {
- if( p == NULL ) {
- return;
- }
- eAdminFreeACCESSINFO(p->next);
- free_nullsafe(p->access_descr);
- free_nullsafe(p->fwprofile);
- p->_head = NULL;
- p->accessprofile = 0;
- free(p);
-}
-
-void _eAdminFreeACCESSLIST_func(eurephiaACCESSLIST *p) {
- if( p == NULL ) {
- return;
- }
- eAdminFreeACCESSINFO(p->profiles);
- p->num_profiles = 0;
- free(p);
-}
-#endif // FIREWALL
diff --git a/common/eurephia_admin_common.h b/common/eurephia_admin_common.h
deleted file mode 100644
index 57304b5..0000000
--- a/common/eurephia_admin_common.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* eurephia_admin_common.h -- Common functions used for the admin API
- *
- * GPLv2 - Copyright (C) 2008 David Sommerseth <dazo@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2
- * of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef EUREPHIA_ADMIN_COMMON_H_
-# define EUREPHIA_ADMIN_COMMON_H_
-
-eurephiaUSERINFO *eAdminPopulateUSERINFO(int uid, const char *uname, const char *pwd,
- const char *activated, const char *deactivd, const char *lastacc);
-
-void _eAdminFreeUSERINFO_func(eurephiaUSERINFO *);
-#define eAdminFreeUSERINFO(x) { _eAdminFreeUSERINFO_func(x); x = NULL; }
-
-void _eAdminFreeUSERLIST_func(eurephiaUSERLIST *);
-#define eAdminFreeUSERLIST(x) { _eAdminFreeUSERLIST_func(x); x = NULL; }
-
-
-eurephiaCERTLIST *eAdminCreateCERTLIST();
-
-eurephiaCERTINFO *eAdminPopulateCERTINFO(int certid, int depth, const char *digest,
- const char *cname, const char *org, const char *email, const char *reg);
-
-void eAdminInsertCERTINFO(eurephiaCERTLIST *list, eurephiaCERTINFO *cert);
-
-void _eAdminFreeCERTINFO_func(eurephiaCERTINFO *);
-#define eAdminFreeCERTINFO(x) { _eAdminFreeCERTINFO_func(x); x = NULL; }
-
-void _eAdminFreeCERTLIST_func(eurephiaCERTLIST *);
-#define eAdminFreeCERTLIST(x) { _eAdminFreeCERTLIST_func(x); x = NULL; }
-
-eurephiaACCESSLIST *eAdminCreateACCESSLIST();
-eurephiaACCESSINFO *eAdminRegisterACCESSINFO(eurephiaACCESSLIST *aclst, int accprofid,
- const char *fwprofile, const char *accdescr);
-
-void _eAdminFreeACCESSINFO_func(eurephiaACCESSINFO *);
-#define eAdminFreeACCESSINFO(x) { _eAdminFreeACCESSINFO_func(x); x = NULL; }
-
-void _eAdminFreeACCESSLIST_func(eurephiaACCESSLIST *);
-#define eAdminFreeACCESSLIST(x) { _eAdminFreeACCESSLIST_func(x); x = NULL; }
-
-#endif /* !EUREPHIA_ADMIN_COMMON_H_ */
diff --git a/common/eurephia_admin_struct.h b/common/eurephia_admin_struct.h
index 2015f95..da7429c 100644
--- a/common/eurephia_admin_struct.h
+++ b/common/eurephia_admin_struct.h
@@ -29,19 +29,6 @@
#define ACCFLAG_RSETLASTUSED 0x020
#define ACCFLAG_RSETLOGINCNT 0x040
-typedef struct _eurephiaACCESSINFO_s {
- int accessprofile;
- char *fwprofile;
- char *access_descr;
- struct _eurephiaACCESSINFO_s *next;
- void *_head;
-} eurephiaACCESSINFO;
-
-typedef struct _eurephiaACCESSLIST_s {
- eurephiaACCESSINFO *profiles;
- int num_profiles;
-} eurephiaACCESSLIST;
-
typedef struct _eurephiaCERTINFO_s {
int info_available;
@@ -52,7 +39,6 @@ typedef struct _eurephiaCERTINFO_s {
char *email;
char *registered;
int certid;
- eurephiaACCESSINFO *access;
struct _eurephiaCERTINFO_s *next;
} eurephiaCERTINFO;
@@ -63,25 +49,6 @@ typedef struct {
int maxlen[];
} eurephiaCERTLIST;
-typedef struct _eurephiaUSERINFO_s {
- char *username;
- char *password;
- char *activated;
- char *deactivated;
- char *last_accessed;
- int uid;
- int logincount;
- long int account_flags;
- long int setnull_flags;
- eurephiaCERTLIST *certlist;
- struct _eurephiaUSERINFO_s *next;
-} eurephiaUSERINFO;
-
-typedef struct {
- eurephiaUSERINFO *users;
- int num_users;
- int maxlen[];
-} eurephiaUSERLIST;
typedef struct _eurephiaLOGENTRY_s {
int id;
diff --git a/database/eurephiadb_driver.h b/database/eurephiadb_driver.h
index f7d3928..625c2bd 100644
--- a/database/eurephiadb_driver.h
+++ b/database/eurephiadb_driver.h
@@ -107,18 +107,19 @@ int (*eDBadminConfigDelete) (eurephiaCTX *ctx, const char *key);
#ifdef HAVE_LIBXML2
xmlDoc *(*eDBadminGetUserList) (eurephiaCTX *ctx, const char *sortkeys);
xmlDoc *(*eDBadminGetUserInfo) (eurephiaCTX *ctx, int infoType, xmlDoc *srch);
-int (*eDBadminAddUser) (eurephiaCTX *ctx, eurephiaUSERINFO *userinfo);
+int (*eDBadminAddUser) (eurephiaCTX *ctx, xmlDoc *userinfo);
int (*eDBadminUpdateUser) (eurephiaCTX *ctx, const int uid, xmlDoc *userinfo);
-int (*eDBadminDeleteUser) (eurephiaCTX *ctx, const int uid, eurephiaUSERINFO *userinfo);
-#endif
+int (*eDBadminDeleteUser) (eurephiaCTX *ctx, const int uid, xmlDoc *userinfo);
+
eurephiaCERTLIST *(*eDBadminGetCertificateList) (eurephiaCTX *ctx, const char *sortkeys);
eurephiaCERTINFO *(*eDBadminGetCertificateInfo) (eurephiaCTX *ctx, eurephiaCERTINFO *searchkey);
int (*eDBadminAddCertificate) (eurephiaCTX *ctx, eurephiaCERTINFO *certinfo);
int (*eDBadminDeleteCertificate) (eurephiaCTX *ctx, const int certid, eurephiaCERTINFO *certinfo);
-eurephiaLOGLIST *(*eDBadminGetLastlog) (eurephiaCTX *ctx, eurephiaUSERINFO *usersrch, eurephiaCERTINFO *certsrch, const char *sortkeys);
-eurephiaLOGLIST *(*eDBadminGetAttemptsLog) (eurephiaCTX *ctx, eurephiaUSERINFO *usersrch, eurephiaCERTINFO *certsrch, const char *sortkeys);
+eurephiaLOGLIST *(*eDBadminGetLastlog) (eurephiaCTX *ctx, xmlDoc *usersrch, eurephiaCERTINFO *certsrch, const char *sortkeys);
+eurephiaLOGLIST *(*eDBadminGetAttemptsLog) (eurephiaCTX *ctx, xmlDoc *usersrch, eurephiaCERTINFO *certsrch, const char *sortkeys);
+#endif /* HAVE_LIBXML2 */
#endif /* !DRIVER_MODE */
diff --git a/database/sqlite/CMakeLists.txt b/database/sqlite/CMakeLists.txt
index 84e653c..12042ef 100644
--- a/database/sqlite/CMakeLists.txt
+++ b/database/sqlite/CMakeLists.txt
@@ -8,7 +8,6 @@ SET(edb_sqlite_SRC
)
SET(COMMON
../eurephiadb_mapping.c
- ../../common/eurephia_admin_common.c
../../common/eurephia_log.c
../../common/eurephiadb_session_common.c
../../common/eurephia_values.c
diff --git a/database/sqlite/administration.c b/database/sqlite/administration.c
index bf228ce..211f8a2 100644
--- a/database/sqlite/administration.c
+++ b/database/sqlite/administration.c
@@ -35,7 +35,6 @@
#include <eurephia_nullsafe.h>
#include <eurephia_context.h>
#include <eurephia_admin_struct.h>
-#include <eurephia_admin_common.h>
#include <eurephia_log.h>
#include <eurephia_xml.h>
#include <eurephia_values.h>
@@ -542,7 +541,7 @@ xmlDoc *eDBadminGetUserInfo(eurephiaCTX *ctx, int getInfo, xmlDoc *srch) {
}
}
-int eDBadminAddUser(eurephiaCTX *ctx, eurephiaUSERINFO *usrinf) {
+int eDBadminAddUser(eurephiaCTX *ctx, xmlDoc *usrinf) {
return 0;
}
@@ -595,7 +594,7 @@ int eDBadminUpdateUser(eurephiaCTX *ctx, const int uid, xmlDoc *usrinf) {
return 1;
}
-int eDBadminDeleteUser(eurephiaCTX *ctx, const int uid, eurephiaUSERINFO *usrinf) {
+int eDBadminDeleteUser(eurephiaCTX *ctx, const int uid, xmlDoc *usrinf) {
return 0;
}
@@ -616,13 +615,13 @@ int eDBadminDeleteCertificate(eurephiaCTX *ctx, const int uid, eurephiaCERTINFO
return 0;
}
-eurephiaLOGLIST *eDBadminGetLastlog(eurephiaCTX *ctx, eurephiaUSERINFO *usersrch, eurephiaCERTINFO *certsrch,
+eurephiaLOGLIST *eDBadminGetLastlog(eurephiaCTX *ctx, xmlDoc *usersrch, eurephiaCERTINFO *certsrch,
const char *sortkeys)
{
return NULL;
}
-eurephiaLOGLIST *eDBadminGetAttemptsLog(eurephiaCTX *ctx, eurephiaUSERINFO *usersrch, eurephiaCERTINFO *certsrch,
+eurephiaLOGLIST *eDBadminGetAttemptsLog(eurephiaCTX *ctx, xmlDoc *usersrch, eurephiaCERTINFO *certsrch,
const char *sortkeys)
{
return NULL;
diff --git a/eurephiadm/CMakeLists.txt b/eurephiadm/CMakeLists.txt
index ee5f57b..1a09b33 100644
--- a/eurephiadm/CMakeLists.txt
+++ b/eurephiadm/CMakeLists.txt
@@ -14,7 +14,6 @@ SET(efw_ipt_SRC
../common/eurephia_getsym.c
../common/eurephia_values.c
../common/eurephiadb_session_common.c
- ../common/eurephia_admin_common.c
../common/eurephia_xml.c
../common/passwd.c
../common/sha512.c
diff --git a/eurephiadm/commands/users.c b/eurephiadm/commands/users.c
index cb876a3..8fc2c7b 100644
--- a/eurephiadm/commands/users.c
+++ b/eurephiadm/commands/users.c
@@ -37,7 +37,6 @@
#include <eurephia_values_struct.h>
#include <eurephiadb_session_struct.h>
#include <eurephia_admin_struct.h>
-#include <eurephia_admin_common.h>
#include <eurephiadb_mapping.h>
#include <eurephiadb_driver.h>