if (!tmp)
continue;
- id = silc_id_payload_parse_id(tmp, tmp_len, NULL);
- if (!id) {
+ id = silc_id_payload_parse_id(tmp, tmp_len, &id_type);
+ if (!id || id_type != SILC_ID_CLIENT) {
silc_server_query_add_error(server, query, TRUE, i + 4,
SILC_STATUS_ERR_BAD_CLIENT_ID);
continue;
for (i = 0; i < query->ids_count; i++)
silc_free(query->ids[i].id);
silc_free(query->ids);
+ query->ids = NULL;
+ query->ids_count = 0;
silc_free(id);
return;
}
/* Normal server must check whether this ID exist, and if not then
send the query to router, unless done so already */
if (server->server_type == SILC_SERVER && !query->resolved) {
- if (!silc_idlist_find_client_by_id(server->local_list,
- id, TRUE, NULL)) {
- if (cmd->sock->type != SILC_SOCKET_TYPE_CLIENT ||
- !silc_idlist_find_client_by_id(server->global_list,
+ if (id_type == SILC_ID_CLIENT) {
+ if (!silc_idlist_find_client_by_id(server->local_list,
id, TRUE, NULL)) {
- silc_server_query_send_router(server, query);
- for (i = 0; i < query->ids_count; i++)
- silc_free(query->ids[i].id);
- silc_free(query->ids);
- silc_free(id);
- return;
+ if (cmd->sock->type != SILC_SOCKET_TYPE_CLIENT ||
+ !silc_idlist_find_client_by_id(server->global_list,
+ id, TRUE, NULL)) {
+ silc_server_query_send_router(server, query);
+ for (i = 0; i < query->ids_count; i++)
+ silc_free(query->ids[i].id);
+ silc_free(query->ids);
+ query->ids = NULL;
+ query->ids_count = 0;
+ silc_free(id);
+ return;
+ }
}
+ } else {
+ /* For now all other ID's except Client ID's are explicitly
+ sent to router for resolving. */
+ silc_server_query_send_router(server, query);
+ for (i = 0; i < query->ids_count; i++)
+ silc_free(query->ids[i].id);
+ silc_free(query->ids);
+ query->ids = NULL;
+ query->ids_count = 0;
+ silc_free(id);
+ return;
}
}
SilcAttributeObjPk pk;
SilcAttributeObjService service;
unsigned char *tmp;
- unsigned char sign[2048];
+ unsigned char sign[2048 + 1];
SilcUInt32 sign_len;
SILC_LOG_DEBUG(("Constructing Requested Attributes"));
silc_strncat(service.address, sizeof(service.address),
server->server_name, strlen(server->server_name));
service.status = !(client_entry->mode & SILC_UMODE_DETACHED);
+ if (client_entry->connection)
+ service.idle = time(NULL) - client_entry->data.last_receive;
buffer = silc_attribute_payload_encode(buffer, attribute,
SILC_ATTRIBUTE_FLAG_VALID,
&service, sizeof(service));