|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1989 The Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted provided ! 6: * that: (1) source distributions retain this entire copyright notice and ! 7: * comment, and (2) distributions including binaries display the following ! 8: * acknowledgement: ``This product includes software developed by the ! 9: * University of California, Berkeley and its contributors'' in the ! 10: * documentation or other materials provided with the distribution and in ! 11: * all advertising materials mentioning features or use of this software. ! 12: * Neither the name of the University nor the names of its contributors may ! 13: * be used to endorse or promote products derived from this software without ! 14: * specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 16: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 17: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: */ ! 19: ! 20: #ifndef lint ! 21: static char sccsid[] = "@(#)krcmd.c 1.6.1.1 (Berkeley) 10/21/90"; ! 22: #endif /* not lint */ ! 23: ! 24: /* ! 25: * $Source: /mit/kerberos/ucb/mit/kcmd/RCS/krcmd.c,v $ ! 26: * $Header: /mit/kerberos/ucb/mit/kcmd/RCS/krcmd.c,v 5.1 ! 27: * 89/07/25 15:38:44 kfall Exp Locker: kfall $ ! 28: * static char *rcsid_kcmd_c = ! 29: * "$Header: /mit/kerberos/ucb/mit/kcmd/RCS/krcmd.c,v 5.1 89/07/25 15:38:44 ! 30: * kfall Exp Locker: kfall $"; ! 31: */ ! 32: ! 33: #ifdef KERBEROS ! 34: #include <sys/types.h> ! 35: #include <stdio.h> ! 36: #include <kerberosIV/des.h> ! 37: #include <kerberosIV/krb.h> ! 38: ! 39: #define SERVICE_NAME "rcmd" ! 40: ! 41: /* ! 42: * krcmd: simplified version of Athena's "kcmd" ! 43: * returns a socket attached to the destination, -1 or krb error on error ! 44: * if fd2p is non-NULL, another socket is filled in for it ! 45: */ ! 46: ! 47: int ! 48: krcmd(ahost, rport, remuser, cmd, fd2p, realm) ! 49: char **ahost; ! 50: u_short rport; ! 51: char *remuser, *cmd; ! 52: int *fd2p; ! 53: char *realm; ! 54: { ! 55: int sock = -1, err = 0; ! 56: KTEXT_ST ticket; ! 57: long authopts = 0L; ! 58: ! 59: err = kcmd( ! 60: &sock, ! 61: ahost, ! 62: rport, ! 63: NULL, /* locuser not used */ ! 64: remuser, ! 65: cmd, ! 66: fd2p, ! 67: &ticket, ! 68: SERVICE_NAME, ! 69: realm, ! 70: (CREDENTIALS *) NULL, /* credentials not used */ ! 71: (bit_64 *) NULL, /* key schedule not used */ ! 72: (MSG_DAT *) NULL, /* MSG_DAT not used */ ! 73: (struct sockaddr_in *) NULL, /* local addr not used */ ! 74: (struct sockaddr_in *) NULL, /* foreign addr not used */ ! 75: authopts ! 76: ); ! 77: ! 78: if (err > KSUCCESS && err < MAX_KRB_ERRORS) { ! 79: fprintf(stderr, "krcmd: %s\n", krb_err_txt[err]); ! 80: return(-1); ! 81: } ! 82: if (err < 0) ! 83: return(-1); ! 84: return(sock); ! 85: } ! 86: ! 87: #endif /* KERBEROS */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.