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

Derrick J Brashear shadow@andrew.cmu.edu
Mon, 16 Aug 2004 18:23:21 -0400


Works fine for me. I compiled it thusly, on Solaris 8
cc -g -R/usr/local/lib -I/usr/local/include -L/usr/local/lib 
-L/usr/local/lib/afs -o foo foo.c -lprot -lkauth -lauth -lrxkad -lrx 
-llwp -lsys -lcom_err -lubik -ldes -lafsutil -lsocket -lnsl -lcrypto 
-lresolv

Note that I have libdes replaced with a shim, which means I require 
libcrypto

R1 = 0
R2 = , 0
R3 = 0, ANDREW.CMU.EDU, 1
R4 = 0
R5 = 0, 1
0,

On Aug 11, 2004, at 7:33 PM, John Hayes wrote:

>
> #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 );
> }