using KClientPasswordLogin

Hua Ying Ling hyling at
Fri Apr 12 19:28:00 EDT 2002

I'm trying to login with KClientPasswordLogin to avoid showing the 
Kerberos login dialog.  When using KClientPasswordLogin to login before 
calling KClientGetTicketForService or KClientGetAuthenticatorForService 
I'll get a -50 error for KClientGetTicketForService and 
KClientGetTicketForService.  Everything works fine if I don't call 
KClientPasswordLogin and login with the Kerberos dialog instead by  
calling KClientGetTicketForService.  Is there something I'm doing 
wrong?(code below)

~Hua Ying

// =============================================
	char*			kAFPServiceVersion = "V1.0";
	char			authent[MAX_KTXT_LEN];
	unsigned long	authlen;

     KClientSessionInfo gKClientSession;
     KClientPrincipal 	currentPrincipal;
     char * user = "hyling";
     char * service2 = "afpserver";


     KClientV4StringToPrincipal(user, &currentPrincipal);
     KClientSetClientPrincipal(gKClientSession, currentPrincipal);

     error = KClientV4StringToPrincipal(service2, &currentPrincipal);
     error = KClientSetServerPrincipal(gKClientSession, currentPrincipal);

     int authlen = MAX_KTXT_LEN;
//    error = KClientPasswordLogin(gKClientSession, "mypasswd");
     error = KClientGetTicketForService(gKClientSession, 0, (void 
*)authent, (UInt32 *)&authlen);

     error = KClientGetAuthenticatorForService( gKClientSession, 0, 
kAFPServiceVersion, &authent, (UInt32 *)&authlen );

More information about the krbdev mailing list