[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
shishi db/error.c db/file.c db/shisa.h src/shis...
From: |
shishi-commit |
Subject: |
shishi db/error.c db/file.c db/shisa.h src/shis... |
Date: |
Tue, 02 Dec 2003 15:57:47 -0500 |
CVSROOT: /cvsroot/shishi
Module name: shishi
Branch:
Changes by: Simon Josefsson <address@hidden> 03/12/02 15:57:47
Modified files:
db : error.c file.c shisa.h
src : shisa.c shisa.ggo
Log message:
Sync.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/error.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/file.c.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/db/shisa.h.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/src/shisa.c.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/src/shisa.ggo.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: shishi/db/error.c
diff -u shishi/db/error.c:1.4 shishi/db/error.c:1.5
--- shishi/db/error.c:1.4 Sun Nov 30 19:22:52 2003
+++ shishi/db/error.c Tue Dec 2 15:57:46 2003
@@ -44,7 +44,10 @@
{SHISA_ADD_REALM_EXISTS, "Tried to add a realm that already exist."},
{SHISA_ADD_REALM_ERROR, "Error adding realm to database."},
{SHISA_REMOVE_REALM_NONEMPTY, "Tried to remove a non-empty realm."},
- {SHISA_REMOVE_REALM_ERROR, "Error removing realm from database."}
+ {SHISA_REMOVE_REALM_ERROR, "Error removing realm from database."},
+ {SHISA_ADD_PRINCIPAL_EXISTS, "Tried to add a principal that already exist."},
+ {SHISA_ADD_REALM_ERROR, "Error adding principal to database."},
+ {SHISA_REMOVE_PRINCIPAL_ERROR, "Error removing principal from database."},
};
/**
Index: shishi/db/file.c
diff -u shishi/db/file.c:1.11 shishi/db/file.c:1.12
--- shishi/db/file.c:1.11 Tue Dec 2 11:19:42 2003
+++ shishi/db/file.c Tue Dec 2 15:57:46 2003
@@ -47,6 +47,8 @@
*
*/
+/* XXX fix race conditions. */
+
#include "internal.h"
/* fileutil.c */
Index: shishi/db/shisa.h
diff -u shishi/db/shisa.h:1.13 shishi/db/shisa.h:1.14
--- shishi/db/shisa.h:1.13 Tue Dec 2 11:19:43 2003
+++ shishi/db/shisa.h Tue Dec 2 15:57:46 2003
@@ -74,10 +74,10 @@
struct Shisa_key
{
int32_t etype;
- char *value;
- size_t valuelen;
- char *saltvalue;
- size_t saltvaluelen;
+ char *key;
+ size_t keylen;
+ char *salt;
+ size_t saltlen;
char *str2keyparam;
size_t str2keyparamlen;
char *password;
Index: shishi/src/shisa.c
diff -u shishi/src/shisa.c:1.13 shishi/src/shisa.c:1.14
--- shishi/src/shisa.c:1.13 Tue Dec 2 12:30:44 2003
+++ shishi/src/shisa.c Tue Dec 2 15:57:47 2003
@@ -184,6 +184,65 @@
}
int
+apply_options (const char *realm,
+ const char *principal,
+ Shisa_principal *ph,
+ Shisa_key *dbkey)
+{
+ char *salt = args_info.salt_arg;
+ char *str2keyparam = NULL;
+ size_t str2keyparamlen = 0;
+ Shishi_key *key;
+ int32_t etype;
+ int rc;
+
+ if (args_info.encryption_type_given)
+ {
+ rc = shishi_cfg_clientkdcetype_set (sh, args_info.encryption_type_arg);
+ if (rc != SHISHI_OK)
+ return EXIT_FAILURE;
+ }
+ etype = shishi_cfg_clientkdcetype_fast (sh);
+
+ if (salt == NULL)
+ asprintf (&salt, "%s%s", realm, principal);
+
+ if (args_info.string_to_key_parameter_given)
+ {
+ /* XXX */
+ }
+
+ if (args_info.password_given)
+ rc = shishi_key_from_string (sh, etype,
+ args_info.password_arg,
+ strlen (args_info.password_arg),
+ salt, strlen (salt),
+ str2keyparam,
+ &key);
+ else
+ rc = shishi_key_random (sh, etype, &key);
+ if (rc != SHISHI_OK)
+ return EXIT_FAILURE;
+
+ if (!args_info.quiet_flag)
+ shishi_key_print (sh, stdout, key);
+
+ dbkey->etype = etype;
+ dbkey->key = shishi_key_value (key);
+ dbkey->keylen = shishi_key_length (key);
+ dbkey->salt = salt;
+ dbkey->saltlen = strlen (salt);
+ dbkey->str2keyparam = str2keyparam;
+ dbkey->str2keyparamlen = str2keyparamlen;
+ dbkey->password = args_info.password_arg;
+ dbkey->notusedafter = (time_t) -1;
+ dbkey->notusedbefore = (time_t) -1;
+ dbkey->isdisabled = 0;
+
+ return EXIT_SUCCESS;
+}
+
+int
modify_principal (const char *realm, const char *principal)
{
Shisa_principal ph;
@@ -226,6 +285,12 @@
Shisa_principal ph;
Shisa_key key;
int rc;
+
+ memset (&ph, 0, sizeof(ph));
+ memset (&key, 0, sizeof(key));
+ rc = apply_options (realm, principal, &ph, &key);
+ if (rc != EXIT_SUCCESS)
+ return EXIT_FAILURE;
if (principal == NULL)
printf ("Adding realm `%s'...", realm);
Index: shishi/src/shisa.ggo
diff -u shishi/src/shisa.ggo:1.6 shishi/src/shisa.ggo:1.7
--- shishi/src/shisa.ggo:1.6 Tue Dec 2 12:30:23 2003
+++ shishi/src/shisa.ggo Tue Dec 2 15:57:47 2003
@@ -40,7 +40,7 @@
option "random" - "Use a random key. (default)" no
option "password" - "Derive key from this password." string no
option "salt" - "Use specified salt for deriving key. Defaults to
concatenation of realm and (unwrapped) principal name." string no
-option "string-to-key-parameter" - "Encryption algorithm specific parameter
for password derivation. Currently only the AES algorithm can utilize this,
where it is interpreted as the iteration count of the PKCS#5 PBKDF2 key
deriver." string no
+option "string-to-key-parameter" - "Encryption algorithm specific parameter
for password derivation. Currently only the AES algorithm can utilize this,
where it is interpreted as the iteration count of the PKCS#5 PBKDF2 key
deriver." string typestr="HEX" no
section "Other options"
option "configuration-file" c "Use specified configuration file." string
typestr="FILE" no
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- shishi db/error.c db/file.c db/shisa.h src/shis...,
shishi-commit <=