summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/hdb/ext.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-11-13 10:51:14 +1100
committerAndrew Bartlett <abartlet@samba.org>2009-11-13 23:19:05 +1100
commit4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608 (patch)
treeca189d440b0a298cdcb3769d994828508dcd2e76 /source4/heimdal/lib/hdb/ext.c
parent5bc87c14a1f5b45ed86e7ff9663f5f0aa2f70094 (diff)
downloadsamba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.tar.gz
samba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.tar.bz2
samba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.zip
s4:heimdal: import lorikeet-heimdal-200911122202 (commit 9291fd2d101f3eecec550178634faa94ead3e9a1)
Diffstat (limited to 'source4/heimdal/lib/hdb/ext.c')
-rw-r--r--source4/heimdal/lib/hdb/ext.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/source4/heimdal/lib/hdb/ext.c b/source4/heimdal/lib/hdb/ext.c
index 8248098dc5..a8a882c6b2 100644
--- a/source4/heimdal/lib/hdb/ext.c
+++ b/source4/heimdal/lib/hdb/ext.c
@@ -281,12 +281,11 @@ hdb_entry_get_password(krb5_context context, HDB *db,
const hdb_entry *entry, char **p)
{
HDB_extension *ext;
- char *str;
int ret;
ext = hdb_find_extension(entry, choice_HDB_extension_data_password);
if (ext) {
- heim_utf8_string str2;
+ heim_utf8_string str;
heim_octet_string pw;
if (db->hdb_master_key_set && ext->data.u.password.mkvno) {
@@ -314,13 +313,13 @@ hdb_entry_get_password(krb5_context context, HDB *db,
return ret;
}
- str2 = pw.data;
- if (str2[pw.length - 1] != '\0') {
+ str = pw.data;
+ if (str[pw.length - 1] != '\0') {
krb5_set_error_message(context, EINVAL, "password malformated");
return EINVAL;
}
- *p = strdup(str2);
+ *p = strdup(str);
der_free_octet_string(&pw);
if (*p == NULL) {
@@ -330,14 +329,17 @@ hdb_entry_get_password(krb5_context context, HDB *db,
return 0;
}
- ret = krb5_unparse_name(context, entry->principal, &str);
- if (ret == 0) {
- krb5_set_error_message(context, ENOENT, "no password attributefor %s", str);
- free(str);
- } else
- krb5_clear_error_message(context);
-
- return ENOENT;
+ {
+ char *name;
+ ret = krb5_unparse_name(context, entry->principal, &name);
+ if (ret == 0) {
+ krb5_set_error_message(context, ENOENT, "no password attributefor %s", name);
+ free(name);
+ } else
+ krb5_clear_error_message(context);
+
+ return ENOENT;
+ }
}
int