[OpenAFS-devel] pr_Initialize falis when called within a simple application

John Hayes jhh@envirobat.org
Wed, 11 Aug 2004 19:33:07 -0400 (EDT)


I am including a copy of the cod I am running below. It actually just
reflects the changes you recommended in making. Changes before you
recommended them.

The "ka_CellToRealm " was just to see it work.

John Hayes


>> It didn't make the problem go away.
>
> what code are you running now?
>

#include <afs/stds.h>
#include <afs/ptint.h>
#include <afs/kautils.h>
#include <afs/ptclient.h>
#include <stdio.h>


extern struct ubik_client *pruclient;


main ( int argc, char *argv [] )

{
        char    cellname [ 1024 ] = "msu.edu",
                dirpath [ 1024 ] = "/usr/vice/etc",
                *Reason = (char *) malloc ( 1024 ),
                *UserName = (char *) malloc ( 1024 ),
                *Password = (char *) malloc ( 1024 ),
                *lcell,
                lrealm [ 1024 ],
                realm [ 1024 ],
                instance [ 1024 ];

        int     retval = 0,
                local;

afs_int32 password_expires = -1;

        Date LifeTime = 24 * 3600;

        pruclient = NULL;

        strcpy ( UserName, argv [ 1 ] );
        strcpy ( Password, argv [ 2 ] );
        strcpy ( instance, "" );

retval = ka_Init(0);
printf ( "R1 = %d\n", retval );
printf ( "R2 = %s, %d\n", lcell, local );
retval = ka_CellToRealm (lcell, lrealm, &local);
printf ( "R3 = %d, %s, %d\n", retval, lrealm, local );
strcpy ( realm, lcell );
retval = ka_CellToRealm (realm, realm, &local);
printf ( "R4 = %d\n", retval );

printf ( "R5 = %d, %d\n", retval, local );

        if ( ! retval )
        {
                retval = ka_UserAuthenticateGeneral (  
KA_USERAUTH_ONLY_VERIFY+KA_USERAUTH_VERSION,
                                                        UserName,
                                                        instance,
                                                        realm,
                                                        Password,
                                                        3600 * 5,
                                                        &password_expires,
                                                        0,
                                                        &Reason);

        }

        pr_End ();

        printf ( "%d, %s\n", retval, Reason );
}