X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fclient-agent%2Fsendmsg.c;h=454c2e71499c8604ef4e5125f2a2a4b07288f8d7;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=3c3606376c6e830e97f574d04c1d56c348e662c3;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a;p=ossec-hids.git diff --git a/src/client-agent/sendmsg.c b/src/client-agent/sendmsg.c old mode 100755 new mode 100644 index 3c36063..454c2e7 --- a/src/client-agent/sendmsg.c +++ b/src/client-agent/sendmsg.c @@ -1,42 +1,36 @@ -/* @(#) $Id: sendmsg.c,v 1.7 2009/12/01 20:27:00 dcid Exp $ */ - /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. * * This program is a free software; you can redistribute it * and/or modify it under the terms of the GNU General Public - * License (version 3) as published by the FSF - Free Software + * License (version 2) as published by the FSF - Free Software * Foundation */ - #include "shared.h" #include "agentd.h" - #include "os_net/os_net.h" - -/* Sends a message to the server */ -int send_msg(int agentid, char *msg) + +/* Send a message to the server */ +int send_msg(int agentid, const char *msg) { - int msg_size; - char crypt_msg[OS_MAXSTR +1]; + size_t msg_size; + char crypt_msg[OS_MAXSTR + 1]; msg_size = CreateSecMSG(&keys, msg, crypt_msg, agentid); - if(msg_size == 0) - { - merror(SEC_ERROR,ARGV0); - return(-1); + if (msg_size == 0) { + merror(SEC_ERROR, ARGV0); + return (-1); } /* Send msg_size of crypt_msg */ - if(OS_SendUDPbySize(logr->sock, msg_size, crypt_msg) < 0) - { - merror(SEND_ERROR,ARGV0, "server"); + if (OS_SendUDPbySize(agt->sock, msg_size, crypt_msg) < 0) { + merror(SEND_ERROR, ARGV0, "server"); sleep(1); - return(-1); + return (-1); } - return(0); + return (0); }