[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS shishi/lib
From: |
shishi-commit |
Subject: |
CVS shishi/lib |
Date: |
Fri, 17 Sep 2004 14:31:04 +0200 |
Update of /home/cvs/shishi/lib
In directory dopio:/tmp/cvs-serv21681
Modified Files:
shishi.h.in kdcreq.c as.c
Log Message:
(shishi_asreq_cnamerealm_get): Remove.
(shishi_asreq_clientrealm): Add.
--- /home/cvs/shishi/lib/shishi.h.in 2004/09/17 12:21:51 1.244
+++ /home/cvs/shishi/lib/shishi.h.in 2004/09/17 12:31:03 1.245
@@ -1052,9 +1052,9 @@
Shishi_asn1 * kdcreq);
extern int shishi_kdcreq_from_file (Shishi * handle, Shishi_asn1 * kdcreq,
int filetype, const char *filename);
-extern int shishi_asreq_cnamerealm_get (Shishi * handle, Shishi_asn1 kdcreq,
- char *cnamerealm,
- size_t * cnamerealmlen);
+extern int shishi_asreq_clientrealm (Shishi * handle,
+ Shishi_asn1 asreq,
+ char **client, size_t * clientlen);
extern int shishi_kdcreq_nonce (Shishi * handle, Shishi_asn1 kdcreq,
uint32_t * nonce);
extern int shishi_kdcreq_nonce_set (Shishi * handle,
--- /home/cvs/shishi/lib/kdcreq.c 2004/09/17 12:21:51 1.70
+++ /home/cvs/shishi/lib/kdcreq.c 2004/09/17 12:31:03 1.71
@@ -414,15 +414,31 @@
client, clientlen);
}
+/**
+ * shishi_asreq_clientrealm:
+ * @handle: Shishi library handle create by shishi_init().
+ * @asreq: AS-REQ variable to get client name and realm from.
+ * @client: pointer to newly allocated zero terminated string containing
+ * principal name and realm. May be %NULL (to only populate @clientlen).
+ * @clientlen: pointer to length of @client on output, excluding terminating
+ * zero. May be %NULL (to only populate @client).
+ *
+ * Convert cname and realm fields from AS-REQ to printable principal
+ * name format. The string is allocate by this function, and it is
+ * the responsibility of the caller to deallocate it. Note that the
+ * output length @clientlen does not include the terminating zero.
+ *
+ * Return value: Returns SHISHI_OK iff successful.
+ **/
int
-shishi_asreq_cnamerealm_get (Shishi * handle,
- Shishi_asn1 asreq,
- char *cnamerealm, size_t * cnamerealmlen)
+shishi_asreq_clientrealm (Shishi * handle,
+ Shishi_asn1 asreq,
+ char **client, size_t * clientlen)
{
- return shishi_principal_name_realm_get (handle, asreq,
- "req-body.cname", asreq,
- "req-body.realm",
- cnamerealm, cnamerealmlen);
+ return shishi_principal_name_realm (handle,
+ asreq, "req-body.cname",
+ asreq, "req-body.realm",
+ client, clientlen);
}
/**
--- /home/cvs/shishi/lib/as.c 2004/09/10 09:04:16 1.42
+++ /home/cvs/shishi/lib/as.c 2004/09/17 12:31:03 1.43
@@ -239,8 +239,6 @@
shishi_as_rep_process (Shishi_as * as, Shishi_key * key, const char *password)
{
Shishi_asn1 ticket, kdcreppart;
- char user[BUFSIZ];
- size_t userlen;
int res;
if (VERBOSE (as->handle))
@@ -252,23 +250,25 @@
if (VERBOSEASN1 (as->handle))
shishi_kdcrep_print (as->handle, stdout, as->asrep);
- userlen = sizeof (user);
- res = shishi_asreq_cnamerealm_get (as->handle, as->asreq, user, &userlen);
- if (res != SHISHI_OK)
- {
- shishi_error_printf (as->handle, "Could not extract cname and "
- "realm from AS-REQ: %s\n", shishi_strerror (res),
- shishi_error (as->handle));
- return res;
- }
- user[userlen] = '\0';
-
if (key == NULL && password == NULL)
{
char *passwd;
+ char *user;
+ size_t userlen;
+
+ res = shishi_asreq_clientrealm (as->handle, as->asreq, &user, &userlen);
+ if (res != SHISHI_OK)
+ {
+ shishi_error_printf (as->handle, "Could not extract cname and "
+ "realm from AS-REQ: %s\n",
+ shishi_strerror (res),
+ shishi_error (as->handle));
+ return res;
+ }
res = shishi_prompt_password (as->handle, &passwd,
"Enter password for `%s': ", user);
+ free (user);
if (res != SHISHI_OK)
{
shishi_error_printf (as->handle, "Reading password failed: %s\n",
- CVS shishi/lib, (continued)
- CVS shishi/lib, shishi-commit, 2004/09/10
- CVS shishi/lib, shishi-commit, 2004/09/10
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib,
shishi-commit <=
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17