X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fwin32%2Fsetup-win.c;h=81063f67b30ea6bec8d173d2e17e5ca6a27ad9f5;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=c31b9c48ae79f76912dbd709210d4ec5317eb8af;hpb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;p=ossec-hids.git diff --git a/src/win32/setup-win.c b/src/win32/setup-win.c old mode 100755 new mode 100644 index c31b9c4..81063f6 --- a/src/win32/setup-win.c +++ b/src/win32/setup-win.c @@ -1,6 +1,3 @@ -/* @(#) $Id: ./src/win32/setup-win.c, 2011/09/08 dcid Exp $ - */ - /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. * @@ -10,54 +7,35 @@ * Foundation */ - #include "setup-shared.h" -/* Setup windows after install */ +/* Set up Windows after installation */ int main(int argc, char **argv) { - if(argc < 2) - { + /* Set the name */ + OS_SetName(ARGV0); + + if (argc < 2) { printf("%s: Invalid syntax.\n", argv[0]); printf("Try: '%s directory'\n\n", argv[0]); - return(0); + return (0); } - /* Trying to chdir to ossec directory. */ - if(chdir(argv[1]) != 0) - { + /* Try to chdir to the OSSEC directory */ + if (chdir(argv[1]) != 0) { printf("%s: Invalid directory: '%s'.\n", argv[0], argv[1]); - return(0); - } - - /* Checking if ossec was installed already (upgrade) */ - if(!fileexist(OSSECCONF)) - { - char cmd[OS_MAXSTR +1]; - - /* Copy default config to ossec.conf */ - snprintf(cmd, OS_MAXSTR, "copy %s %s", OSSECDEF, OSSECCONF); - system(cmd); + return (0); } - - /* Setting up local files */ - system("add-localfile.exe \"C:\\Windows\\pfirewall.log\" --quiet"); - system("add-localfile.exe \"C:\\Documents and Settings\\All Users\\Application Data\\Symantec\\Symantec AntiVirus Corporate Edition\\7.5\\Logs\\\%m\%d20\%y.log\" --quiet"); - - - /* Configure ossec for automatic startup */ + /* Configure OSSEC for automatic startup */ system("sc config OssecSvc start= auto"); - - /* Changing permissions. */ + /* Change permissions */ checkVista(); - - if(isVista) - { - char cmd[OS_MAXSTR +1]; + if (isVista) { + char cmd[OS_MAXSTR + 1]; /* Copy some files to outside */ snprintf(cmd, OS_MAXSTR, "move os_win32ui.exe ../"); @@ -75,12 +53,10 @@ int main(int argc, char **argv) snprintf(cmd, OS_MAXSTR, "move help.txt ../"); system(cmd); + /* Change permissions */ + system("echo y|icacls * /T \"*S-1-5-32-544:F\" "); - /* Changing permissions. */ - system("echo y|cacls * /T /G Administrators:f "); - - - /* Copying them back. */ + /* Copy them back */ snprintf(cmd, OS_MAXSTR, "move ..\\os_win32ui.exe ."); system(cmd); @@ -95,11 +71,9 @@ int main(int argc, char **argv) snprintf(cmd, OS_MAXSTR, "move ..\\help.txt ."); system(cmd); - } - else - { - system("echo y|cacls . /T /G Administrators:f "); + } else { + system("echo y|icacls . /T /G \"*S-1-5-32-544:F\" "); } - return(0); + return (1); }