home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!sdd.hp.com!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!das-news.harvard.edu!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!jj1h+
- From: Joseph_Jackson@transarc.com
- Newsgroups: comp.protocols.kerberos
- Subject: Re: AFS calls from C code
- Message-ID: <IeYahfn0Bwwc06B6J7@transarc.com>
- Date: 19 Aug 92 07:40:27 GMT
- Article-I.D.: transarc.IeYahfn0Bwwc06B6J7
- References: <9208190055.AA38026@cs90code.csv-tgsc.amex-trs.com>
- Organization: Carnegie Mellon, Pittsburgh, PA
- Lines: 105
- In-Reply-To: <9208190055.AA38026@cs90code.csv-tgsc.amex-trs.com>
-
- Perhaps the program below is what you're looking for? It will
- implement something similar to the "pagsh" and "klog" combination.
- I'll include the Makefile followed by the single source file.
-
- If you have additional questions, you might consider talking to your
- local AFS Site Contacts. They have direct access to Transarc's
- AFS Product Support group and can submit questions on your behalf.
-
- Joe Jackson,
- AFS Product Support,
- Transarc Corp.
-
- _______________________________________________________________
- Makefile:
-
- PROGRAMS=afs-auth
-
- # AFSDIR = /afs/transarc.com/product/afs/3.1b/@sys
- AFSDIR = /usr/afsws
- AFSLIBDIR = $(AFSDIR)/lib
- AFSLIBS = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik \
- -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err \
- $(AFSLIBDIR)/afs/util.a
- INCLUDES = -I$(AFSDIR)/include
-
- LDFLAGS = $(AFSLIBS)
- CFLAGS = $(INCLUDES) -g -D_NO_PROTO
-
- all: $(PROGRAMS)
-
- .c: ; $(CC) $(CFLAGS) $@.c $(LDFLAGS) -o $@
-
-
- _______________________________________________________
- afs-auth.c:
-
- #include <afs/kautils.h>
-
- struct greet_info {
- char *name; /* user name */
- char *password; /* user password */
- char *string; /* random string */
- };
-
- int try_to_login();
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- int code;
- struct greet_info test_greet;
- static char name[128], password[128];
-
- memset(name,NULL,sizeof(name));
- memset(password,NULL,sizeof(password));
-
- printf("Enter AFS User Name: ");
- if( !gets(name) ){
- printf("Unable to grab name from stdin\n");
- perror("Error message returned");
- exit(1);
- }
- printf("Enter Password: ");
- if ( !gets(password) ){
- printf("Unable to grab password from stdin\n");
- perror("Error message returned");
- exit(1);
- }
-
- test_greet.name = name;
- test_greet.password = password;
-
- code = try_to_login(&test_greet);
-
- system ("/usr/ucb/groups;/usr/afsws/bin/tokens");
-
- return code;
- }
-
- int try_to_login (test_g)
- struct greet_info *test_g;
- {
-
- int code;
- char *reason;
-
- printf("\nName: %s\nPassword: %s\n", test_g->name, test_g->password);
-
- code = ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION+KA_USERAUTH_DOSETPAG,
- test_g->name,
- (char *) 0, /* instance */
- (char *) 0, /* realm */
- test_g->password,
- 0, /* lifetime, default */
- 0, 0, /* spares */
- &reason);
-
- if (code != 0)
- printf("AFS Verify failed because %s\n", reason);
- else
- printf("Verify succeeded\n");
-
- return code;
- }
-