1 /* 2 * $Source: /mit/kerberos/ucb/mit/kcmd/RCS/krcmd.c,v $ 3 * $Header: /mit/kerberos/ucb/mit/kcmd/RCS/krcmd.c,v 5.1 89/07/25 15:38:44 kfall Exp Locker: kfall $ 4 */ 5 6 #ifndef lint 7 static char *rcsid_kcmd_c = 8 "$Header: /mit/kerberos/ucb/mit/kcmd/RCS/krcmd.c,v 5.1 89/07/25 15:38:44 kfall Exp Locker: kfall $"; 9 #endif lint 10 #define LIBC_SCCS 11 12 /* 13 * Copyright (c) 1989 The Regents of the University of California. 14 * All rights reserved. 15 * 16 * Redistribution and use in source and binary forms are permitted 17 * provided that the above copyright notice and this paragraph are 18 * duplicated in all such forms and that any documentation, 19 * advertising materials, and other materials related to such 20 * distribution and use acknowledge that the software was developed 21 * by the University of California, Berkeley. The name of the 22 * University may not be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 25 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 27 */ 28 29 #ifndef lint 30 static char sccsid[] = "@(#)krcmd.c 1.3 (Berkeley) 2/10/89"; 31 #endif /* not lint */ 32 33 #include <sys/types.h> 34 #include <stdio.h> 35 #include <krb.h> 36 37 #define SERVICE_NAME "rcmd" 38 39 int 40 krcmd(ahost, rport, remuser, cmd, fd2p, realm) 41 char **ahost; 42 u_short rport; 43 char *remuser, *cmd; 44 int *fd2p; 45 char *realm; 46 { 47 int sock = -1, err; 48 KTEXT_ST ticket; 49 long authopts = 0L; 50 51 err = kcmd( 52 &sock, 53 ahost, 54 rport, 55 NULL, /* locuser not used */ 56 remuser, 57 cmd, 58 fd2p, 59 &ticket, 60 SERVICE_NAME, 61 realm, 62 NULL, /* credentials not used */ 63 NULL, /* key schedule not used */ 64 NULL, /* MSG_DAT not used */ 65 NULL, /* local addr not used */ 66 NULL, /* foreign addr not used */ 67 authopts 68 ); 69 70 if(err > KSUCCESS && err < MAX_KRB_ERRORS) { 71 fprintf(stderr, "krcmd: %s\n", krb_err_txt[err]); 72 return(-1); 73 } 74 return(sock); 75 } 76 77 #include <sys/socket.h> 78 #include <netinet/in.h> 79 80 int 81 krcmd_mutual(ahost, rport, remuser, cmd, fd2p, realm, cred, sched) 82 char **ahost; 83 u_short rport; 84 char *remuser, *cmd; 85 int *fd2p; 86 char *realm; 87 CREDENTIALS *cred; 88 Key_schedule sched; 89 { 90 int sock, err; 91 KTEXT_ST ticket; 92 MSG_DAT msg_dat; 93 struct sockaddr_in laddr, faddr; 94 long authopts = KOPT_DO_MUTUAL; 95 96 err = kcmd( 97 &sock, 98 ahost, 99 rport, 100 NULL, /* locuser not used */ 101 remuser, 102 cmd, 103 fd2p, 104 &ticket, 105 SERVICE_NAME, 106 realm, 107 cred, /* filled in */ 108 sched, /* filled in */ 109 &msg_dat, /* filled in? */ 110 &laddr, /* filled in */ 111 &faddr, /* filled in */ 112 authopts 113 ); 114 115 if(err > KSUCCESS && err < MAX_KRB_ERRORS) { 116 fprintf(stderr, "krcmd_mutual: %s\n", krb_err_txt[err]); 117 return(-1); 118 } 119 return(sock); 120 } 121