Use kuser_locl.h

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1311 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1997-03-08 10:46:03 +00:00
parent 3a7dce096c
commit f1db719a8a
2 changed files with 27 additions and 24 deletions

View File

@@ -1,7 +1,4 @@
#include <stdio.h> #include "kuser_locl.h"
#include <string.h>
#include <pwd.h>
#include <krb5.h>
int int
@@ -15,18 +12,24 @@ main (int argc, char **argv)
krb5_creds cred; krb5_creds cred;
err = krb5_init_context (&context); err = krb5_init_context (&context);
if (err) if (err){
abort (); fprintf(stderr, "%s\n", krb5_get_err_text(context, err));;
abort();
}
err = krb5_cc_default (context, &ccache); err = krb5_cc_default (context, &ccache);
if (err) if (err){
abort (); fprintf(stderr, "%s\n", krb5_get_err_text(context, err));;
abort();
}
if(argv[1]){ if(argv[1]){
err = krb5_parse_name (context, argv[1], &principal); err = krb5_parse_name (context, argv[1], &principal);
if (err) if (err){
abort (); fprintf(stderr, "%s\n", krb5_get_err_text(context, err));;
abort();
}
}else{ }else{
char *realm; char *realm;
@@ -40,8 +43,10 @@ main (int argc, char **argv)
} }
err = krb5_cc_initialize (context, ccache, principal); err = krb5_cc_initialize (context, ccache, principal);
if (err) if (err){
abort (); fprintf(stderr, "%s\n", krb5_get_err_text(context, err));;
abort();
}
cred.client = principal; cred.client = principal;
cred.times.endtime = time (NULL) + 4711; cred.times.endtime = time (NULL) + 4711;
@@ -55,8 +60,10 @@ main (int argc, char **argv)
principal->realm.length, principal->realm.length,
principal->realm.data, principal->realm.data,
NULL); NULL);
if (err) if (err){
abort (); fprintf(stderr, "%s\n", krb5_get_err_text(context, err));;
abort();
}
cred.server->type = KRB5_NT_SRV_INST; cred.server->type = KRB5_NT_SRV_INST;
err = krb5_get_in_tkt_with_password (context, err = krb5_get_in_tkt_with_password (context,
@@ -68,8 +75,10 @@ main (int argc, char **argv)
ccache, ccache,
&cred, &cred,
NULL); NULL);
if (err) if (err){
abort (); fprintf(stderr, "%s\n", krb5_get_err_text(context, err));;
abort();
}
krb5_free_context (context); krb5_free_context (context);
return 0; return 0;

View File

@@ -1,10 +1,4 @@
#include <stdio.h> #include "kuser_locl.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <krb5.h>
char* char*
stime(time_t t) stime(time_t t)