mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-06 17:17:56 +03: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,
|
(unsigned char *)args->dom.uuid,
|
||||||
args->dom.name,
|
args->dom.name,
|
||||||
args->path,
|
args->path,
|
||||||
|
args->flags,
|
||||||
&inode, &offset)) < 0)
|
&inode, &offset)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -89,6 +90,7 @@ virLogManagerProtocolDispatchDomainGetLogFilePosition(virNetServerPtr server ATT
|
|||||||
|
|
||||||
if (virLogHandlerDomainGetLogFilePosition(virLogDaemonGetHandler(logDaemon),
|
if (virLogHandlerDomainGetLogFilePosition(virLogDaemonGetHandler(logDaemon),
|
||||||
args->path,
|
args->path,
|
||||||
|
args->flags,
|
||||||
&inode, &offset) < 0)
|
&inode, &offset) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -127,7 +129,8 @@ virLogManagerProtocolDispatchDomainReadLogFile(virNetServerPtr server ATTRIBUTE_
|
|||||||
args->path,
|
args->path,
|
||||||
args->pos.inode,
|
args->pos.inode,
|
||||||
args->pos.offset,
|
args->pos.offset,
|
||||||
args->maxlen)) == NULL)
|
args->maxlen,
|
||||||
|
args->flags)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret->data = data;
|
ret->data = data;
|
||||||
|
@ -357,6 +357,7 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
|||||||
const unsigned char *domuuid,
|
const unsigned char *domuuid,
|
||||||
const char *domname,
|
const char *domname,
|
||||||
const char *path,
|
const char *path,
|
||||||
|
unsigned int flags,
|
||||||
ino_t *inode,
|
ino_t *inode,
|
||||||
off_t *offset)
|
off_t *offset)
|
||||||
{
|
{
|
||||||
@ -364,6 +365,8 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
|||||||
virLogHandlerLogFilePtr file = NULL;
|
virLogHandlerLogFilePtr file = NULL;
|
||||||
int pipefd[2] = { -1, -1 };
|
int pipefd[2] = { -1, -1 };
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
virObjectLock(handler);
|
virObjectLock(handler);
|
||||||
|
|
||||||
handler->inhibitor(true, handler->opaque);
|
handler->inhibitor(true, handler->opaque);
|
||||||
@ -432,6 +435,7 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
|||||||
int
|
int
|
||||||
virLogHandlerDomainGetLogFilePosition(virLogHandlerPtr handler,
|
virLogHandlerDomainGetLogFilePosition(virLogHandlerPtr handler,
|
||||||
const char *path,
|
const char *path,
|
||||||
|
unsigned int flags,
|
||||||
ino_t *inode,
|
ino_t *inode,
|
||||||
off_t *offset)
|
off_t *offset)
|
||||||
{
|
{
|
||||||
@ -439,6 +443,8 @@ virLogHandlerDomainGetLogFilePosition(virLogHandlerPtr handler,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
virObjectLock(handler);
|
virObjectLock(handler);
|
||||||
|
|
||||||
for (i = 0; i < handler->nfiles; i++) {
|
for (i = 0; i < handler->nfiles; i++) {
|
||||||
@ -472,12 +478,15 @@ virLogHandlerDomainReadLogFile(virLogHandlerPtr handler,
|
|||||||
const char *path,
|
const char *path,
|
||||||
ino_t inode,
|
ino_t inode,
|
||||||
off_t offset,
|
off_t offset,
|
||||||
size_t maxlen)
|
size_t maxlen,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virRotatingFileReaderPtr file = NULL;
|
virRotatingFileReaderPtr file = NULL;
|
||||||
char *data = NULL;
|
char *data = NULL;
|
||||||
ssize_t got;
|
ssize_t got;
|
||||||
|
|
||||||
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
virObjectLock(handler);
|
virObjectLock(handler);
|
||||||
|
|
||||||
if (!(file = virRotatingFileReaderNew(path, DEFAULT_MAX_BACKUP)))
|
if (!(file = virRotatingFileReaderNew(path, DEFAULT_MAX_BACKUP)))
|
||||||
|
@ -48,11 +48,13 @@ int virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
|||||||
const unsigned char *domuuid,
|
const unsigned char *domuuid,
|
||||||
const char *domname,
|
const char *domname,
|
||||||
const char *path,
|
const char *path,
|
||||||
|
unsigned int flags,
|
||||||
ino_t *inode,
|
ino_t *inode,
|
||||||
off_t *offset);
|
off_t *offset);
|
||||||
|
|
||||||
int virLogHandlerDomainGetLogFilePosition(virLogHandlerPtr handler,
|
int virLogHandlerDomainGetLogFilePosition(virLogHandlerPtr handler,
|
||||||
const char *path,
|
const char *path,
|
||||||
|
unsigned int flags,
|
||||||
ino_t *inode,
|
ino_t *inode,
|
||||||
off_t *offset);
|
off_t *offset);
|
||||||
|
|
||||||
@ -60,7 +62,8 @@ char *virLogHandlerDomainReadLogFile(virLogHandlerPtr handler,
|
|||||||
const char *path,
|
const char *path,
|
||||||
ino_t inode,
|
ino_t inode,
|
||||||
off_t offset,
|
off_t offset,
|
||||||
size_t maxlen);
|
size_t maxlen,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
virJSONValuePtr virLogHandlerPreExecRestart(virLogHandlerPtr handler);
|
virJSONValuePtr virLogHandlerPreExecRestart(virLogHandlerPtr handler);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user