X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Futil%2Fsyscheck_update.c;h=e39e3c88a83d94dc52a35cbe8cda0afd31fff5af;hp=1a7f25aa9757c5f1e464f569026303c33da3cda6;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/util/syscheck_update.c b/src/util/syscheck_update.c index 1a7f25a..e39e3c8 100755 --- a/src/util/syscheck_update.c +++ b/src/util/syscheck_update.c @@ -1,4 +1,5 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/util/syscheck_update.c, 2011/09/08 dcid Exp $ + */ /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. @@ -20,17 +21,16 @@ /** help **/ void helpmsg() { - printf("\nOSSEC HIDS %s: Updates the integrity check database.\n", ARGV0); + printf("\nOSSEC HIDS %s: Updates (clears) the integrity check database.\n", ARGV0); printf("Available options:\n"); printf("\t-h This help message.\n"); printf("\t-l List available agents.\n"); - printf("\t-a Update syscheck database for all agents.\n"); - printf("\t-u Update syscheck database for a specific agent.\n"); - printf("\t-u local Update syscheck database locally.\n\n"); + printf("\t-a Update (clear) syscheck database for all agents.\n"); + printf("\t-u Update (clear) syscheck database for a specific agent.\n"); + printf("\t-u local Update (clear) syscheck database locally.\n\n"); exit(1); } - /** main **/ int main(int argc, char **argv) { @@ -39,18 +39,18 @@ int main(int argc, char **argv) char *user = USER; int gid; int uid; - + /* Setting the name */ OS_SetName(ARGV0); - - + + /* user arguments */ if(argc < 2) { helpmsg(); } - + /* Getting the group name */ gid = Privsep_GetGroup(group); uid = Privsep_GetUser(user); @@ -59,14 +59,14 @@ int main(int argc, char **argv) ErrorExit(USER_ERROR, ARGV0, user, group); } - + /* Setting the group */ if(Privsep_SetGroup(gid) < 0) { ErrorExit(SETGID_ERROR,ARGV0, group); } - - + + /* Chrooting to the default directory */ if(Privsep_Chroot(dir) < 0) { @@ -76,14 +76,14 @@ int main(int argc, char **argv) /* Inside chroot now */ nowChroot(); - + /* Setting the user */ if(Privsep_SetUser(uid) < 0) { ErrorExit(SETUID_ERROR, ARGV0, user); } - + /* User options */ if(strcmp(argv[1], "-h") == 0) { @@ -91,7 +91,7 @@ int main(int argc, char **argv) } else if(strcmp(argv[1], "-l") == 0) { - printf("\nOSSEC HIDS %s: Updates the integrity check database.", + printf("\nOSSEC HIDS %s: Updates the integrity check database.", ARGV0); print_agents(0, 0, 0); printf("\n"); @@ -129,7 +129,7 @@ int main(int argc, char **argv) } snprintf(full_path, OS_MAXSTR,"%s/%s", SYSCHECK_DIR, entry->d_name); - + fp = fopen(full_path, "w"); if(fp) { @@ -142,7 +142,7 @@ int main(int argc, char **argv) } closedir(sys_dir); - printf("\n** Integrity check database updated.\n\n"); + printf("\n** Integrity check database updated.\n\n"); exit(0); } else @@ -151,14 +151,14 @@ int main(int argc, char **argv) helpmsg(); } - + /* local */ if(strcmp(argv[2],"local") == 0) { char final_dir[1024]; FILE *fp; snprintf(final_dir, 1020, "/%s/syscheck", SYSCHECK_DIR); - + fp = fopen(final_dir, "w"); if(fp) { @@ -169,7 +169,7 @@ int main(int argc, char **argv) /* Deleting cpt file */ snprintf(final_dir, 1020, "/%s/.syscheck.cpt", SYSCHECK_DIR); - + fp = fopen(final_dir, "w"); if(fp) { @@ -192,12 +192,12 @@ int main(int argc, char **argv) printf("\n** Invalid agent id '%s'.\n", argv[2]); helpmsg(); } - + /* Deleting syscheck */ delete_syscheck(keys.keyentries[i]->name,keys.keyentries[i]->ip->ip,0); } - - printf("\n** Integrity check database updated.\n\n"); + + printf("\n** Integrity check database updated.\n\n"); return(0); }