mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
logging: validate flags passed from client in virtlogd
The virtlogd RPC messages all have a flags parameter. For sake of future error reporting we should be verifying these are all 0 for now. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
50896b2804
commit
b6cbabc551
@ -56,6 +56,7 @@ virLogManagerProtocolDispatchDomainOpenLogFile(virNetServerPtr server ATTRIBUTE_
|
||||
(unsigned char *)args->dom.uuid,
|
||||
args->dom.name,
|
||||
args->path,
|
||||
args->flags,
|
||||
&inode, &offset)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -89,6 +90,7 @@ virLogManagerProtocolDispatchDomainGetLogFilePosition(virNetServerPtr server ATT
|
||||
|
||||
if (virLogHandlerDomainGetLogFilePosition(virLogDaemonGetHandler(logDaemon),
|
||||
args->path,
|
||||
args->flags,
|
||||
&inode, &offset) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -127,7 +129,8 @@ virLogManagerProtocolDispatchDomainReadLogFile(virNetServerPtr server ATTRIBUTE_
|
||||
args->path,
|
||||
args->pos.inode,
|
||||
args->pos.offset,
|
||||
args->maxlen)) == NULL)
|
||||
args->maxlen,
|
||||
args->flags)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
ret->data = data;
|
||||
|
@ -357,6 +357,7 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
||||
const unsigned char *domuuid,
|
||||
const char *domname,
|
||||
const char *path,
|
||||
unsigned int flags,
|
||||
ino_t *inode,
|
||||
off_t *offset)
|
||||
{
|
||||
@ -364,6 +365,8 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
||||
virLogHandlerLogFilePtr file = NULL;
|
||||
int pipefd[2] = { -1, -1 };
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
virObjectLock(handler);
|
||||
|
||||
handler->inhibitor(true, handler->opaque);
|
||||
@ -432,6 +435,7 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
||||
int
|
||||
virLogHandlerDomainGetLogFilePosition(virLogHandlerPtr handler,
|
||||
const char *path,
|
||||
unsigned int flags,
|
||||
ino_t *inode,
|
||||
off_t *offset)
|
||||
{
|
||||
@ -439,6 +443,8 @@ virLogHandlerDomainGetLogFilePosition(virLogHandlerPtr handler,
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
virObjectLock(handler);
|
||||
|
||||
for (i = 0; i < handler->nfiles; i++) {
|
||||
@ -472,12 +478,15 @@ virLogHandlerDomainReadLogFile(virLogHandlerPtr handler,
|
||||
const char *path,
|
||||
ino_t inode,
|
||||
off_t offset,
|
||||
size_t maxlen)
|
||||
size_t maxlen,
|
||||
unsigned int flags)
|
||||
{
|
||||
virRotatingFileReaderPtr file = NULL;
|
||||
char *data = NULL;
|
||||
ssize_t got;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
virObjectLock(handler);
|
||||
|
||||
if (!(file = virRotatingFileReaderNew(path, DEFAULT_MAX_BACKUP)))
|
||||
|
@ -48,11 +48,13 @@ int virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
||||
const unsigned char *domuuid,
|
||||
const char *domname,
|
||||
const char *path,
|
||||
unsigned int flags,
|
||||
ino_t *inode,
|
||||
off_t *offset);
|
||||
|
||||
int virLogHandlerDomainGetLogFilePosition(virLogHandlerPtr handler,
|
||||
const char *path,
|
||||
unsigned int flags,
|
||||
ino_t *inode,
|
||||
off_t *offset);
|
||||
|
||||
@ -60,7 +62,8 @@ char *virLogHandlerDomainReadLogFile(virLogHandlerPtr handler,
|
||||
const char *path,
|
||||
ino_t inode,
|
||||
off_t offset,
|
||||
size_t maxlen);
|
||||
size_t maxlen,
|
||||
unsigned int flags);
|
||||
|
||||
virJSONValuePtr virLogHandlerPreExecRestart(virLogHandlerPtr handler);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user