make build without KRB4

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11844 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2003-03-18 04:24:20 +00:00
parent f89e9c706b
commit 2d1b43f459

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997-2002 Kungliga Tekniska H<>gskolan * Copyright (c) 1997-2003 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -39,7 +39,9 @@ RCSID("$Id$");
#ifdef KRB5 #ifdef KRB5
#include <krb5.h> #include <krb5.h>
#endif #endif
#ifdef KRB4
#include <krb.h> #include <krb.h>
#endif
#include <kafs.h> #include <kafs.h>
#include <roken.h> #include <roken.h>
#include <getarg.h> #include <getarg.h>
@@ -55,12 +57,24 @@ static char *realm;
static getarg_strings files; static getarg_strings files;
static int unlog_flag; static int unlog_flag;
static int verbose; static int verbose;
#ifdef KRB4
static int use_krb4 = 1;
#endif
#ifdef KRB5
static int use_krb5 = 1;
#endif
struct getargs args[] = { struct getargs args[] = {
{ "cell", 'c', arg_strings, &cells, "cells to get tokens for", "cell" }, { "cell", 'c', arg_strings, &cells, "cells to get tokens for", "cell" },
{ "file", 'p', arg_strings, &files, "files to get tokens for", "path" }, { "file", 'p', arg_strings, &files, "files to get tokens for", "path" },
{ "realm", 'k', arg_string, &realm, "realm for afs cell", "realm" }, { "realm", 'k', arg_string, &realm, "realm for afs cell", "realm" },
{ "unlog", 'u', arg_flag, &unlog_flag, "remove tokens" }, { "unlog", 'u', arg_flag, &unlog_flag, "remove tokens" },
#ifdef KRB4
{ "v4", 0, arg_negative_flag, &use_krb4, "use Kerberos 4" },
#endif
#ifdef KRB5
{ "v5", 0, arg_negative_flag, &use_krb5, "use Kerberos 5" },
#endif
#if 0 #if 0
{ "create-user", 0, arg_flag, &create_user, "create user if not found" }, { "create-user", 0, arg_flag, &create_user, "create user if not found" },
#endif #endif
@@ -214,21 +228,35 @@ afslog_file(const char *path)
static int static int
do_afslog(const char *cell) do_afslog(const char *cell)
{ {
int ret; int k5ret, k4ret;
k5ret = k4ret = 0;
#ifdef KRB5 #ifdef KRB5
if(context != NULL && id != NULL) { if(context != NULL && id != NULL && use_krb5) {
ret = krb5_afslog(context, id, cell, NULL); k5ret = krb5_afslog(context, id, cell, NULL);
if(ret == 0) if(k5ret == 0)
return 0; return 0;
if(verbose)
warnx("krb5_afslog(%s): %s", cell,
krb5_get_err_text(context, ret));
} }
#endif #endif
ret = krb_afslog(cell, NULL); #if KRB4
if(ret) if (use_krb4) {
warnx("krb_afslog(%s): %s", cell, krb_get_err_text(ret)); k4ret = krb_afslog(cell, NULL);
return ret; if(k4ret == 0)
return 0;
}
#endif
#ifdef KRB5
if (k5ret)
warnx("krb5_afslog(%s): %s", cell, krb5_get_err_text(context, k5ret));
#endif
#ifdef KRB4
if (k4ret)
warnx("krb_afslog(%s): %s", cell, krb_get_err_text(k4ret));
#endif
if (k5ret || k4ret)
return 1;
return 0;
} }
int int