#include #include #include "firsttry.h" /* CpSc 824 Simple "hello world" program that demonstrates an rpc call. */ main (int argc, char *argv[]) { CLIENT *cl; char **p; char netname[MAXNETNAMELEN+1]; if (argc != 2) { printf("Usage: firstmain hostname\n"); exit(1); } cl = clnt_create(argv[1],FIRSTTRYPROG, FIRSTTRYVERS, "tcp"); if (cl == NULL) { clnt_pcreateerror(argv[1]); exit(1); } /* Add Unix credentials */ strcpy(netname, "clear"); auth_destroy(cl -> cl_auth); /* Destroy default auth info */ if ((user2netname(netname, getuid(), NULL)) != 1) { printf("Debug: netname=%s\n", netname); perror("netname"); exit(1); } printf("Debug: netname=%s\n", netname); if ((cl -> cl_auth = authdes_seccreate(netname, 60, NULL, NULL)) == NULL) { perror("seccreate"); exit(2); } printf("Getting ready to call firsttry\n"); p = firsttry_1(NULL,cl); printf("Back from firsttry\n"); if (p == NULL) { clnt_perror(cl,argv[1]); exit(1); } printf("Returned string=%s\n",*p); }