2 minute analysis:
This function is mentioned in the error message. log2file is one of
those fancy "..." functions, allowing you to create a message and
populate it with the values of variables.
int rename_ex(const char *source, const char *destination)
{
    if (rename(source, destination)) {
        log2file(
            RENAME_ERROR,
            __local_name,
            source,
            destination,
            errno,
            strerror(errno)
        );

        return (-1);
    }

    return (0);
}

RENAME_ERROR:
#define RENAME_ERROR  "%s(1124): ERROR: Unable to rename file: '%s'."
It takes 2 values, both strings. The rename function above passes 5 to
it, a mix of strings and ints.
5 > 2, hence the error. I'm not sure how it will affect any important
functionality, maybe just logging.

In master RENAME_ERROR has been changed to:
#define RENAME_ERROR  "%s(1124): ERROR: Could not rename file '%s' to
'%s' due to [(%d)-(%s)]."
allowing all 5 variables to be used.

There are only a couple of instances where this message is used (from 2.8.3):
agentlessd/agentlessd.c:            merror(RENAME_ERROR, ARGV0, new_location);
shared/file_op.c:            RENAME_ERROR,
syscheckd/seechanges.c:            merror(RENAME_ERROR, ARGV0, filename);

It looks like the other instances have the correct number of
variables. The easiest fix is probably to copy the RENAME_ERROR from
master to RENAME_ERROR2, and modify file_op.c to use RENAME_ERROR2
instead.

These warnings all appear to be fixed in master though, so as usual I
recommend upgrading to a recent version of OSSEC. ;-)

On Mon, Aug 14, 2017 at 12:41 PM, R Brandt
<[email protected]> wrote:
> Was this issue resolved?
> I am getting the same error on CentOS 7.2 with ossec 2.8.3.
> Richard
>
> On Tuesday, July 19, 2016 at 1:14:03 PM UTC-6, Kumar G wrote:
>>
>> Thanks Dan.
>>
>> Let me check with the new code and see.
>>
>> On 19 July 2016 at 23:27, dan (ddp) <[email protected]> wrote:
>>>
>>> On Tue, Jul 19, 2016 at 1:32 PM, Kumar Mg <[email protected]> wrote:
>>> > Hi
>>> >
>>> > We are getting these message during compilation and not sure if any
>>> > code
>>> > update is required for the rename_ex function in src/shared/file_op.c.
>>> >
>>>
>>> I don't see any issues with it in the current source. I don't have
>>> 2.8.3 handy to check that.
>>>
>>> > Compiling on CentOS 7 for OSSEC 2.8.3 version.
>>> >
>>> >
>>> > *** Making shared ***
>>> >
>>> >
>>> >
>>> > make[1]: Entering directory `/OSSECSRC/src/shared'
>>> >
>>> > cc -c -g -Wall -I../ -I../headers   -DUSE_OPENSSL -DUSEINOTIFY
>>> > -DMAX_AGENTS=512   -DARGV0=\"shared-libs\" -DOSSECHIDS *.c
>>> >
>>> > file_op.c: In function 'rename_ex':
>>> >
>>> > file_op.c:660:9: warning: too many arguments for format
>>> > [-Wformat-extra-args]
>>> >
>>> >          );
>>> >
>>> >          ^
>>> >
>>> > ar cru lib_shared.a *.o
>>> >
>>> > ranlib lib_shared.a
>>> >
>>> > make[1]: Leaving directory `/OSSECSRC/src/shared'
>>> >
>>> >
>>> >
>>> > Thanks
>>> > Kumar
>>> >
>>> > --
>>> >
>>> > ---
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "ossec-list" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> > an
>>> > email to [email protected].
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "ossec-list" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ossec-list" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"ossec-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to