move rcsid, make afs optional, make ntlm optional
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24366 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -32,11 +32,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "kuser_locl.h"
|
#include "kuser_locl.h"
|
||||||
RCSID("$Id$");
|
|
||||||
|
|
||||||
#include "krb5-v4compat.h"
|
#include "krb5-v4compat.h"
|
||||||
|
|
||||||
|
#ifndef NO_NTLM
|
||||||
#include "heimntlm.h"
|
#include "heimntlm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
int forwardable_flag = -1;
|
int forwardable_flag = -1;
|
||||||
int proxiable_flag = -1;
|
int proxiable_flag = -1;
|
||||||
@@ -73,7 +74,9 @@ static int enterprise_flag = 0;
|
|||||||
static int ok_as_delegate_flag = 0;
|
static int ok_as_delegate_flag = 0;
|
||||||
static int use_referrals_flag = 0;
|
static int use_referrals_flag = 0;
|
||||||
static int windows_flag = 0;
|
static int windows_flag = 0;
|
||||||
|
#ifndef NO_NTLM
|
||||||
static char *ntlm_domain;
|
static char *ntlm_domain;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static struct getargs args[] = {
|
static struct getargs args[] = {
|
||||||
@@ -168,8 +171,10 @@ static struct getargs args[] = {
|
|||||||
{ "pk-use-enckey", 0, arg_flag, &pk_use_enckey,
|
{ "pk-use-enckey", 0, arg_flag, &pk_use_enckey,
|
||||||
NP_("Use RSA encrypted reply (instead of DH)", "") },
|
NP_("Use RSA encrypted reply (instead of DH)", "") },
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NO_NTLM
|
||||||
{ "ntlm-domain", 0, arg_string, &ntlm_domain,
|
{ "ntlm-domain", 0, arg_string, &ntlm_domain,
|
||||||
NP_("NTLM domain", ""), "domain" },
|
NP_("NTLM domain", ""), "domain" },
|
||||||
|
#endif
|
||||||
|
|
||||||
{ "ok-as-delegate", 0, arg_flag, &ok_as_delegate_flag,
|
{ "ok-as-delegate", 0, arg_flag, &ok_as_delegate_flag,
|
||||||
NP_("honor ok-as-delegate on tickets", "") },
|
NP_("honor ok-as-delegate on tickets", "") },
|
||||||
@@ -341,8 +346,10 @@ renew_validate(krb5_context context,
|
|||||||
if(get_v4_tgt)
|
if(get_v4_tgt)
|
||||||
do_524init(context, cache, out, NULL);
|
do_524init(context, cache, out, NULL);
|
||||||
#endif
|
#endif
|
||||||
if(do_afslog && k_hasafs())
|
#ifndef NO_AFS
|
||||||
|
if(do_afslog && k_hasafs()) {
|
||||||
krb5_afslog(context, cache, NULL, NULL);
|
krb5_afslog(context, cache, NULL, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
krb5_free_creds (context, out);
|
krb5_free_creds (context, out);
|
||||||
@@ -355,6 +362,8 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_NTLM
|
||||||
|
|
||||||
static krb5_error_code
|
static krb5_error_code
|
||||||
store_ntlmkey(krb5_context context, krb5_ccache id,
|
store_ntlmkey(krb5_context context, krb5_ccache id,
|
||||||
const char *domain, struct ntlm_buf *buf)
|
const char *domain, struct ntlm_buf *buf)
|
||||||
@@ -376,6 +385,7 @@ store_ntlmkey(krb5_context context, krb5_ccache id,
|
|||||||
free(name);
|
free(name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static krb5_error_code
|
static krb5_error_code
|
||||||
get_new_tickets(krb5_context context,
|
get_new_tickets(krb5_context context,
|
||||||
@@ -392,10 +402,11 @@ get_new_tickets(krb5_context context,
|
|||||||
krb5_deltat renew = 0;
|
krb5_deltat renew = 0;
|
||||||
char *renewstr = NULL;
|
char *renewstr = NULL;
|
||||||
krb5_enctype *enctype = NULL;
|
krb5_enctype *enctype = NULL;
|
||||||
struct ntlm_buf ntlmkey;
|
|
||||||
krb5_ccache tempccache;
|
krb5_ccache tempccache;
|
||||||
|
#ifndef NO_NTLM
|
||||||
|
struct ntlm_buf ntlmkey;
|
||||||
memset(&ntlmkey, 0, sizeof(ntlmkey));
|
memset(&ntlmkey, 0, sizeof(ntlmkey));
|
||||||
|
#endif
|
||||||
passwd[0] = '\0';
|
passwd[0] = '\0';
|
||||||
|
|
||||||
if (password_file) {
|
if (password_file) {
|
||||||
@@ -556,8 +567,10 @@ get_new_tickets(krb5_context context,
|
|||||||
opt);
|
opt);
|
||||||
}
|
}
|
||||||
krb5_get_init_creds_opt_free(context, opt);
|
krb5_get_init_creds_opt_free(context, opt);
|
||||||
|
#ifndef NO_NTLM
|
||||||
if (ntlm_domain && passwd[0])
|
if (ntlm_domain && passwd[0])
|
||||||
heim_ntlm_nt_key(passwd, &ntlmkey);
|
heim_ntlm_nt_key(passwd, &ntlmkey);
|
||||||
|
#endif
|
||||||
memset(passwd, 0, sizeof(passwd));
|
memset(passwd, 0, sizeof(passwd));
|
||||||
|
|
||||||
switch(ret){
|
switch(ret){
|
||||||
@@ -615,8 +628,10 @@ get_new_tickets(krb5_context context,
|
|||||||
if (ret)
|
if (ret)
|
||||||
krb5_err (context, 1, ret, "krb5_cc_move");
|
krb5_err (context, 1, ret, "krb5_cc_move");
|
||||||
|
|
||||||
|
#if HAVE_NTLM
|
||||||
if (ntlm_domain && ntlmkey.data)
|
if (ntlm_domain && ntlmkey.data)
|
||||||
store_ntlmkey(context, ccache, ntlm_domain, &ntlmkey);
|
store_ntlmkey(context, ccache, ntlm_domain, &ntlmkey);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ok_as_delegate_flag || windows_flag || use_referrals_flag) {
|
if (ok_as_delegate_flag || windows_flag || use_referrals_flag) {
|
||||||
unsigned char d = 0;
|
unsigned char d = 0;
|
||||||
@@ -708,8 +723,10 @@ renew_func(void *ptr)
|
|||||||
if(get_v4_tgt || convert_524)
|
if(get_v4_tgt || convert_524)
|
||||||
do_524init(ctx->context, ctx->ccache, NULL, server_str);
|
do_524init(ctx->context, ctx->ccache, NULL, server_str);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NO_AFS
|
||||||
if(do_afslog && k_hasafs())
|
if(do_afslog && k_hasafs())
|
||||||
krb5_afslog(ctx->context, ctx->ccache, NULL, NULL);
|
krb5_afslog(ctx->context, ctx->ccache, NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
expire = ticket_lifetime(ctx->context, ctx->ccache, ctx->principal,
|
expire = ticket_lifetime(ctx->context, ctx->ccache, ctx->principal,
|
||||||
server_str) / 2;
|
server_str) / 2;
|
||||||
@@ -820,8 +837,10 @@ main (int argc, char **argv)
|
|||||||
if (ret)
|
if (ret)
|
||||||
krb5_err (context, 1, ret, N_("resolving credentials cache", ""));
|
krb5_err (context, 1, ret, N_("resolving credentials cache", ""));
|
||||||
|
|
||||||
|
#ifndef NO_AFS
|
||||||
if(argc > 1 && k_hasafs ())
|
if(argc > 1 && k_hasafs ())
|
||||||
k_setpag();
|
k_setpag();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (lifetime) {
|
if (lifetime) {
|
||||||
int tmp = parse_time (lifetime, "s");
|
int tmp = parse_time (lifetime, "s");
|
||||||
@@ -865,8 +884,10 @@ main (int argc, char **argv)
|
|||||||
if(get_v4_tgt || convert_524)
|
if(get_v4_tgt || convert_524)
|
||||||
do_524init(context, ccache, NULL, server_str);
|
do_524init(context, ccache, NULL, server_str);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NO_AFS
|
||||||
if(do_afslog && k_hasafs())
|
if(do_afslog && k_hasafs())
|
||||||
krb5_afslog(context, ccache, NULL, NULL);
|
krb5_afslog(context, ccache, NULL, NULL);
|
||||||
|
#endif
|
||||||
if(argc > 1) {
|
if(argc > 1) {
|
||||||
struct renew_ctx ctx;
|
struct renew_ctx ctx;
|
||||||
time_t timeout;
|
time_t timeout;
|
||||||
@@ -891,8 +912,10 @@ main (int argc, char **argv)
|
|||||||
#ifndef HEIMDAL_SMALLER
|
#ifndef HEIMDAL_SMALLER
|
||||||
_krb5_krb_dest_tkt(context, krb4_cc_name);
|
_krb5_krb_dest_tkt(context, krb4_cc_name);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NO_AFS
|
||||||
if(k_hasafs())
|
if(k_hasafs())
|
||||||
k_unlog();
|
k_unlog();
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
krb5_cc_close (context, ccache);
|
krb5_cc_close (context, ccache);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Reference in New Issue
Block a user