svn commit: lorikeet r582 - in trunk/heimdal/lib/hdb: .

lha at samba.org lha at samba.org
Mon Oct 9 06:44:00 GMT 2006


Author: lha
Date: 2006-10-09 06:44:00 +0000 (Mon, 09 Oct 2006)
New Revision: 582

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=582

Log:
Merge changes from heimdal 20061008 cvs.

Modified:
   trunk/heimdal/lib/hdb/keytab.c


Changeset:
Modified: trunk/heimdal/lib/hdb/keytab.c
===================================================================
--- trunk/heimdal/lib/hdb/keytab.c	2006-10-09 05:59:56 UTC (rev 581)
+++ trunk/heimdal/lib/hdb/keytab.c	2006-10-09 06:44:00 UTC (rev 582)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden). 
  * All rights reserved. 
  *
@@ -35,7 +35,7 @@
 
 /* keytab backend for HDB databases */
 
-RCSID("$Id: keytab.c,v 1.11 2006/04/27 11:01:30 lha Exp $");
+RCSID("$Id: keytab.c,v 1.13 2006/10/06 16:53:11 lha Exp $");
 
 struct hdb_data {
     char *dbname;
@@ -44,7 +44,7 @@
 
 /*
  * the format for HDB keytabs is:
- * HDB:[database:file:mkey]
+ * HDB:[database:mkey]
  */
 
 static krb5_error_code
@@ -201,6 +201,8 @@
     const char *dbname = d->dbname;
     const char *mkey   = d->mkey;
 
+    memset(&ent, 0, sizeof(ent));
+
     if (dbname == NULL)
 	find_db (context, &dbname, &mkey, principal);
 
@@ -218,26 +220,18 @@
 	(*db->hdb_destroy)(context, db);
 	return ret;
     }
-    ret = (*db->hdb_fetch)(context, db, principal, HDB_F_DECRYPT|HDB_F_GET_CLIENT|HDB_F_GET_SERVER, &ent);
+    ret = (*db->hdb_fetch)(context, db, principal, HDB_F_DECRYPT, &ent);
 
-
-    /* Shutdown the hdb on error */
     if(ret == HDB_ERR_NOENTRY) {
-	(*db->hdb_close)(context, db);
-	(*db->hdb_destroy)(context, db);
-	return KRB5_KT_NOTFOUND;
-    } else if (ret) {
-	(*db->hdb_close)(context, db);
-	(*db->hdb_destroy)(context, db);
-	return ret;
-    }
+	ret = KRB5_KT_NOTFOUND;
+	goto out;
+    }else if(ret)
+	goto out;
+
     if(kvno && ent.entry.kvno != kvno) {
-	/* The order here matters, we must free these in this order
-	 * due to hdb-ldb and Samba4's talloc */
 	hdb_free_entry(context, &ent);
-	(*db->hdb_close)(context, db);
-	(*db->hdb_destroy)(context, db);
- 	return KRB5_KT_NOTFOUND;
+ 	ret = KRB5_KT_NOTFOUND;
+	goto out;
     }
     if(enctype == 0)
 	if(ent.entry.keys.len > 0)
@@ -254,9 +248,8 @@
 	    break;
 	}
     }
-    /* The order here matters, we must free these in this order
-     * due to hdb-ldb and Samba4's talloc */
     hdb_free_entry(context, &ent);
+out:
     (*db->hdb_close)(context, db);
     (*db->hdb_destroy)(context, db);
     return ret;



More information about the samba-cvs mailing list