aboutsummaryrefslogtreecommitdiff
path: root/crypto/heimdal/kuser/generate-requests.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/kuser/generate-requests.c')
-rw-r--r--crypto/heimdal/kuser/generate-requests.c80
1 files changed, 32 insertions, 48 deletions
diff --git a/crypto/heimdal/kuser/generate-requests.c b/crypto/heimdal/kuser/generate-requests.c
index 95d8dc968bbf..8f50427adca1 100644
--- a/crypto/heimdal/kuser/generate-requests.c
+++ b/crypto/heimdal/kuser/generate-requests.c
@@ -1,50 +1,38 @@
/*
- * Copyright (c) 2000 - 2004 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
+ * Copyright (c) 2000 - 2004 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
*
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*/
#include "kuser_locl.h"
-RCSID("$Id: generate-requests.c 19233 2006-12-06 08:04:05Z lha $");
-
-static krb5_error_code
-null_key_proc (krb5_context context,
- krb5_enctype type,
- krb5_salt salt,
- krb5_const_pointer keyseed,
- krb5_keyblock **key)
-{
- return ENOTTY;
-}
-
static unsigned
read_words (const char *filename, char ***ret_w)
{
@@ -68,12 +56,14 @@ read_words (const char *filename, char ***ret_w)
*ret_w = w;
if (n == 0)
errx(1, "%s is an empty file, no words to try", filename);
+ fclose(f);
return n;
}
static void
generate_requests (const char *filename, unsigned nreq)
{
+ krb5_principal client;
krb5_context context;
krb5_error_code ret;
krb5_creds cred;
@@ -89,24 +79,18 @@ generate_requests (const char *filename, unsigned nreq)
for (i = 0; i < nreq; ++i) {
char *name = words[rand() % nwords];
- krb5_realm *client_realm;
memset(&cred, 0, sizeof(cred));
- ret = krb5_parse_name (context, name, &cred.client);
+ ret = krb5_parse_name (context, name, &client);
if (ret)
krb5_err (context, 1, ret, "krb5_parse_name %s", name);
- client_realm = krb5_princ_realm (context, cred.client);
- ret = krb5_make_principal(context, &cred.server, *client_realm,
- KRB5_TGS_NAME, *client_realm, NULL);
+ ret = krb5_get_init_creds_password (context, &cred, client, "",
+ NULL, NULL, 0, NULL, NULL);
if (ret)
- krb5_err (context, 1, ret, "krb5_make_principal");
-
- ret = krb5_get_in_cred (context, 0, NULL, NULL, NULL, NULL,
- null_key_proc, NULL, NULL, NULL,
- &cred, NULL);
- krb5_free_cred_contents (context, &cred);
+ krb5_free_cred_contents (context, &cred);
+ krb5_free_principal(context, client);
}
}