Windows: afslogon major refactoring NPLogonNotify()
[openafs.git] / src / WINNT / afsd / afskfw.c
index ea05966..425c567 100644 (file)
@@ -3389,6 +3389,32 @@ KFW_AFS_copy_file_cache_to_default_cache(char * filename)
     return 0;
 }
 
+char *
+KFW_get_default_realm(void)
+{
+    krb5_context ctx = NULL;
+    char * def_realm = NULL, *realm = NULL;
+    krb5_error_code code;
+
+    code = krb5_init_context(&ctx);
+    if (code)
+        return NULL;
+
+    if (code = krb5_get_default_realm(ctx, &def_realm))
+        goto cleanup;
+
+    realm = strdup(def_realm);
+
+  cleanup:
+    if (def_realm)
+        krb5_free_default_realm(ctx, def_realm);
+
+    if (ctx)
+        krb5_free_context(ctx);
+
+    return realm;
+}
+
 /* We are including this
 
 /* Ticket lifetime.  This defines the table used to lookup lifetime for the