summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2008-12-06 01:32:39 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2008-12-06 01:32:39 +0100
commitb67f22e540526b115e84dcc52f37606ac78b238f (patch)
tree55ab5e95e7f4736a5404fe6852b17732522cd5cf /common
parent6c8d48c8bee1983c6a8fe6a2bfeba3488e28c334 (diff)
downloadeurephia-b67f22e540526b115e84dcc52f37606ac78b238f.tar.gz
eurephia-b67f22e540526b115e84dcc52f37606ac78b238f.tar.xz
eurephia-b67f22e540526b115e84dcc52f37606ac78b238f.zip
Added admin function to give a list of users
Diffstat (limited to 'common')
-rw-r--r--common/eurephia_admin_common.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/common/eurephia_admin_common.c b/common/eurephia_admin_common.c
index 7333408..c49c1a3 100644
--- a/common/eurephia_admin_common.c
+++ b/common/eurephia_admin_common.c
@@ -24,7 +24,9 @@
#include <assert.h>
#include <eurephia_nullsafe.h>
+#include <passwd.h>
+#define EUREPHIA_ADMIN_COMMON_C
#include "eurephia_admin_common.h"
eFieldMap *eAdminGetTableMap(int table) {
@@ -57,7 +59,6 @@ eFieldMap *eAdminGetTableMap(int table) {
char *eAdminConvertSortKeys(eFieldMap *tfmap, const char *skeys_str) {
eFieldMap *sk_map = NULL;
- long sortmap = 0;
int i, j;
char *cp = NULL, *tok = NULL, *delims = ",";
static char sortkeys[8194];
@@ -92,3 +93,38 @@ char *eAdminConvertSortKeys(eFieldMap *tfmap, const char *skeys_str) {
sortkeys[strlen(sortkeys)-1] = '\0';
return sortkeys;
}
+
+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(uname);
+ newrec->password = (pwd == NULL ? NULL : passwdhash(pwd));
+ newrec->activated = strdup(activated);
+ newrec->deactivated = strdup(deactivd);
+ newrec->last_accessed = strdup(lastacc);
+ newrec->next = NULL;
+
+ return newrec;
+}
+
+
+void _eAdminFreeUSERINFO_func(eurephiaUSERINFO *p) {
+ if( p == NULL ) {
+ return;
+ }
+ 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_nullsafe(p);
+}