/* Get requested attributes if set */
tmp = silc_argument_get_arg_type(cmd->args, 3, &tmp_len);
- if (tmp)
+ if (tmp && tmp_len <= SILC_ATTRIBUTE_MAX_REQUEST_LEN)
query->attrs = silc_attribute_payload_parse(tmp, tmp_len);
break;
}
}
+ /* Remove the NOATTR status periodically */
+ if (client_entry->data.status & SILC_IDLIST_STATUS_NOATTR &&
+ client_entry->updated + 600 < time(NULL))
+ client_entry->data.status &= ~SILC_IDLIST_STATUS_NOATTR;
+
/* When requested attributes is present and local client is detached
we cannot send the command to the client, we'll reply on behalf of
the client instead. */
client_entry->data.status |= SILC_IDLIST_STATUS_RESOLVING;
client_entry->data.status &= ~SILC_IDLIST_STATUS_RESOLVED;
client_entry->resolve_cmd_ident = ident;
+ client_entry->updated = time(NULL);
/* Save the queried ID, which we will reprocess after we get this and
all other queries back. */
buffer = silc_attribute_payload_encode(buffer, attribute,
SILC_ATTRIBUTE_FLAG_VALID,
&service, sizeof(service));
+ if (!buffer)
+ return NULL;
break;
case SILC_ATTRIBUTE_STATUS_MOOD:
(void *)
SILC_ATTRIBUTE_MOOD_NORMAL,
sizeof(SilcUInt32));
+ if (!buffer)
+ return NULL;
break;
case SILC_ATTRIBUTE_STATUS_FREETEXT:
buffer = silc_attribute_payload_encode(buffer, attribute,
SILC_ATTRIBUTE_FLAG_VALID,
tmp, strlen(tmp));
+ if (!buffer)
+ return NULL;
break;
case SILC_ATTRIBUTE_PREFERRED_CONTACT:
(void *)
SILC_ATTRIBUTE_CONTACT_CHAT,
sizeof(SilcUInt32));
+ if (!buffer)
+ return NULL;
break;
case SILC_ATTRIBUTE_USER_PUBLIC_KEY:
SILC_ATTRIBUTE_FLAG_INVALID,
&pk, sizeof(pk));
silc_free(pk.data);
+ if (!buffer)
+ return NULL;
break;
}
buffer = silc_attribute_payload_encode(buffer, attribute,
SILC_ATTRIBUTE_FLAG_INVALID,
NULL, 0);
+ if (!buffer)
+ return NULL;
break;
default:
buffer = silc_attribute_payload_encode(buffer, attribute,
SILC_ATTRIBUTE_FLAG_INVALID,
NULL, 0);
+ if (!buffer)
+ return NULL;
break;
}
}
SILC_ATTRIBUTE_FLAG_INVALID,
&pk, sizeof(pk));
silc_free(pk.data);
+ if (!buffer)
+ return NULL;
/* Finally compute the digital signature of all the data we provided
as an indication that we provided rightfull information, and this
SILC_ATTRIBUTE_FLAG_VALID,
&pk, sizeof(pk));
}
+ if (!buffer)
+ return NULL;
return buffer;
}