示例#1
0
static void do_client_capabilities(struct vdagent_virtio_port *vport,
    VDAgentMessage *message_header,
    VDAgentAnnounceCapabilities *caps)
{
    int new_size = VD_AGENT_CAPS_SIZE_FROM_MSG_SIZE(message_header->size);

    if (capabilities_size != new_size) {
        capabilities_size = new_size;
        free(capabilities);
        capabilities = malloc(capabilities_size * sizeof(uint32_t));
        if (!capabilities) {
            syslog(LOG_ERR, "oom allocating capabilities array (read)");
            capabilities_size = 0;
            return;
        }
    }
    memcpy(capabilities, caps->caps, capabilities_size * sizeof(uint32_t));
    if (caps->request) {
        /* Report the previous client has disconneced. */
        do_client_disconnect();
        if (debug)
            syslog(LOG_DEBUG, "New client connected");
        client_connected = 1;
        send_capabilities(vport, 0);
    }
}
示例#2
0
void Seat::seat_bind_resource(Resource *resource)
{
    send_capabilities(resource->handle, capability_keyboard | capability_pointer);
}
示例#3
0
/*
 * m_pass() - Added Sat, 4 March 1989
 *
 *
 * mr_pass - PASS message handler
 *      parv[0] = sender prefix
 *      parv[1] = password
 *      parv[2] = "TS" if this server supports TS.
 *      parv[3] = optional TS version field -- needed for TS6
 */
static int
mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	if(client_p->localClient->passwd)
	{
		memset(client_p->localClient->passwd, 0, strlen(client_p->localClient->passwd));
		rb_free(client_p->localClient->passwd);
	}

	client_p->localClient->passwd = rb_strndup(parv[1], PASSWDLEN);

	if(parc > 2)
	{
#ifdef COMPAT_211
		/* detected 2.11 protocol? */
		if (strlen(parv[2]) == 10 && parc > 4) {
			if (strchr(parv[4], 'Z'))
				client_p->localClient->caps |= CAP_ZIP;
			if (strchr(parv[4], 'T'))
				client_p->localClient->caps |= CAP_TB;
			if (strchr(parv[4], 'j'))
				client_p->localClient->caps |= CAP_JAPANESE;

			if (!strcmp(parv[2], IRCNET_VERSTRING)) {
				/* nah, it's just us pretending, we're going to receive CAPAB.
				   Will fill the SID in server stage though. */
				client_p->localClient->caps |= CAP_TS6|CAPS_IRCNET;
			} else {
				/* True 2.11 */
				client_p->localClient->caps |= CAP_211|CAPS_IRCNET;
				/* As we're never going to receive CAPAB for this one */
				client_p->localClient->fullcaps =	
					rb_strdup(send_capabilities(NULL, client_p->localClient->caps));
			}
			return 0;
		}
#endif
		/* 
		 * It looks to me as if orabidoo wanted to have more
		 * than one set of option strings possible here...
		 * i.e. ":AABBTS" as long as TS was the last two chars
		 * however, as we are now using CAPAB, I think we can
		 * safely assume if there is a ":TS" then its a TS server
		 * -Dianora
		 */
		if(irccmp(parv[2], "TS") == 0 && client_p->tsinfo == 0)
			client_p->tsinfo = TS_DOESTS;

		if(parc == 5 && atoi(parv[3]) >= 6)
		{
			/* only mark as TS6 if the SID is valid.. */
			if(check_sid(parv[4]))
			{
				client_p->localClient->caps |= CAP_TS6;
				strcpy(client_p->id, parv[4]);
			}
		}
	}

	return 0;
}