]> andersk Git - moira.git/blobdiff - incremental/afs/afs.c
Build without krb4 if it's unavailable.
[moira.git] / incremental / afs / afs.c
index dd2dee2ca5a677979b93521c520f4db032f881c9..99a4f2b61f46141b8f277e171a00497247b508f6 100644 (file)
 #include <unistd.h>
 
 #include <com_err.h>
+#ifdef HAVE_KRB4
 #include <krb.h>
+#endif
+#include <krb5.h>
 
 #include <afs/param.h>
 #include <afs/cellconfig.h>
@@ -552,14 +555,24 @@ void edit_group(int op, char *group, char *type, char *member)
   char *p = 0;
   char buf[PR_MAXNAMELEN];
   int code, ustate;
-  static char local_realm[REALM_SZ+1] = "";
+  static char *local_realm = NULL;
   struct member *m;
+  krb5_context context = NULL;
 
   /* The following KERBEROS code allows for the use of entities
    * user@foreign_cell.
    */
-  if (!local_realm[0])
-    krb_get_lrealm(local_realm, 1);
+  if (!local_realm)
+    {
+      code = krb5_init_context(&context);
+      if (code)
+       goto out;
+
+      code = krb5_get_default_realm(context, &local_realm);
+      if (code)
+       goto out;
+    }
+
   if (!strcmp(type, "KERBEROS"))
     {
       p = strchr(member, '@');
@@ -632,6 +645,12 @@ void edit_group(int op, char *group, char *type, char *member)
          code = PRNOENT;
        }
 
+    out:
+      if (context)
+       krb5_free_context(context);
+      if (local_realm)
+       free(local_realm);
+
       critical_alert("incremental", "Couldn't %s %s %s %s: %s",
                     op ? "add" : "remove", member,
                     op ? "to" : "from", buf,
This page took 0.060131 seconds and 4 git commands to generate.