[Pkg-ossec-devel] [pkg-ossec] 11/18: Updated patch #02 to 2.7.1-beta-1 upstream version.
Jose Antonio Quevedo Muñoz
jaqm-guest at alioth.debian.org
Tue Aug 13 15:24:52 UTC 2013
This is an automated email from the git hooks/post-receive script.
jaqm-guest pushed a commit to branch debian
in repository pkg-ossec.
commit 47adf7eb6bbfe0e6f2896a1d3b7d1323444e7bb3
Author: Jose Antonio Quevedo <joseantonio.quevedo at gmail.com>
Date: Tue Aug 13 13:08:49 2013 +0200
Updated patch #02 to 2.7.1-beta-1 upstream version.
---
debian/patches/02-add-chroot-option.patch | 772 ++---------------------------
1 file changed, 43 insertions(+), 729 deletions(-)
diff --git a/debian/patches/02-add-chroot-option.patch b/debian/patches/02-add-chroot-option.patch
index 879144a..92f495d 100644
--- a/debian/patches/02-add-chroot-option.patch
+++ b/debian/patches/02-add-chroot-option.patch
@@ -40,7 +40,7 @@ Last-Update: 2012-08-26
{
switch(c){
case 'V':
-@@ -122,6 +123,12 @@
+@@ -123,6 +124,12 @@
ErrorExit("%s: Invalid port: %s", ARGV0, optarg);
}
break;
@@ -53,7 +53,7 @@ Last-Update: 2012-08-26
default:
report_help();
break;
-@@ -151,8 +158,13 @@
+@@ -152,8 +159,13 @@
/* chrooting -- TODO: this isn't a chroot. Should also close
unneeded open file descriptors (like stdin/stdout)*/
@@ -81,16 +81,16 @@ Last-Update: 2012-08-26
/* Using MAILUSER (read only) */
@@ -38,7 +39,7 @@
OS_SetName(ARGV0);
-
+
- while((c = getopt(argc, argv, "vVdhtfu:g:D:c:")) != -1){
+ while((c = getopt(argc, argv, "vVdhtfu:g:D:c:NC")) != -1){
switch(c){
case 'V':
print_version();
-@@ -77,6 +78,12 @@
+@@ -78,6 +79,12 @@
case 't':
- test_config = 1;
+ test_config = 1;
break;
+ case 'N':
+ do_chroot = 0;
@@ -101,29 +101,6 @@ Last-Update: 2012-08-26
default:
help(ARGV0);
break;
-@@ -147,14 +154,15 @@
- if(Privsep_SetGroup(gid) < 0)
- ErrorExit(SETGID_ERROR,ARGV0,group);
-
--
- /* chrooting */
-- if(Privsep_Chroot(dir) < 0)
-- ErrorExit(CHROOT_ERROR,ARGV0,dir);
--
--
-- /* Now on chroot */
-- nowChroot();
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ ErrorExit(CHROOT_ERROR,ARGV0,dir);
-+ /* Now on chroot */
-+ nowChroot();
-+ } else {
-+ chdir(dir);
-+ }
-
-
-
--- a/src/shared/help.c
+++ b/src/shared/help.c
@@ -35,7 +35,9 @@
@@ -156,9 +133,9 @@ Last-Update: 2012-08-26
switch(c){
case 'V':
print_version();
-@@ -188,6 +189,12 @@
+@@ -189,6 +190,12 @@
case 't':
- test_config = 1;
+ test_config = 1;
break;
+ case 'N':
+ do_chroot = 0;
@@ -169,25 +146,6 @@ Last-Update: 2012-08-26
default:
help(ARGV0);
break;
-@@ -281,11 +288,13 @@
- ErrorExit(SETGID_ERROR,ARGV0,group);
-
- /* Chrooting */
-- if(Privsep_Chroot(dir) < 0)
-- ErrorExit(CHROOT_ERROR,ARGV0,dir);
--
--
-- nowChroot();
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ ErrorExit(CHROOT_ERROR,ARGV0,dir);
-+ nowChroot();
-+ } else {
-+ chdir(dir);
-+ }
-
-
-
--- a/src/analysisd/makelists.c
+++ b/src/analysisd/makelists.c
@@ -67,7 +67,9 @@
@@ -231,25 +189,6 @@ Last-Update: 2012-08-26
default:
help(ARGV0);
break;
-@@ -158,11 +167,13 @@
- ErrorExit(SETGID_ERROR,ARGV0,group);
-
- /* Chrooting */
-- if(Privsep_Chroot(dir) < 0)
-- ErrorExit(CHROOT_ERROR,ARGV0,dir);
--
-- nowChroot();
--
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ ErrorExit(CHROOT_ERROR,ARGV0,dir);
-+ nowChroot();
-+ } else {
-+ chdir(dir);
-+ }
-
-
- /* Createing the lists for use in rules */
--- a/src/os_maild/maild.c
+++ b/src/os_maild/maild.c
@@ -31,6 +31,7 @@
@@ -262,16 +201,16 @@ Last-Update: 2012-08-26
char *user = MAILUSER;
@@ -45,7 +46,7 @@
OS_SetName(ARGV0);
-
+
- while((c = getopt(argc, argv, "Vdhtfu:g:D:c:")) != -1){
+ while((c = getopt(argc, argv, "Vdhtfu:g:D:c:NC")) != -1){
switch(c){
case 'V':
print_version();
-@@ -81,6 +82,12 @@
+@@ -82,6 +83,12 @@
case 't':
- test_config = 1;
+ test_config = 1;
break;
+ case 'N':
+ do_chroot = 0;
@@ -282,9 +221,9 @@ Last-Update: 2012-08-26
default:
help(ARGV0);
break;
-@@ -143,11 +150,13 @@
+@@ -144,11 +151,13 @@
+
-
/* chrooting */
- if(Privsep_Chroot(dir) < 0)
- ErrorExit(CHROOT_ERROR,ARGV0,dir);
@@ -299,20 +238,11 @@ Last-Update: 2012-08-26
+ chdir(dir);
+ }
-
- /* Changing user */
+
+ /* Changing user */
--- a/src/addagent/main.c
+++ b/src/addagent/main.c
-@@ -25,6 +25,8 @@
- printf("\t-l List available agents.\n");
- printf("\t-e <id> Extracts key for an agent (Manager only).\n");
- printf("\t-i <id> Import authentication key (Agent only).\n");
-+ printf("\t-N Do not chroot.\n");
-+ printf("\t-C Chroot the program (default behaviour).\n");
- printf("\t-f <file> Bulk generate client keys from file. (Manager only).\n\n");
- exit(1);
- }
-@@ -70,6 +72,7 @@
+@@ -73,6 +73,7 @@
char *user_msg;
int c = 0, cmdlist = 0;
@@ -320,7 +250,7 @@ Last-Update: 2012-08-26
char *cmdexport = NULL;
char *cmdimport = NULL;
char *cmdbulk = NULL;
-@@ -85,7 +88,7 @@
+@@ -88,7 +89,7 @@
OS_SetName(ARGV0);
@@ -329,7 +259,7 @@ Last-Update: 2012-08-26
switch(c){
case 'V':
print_version();
-@@ -124,6 +127,12 @@
+@@ -127,6 +128,12 @@
case 'l':
cmdlist = 1;
break;
@@ -342,7 +272,7 @@ Last-Update: 2012-08-26
default:
helpmsg();
break;
-@@ -155,16 +164,18 @@
+@@ -158,16 +165,18 @@
/* Chrooting to the default directory */
@@ -380,16 +310,16 @@ Last-Update: 2012-08-26
char *user = USER;
@@ -33,7 +34,7 @@
OS_SetName(ARGV0);
-
+
- while((c = getopt(argc, argv, "Vdhtfu:g:D:c:")) != -1){
+ while((c = getopt(argc, argv, "Vdhtfu:g:D:c:NC")) != -1){
switch(c){
case 'V':
print_version();
-@@ -69,6 +70,12 @@
+@@ -70,6 +71,12 @@
case 't':
- test_config = 1;
+ test_config = 1;
break;
+ case 'N':
+ do_chroot = 0;
@@ -400,9 +330,9 @@ Last-Update: 2012-08-26
default:
help(ARGV0);
break;
-@@ -170,11 +177,13 @@
+@@ -171,11 +178,13 @@
+
-
/* chrooting */
- if(Privsep_Chroot(dir) < 0)
- ErrorExit(CHROOT_ERROR,ARGV0,dir);
@@ -417,8 +347,8 @@ Last-Update: 2012-08-26
+ chdir(dir);
+ }
-
- /* Changing user */
+
+ /* Changing user */
--- a/src/monitord/report.c
+++ b/src/monitord/report.c
@@ -25,6 +25,8 @@
@@ -439,7 +369,7 @@ Last-Update: 2012-08-26
char *user = USER;
char *group = GROUPGLOBAL;
@@ -77,7 +80,7 @@
-
+
r_filter.report_name = NULL;
- while((c = getopt(argc, argv, "Vdhstu:g:D:c:f:v:n:r:")) != -1)
@@ -447,7 +377,7 @@ Last-Update: 2012-08-26
{
switch(c){
case 'V':
-@@ -145,6 +148,12 @@
+@@ -146,6 +149,12 @@
case 's':
r_filter.show_alerts = 1;
break;
@@ -460,9 +390,9 @@ Last-Update: 2012-08-26
default:
report_help();
break;
-@@ -174,11 +183,13 @@
+@@ -175,11 +184,13 @@
+
-
/* chrooting */
- if(Privsep_Chroot(dir) < 0)
- ErrorExit(CHROOT_ERROR,ARGV0,dir);
@@ -477,8 +407,8 @@ Last-Update: 2012-08-26
+ chdir(dir);
+ }
-
- /* Changing user */
+
+ /* Changing user */
--- a/src/os_dbd/main.c
+++ b/src/os_dbd/main.c
@@ -56,6 +56,7 @@
@@ -491,16 +421,16 @@ Last-Update: 2012-08-26
char *dir = DEFAULTDIR;
@@ -73,7 +74,7 @@
OS_SetName(ARGV0);
-
+
- while((c = getopt(argc, argv, "vVdhtfu:g:D:c:")) != -1){
+ while((c = getopt(argc, argv, "vVdhtfu:g:D:c:NC")) != -1){
switch(c){
case 'V':
db_info();
-@@ -112,6 +113,12 @@
+@@ -113,6 +114,12 @@
case 't':
- test_config = 1;
+ test_config = 1;
break;
+ case 'N':
+ do_chroot = 0;
@@ -511,9 +441,9 @@ Last-Update: 2012-08-26
default:
help(ARGV0);
break;
-@@ -216,12 +223,14 @@
+@@ -217,12 +224,14 @@
+
-
/* chrooting */
- if(Privsep_Chroot(dir) < 0)
- ErrorExit(CHROOT_ERROR,ARGV0,dir);
@@ -534,24 +464,7 @@ Last-Update: 2012-08-26
/* Inserting server info into the db */
--- a/src/remoted/main.c
+++ b/src/remoted/main.c
-@@ -21,6 +21,7 @@
- int i = 0,c = 0;
- int uid = 0, gid = 0;
- int test_config = 0,run_foreground = 0;
-+ int do_chroot = 1;
-
- char *cfg = DEFAULTCPATH;
- char *dir = DEFAULTDIR;
-@@ -32,7 +33,7 @@
- OS_SetName(ARGV0);
-
-
-- while((c = getopt(argc, argv, "Vdthfu:g:c:D:")) != -1){
-+ while((c = getopt(argc, argv, "Vdthfu:g:c:D:NC")) != -1){
- switch(c){
- case 'V':
- print_version();
-@@ -68,6 +69,17 @@
+@@ -69,6 +69,17 @@
if(!optarg)
ErrorExit("%s: -D needs an argument",ARGV0);
dir = optarg;
@@ -569,7 +482,7 @@ Last-Update: 2012-08-26
}
}
-@@ -114,11 +126,13 @@
+@@ -115,11 +126,13 @@
ErrorExit(SETGID_ERROR, ARGV0, group);
/* Going on chroot */
@@ -601,12 +514,12 @@ Last-Update: 2012-08-26
@@ -55,6 +57,7 @@
int c = 0, restart_syscheck = 0, restart_all_agents = 0, list_agents = 0;
- int info_agent = 0, agt_id = 0, active_only = 0, csv_output = 0;
+ int info_agent = 0, agt_id = 0, active_only = 0, csv_output = 0;
int list_responses = 0, end_time = 0, restart_agent = 0;
+ int do_chroot = 1;
char shost[512];
-
+
@@ -73,7 +76,7 @@
}
@@ -629,30 +542,6 @@ Last-Update: 2012-08-26
default:
helpmsg();
break;
-@@ -165,14 +174,16 @@
-
-
- /* Chrooting to the default directory */
-- if(Privsep_Chroot(dir) < 0)
-- {
-- ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ {
-+ ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ }
-+ /* Inside chroot now */
-+ nowChroot();
-+ } else {
-+ chdir(dir);
- }
--
--
-- /* Inside chroot now */
-- nowChroot();
-
-
- /* Setting the user */
--- a/src/util/rootcheck_control.c
+++ b/src/util/rootcheck_control.c
@@ -35,6 +35,8 @@
@@ -694,30 +583,6 @@ Last-Update: 2012-08-26
default:
helpmsg();
break;
-@@ -142,14 +151,16 @@
-
-
- /* Chrooting to the default directory */
-- if(Privsep_Chroot(dir) < 0)
-- {
-- ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ {
-+ ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ }
-+ /* Inside chroot now */
-+ nowChroot();
-+ } else {
-+ chdir(dir);
- }
--
--
-- /* Inside chroot now */
-- nowChroot();
-
-
- /* Setting the user */
--- a/src/util/clear_stats.c
+++ b/src/util/clear_stats.c
@@ -28,6 +28,8 @@
@@ -729,116 +594,6 @@ Last-Update: 2012-08-26
exit(1);
}
-@@ -43,6 +45,8 @@
- char *user = USER;
- int gid;
- int uid;
-+ int c;
-+ int do_chroot = 1;
-
-
- /* Setting the name */
-@@ -50,11 +54,42 @@
-
-
- /* user arguments */
-- if(argc != 2)
-+
-+ while((c = getopt(argc, argv, "hadwNC")) != -1)
- {
-- helpmsg();
-+ switch(c){
-+ case 'h':
-+ helpmsg();
-+ break;
-+ case 'a':
-+ clear_daily = 1;
-+ clear_weekly = 1;
-+ break;
-+ case 'd':
-+ clear_daily = 1;
-+ break;
-+ case 'w':
-+ clear_weekly = 1;
-+ break;
-+ case 'N':
-+ do_chroot = 0;
-+ break;
-+ case 'C':
-+ do_chroot = 1;
-+ break;
-+ default:
-+ printf("\n** Invalid option '%s'.\n", argv[1]);
-+ helpmsg();
-+ break;
-+ }
- }
--
-+
-+ if(! clear_weekly && ! clear_daily)
-+ {
-+ /* We did not get any valid a, d or w option */
-+ helpmsg();
-+ }
-+
- /* Getting the group name */
- gid = Privsep_GetGroup(group);
- uid = Privsep_GetUser(user);
-@@ -72,14 +107,16 @@
-
-
- /* Chrooting to the default directory */
-- if(Privsep_Chroot(dir) < 0)
-- {
-- ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ {
-+ ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ }
-+ /* Inside chroot now */
-+ nowChroot();
-+ } else {
-+ chdir(dir);
- }
--
--
-- /* Inside chroot now */
-- nowChroot();
-
-
- /* Setting the user */
-@@ -88,30 +125,6 @@
- ErrorExit(SETUID_ERROR, ARGV0, user);
- }
-
-- /* User options */
-- if(strcmp(argv[1], "-h") == 0)
-- {
-- helpmsg();
-- }
-- else if(strcmp(argv[1], "-a") == 0)
-- {
-- clear_daily = 1;
-- clear_weekly = 1;
-- }
-- else if(strcmp(argv[1], "-d") == 0)
-- {
-- clear_daily = 1;
-- }
-- else if(strcmp(argv[1], "-w") == 0)
-- {
-- clear_weekly = 1;
-- }
-- else
-- {
-- printf("\n** Invalid option '%s'.\n", argv[1]);
-- helpmsg();
-- }
--
-
- /* Clear daily files */
- if(clear_daily)
--- a/src/util/syscheck_update.c
+++ b/src/util/syscheck_update.c
@@ -27,6 +27,8 @@
@@ -850,285 +605,6 @@ Last-Update: 2012-08-26
printf("\t-u local Update (clear) syscheck database locally.\n\n");
exit(1);
}
-@@ -39,6 +41,10 @@
- char *user = USER;
- int gid;
- int uid;
-+ int c;
-+ int do_chroot = 1;
-+ int list_agents, update_agents = 0;
-+ char *agent_id = NULL;
-
-
- /* Setting the name */
-@@ -50,6 +56,33 @@
- {
- helpmsg();
- }
-+ while((c = getopt(argc, argv, "hlau:NC")) != -1)
-+ {
-+ switch(c){
-+ case 'h':
-+ helpmsg();
-+ break;
-+ case 'l':
-+ list_agents = 1;
-+ break;
-+ case 'u':
-+ if(!optarg)
-+ {
-+ merror("%s: -u needs an argument",ARGV0);
-+ helpmsg();
-+ }
-+ agent_id = optarg;
-+ update_agents = 1;
-+ break;
-+ case 'a':
-+ agent_id = strdup("all");
-+ update_agents = 1;
-+ break;
-+ default:
-+ helpmsg();
-+ }
-+ }
-+
-
- /* Getting the group name */
- gid = Privsep_GetGroup(group);
-@@ -68,14 +101,16 @@
-
-
- /* Chrooting to the default directory */
-- if(Privsep_Chroot(dir) < 0)
-- {
-- ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ {
-+ ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ }
-+ /* Inside chroot now */
-+ nowChroot();
-+ } else {
-+ chdir(dir);
- }
--
--
-- /* Inside chroot now */
-- nowChroot();
-
-
- /* Setting the user */
-@@ -85,11 +120,7 @@
- }
-
- /* User options */
-- if(strcmp(argv[1], "-h") == 0)
-- {
-- helpmsg();
-- }
-- else if(strcmp(argv[1], "-l") == 0)
-+ if( list_agents )
- {
- printf("\nOSSEC HIDS %s: Updates the integrity check database.",
- ARGV0);
-@@ -97,108 +128,98 @@
- printf("\n");
- exit(0);
- }
-- else if(strcmp(argv[1], "-u") == 0)
-+ else if( update_agents )
- {
-- if(argc != 3)
-- {
-- printf("\n** Option -u requires an extra argument\n");
-- helpmsg();
-- }
-- }
-- else if(strcmp(argv[1], "-a") == 0)
-- {
-- DIR *sys_dir;
-- struct dirent *entry;
--
-- sys_dir = opendir(SYSCHECK_DIR);
-- if(!sys_dir)
-- {
-- ErrorExit("%s: Unable to open: '%s'", ARGV0, SYSCHECK_DIR);
-- }
--
-- while((entry = readdir(sys_dir)) != NULL)
-- {
-- FILE *fp;
-- char full_path[OS_MAXSTR +1];
--
-- /* Do not even attempt to delete . and .. :) */
-- if((strcmp(entry->d_name,".") == 0)||
-- (strcmp(entry->d_name,"..") == 0))
-- {
-- continue;
-- }
--
-- snprintf(full_path, OS_MAXSTR,"%s/%s", SYSCHECK_DIR, entry->d_name);
--
-- fp = fopen(full_path, "w");
-- if(fp)
-- {
-- fclose(fp);
-- }
-- if(entry->d_name[0] == '.')
-- {
-- unlink(full_path);
-- }
-- }
-+ if ( strcmp(agent_id, "all") == 0 )
-+ {
-+ DIR *sys_dir;
-+ struct dirent *entry;
-+
-+ sys_dir = opendir(SYSCHECK_DIR);
-+ if(!sys_dir)
-+ {
-+ ErrorExit("%s: Unable to open: '%s'", ARGV0, SYSCHECK_DIR);
-+ }
-+
-+ while((entry = readdir(sys_dir)) != NULL)
-+ {
-+ FILE *fp;
-+ char full_path[OS_MAXSTR +1];
-+
-+ /* Do not even attempt to delete . and .. :) */
-+ if((strcmp(entry->d_name,".") == 0)||
-+ (strcmp(entry->d_name,"..") == 0))
-+ {
-+ continue;
-+ }
-+
-+ snprintf(full_path, OS_MAXSTR,"%s/%s", SYSCHECK_DIR, entry->d_name);
-+
-+ fp = fopen(full_path, "w");
-+ if(fp)
-+ {
-+ fclose(fp);
-+ }
-+ if(entry->d_name[0] == '.')
-+ {
-+ unlink(full_path);
-+ }
-+ }
-+
-+ closedir(sys_dir);
-+ printf("\n** Integrity check database updated.\n\n");
-+ exit(0);
-+ }
-+ else if(strcmp(agent_id,"local") == 0)
-+ {
-+ /* local */
-+ char final_dir[1024];
-+ FILE *fp;
-+ snprintf(final_dir, 1020, "/%s/syscheck", SYSCHECK_DIR);
-+
-+ fp = fopen(final_dir, "w");
-+ if(fp)
-+ {
-+ fclose(fp);
-+ }
-+ unlink(final_dir);
-+
-+
-+ /* Deleting cpt file */
-+ snprintf(final_dir, 1020, "/%s/.syscheck.cpt", SYSCHECK_DIR);
-+
-+ fp = fopen(final_dir, "w");
-+ if(fp)
-+ {
-+ fclose(fp);
-+ }
-+ /* unlink(final_dir); */
-+ }
-+ /* external agents */
-+ else
-+ {
-+ int i;
-+ keystore keys;
-+
-+ OS_ReadKeys(&keys);
-+
-+ i = OS_IsAllowedID(&keys, argv[2]);
-+ if(i < 0)
-+ {
-+ printf("\n** Invalid agent id '%s'.\n", argv[2]);
-+ helpmsg();
-+ }
-+
-+ /* Deleting syscheck */
-+ delete_syscheck(keys.keyentries[i]->name,keys.keyentries[i]->ip->ip,0);
-+ }
-
-- closedir(sys_dir);
-- printf("\n** Integrity check database updated.\n\n");
-- exit(0);
-+ printf("\n** Integrity check database updated.\n\n");
-+ exit(0);
- }
-- else
-- {
-- printf("\n** Invalid option '%s'.\n", argv[1]);
-- 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)
-- {
-- fclose(fp);
-- }
-- unlink(final_dir);
--
-
-- /* Deleting cpt file */
-- snprintf(final_dir, 1020, "/%s/.syscheck.cpt", SYSCHECK_DIR);
--
-- fp = fopen(final_dir, "w");
-- if(fp)
-- {
-- fclose(fp);
-- }
-- /* unlink(final_dir); */
-- }
--
-- /* external agents */
-- else
-- {
-- int i;
-- keystore keys;
--
-- OS_ReadKeys(&keys);
--
-- i = OS_IsAllowedID(&keys, argv[2]);
-- if(i < 0)
-- {
-- 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");
-- return(0);
-+ printf("\n** No work to do (wrong options?).\n\n");
-+ exit(0);
- }
-
-
--- a/src/util/syscheck_control.c
+++ b/src/util/syscheck_control.c
@@ -37,6 +37,8 @@
@@ -1170,30 +646,6 @@ Last-Update: 2012-08-26
default:
helpmsg();
break;
-@@ -152,14 +161,16 @@
-
-
- /* Chrooting to the default directory */
-- if(Privsep_Chroot(dir) < 0)
-- {
-- ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ {
-+ ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ }
-+ /* Inside chroot now */
-+ nowChroot();
-+ } else {
-+ chdir(dir);
- }
--
--
-- /* Inside chroot now */
-- nowChroot();
-
-
- /* Setting the user */
--- a/src/client-agent/agentd.c
+++ b/src/client-agent/agentd.c
@@ -25,7 +25,7 @@
@@ -1205,25 +657,6 @@ Last-Update: 2012-08-26
{
int rc = 0;
int pid = 0;
-@@ -49,11 +49,13 @@
-
-
- /* chrooting */
-- if(Privsep_Chroot(dir) < 0)
-- ErrorExit(CHROOT_ERROR, ARGV0, dir);
--
--
-- nowChroot();
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ nowChroot();
-+ } else {
-+ chdir(dir);
-+ }
-
-
- if(Privsep_SetUser(uid) < 0)
--- a/src/client-agent/agentd.h
+++ b/src/client-agent/agentd.h
@@ -29,7 +29,7 @@
@@ -1237,23 +670,7 @@ Last-Update: 2012-08-26
void *EventForward();
--- a/src/client-agent/main.c
+++ b/src/client-agent/main.c
-@@ -43,13 +43,14 @@
-
- int uid = 0;
- int gid = 0;
-+ int do_chroot = 1;
-
-
- /* Setting the name */
- OS_SetName(ARGV0);
-
-
-- while((c = getopt(argc, argv, "Vtdhu:g:D:")) != -1){
-+ while((c = getopt(argc, argv, "Vtdhu:g:D:NC")) != -1){
- switch(c){
- case 'V':
- print_version();
-@@ -78,6 +79,12 @@
+@@ -78,6 +78,12 @@
ErrorExit("%s: -D needs an argument",ARGV0);
dir = optarg;
break;
@@ -1266,14 +683,14 @@ Last-Update: 2012-08-26
}
}
-@@ -130,7 +137,7 @@
+@@ -130,7 +136,7 @@
/* Agentd Start */
- AgentdStart(dir, uid, gid, user, group);
+ AgentdStart(dir, uid, gid, user, group, do_chroot);
-
+
return(0);
--- a/src/util/list_agents.c
+++ b/src/util/list_agents.c
@@ -1286,106 +703,3 @@ Last-Update: 2012-08-26
exit(1);
}
-@@ -42,6 +44,8 @@
- int gid;
- int uid;
- int flag;
-+ int c;
-+ int do_chroot = 1;
-
-
- /* Setting the name */
-@@ -53,6 +57,36 @@
- {
- helpmsg();
- }
-+ /* User options */
-+ while((c = getopt(argc, argv, "hacnNC")) != -1)
-+ {
-+ switch(c){
-+ case 'h':
-+ helpmsg();
-+ break;
-+ case 'a':
-+ flag = GA_ALL;
-+ msg = "is available.";
-+ break;
-+ case 'c':
-+ flag = GA_ACTIVE;
-+ msg = "is active.";
-+ break;
-+ case 'n':
-+ flag = GA_NOTACTIVE;
-+ msg = "is not active.";
-+ break;
-+ case 'N':
-+ do_chroot = 0;
-+ break;
-+ case 'C':
-+ do_chroot = 1;
-+ break;
-+ default:
-+ helpmsg;
-+ }
-+ }
-+
-
- /* Getting the group name */
- gid = Privsep_GetGroup(group);
-@@ -71,14 +105,16 @@
-
-
- /* Chrooting to the default directory */
-- if(Privsep_Chroot(dir) < 0)
-- {
-- ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ if (do_chroot) {
-+ if(Privsep_Chroot(dir) < 0)
-+ {
-+ ErrorExit(CHROOT_ERROR, ARGV0, dir);
-+ }
-+ /* Inside chroot now */
-+ nowChroot();
-+ } else {
-+ chdir(dir);
- }
--
--
-- /* Inside chroot now */
-- nowChroot();
-
-
- /* Setting the user */
-@@ -87,32 +123,6 @@
- ErrorExit(SETUID_ERROR, ARGV0, user);
- }
-
-- /* User options */
-- if(strcmp(argv[1], "-h") == 0)
-- {
-- helpmsg();
-- }
-- else if(strcmp(argv[1], "-a") == 0)
-- {
-- flag = GA_ALL;
-- msg = "is available.";
-- }
-- else if(strcmp(argv[1], "-c") == 0)
-- {
-- flag = GA_ACTIVE;
-- msg = "is active.";
-- }
-- else if(strcmp(argv[1], "-n") == 0)
-- {
-- flag = GA_NOTACTIVE;
-- msg = "is not active.";
-- }
-- else
-- {
-- printf("\n** Invalid option '%s'.\n", argv[1]);
-- helpmsg();
-- }
--
-
- agent_list = get_agents(flag);
- if(agent_list)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ossec/pkg-ossec.git
More information about the Pkg-ossec-devel
mailing list