add some krb5_{set,clear}_error_string
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9937 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -45,11 +45,14 @@ krb4_kt_resolve(krb5_context context, const char *name, krb5_keytab id)
|
||||
struct krb4_kt_data *d;
|
||||
|
||||
d = malloc (sizeof(*d));
|
||||
if (d == NULL)
|
||||
if (d == NULL) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
d->filename = strdup (name);
|
||||
if (d->filename == NULL) {
|
||||
free(d);
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
id->data = d;
|
||||
@@ -92,17 +95,23 @@ krb4_kt_start_seq_get_int (krb5_context context,
|
||||
{
|
||||
struct krb4_kt_data *d = id->data;
|
||||
struct krb4_cursor_extra_data *ed;
|
||||
int ret;
|
||||
|
||||
ed = malloc (sizeof(*ed));
|
||||
if (ed == NULL)
|
||||
if (ed == NULL) {
|
||||
krb5_set_error_string (context, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
ed->entry.principal = NULL;
|
||||
ed->num = -1;
|
||||
c->data = ed;
|
||||
c->fd = open (d->filename, flags);
|
||||
if (c->fd < 0) {
|
||||
ret = errno;
|
||||
free (ed);
|
||||
return errno;
|
||||
krb5_set_error_string(context, "open(%s): %s", d->filename,
|
||||
strerror(ret));
|
||||
return ret;
|
||||
}
|
||||
c->sp = krb5_storage_from_fd(c->fd);
|
||||
return 0;
|
||||
@@ -238,8 +247,12 @@ krb4_kt_add_entry (krb5_context context,
|
||||
if (fd < 0) {
|
||||
fd = open (d->filename,
|
||||
O_WRONLY | O_APPEND | O_BINARY | O_CREAT, 0600);
|
||||
if (fd < 0)
|
||||
return errno;
|
||||
if (fd < 0) {
|
||||
ret = errno;
|
||||
krb5_set_error_string(context, "open(%s): %s", d->filename,
|
||||
strerror(ret));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
ret = krb5_524_conv_principal (context, entry->principal,
|
||||
service, instance, realm);
|
||||
|
Reference in New Issue
Block a user