shishi-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU shishi branch, master, updated. shishi-1-0-1-22-ga545f50


From: Simon Josefsson
Subject: [SCM] GNU shishi branch, master, updated. shishi-1-0-1-22-ga545f50
Date: Thu, 16 Aug 2012 06:31:52 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU shishi".

http://git.savannah.gnu.org/cgit/shishi.git/commit/?id=a545f50e89e74149a2dfcbfb89a571cb00a439ef

The branch, master has been updated
       via  a545f50e89e74149a2dfcbfb89a571cb00a439ef (commit)
       via  0e382d4b42c243b83f5d379935dc3b43fd990912 (commit)
      from  9438ed43e82a83c751dff466ddc0a58252ac9a30 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a545f50e89e74149a2dfcbfb89a571cb00a439ef
Author: Simon Josefsson <address@hidden>
Date:   Thu Aug 16 08:31:31 2012 +0200

    Fix salt derivation, reported by Mats.

commit 0e382d4b42c243b83f5d379935dc3b43fd990912
Author: Simon Josefsson <address@hidden>
Date:   Thu Aug 16 08:24:27 2012 +0200

    Test shishi_derive_default_salt more, to catch regression.

-----------------------------------------------------------------------

Summary of changes:
 lib/principal.c |    6 ++++++
 tests/crypto.c  |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/lib/principal.c b/lib/principal.c
index 1e69027..8d5b429 100644
--- a/lib/principal.c
+++ b/lib/principal.c
@@ -450,8 +450,11 @@ shishi_derive_default_salt (Shishi * handle, const char 
*name, char **salt)
 {
   char *principal;
   char *realm;
+  char *p;
   int rc;
 
+  /* XXX also deal with escaped /'s. */
+
   rc = shishi_parse_name (handle, name, &principal, &realm);
   if (rc != SHISHI_OK)
     return rc;
@@ -463,6 +466,9 @@ shishi_derive_default_salt (Shishi * handle, const char 
*name, char **salt)
       return SHISHI_INVALID_PRINCIPAL_NAME;
     }
 
+  while ((p = strchr (principal, '/')))
+    memmove (p, p + 1, strlen (p));
+
   *salt = xasprintf ("%s%s", realm, principal);
 
   free (realm);
diff --git a/tests/crypto.c b/tests/crypto.c
index eefe3df..96879e6 100644
--- a/tests/crypto.c
+++ b/tests/crypto.c
@@ -343,6 +343,7 @@ test (Shishi * handle)
   char out[BUFSIZ];
   size_t i;
   int res;
+  char *salt;
 
   if (debug)
     shishi_cfg (handle, strdup ("verbose-crypto,verbose-crypto-noise"));
@@ -351,6 +352,18 @@ test (Shishi * handle)
   if (res != SHISHI_DES3_CBC_HMAC_SHA1_KD)
     fail ("shishi_cipher_parse (\"3des\") == %d\n", res);
 
+  res = shishi_derive_default_salt (handle, "address@hidden", &salt);
+  if (res != SHISHI_OK)
+    fail ("shishi_derive_default_salt failed %d\n", res);
+  if (strcmp (salt, "BARfoo") != 0)
+    fail ("shishi_derive_default_salt comparison failed %s\n", salt);
+
+  res = shishi_derive_default_salt (handle, "foo/address@hidden", &salt);
+  if (res != SHISHI_OK)
+    fail ("shishi_derive_default_salt failed %d\n", res);
+  if (strcmp (salt, "BARfoobar") != 0)
+    fail ("shishi_derive_default_salt comparison failed %s\n", salt);
+
   for (i = 0; i < sizeof (drdk) / sizeof (drdk[0]); i++)
     {
       if (debug)


hooks/post-receive
-- 
GNU shishi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]