On 09.05.2013 14:59, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > Introduce use of a virDomainDefPtr in the domain lookup > APIs to simplify introduction of ACL security checks. > The virDomainPtr cannot be safely used, since the app > may have supplied mis-matching name/uuid/id fields. eg > the name points to domain X, while the uuid points to > domain Y. Resolving the virDomainPtr to a virDomainDefPtr > ensures a consistent name/uuid/id set. > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> > --- > src/conf/domain_conf.c | 24 ++++++++ > src/conf/domain_conf.h | 4 ++ > src/libvirt_private.syms | 1 + > src/xen/xen_driver.c | 147 +++++++++++++++++++++++++++++++---------------- > src/xen/xen_hypervisor.c | 17 +++--- > src/xen/xen_hypervisor.h | 8 +-- > src/xen/xen_inotify.c | 14 ++--- > src/xen/xend_internal.c | 34 +++++------ > src/xen/xend_internal.h | 4 +- > src/xen/xm_internal.c | 30 ++++------ > src/xen/xm_internal.h | 5 +- > 11 files changed, 173 insertions(+), 115 deletions(-) > > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c > index d55ce6b..61995cd 100644 > --- a/src/conf/domain_conf.c > +++ b/src/conf/domain_conf.c > @@ -2048,6 +2048,30 @@ error: > return NULL; > } > > + > +virDomainDefPtr virDomainDefNew(const char *name, > + const unsigned char *uuid, > + int id) > +{ > + virDomainDefPtr def; > + > + if (VIR_ALLOC(def) < 0) { > + virReportOOMError(); > + return NULL; > + } > + > + if (!(def->name = strdup(name))) { > + VIR_FREE(def); > + return NULL; > + } Can you switch to VIR_STRDUP instead? Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list