KLCreatePrincipalFromTriplet should work with empty instance
authorAlexandra Ellwood <lxs@mit.edu>
Fri, 17 Oct 2008 18:34:51 +0000 (18:34 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Fri, 17 Oct 2008 18:34:51 +0000 (18:34 +0000)
Fixed bug where shim layer was calling kim_identity_create_from_components
incorrectly in this case.

ticket: new

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

src/kim/lib/mac/KerberosLogin.c

index 47bb1425345234c3fdd80b5005a5596b9d833e37..de05e57ddb61bdeb1911eb18bbbb65287494bf1d 100644 (file)
@@ -1446,11 +1446,18 @@ KLStatus KLCreatePrincipalFromTriplet (const char  *inName,
                                        const char  *inRealm,
                                        KLPrincipal *outPrincipal)
 {
-    return kl_check_error (kim_identity_create_from_components (outPrincipal,
-                                                                inRealm,
-                                                                inName, 
-                                                                inInstance,
-                                                                NULL));
+    if (inInstance && strlen (inInstance) > 0) {
+        return kl_check_error (kim_identity_create_from_components (outPrincipal,
+                                                                    inRealm,
+                                                                    inName, 
+                                                                    inInstance,
+                                                                    NULL));
+    } else {
+        return kl_check_error (kim_identity_create_from_components (outPrincipal,
+                                                                    inRealm,
+                                                                    inName, 
+                                                                    NULL));        
+    }
 }
 
 /* ------------------------------------------------------------------------ */