📄 krb_sendauth.3
字号:
.\" $Source: /usr/src/kerberosIV/man/RCS/krb_sendauth.3,v $.\" $Author: kfall $.\" $Header: /usr/src/kerberosIV/man/RCS/krb_sendauth.3,v 4.2 90/06/25 21:12:26 kfall Exp $.\" Copyright 1988 by the Massachusetts Institute of Technology..\".\" For copying and distribution information,.\" please see the file <mit-copyright.h>..\".TH KRB_SENDAUTH 3 "Kerberos Version 4.0" "MIT Project Athena".SH NAMEkrb_sendauth, krb_recvauth, krb_net_write, krb_net_read \-Kerberos routines for sending authentication via network stream sockets.SH SYNOPSIS.nf.nj.ft B#include <kerberosIV/krb.h>#include <kerberosIV/des.h>#include <netinet/in.h>.PP.fi.HP 1i.ft Bint krb_sendauth(options, fd, ktext, service, inst, realm, checksum,msg_data, cred, schedule, laddr, faddr, version).nf.RS 0.ft Blong options;int fd;KTEXT ktext;char *service, *inst, *realm;u_long checksum;MSG_DAT *msg_data;CREDENTIALS *cred;Key_schedule schedule;struct sockaddr_in *laddr, *faddr;char *version;.PP.fi.HP 1i.ft Bint krb_recvauth(options, fd, ktext, service, inst, faddr, laddr,auth_data, filename, schedule, version).nf.RS 0.ft Blong options;int fd;KTEXT ktext;char *service, *inst;struct sockaddr_in *faddr, *laddr;AUTH_DAT *auth_data;char *filename;Key_schedule schedule;char *version; .PP.ft Bint krb_net_write(fd, buf, len)int fd;char *buf;int len;.PP.ft Bint krb_net_read(fd, buf, len)int fd;char *buf;int len;.fi.SH DESCRIPTION.PPThese functions,which are built on top of the core Kerberos library,provide a convenient means for client and serverprograms to send authentication messagesto one another through network connections.The.I krb_sendauthfunction sends an authenticated ticket from the client program tothe server program by writing the ticket to a network socket.The.I krb_recvauthfunction receives the ticket from the client byreading from a network socket..SH KRB_SENDAUTH.PPThis function writes the ticket tothe network socket specified by thefile descriptor.IR fd,returning KSUCCESS if the write proceeds successfully,and an error code if it does not.The.I ktextargument should point to an allocated KTEXT_ST structure.The.IR service,.IR inst,and.IR realmarguments specify the server program's Kerberos principal name,instance, and realm.If you are writing a client that uses the local realm exclusively,you can set the.I realmargument to NULL.The.I versionargument allows the client program to pass an application-specificversion string that the server program can then match againstits own version string.The.I versionstring can be up to KSEND_VNO_LEN (see .IR <krb.h> )characters in length.The.I checksumargument can be used to pass checksum information to theserver program.The client program is responsible for specifying this information.This checksum information is difficult to corrupt because.I krb_sendauthpasses it over the network in encrypted form.The.I checksumargument is passed as the checksum argument to.IR krb_mk_req .You can set.IR krb_sendauth'sother arguments to NULL unless you want theclient and server programs to mutually authenticatethemselves.In the case of mutual authentication,the client authenticates itself to the server program,and demands that the server in turn authenticate itself tothe client..SH KRB_SENDAUTH AND MUTUAL AUTHENTICATION.PPIf you want mutual authentication,make sure that you read all pending data from the local socketbefore calling.IR krb_sendauth.Set.IR krb_sendauth's.I optionsargument to.BR KOPT_DO_MUTUAL(this macro is defined in the.IR krb.hfile);make sure that the.I laddrargument points tothe address of the local socket,and that.I faddrpoints to the foreign socket's network address..I Krb_sendauthfills in the other arguments--.IR msg_data ,.IR cred ,and.IR schedule --beforesending the ticket to the server program.You must, however, allocate space for these argumentsbefore calling the function..I Krb_sendauthsupports two other options:.BR KOPT_DONT_MK_REQ,and.BR KOPT_DONT_CANON.If called with.I optionsset as KOPT_DONT_MK_REQ,.I krb_sendauthwill not use the.I krb_mk_reqfunction to retrieve the ticket from the Kerberos server.The.I ktextargument must point to an existing ticket and authenticator (such aswould be created by .IR krb_mk_req ),and the.IR service,.IR inst,and.IR realmarguments can be set to NULL.If called with.I optionsset as KOPT_DONT_CANON,.I krb_sendauthwill not convert the service's instance to canonical form using .IR krb_get_phost (3).If you want to call.I krb_sendauthwith a multiple.I optionsspecification,construct.I optionsas a bitwise-OR of the options you want to specify..SH KRB_RECVAUTH.PPThe.I krb_recvauthfunctionreads a ticket/authenticator pair from the socket pointed to by the.I fdargument.Set the.I optionsargumentas a bitwise-OR of the options desired.Currently only KOPT_DO_MUTUAL is useful to the receiver.The.I ktextargumentshould point to an allocated KTEXT_ST structure..I Krb_recvauthfills.I ktextwith theticket/authenticator pair read from.IR fd ,then passes it to.IR krb_rd_req .The.I serviceand.I instargumentsspecify the expected service and instance for which the ticket wasgenerated. They are also passed to.IR krb_rd_req.The.I instargument may be set to "*" if the caller wishes.I krb_mk_reqto fill in the instance used (note that there must be space in the.I instargument to hold a full instance name, see .IR krb_mk_req (3)).The.I faddrargumentshould point to the address of the peer which is presenting the ticket.It is also passed to.IR krb_rd_req .If the client and server plan to mutually authenticateone another,the.I laddrargumentshould point to the local address of the file descriptor.Otherwise you can set this argument to NULL.The.I auth_dataargumentshould point to an allocated AUTH_DAT area.It is passed to and filled in by.IR krb_rd_req .The checksum passed to the corresponding.I krb_sendauthis available as part of the filled-in AUTH_DAT area.The.I filenameargumentspecifies the filenamewhich the service program should use to obtain its service key..I Krb_recvauthpasses.I filenameto the.I krb_rd_reqfunction.If you set this argument to "",.I krb_rd_reqlooks for the service key in the file.IR /etc/kerberosIV/srvtab.If the client and server are performing mutual authentication,the.I scheduleargumentshould point to an allocated Key_schedule.Otherwise it is ignored and may be NULL.The.I versionargument should point to a character array of at least KSEND_VNO_LENcharacters. It is filled in with the version string passed by the client to.IR krb_sendauth..PP.SH KRB_NET_WRITE AND KRB_NET_READ.PPThe.I krb_net_writefunctionemulates the write(2) system call, but guarantees that all dataspecified is written to.I fdbefore returning, unless an error condition occurs..PPThe.I krb_net_readfunctionemulates the read(2) system call, but guarantees that the requestedamount of data is read from.I fdbefore returning, unless an error condition occurs..PP.SH BUGS.IR krb_sendauth,.IR krb_recvauth,.IR krb_net_write,and.IR krb_net_readwill not work properly on sockets set to non-blocking I/O mode..SH SEE ALSOkrb_mk_req(3), krb_rd_req(3), krb_get_phost(3).SH AUTHORJohn T. Kohl, MIT Project Athena.SH RESTRICTIONSCopyright 1988, Massachusetts Instititute of Technology.For copying and distribution information,please see the file <mit-copyright.h>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -