In krb5_sname_to_principal, correctly handle failures from
authorGreg Hudson <ghudson@mit.edu>
Wed, 15 Sep 2010 15:50:15 +0000 (15:50 +0000)
committerGreg Hudson <ghudson@mit.edu>
Wed, 15 Sep 2010 15:50:15 +0000 (15:50 +0000)
krb5_build_principal.

ticket: 6777

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24309 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/sn2princ.c

index 8bd823090580403c1137467fdf8464ed5a276b9d..9645fef376e4a66f3203d93a5be6c92a23bf88f0 100644 (file)
@@ -196,8 +196,8 @@ krb5_sname_to_principal(krb5_context context, const char *hostname, const char *
         retval = krb5_build_principal(context, ret_princ, strlen(realm),
                                       realm, sname, remote_host,
                                       (char *)0);
-
-        krb5_princ_type(context, *ret_princ) = type;
+        if (retval == 0)
+            krb5_princ_type(context, *ret_princ) = type;
 
 #ifdef DEBUG_REFERRALS
         printf("krb5_sname_to_principal returning\n");