[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
shishi/db Makefile.am cfg.c file.c init.c shisa...
From: |
shishi-commit |
Subject: |
shishi/db Makefile.am cfg.c file.c init.c shisa... |
Date: |
Fri, 28 Nov 2003 19:23:24 -0500 |
CVSROOT: /cvsroot/shishi
Module name: shishi
Branch:
Changes by: Simon Josefsson <address@hidden> 03/11/28 19:23:23
Modified files:
db : Makefile.am cfg.c file.c init.c shisa.h
Added files:
db : error.c
Log message:
Fix.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/error.c?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/Makefile.am.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/cfg.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/file.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/init.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/shisa.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: shishi/db/Makefile.am
diff -u shishi/db/Makefile.am:1.4 shishi/db/Makefile.am:1.5
--- shishi/db/Makefile.am:1.4 Fri Nov 28 16:47:00 2003
+++ shishi/db/Makefile.am Fri Nov 28 19:23:23 2003
@@ -26,7 +26,7 @@
include_HEADERS = shisa.h
lib_LTLIBRARIES = libshisa.la
-libshisa_la_SOURCES = shisa.h init.c cfg.c db.c file.c
+libshisa_la_SOURCES = shisa.h init.c cfg.c db.c error.c file.c
libshisa_la_LIBADD = ../gl/libfoo.la ../lib/libshishi.la
# XXX use different libtool version for this library?
libshisa_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
Index: shishi/db/cfg.c
diff -u shishi/db/cfg.c:1.3 shishi/db/cfg.c:1.4
--- shishi/db/cfg.c:1.3 Fri Nov 28 17:35:45 2003
+++ shishi/db/cfg.c Fri Nov 28 19:23:23 2003
@@ -34,7 +34,7 @@
/**
* shisa_cfg_db:
- * @handle: Shisa library handle created by shishi().
+ * @dbh: Shisa library handle created by shisa().
* @value: string with database definition.
*
* Setup and open a new database. The syntax of the @value parameter
@@ -72,14 +72,14 @@
backend = _shisa_find_backend (db);
if (backend == NULL)
{
- fprintf (stderr, "Unknown database type: `%s'\n", db);
- return SHISA_CFG_ERROR;
+ shisa_info (dbh, "Unknown database type: `%s'.", db);
+ return SHISA_CFG_SYNTAX_ERROR;
}
rc = backend->init (dbh, location, options, &state);
if (rc != SHISA_OK)
{
- fprintf (stderr, "Cannot initialize `%s' database backend\n", db);
+ shisa_info (dbh, "Cannot initialize `%s' database backend.", db);
return rc;
}
@@ -92,7 +92,7 @@
/**
* shisa_cfg:
- * @handle: Shisa library handle created by shishi().
+ * @dbh: Shisa library handle created by shisa().
* @option: string with shisa library option.
*
* Configure shisa library with given option.
@@ -116,7 +116,8 @@
break;
default:
- fprintf (stderr, "Unknown option: `%s'\n", value);
+ shisa_info (dbh, "Unknown option: `%s'.", value);
+ return SHISA_CFG_SYNTAX_ERROR;
break;
}
}
@@ -126,12 +127,12 @@
/**
* shisa_cfg_from_file:
- * @handle: Shishi library handle create by shishi_init().
+ * @dbh: Shisa library handle created by shisa().
* @cfg: filename to read configuration from.
*
- * Configure shishi library using configuration file.
+ * Configure shisa library using configuration file.
*
- * Return Value: Returns SHISHI_OK iff succesful.
+ * Return Value: Returns %SHISA_OK iff succesful.
**/
int
shisa_cfg_from_file (Shisa * dbh, const char *cfg)
@@ -146,7 +147,7 @@
if (fh == NULL)
{
perror (cfg);
- return SHISA_FOPEN_ERROR;
+ return SHISA_CFG_NO_FILE;
}
initbuffer (&lb);
@@ -174,27 +175,12 @@
freebuffer (&lb);
if (ferror (fh))
- return SHISA_IO_ERROR;
+ return SHISA_CFG_IO_ERROR;
if (fclose (fh) != 0)
- return SHISA_IO_ERROR;
+ return SHISA_CFG_IO_ERROR;
return SHISA_OK;
-}
-
-/**
- * shisa_cfg_print:
- * @dbh: Shisa library handle created by shisa().
- * @fh: file descriptor open for writing.
- *
- * Print library configuration status, mostly for debugging purposes.
- *
- * Return Value: Returns %SHISA_OK.
- **/
-void
-shisa_cfg_print (Shisa * dbh, FILE * fh)
-{
- fprintf (fh, "Shisa initial library configuration:\n");
}
/**
Index: shishi/db/file.c
diff -u shishi/db/file.c:1.1 shishi/db/file.c:1.2
--- shishi/db/file.c:1.1 Fri Nov 28 16:47:00 2003
+++ shishi/db/file.c Fri Nov 28 19:23:23 2003
@@ -66,7 +66,8 @@
break;
default:
- fprintf (stderr, "Unknown option for file database: `%s'\n", value);
+ shisa_info (dbh, "Unknown file database option: `%s'.", value);
+ return SHISA_CFG_SYNTAX_ERROR;
break;
}
}
@@ -97,12 +98,16 @@
else
info->fh = fopen (location, "r+");
if (info->fh == NULL && info->allowcreate)
- info->fh = fopen (location, "w+");
+ {
+ info->fh = fopen (location, "w+");
+ if (info->fh != NULL)
+ shisa_info (dbh, "Created file database: `%s'.", location);
+ }
if (info->fh == NULL)
{
free (info);
perror(location);
- return SHISA_FOPEN_ERROR;
+ return SHISA_DB_OPEN_ERROR;
}
info->path = xstrdup (location);
Index: shishi/db/init.c
diff -u shishi/db/init.c:1.2 shishi/db/init.c:1.3
--- shishi/db/init.c:1.2 Fri Nov 28 16:47:00 2003
+++ shishi/db/init.c Fri Nov 28 19:23:23 2003
@@ -71,7 +71,7 @@
* ($sysconfdir/shisa.conf).
*
* The handle is allocated regardless of return values, except for
- * SHISA_HANDLE_ERROR which indicates a problem allocating the handle.
+ * SHISA_INIT_ERROR which indicates a problem allocating the handle.
* (The other error conditions comes from reading the files.)
*
* Return value: Returns %SHISA_OK iff successful.
@@ -93,7 +93,7 @@
* decided at compile time ($sysconfdir/shisa.conf).
*
* The handle is allocated regardless of return values, except for
- * SHISA_HANDLE_ERROR which indicates a problem allocating the handle.
+ * SHISA_INIT_ERROR which indicates a problem allocating the handle.
* (The other error conditions comes from reading the files.)
*
* Return value: Returns %SHISA_OK iff successful.
@@ -104,13 +104,13 @@
int rc;
if (!dbh || !(*dbh = shisa ()))
- return SHISA_HANDLE_ERROR;
+ return SHISA_INIT_ERROR;
if (!file)
file = shisa_cfg_default_systemfile (*dbh);
rc = shisa_cfg_from_file (*dbh, file);
- if (rc != SHISA_OK && rc != SHISA_FOPEN_ERROR)
+ if (rc != SHISA_OK && rc != SHISA_CFG_NO_FILE)
return rc;
if ((*dbh)->ndbs == 0)
Index: shishi/db/shisa.h
diff -u shishi/db/shisa.h:1.5 shishi/db/shisa.h:1.6
--- shishi/db/shisa.h:1.5 Fri Nov 28 17:48:55 2003
+++ shishi/db/shisa.h Fri Nov 28 19:23:23 2003
@@ -30,18 +30,17 @@
enum Shisa_rc
{
SHISA_OK = 0,
- SHISA_CFG_ERROR,
- SHISA_FOPEN_ERROR,
- SHISA_IO_ERROR,
- SHISA_HANDLE_ERROR
+ SHISA_INIT_ERROR,
+ SHISA_CFG_NO_FILE,
+ SHISA_CFG_IO_ERROR,
+ SHISA_CFG_SYNTAX_ERROR,
+ SHISA_DB_OPEN_ERROR
};
typedef enum Shisa_rc Shisa_rc;
typedef struct Shisa Shisa;
-typedef struct Shisa_principal Shisa_principal;
-typedef struct Shisa_key Shisa_key;
-struct Shisa_principal_info
+struct Shisa_principal
{
const char *name;
const char *realm;
@@ -50,9 +49,9 @@
int isdisabled;
int32_t kvno;
};
-typedef struct Shisa_principal_info Shisa_principal_info;
+typedef struct Shisa_principal Shisa_principal;
-struct Shisa_key_info
+struct Shisa_key
{
int32_t etype;
const char *value;
@@ -66,7 +65,7 @@
time_t notusedbefore;
int isdisabled;
};
-typedef struct Shisa_key_info Shisa_key_info;
+typedef struct Shisa_key Shisa_key;
/* init.c */
extern Shisa *shisa (void);
@@ -78,36 +77,39 @@
extern int shisa_cfg (Shisa * dbh, char *option);
extern int shisa_cfg_db (Shisa * dbh, char *value);
extern int shisa_cfg_from_file (Shisa * dbh, const char *cfg);
-extern void shisa_cfg_print (Shisa * dbh, FILE * fh);
extern const char *shisa_cfg_default_systemfile (Shisa * dbh);
/* Core API. */
-extern int shisa_principal_find (Shisa * dbh,
- const char *name,
- const char *realm,
- Shisa_principal **ph);
+extern int shisa_enumerate_realms (Shisa *dbh,
+ char ***realms,
+ size_t *nrealms);
extern int shisa_enumerate_principals (Shisa *dbh,
+ const char *realm,
char ***principals,
size_t *nprincipals);
-extern int shisa_principal_create (Shisa * dbh,
- const char *name,
- const char *realm,
- Shisa_principal **ph);
-extern int shisa_principal_info_get (Shisa_principal * ph,
- Shisa_principal_info *info);
-extern int shisa_principal_info_free (Shisa_principal * ph,
- const Shisa_principal_info *info);
-extern int shisa_principal_info_set (Shisa_principal * ph,
- const Shisa_principal_info *info);
-extern int shisa_principal_key_get (Shisa_principal * ph,
- Shisa_key_info **keyinfo);
-extern int shisa_principal_key_get_version (Shisa_principal * ph,
- uint32_t kvno,
- Shisa_key_info **keyinfo);
-extern int shisa_principal_key_add (Shisa_principal * ph,
- const Shisa_key_info *keyinfo);
+
+extern int shisa_principal_find (Shisa * dbh,
+ const char *client,
+ const char *realm,
+ Shisa_principal **ph);
+extern int shisa_principal_free (Shisa_principal *ph);
+extern int shisa_principal_set (Shisa * dbh, const Shisa_principal * ph);
+extern int shisa_principal_add (Shisa * dbh, const Shisa_principal * ph,
+ const Shisa_key *key);
+extern int shisa_principal_remove (Shisa * dbh, const Shisa_principal * ph);
+
+extern int shisa_key_find (Shisa * dbh, const Shisa_principal * ph,
+ Shisa_key **key);
+extern int shisa_key_free (Shisa_key **key);
+extern int shisa_key_set (Shisa * dbh, const Shisa_principal * ph,
+ const Shisa_key *key);
+extern int shisa_key_add (Shisa * dbh, const Shisa_principal * ph,
+ const Shisa_key *key);
+extern int shisa_key_remove (Shisa * dbh, const Shisa_principal * ph,
+ const Shisa_key *key);
/* Utility API. */
-extern int shisa_setpasswd (Shisa_principal * principal, const char *passwd);
+extern int shisa_addpasswd (Shisa * dbh, Shisa_principal * ph,
+ const char *passwd);
#endif /* SHISA_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- shishi/db Makefile.am cfg.c file.c init.c shisa...,
shishi-commit <=