void RPC2_setbindaddr(RPC2_HostIdent *host) { if (rpc2_bindhost.Tag == RPC2_HOSTBYADDRINFO) RPC2_freeaddrinfo(rpc2_bindhost.Value.AddrInfo); rpc2_bindhost.Tag = RPC2_DUMMYHOST; if (!host) return; memcpy(&rpc2_bindhost, host, sizeof(RPC2_HostIdent)); if (host->Tag == RPC2_HOSTBYADDRINFO) rpc2_bindhost.Value.AddrInfo = RPC2_copyaddrinfo(host->Value.AddrInfo); }
static int TryBinding(const RPC2_Integer AuthenticationType, const char *viceName, const int viceNamelen, const char *vicePasswd, const int vicePasswdlen, const struct RPC2_addrinfo *AuthHost, RPC2_Handle *RPCid) { RPC2_BindParms bp; RPC2_HostIdent hident; RPC2_SubsysIdent sident; RPC2_CountedBS cident; RPC2_EncryptionKey hkey; long rc; int len; hident.Tag = RPC2_HOSTBYADDRINFO; hident.Value.AddrInfo = RPC2_copyaddrinfo(AuthHost); sident.Tag = RPC2_SUBSYSBYID; sident.Value.SubsysId = htonl(AUTH_SUBSYSID); cident.SeqLen = viceNamelen; cident.SeqBody = (RPC2_ByteSeq)viceName; len = vicePasswdlen; if ( len > RPC2_KEYSIZE) len = RPC2_KEYSIZE; memset(hkey, 0, RPC2_KEYSIZE); memcpy(hkey, vicePasswd, len); bp.SecurityLevel = RPC2_SECURE; bp.EncryptionType = RPC2_XOR; bp.SideEffectType = 0; bp.AuthenticationType = AuthenticationType; bp.ClientIdent = &cident; bp.SharedSecret = &hkey; rc = RPC2_NewBinding(&hident, NULL, &sident, &bp, RPCid); RPC2_freeaddrinfo(hident.Value.AddrInfo); return (rc); }