Ejemplo n.º 1
0
void InitInstance(Skype_Inst *pInst)
{
	memset(pInst, 0, sizeof(Skype_Inst));
	GenSessionKey(pInst->SessionKey, sizeof(pInst->SessionKey));
	InitNodeId(pInst);
	memcpy(pInst->Language, "en", 2);
	pInst->PublicIP = 0x7F000001;	// 127.0.0.1, we could use hostscan to get real IP, but not necessary for just login
#ifdef DEBUG
	pInst->pfLog = (int (__cdecl *)(void *, const char *, ...))fprintf;
	pInst->pLogStream = stdout;
#endif
}
Ejemplo n.º 2
0
static AJ_Status AuthResponse(AJ_Message* msg, char* inStr)
{
    AJ_Status status;
    char* buf;

    if (authContext.sasl.state == AJ_SASL_AUTHENTICATED) {
        return GenSessionKey(msg);
    }
    /*
     * Need a short-lived buffer to compose the response
     */
    buf = (char*)AJ_Malloc(AUTH_BUF_LEN);
    if (!buf) {
        status = AJ_ERR_RESOURCES;
    } else {
        status = AJ_SASL_Advance(&authContext.sasl, inStr, buf, AUTH_BUF_LEN);
        if (status == AJ_OK) {
            AJ_Message call;
            AJ_MarshalMethodCall(msg->bus, &call, AJ_METHOD_AUTH_CHALLENGE, msg->sender, 0, AJ_NO_FLAGS, AUTH_CALL_TIMEOUT);
            AJ_MarshalArgs(&call, "s", buf);
            status = AJ_DeliverMsg(&call);
        }
        AJ_Free(buf);
    }
    /*
     * If there was an error finalize the auth mechanism
     */
    if (status != AJ_OK) {
        if (authContext.sasl.mechanism) {
            authContext.sasl.mechanism->Final(authContext.peerGuid);
        }
        /*
         * Report authentication failure to application
         */
        if (status != AJ_OK) {
            PeerAuthComplete(status);
        }
    }
    return status;
}