Path: blob/main/crypto/krb5/src/ccapi/lib/win/ccs_reply_proc.c
39566 views
/* ccapi/lib/win/ccs_reply_proc.c */1/*2* Copyright 2008 Massachusetts Institute of Technology.3* All Rights Reserved.4*5* Export of this software from the United States of America may6* require a specific license from the United States Government.7* It is the responsibility of any person or organization contemplating8* export to obtain such a license before exporting.9*10* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and11* distribute this software and its documentation for any purpose and12* without fee is hereby granted, provided that the above copyright13* notice appear in all copies and that both that copyright notice and14* this permission notice appear in supporting documentation, and that15* the name of M.I.T. not be used in advertising or publicity pertaining16* to distribution of the software without specific, written prior17* permission. Furthermore if you modify this software you must label18* your software as modified software and not distribute it in such a19* fashion that it might be confused with the original M.I.T. software.20* M.I.T. makes no representations about the suitability of21* this software for any purpose. It is provided "as is" without express22* or implied warranty.23*/2425#include <stdio.h>26#include <stdlib.h>27#include <windows.h>2829#include "cci_debugging.h"30#include "ccs_reply.h" /* generated by MIDL compiler */31#include "ccutils.h"32#include "tls.h"33#include "win-utils.h"343536void ccs_rpc_request_reply(37const long rpcmsg, /* Message type */38const char tspHandle[], /* Client's tspdata* */39const char* uuid, /* uuid for making thread-specific event name */40const long srvStartTime, /* Server Start Time */41const long cbIn, /* Length of buffer */42const char* chIn, /* Data buffer */43long* ret_status ) { /* Return code */4445HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX);46struct tspdata* tsp;47k5_ipc_stream stream;48long status = 0;4950memcpy(&tsp, tspHandle, sizeof(tsp));51if (!status) {52status = krb5int_ipc_stream_new (&stream); /* Create a stream for the request data */53}5455if (!status) { /* Put the data into the stream */56status = krb5int_ipc_stream_write (stream, chIn, cbIn);57}5859if (!status) { /* Put the data into the stream */60tspdata_setStream(tsp, stream);61}6263SetEvent(hEvent);64CloseHandle(hEvent);65*ret_status = status;66}6768void ccs_rpc_connect_reply(69const long rpcmsg, /* Message type */70const char tspHandle[], /* Client's tspdata* */71const char* uuid, /* uuid for making thread-specific event name */72const long srvStartTime, /* Server Start Time */73long* status ) { /* Return code */7475HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX);76DWORD* p = (DWORD*)(tspHandle);7778SetEvent(hEvent);79CloseHandle(hEvent);80}8182void ccapi_listen(83RPC_ASYNC_STATE* rpcState,84handle_t hBinding,85const long rpcmsg, /* Message type */86long* status ) { /* Return code */8788cci_debug_printf("%s %s!", __FUNCTION__, rpcState->UserInfo);89*status = 0;90}919293