ia64/xen-unstable

changeset 10047:891e0d1cf4ab

dom0 and anonymous connections can create unlimited sized entries in the store.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Thu May 11 15:51:56 2006 +0100 (2006-05-11)
parents 08f5adb5058b
children d0c7cc0afd15
files tools/xenstore/xenstored_core.c tools/xenstore/xenstored_domain.c tools/xenstore/xenstored_domain.h
line diff
     1.1 --- a/tools/xenstore/xenstored_core.c	Thu May 11 15:01:54 2006 +0100
     1.2 +++ b/tools/xenstore/xenstored_core.c	Thu May 11 15:51:56 2006 +0100
     1.3 @@ -461,7 +461,7 @@ static bool write_node(struct connection
     1.4  		+ node->num_perms*sizeof(node->perms[0])
     1.5  		+ node->datalen + node->childlen;
     1.6  
     1.7 -	if (data.dsize >= quota_max_entry_size)
     1.8 +	if (domain_is_unprivileged(conn) && data.dsize >= quota_max_entry_size)
     1.9  		goto error;
    1.10  
    1.11  	data.dptr = talloc_size(node, data.dsize);
     2.1 --- a/tools/xenstore/xenstored_domain.c	Thu May 11 15:01:54 2006 +0100
     2.2 +++ b/tools/xenstore/xenstored_domain.c	Thu May 11 15:51:56 2006 +0100
     2.3 @@ -250,6 +250,11 @@ bool domain_can_read(struct connection *
     2.4  	return (intf->req_cons != intf->req_prod);
     2.5  }
     2.6  
     2.7 +bool domain_is_unprivileged(struct connection *conn)
     2.8 +{
     2.9 +	return (conn && conn->domain && conn->domain->domid != 0);
    2.10 +}
    2.11 +
    2.12  bool domain_can_write(struct connection *conn)
    2.13  {
    2.14  	struct xenstore_domain_interface *intf = conn->domain->interface;
    2.15 @@ -587,7 +592,7 @@ void domain_entry_dec(struct connection 
    2.16  
    2.17  int domain_entry(struct connection *conn)
    2.18  {
    2.19 -	return (conn && conn->domain && conn->domain->domid)
    2.20 +	return (domain_is_unprivileged(conn))
    2.21  		? conn->domain->nbentry
    2.22  		: 0;
    2.23  }
    2.24 @@ -609,7 +614,7 @@ void domain_watch_dec(struct connection 
    2.25  
    2.26  int domain_watch(struct connection *conn)
    2.27  {
    2.28 -	return (conn && conn->domain && conn->domain->domid)
    2.29 +	return (domain_is_unprivileged(conn))
    2.30  		? conn->domain->nbwatch
    2.31  		: 0;
    2.32  }
     3.1 --- a/tools/xenstore/xenstored_domain.h	Thu May 11 15:01:54 2006 +0100
     3.2 +++ b/tools/xenstore/xenstored_domain.h	Thu May 11 15:51:56 2006 +0100
     3.3 @@ -47,6 +47,8 @@ void restore_existing_connections(void);
     3.4  bool domain_can_read(struct connection *conn);
     3.5  bool domain_can_write(struct connection *conn);
     3.6  
     3.7 +bool domain_is_unprivileged(struct connection *conn);
     3.8 +
     3.9  /* Quota manipulation */
    3.10  void domain_entry_inc(struct connection *conn);
    3.11  void domain_entry_dec(struct connection *conn);