git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@702 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1996-08-31 21:04:12 +00:00
parent def813850a
commit c36c25417e

View File

@@ -1,61 +0,0 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/types.h>
#include <sys/param.h>
#include <netdb.h>
#include <krb.h>
#include <kafs.h>
RCSID("$Id$");
int
klogin(char *name, char *password)
{
int kerror;
KTEXT_ST tkt;
AUTH_DAT ad;
char hostname[MaxHostNameLen];
char realm[REALM_SZ];
char *phost;
struct hostent *hp;
k_gethostname(hostname, sizeof(hostname));
phost = krb_get_phost(hostname);
krb_get_lrealm(realm, 0);
kerror = krb_get_pw_in_tkt(name, "", realm,
"krbtgt", realm,
12, password);
if(kerror)
return kerror;
kerror = krb_mk_req(&tkt, "rcmd", phost, realm, 33);
if (kerror){
dest_tkt();
return kerror;
}
hp = gethostbyname(hostname);
if(!hp){
dest_tkt();
return -1;
}
kerror = krb_rd_req(&tkt, "rcmd", phost, *(unsigned int*)(hp->h_addr),
&ad, "");
if(kerror){
dest_tkt();
return kerror;
}
if(k_hasafs())
k_afsklog(0, 0);
return 0;
}