summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/krb5/keytab.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-10-27 11:35:07 +0100
committerStefan Metzmacher <metze@samba.org>2008-10-28 08:53:09 +0100
commit2b29b7186459d945ec448694164bfe4239b30d72 (patch)
tree561495b1870facf03f7892559a184f4f49df1fe2 /source4/heimdal/lib/krb5/keytab.c
parent698b7fd43658d9e96d28f26c9e1dae5e770bb57f (diff)
downloadsamba-2b29b7186459d945ec448694164bfe4239b30d72.tar.gz
samba-2b29b7186459d945ec448694164bfe4239b30d72.tar.bz2
samba-2b29b7186459d945ec448694164bfe4239b30d72.zip
s4: import lorikeet-heimdal-200810271034
metze
Diffstat (limited to 'source4/heimdal/lib/krb5/keytab.c')
-rw-r--r--source4/heimdal/lib/krb5/keytab.c103
1 files changed, 53 insertions, 50 deletions
diff --git a/source4/heimdal/lib/krb5/keytab.c b/source4/heimdal/lib/krb5/keytab.c
index f3e6b9e8f4..aa7c77ce46 100644
--- a/source4/heimdal/lib/krb5/keytab.c
+++ b/source4/heimdal/lib/krb5/keytab.c
@@ -1,34 +1,34 @@
/*
- * Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
+ * Copyright (c) 1997 - 2005 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 "krb5_locl.h"
@@ -47,15 +47,15 @@ krb5_kt_register(krb5_context context,
struct krb5_keytab_data *tmp;
if (strlen(ops->prefix) > KRB5_KT_PREFIX_MAX_LEN - 1) {
- krb5_set_error_message(context, KRB5_KT_BADNAME,
- "krb5_kt_register; prefix too long");
+ krb5_set_error_message(context, KRB5_KT_BADNAME,
+ N_("can't register cache type, prefix too long", ""));
return KRB5_KT_BADNAME;
}
tmp = realloc(context->kt_types,
(context->num_kt_types + 1) * sizeof(*context->kt_types));
if(tmp == NULL) {
- krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
+ krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
return ENOMEM;
}
memcpy(&tmp[context->num_kt_types], ops,
@@ -92,21 +92,21 @@ krb5_kt_resolve(krb5_context context,
type_len = residual - name;
residual++;
}
-
+
for(i = 0; i < context->num_kt_types; i++) {
if(strncasecmp(type, context->kt_types[i].prefix, type_len) == 0)
break;
}
if(i == context->num_kt_types) {
krb5_set_error_message(context, KRB5_KT_UNKNOWN_TYPE,
- "unknown keytab type %.*s",
+ N_("unknown keytab type %.*s", "type"),
(int)type_len, type);
return KRB5_KT_UNKNOWN_TYPE;
}
-
+
k = malloc (sizeof(*k));
if (k == NULL) {
- krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
+ krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
return ENOMEM;
}
memcpy(k, &context->kt_types[i], sizeof(*k));
@@ -129,7 +129,7 @@ krb5_error_code KRB5_LIB_FUNCTION
krb5_kt_default_name(krb5_context context, char *name, size_t namesize)
{
if (strlcpy (name, context->default_keytab, namesize) >= namesize) {
- krb5_clear_error_string (context);
+ krb5_clear_error_message (context);
return KRB5_CONFIG_NOTENUFSPACE;
}
return 0;
@@ -150,17 +150,17 @@ krb5_kt_default_modify_name(krb5_context context, char *name, size_t namesize)
else {
size_t len = strcspn(context->default_keytab + 4, ",");
if(len >= namesize) {
- krb5_clear_error_string(context);
+ krb5_clear_error_message(context);
return KRB5_CONFIG_NOTENUFSPACE;
}
strlcpy(name, context->default_keytab + 4, namesize);
name[len] = '\0';
return 0;
- }
+ }
} else
kt = context->default_keytab_modify;
if (strlcpy (name, kt, namesize) >= namesize) {
- krb5_clear_error_string (context);
+ krb5_clear_error_message (context);
return KRB5_CONFIG_NOTENUFSPACE;
}
return 0;
@@ -233,7 +233,7 @@ krb5_kt_get_type(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
-krb5_kt_get_name(krb5_context context,
+krb5_kt_get_name(krb5_context context,
krb5_keytab keytab,
char *name,
size_t namesize)
@@ -248,14 +248,14 @@ krb5_kt_get_name(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
-krb5_kt_get_full_name(krb5_context context,
+krb5_kt_get_full_name(krb5_context context,
krb5_keytab keytab,
char **str)
{
char type[KRB5_KT_PREFIX_MAX_LEN];
char name[MAXPATHLEN];
krb5_error_code ret;
-
+
*str = NULL;
ret = krb5_kt_get_type(context, keytab, type, sizeof(type));
@@ -267,7 +267,7 @@ krb5_kt_get_full_name(krb5_context context,
return ret;
if (asprintf(str, "%s:%s", type, name) == -1) {
- krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
+ krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
*str = NULL;
return ENOMEM;
}
@@ -281,7 +281,7 @@ krb5_kt_get_full_name(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
-krb5_kt_close(krb5_context context,
+krb5_kt_close(krb5_context context,
krb5_keytab id)
{
krb5_error_code ret;
@@ -300,12 +300,12 @@ krb5_kt_close(krb5_context context,
krb5_boolean KRB5_LIB_FUNCTION
krb5_kt_compare(krb5_context context,
- krb5_keytab_entry *entry,
+ krb5_keytab_entry *entry,
krb5_const_principal principal,
krb5_kvno vno,
krb5_enctype enctype)
{
- if(principal != NULL &&
+ if(principal != NULL &&
!krb5_principal_compare(context, entry->principal, principal))
return FALSE;
if(vno && vno != entry->vno)
@@ -381,7 +381,8 @@ krb5_kt_get_entry(krb5_context context,
kvno_str[0] = '\0';
krb5_set_error_message (context, KRB5_KT_NOTFOUND,
- "Failed to find %s%s in keytab %s (%s)",
+ N_("Failed to find %s%s in keytab %s (%s)",
+ "principal, kvno, keytab file, enctype"),
princ,
kvno_str,
kt_name ? kt_name : "unknown keytab",
@@ -447,8 +448,9 @@ krb5_kt_start_seq_get(krb5_context context,
{
if(id->start_seq_get == NULL) {
krb5_set_error_message(context, HEIM_ERR_OPNOTSUPP,
- "start_seq_get is not supported in the %s "
- " keytab", id->prefix);
+ N_("start_seq_get is not supported "
+ "in the %s keytab type", ""),
+ id->prefix);
return HEIM_ERR_OPNOTSUPP;
}
return (*id->start_seq_get)(context, id, cursor);
@@ -468,8 +470,9 @@ krb5_kt_next_entry(krb5_context context,
{
if(id->next_entry == NULL) {
krb5_set_error_message(context, HEIM_ERR_OPNOTSUPP,
- "next_entry is not supported in the %s "
- " keytab", id->prefix);
+ N_("next_entry is not supported in the %s "
+ " keytab", ""),
+ id->prefix);
return HEIM_ERR_OPNOTSUPP;
}
return (*id->next_entry)(context, id, entry, cursor);
@@ -505,7 +508,7 @@ krb5_kt_add_entry(krb5_context context,
{
if(id->add == NULL) {
krb5_set_error_message(context, KRB5_KT_NOWRITE,
- "Add is not supported in the %s keytab",
+ N_("Add is not supported in the %s keytab", ""),
id->prefix);
return KRB5_KT_NOWRITE;
}
@@ -525,7 +528,7 @@ krb5_kt_remove_entry(krb5_context context,
{
if(id->remove == NULL) {
krb5_set_error_message(context, KRB5_KT_NOWRITE,
- "Remove is not supported in the %s keytab",
+ N_("Remove is not supported in the %s keytab", ""),
id->prefix);
return KRB5_KT_NOWRITE;
}