Author: metze
Date: 2004-11-19 15:18:34 +0000 (Fri, 19 Nov 2004)
New Revision: 133

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

Log:
only replace the principal when everything goes ok,
this fixes a segfault whwn you do kinit with a non existing user

metze

Modified:
   trunk/heimdal/lib/hdb/hdb-ldb.c


Changeset:
Modified: trunk/heimdal/lib/hdb/hdb-ldb.c
===================================================================
--- trunk/heimdal/lib/hdb/hdb-ldb.c     2004-11-19 13:25:30 UTC (rev 132)
+++ trunk/heimdal/lib/hdb/hdb-ldb.c     2004-11-19 15:18:34 UTC (rev 133)
@@ -628,13 +628,17 @@
                        }
                }
        }
-       
-       /* no matter what the principal in the record, return what was asked 
for */
-       krb5_free_principal(context, entry->principal);
-       entry->principal = p_copy;
 
        free(princ);
 
+       if (ret == 0) {
+               /* no matter what the principal in the record, return what was 
asked for */
+               krb5_free_principal(context, entry->principal);
+               entry->principal = p_copy;
+       } else {
+               krb5_free_principal(context, p_copy);
+       }
+
        if (msg) {
                ldb_search_free(ldb_ctx, msg);
        }

Reply via email to