krb_sendmutual.3krb

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3KRB 代码 · 共 350 行

3KRB
350
字号
.TH krb_sendmutual 3krb.SH Namekrb_sendmutual, krb_recvmutual \- Kerberos mutual authentication routines.SH Syntax.nf.nj \fB#include <krb.h>\fP \fB#include <des.h>\fP.PP \fBint krb_sendmutual\fP (\fIoptions, msg_out, success, fd,                              f_addr, l_addr, ad, schedule\fP).sp .5 \fBlong\fP			\fIoptions\fP; \fBKTEXT\fP		\fImsg_out\fP; \fBint\fP			\fIsuccess\fP; \fBint\fP			\fIfd\fP; \fBstruct sockaddr_in\fP	\fI*f_addr\fP; \fBstruct sockaddr_in\fP	\fI*l_addr\fP; \fBAUTH_DAT\fP		\fI*ad\fP; \fBKey_schedule\fP		\fIschedule\fP;.sp 1.5 \fBint krb_recvmutual\fP (\fIoptions, fd, checksum, msg_in,                              msg_data, cred, schedule, l_addr,                              f_addr\fP).sp .5 \fBlong\fP			\fIoptions\fP; \fBint\fP			\fIfd\fP; \fBu_long\fP			\fIchecksum\fP; \fBKTEXT\fP		\fImsg_in\fP; \fBMSG_DAT\fP		\fI*msg_data\fP; \fBCREDENTIALS\fP	\fI*cred\fP; \fBKey_schedule\fP		\fIschedule\fP; \fBstruct sockaddr_in\fP	\fI*l_addr\fP; \fBstruct sockaddr_in\fP	\fI*f_addr\fP;.PP.fi.SH Arguments.TP 9.I optionsdefined in .PN /usr/include/krb.h .There is only one optioncurrently supported, KOPT_NORDWR.  If this option is not set,the mutual authentication information is read either fromthe supplied file descriptor, \fIfd\fP, or sent across the supplied filedescriptor, \fIfd\fP.  If it is specified, then no datais read from or written to the file descriptor; instead, data is read fromand written to the buffers supplied asparameters, \fImsg_in\fP, \fImsg_out\fP..TP.I fdthe file descriptor used to send data to the foreignprincipal, or it is the file descriptor from which data fromthe foreign principal can be read..IPThe foreign principal is the principal to which the principal that calls a.PN krb_sendmutual(3krb)routine, the local principal, is attempting to mutually authenticate itself.The file descriptor must be associated with a socket that usesblocking I/O.  The \fIfd\fP parameter is not used if the KOPT_NORDWR optionis set. .TP.I f_addrthe address of the socket that the foreignprincipal uses to communicate with the local principal..TP.I l_addrthe address of the socket that the local principaluses to communicate with the foreign principal..TP.I msg_outIf KOPT_NORDWR is sent as an option, \fImsg_out\fP is used as a buffer to store the mutual authentication data thatshould be sent to the foreign principal.  If KOPT_NORDWR isnot set, \fImsg_out\fP is not used and the mutual authenticationmessage is written to \fIfd\fP..TP.I successIf success is not set to KSUCCESS, then the mutualauthentication message generated by .PN krb_sendmutualis a message indicating failure.  This parameter isuseful if the initial attempt to authenticate theforeign principal failed.  Since this initial authenticationattempt failed, then the attempt to authenticatethe local principal to the foreign principal also must fail.  If \fIsuccess\fP isset to KSUCCESS, then a mutual authentication message isgenerated..TP.I ada pointer to the AUTH_DAT structure that describes the authenticationassociation between the local and foreignprincipals.  The \fIad\fP structure is output from .PN krb_rd_req(see .PN kerberos(3krb) ) andis used as input to .PN krb_sendmutual .Space for the \fIad\fPstructure must be allocated..TP.I checksuminput to .PN krb_recvmutual ,it must have the samevalue as the .I checksumused as input to .PN krb_mk_req(see.PN kerberos(3krb) )or to.PN krb_sendauth(see.PN krb_sendauth(3krb) ).The checksum is included in the ticket-authenticator pair produced by.PN krb_mk_reqand sent by.PN krb_sendauthto the foreign principal.  It serves as a secret piece of data thatcan only be known to the foreign principal if the foreign principal wasauthenticated as the foreign principal.  It is included by.PN krb_sendmutualin the mutual authentication message.  If the checksum input to .PN krb_recvmutualmatches the one sent back by.PN krb_sendmutual ,then the caller of.PN krb_sendmutualis authenticated to the caller of.PN krb_recvmutual ..TP.I msg_inIf KOPT_NORDWR is sent as an option, then data in \fImsg_in\fP isread as if it contained the mutual authentication bitssent to the local principal by the foreign principal.If KOPT_NORDWR is not set, then \fImsg_in\fP is not used and themutual authentication message is read from \fIfd\fP..TP.I msg_dataa structure returned by .PN krb_recvmutualthat isfilled with the mutual authentication message sent to the local principal as well as information about the statusof the message.  Space must be allocated for the \fImsg_data\fPstructure..TP.I creda pointer to a credentials structure that is inputto .PN krb_recvmutual .The credentials structure that \fIcred\fP points to must be the credentials structure that includes the ticket that thelocal principal uses to authenticate the foreign principal.This credential structure isusually obtained through the use of .PN krb_get_cred(See.PN kerberos(3krb) )..TP.I schedulethe key schedule derived from the session keybetween the local and foreign principals.  It is input to both.PN krb_sendmutualand.PN krb_recvmutual ,and it can be generatedfrom the session key with .PN des_key_sched(see.PN des_crypt(3krb) )..SH Description.NXR "Kerberos routines" "krb_sendmutual".NXR "Kerberos routines" "krb_recvmutual"The .PN krb_sendmutual(3krb) routines are designed to be used by applications which communicateover the network, support "on-the-wire" protocols in which authenticationinformation can be placed, and require both parties in the communicationsprocess to be authenticated to the other (mutual authentication).  Theyare best used with.PN krb_mk_reqand.PN krb_rd_req .If a principal "A" calls.PN krb_mk_reqand sends the output to principal"B", which uses .PN krb_rd_reqto interpret the data successfully,then "B" will have authenticated principal "A".  But, principal "A" will not know thatthe message it sent was really received by "B".  To prove the identity of principal "B"to principal "A" after thecalls to.PN krb_mk_reqand.PN krb_rd_reqare finished,the.PN krb_sendmutual(3krb)calls are used..PP.PN krb_sendmutualand.PN krb_recvmutualcan also be used with  .PN krb_mk_reqand.PN krb_rd_reqby applications which cannot tolerate additions to their "on-the-wire"protocols.  After the communications channel between "A" and "B" isestablished, but before "A" and "B" communicate and before the "on-the-wire"protocol of the applications comes into effect,.PN krb_mk_reqand.PN krb_rd_reqcan be used as described above to authenticate "A" to "B"..PN krb_sendmutualand.PN krb_recvmutualcan then be used with the KOPT_NORDWR option not set to authenticate "B" to "A"..PPSince the authentication information is sent between the applications beforethe "on-the-wire" protocol of the application comes into effect, theapplication must develop some way to distinguish between the new authenticatedinitial message exchange and an old unauthenticated initial message exchange.This is not a recommended use for.PN krb_sendmutualand.PN krb_recvmutual .If you do not want to modify the "on-the-wire" protocol of an application, yetwant to authenticate the application, then use the .PN krb_sendauth(3krb)routines..PPThe routines of this library make extensive use of the following locallydefined data types: KTEXT, AUTH_DAT, CREDENTIALS, Key_schedule, andMSG_DAT.  For more specific information on the definitions of these datatypes, see the.PN des.hand.PN krb.hfiles..IP krb_sendmutual.PP.PN krb_sendmutualis used to produce and possibly send the datathat will authenticate principal "B" to principal "A".  If theauthentication of principal "A" did not succeed, \fIsuccess\fP shouldbe set to KFAILURE, and .PN krb_sendmutualproduces amessage indicating authentication failure.  If it is set toKSUCCESS, then.PN krb_sendmutualproduces the data necessary toauthenticate "B" to "A".  If the option KOPT_NORDWR is set, thedata is written to buffer \fImsg_out\fP; otherwise, it iswritten to file descriptor, \fIfd\fP.  .PPThe following is a list of the return values and, ifthey are error codes, their possible cause:.IP SENDMUT_OPNOTSUP 18The \fIoptions\fP bits sent to .PN krb_sendmutualcontain a bitthat is set but does not correspond to an option..IP SENDMUT_PARAMThe \fImsg_out\fP structure must have space within itallocated to store the message.  Otherwise, SENDMUT_PARAM is returnedif the KOPT_NORDWR option is set..IP SENDMUT_MAKMSGIf there is an error in forming the mutualauthentication message itself, SENDMUT_MAKMSG is returned..IP SENDMUT_WRIf the message cannot be written to the filedescriptor \fIfd\fP, SENDMUT_WR is returned..IP KSUCCESSIf the message has been correctly formed, KSUCCESSis returned..sp 2.IP krb_recvmutual.PPThe.PN krb_recvmutualroutineinterprets the mutual authenticationmessage sent to principal "A" by principal "B".  If the KOPT_NORDWR option is set, .PN krb_recvmutualreads from buffer \fImsg_in\fP, the message sentfrom "B" to "A".  Otherwise, it reads the message from file descriptor, \fIfd\fP.The \fIchecksum\fP sent as input to .PN krb_recvmutualmust be thesame checksum used as input to .PN krb_mk_req .The checksum is anintegral part of proving the identity of principal "B" to "A".The following is a list of the return values and, ifthey are error codes, their possible cause:.IP RECVMUT_OPNOTSUP 18The \fIoptions\fP bits sent to .PN krb_recvmutualcontain a bitthat is set, but does not correspond to an option..IP RECVMUT_MSGLENThe size of the \fImsg_in\fP buffer is incorrect..IP RECVMUT_RDIf the message cannot be read from the file descriptor \fIfd\fP, thenSENDMUT_RD is returned..IP RD_AP_VERSIONIf the Kerberos version used to create the mutualauthentication message is not currently supported by .PN krb_recvmutual ,then RD_AP_VERSION is returned..IP RD_AP_MSG_TYPEIf the message that is read from the file descriptor \fIfd\fP, orinput as \fImsg_in\fP is not a mutual authentication message,RD_AP_MSG_TYPE is returned..IP RD_AP_MODIFIEDIf the message has been modified between principals "B" and "A", or ifwas incorrectly produced, then RD_AP_MODIFIED isreturned..IP RD_AP_TIMEIf the mutual authentication message is tooold, RD_AP_TIME is returned..IP KFAILUREIf principal "A" was not authenticated to principal "B", or if the mutualauthentication message fails to identify "B", KFAILUREis returned..IP KSUCCESSIf principal "B" has been correctly authenticated to principal "A",KSUCCESS is returned..SH Restrictions.PN krb_sendmutualand.PN krb_recvmutualwill not work properly withsockets that do not use blocking I/O..SH See Alsokerberos(3krb), krb_sendauth(3krb), des_crypt(3krb), krb_svc_init(3krb)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?