- Update to 0.9.16.1

PR:		ports/119708
Submitted by:	maintainer
This commit is contained in:
Renato Botelho 2008-01-18 19:35:18 +00:00
parent 00a2981790
commit 34b52ba189
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=205793
4 changed files with 4 additions and 193 deletions

View File

@ -4,7 +4,7 @@
# $FreeBSD$
PORTNAME= libprelude
PORTVERSION= 0.9.16
PORTVERSION= 0.9.16.1
CATEGORIES= security
MASTER_SITES= http://www.prelude-ids.org/download/releases/ \
http://www.prelude-ids.org/download/releases/old/

View File

@ -1,3 +1,3 @@
MD5 (libprelude-0.9.16.tar.gz) = d2fa3e77d9104d8ae02e7730e1180f99
SHA256 (libprelude-0.9.16.tar.gz) = 2831740fdfbfb4299356a091bb883396188c69553dd148cc581eba35d3c00903
SIZE (libprelude-0.9.16.tar.gz) = 1964830
MD5 (libprelude-0.9.16.1.tar.gz) = ba597fdfb9641a0099a8907ea53c6db8
SHA256 (libprelude-0.9.16.1.tar.gz) = d300bddf9101daf67f86cc6edf094b85cca1e3b3d9c4352a0083da1486b6b20b
SIZE (libprelude-0.9.16.1.tar.gz) = 1973446

View File

@ -1,91 +0,0 @@
--- ./prelude-admin/prelude-admin.c.orig Mon Oct 1 12:47:42 2007
+++ ./prelude-admin/prelude-admin.c Tue Oct 23 10:16:42 2007
@@ -69,7 +69,6 @@
#ifdef WIN32
# define chown(x, y, z) (0)
# define fchown(x, y, z) (0)
-# define fchmod(x, y) (0)
# define getuid(x) (0)
# define getgid(x) (0)
# define mkdir(x, y) mkdir(x)
@@ -710,10 +709,6 @@
return -1;
}
- ret = fchmod(fileno(fd), S_IRUSR|S_IWUSR|S_IRGRP);
- if ( ret < 0 )
- fprintf(stderr, "error changing '%s' permission: %s.\n", filename, strerror(errno));
-
ret = fchown(fileno(fd), prelude_client_profile_get_uid(profile), prelude_client_profile_get_gid(profile));
if ( ret < 0 )
fprintf(stderr, "error changing '%s' ownership: %s.\n", filename, strerror(errno));
@@ -752,19 +747,18 @@
already_exist = access(filename, F_OK);
- fd = fopen(filename, (already_exist == 0) ? "r" : "w");
- if ( ! fd ) {
- fprintf(stderr, "error opening %s: %s.\n", filename, strerror(errno));
+ ret = open(filename, (already_exist == 0) ? O_RDONLY : O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR|S_IRGRP);
+ if ( ret < 0 ) {
+ fprintf(stderr, "error opening '%s': %s.\n", filename, strerror(errno));
return -1;
}
- ret = fchown(fileno(fd), prelude_client_profile_get_uid(profile), prelude_client_profile_get_gid(profile));
- if ( ret < 0 )
- fprintf(stderr, "couldn't change %s owner.\n", filename);
-
- ret = fchmod(fileno(fd), S_IRUSR|S_IWUSR|S_IRGRP);
- if ( ret < 0 )
- fprintf(stderr, "couldn't make ident file readable for all.\n");
+ fd = fdopen(ret, (already_exist == 0) ? "r" : "w");
+ if ( ! fd ) {
+ close(ret);
+ fprintf(stderr, "error opening '%s': %s.\n", filename, strerror(errno));
+ return -1;
+ }
if ( already_exist == 0 ) {
if ( ! fgets(buf, sizeof(buf), fd) ) {
@@ -945,11 +939,11 @@
-static int create_directory(prelude_client_profile_t *profile, const char *dirname)
+static int create_directory(prelude_client_profile_t *profile, const char *dirname, int flags)
{
int ret;
- ret = mkdir(dirname, S_IRWXU|S_IRWXG);
+ ret = mkdir(dirname, flags);
if ( ret < 0 && errno != EEXIST ) {
fprintf(stderr, "error creating directory %s: %s.\n", dirname, strerror(errno));
return -1;
@@ -977,7 +971,7 @@
prelude_client_profile_get_profile_dirname(profile, buf, sizeof(buf));
- ret = create_directory(profile, buf);
+ ret = create_directory(profile, buf, S_IRWXU|S_IRGRP|S_IXGRP);
if ( ret < 0 ) {
fprintf(stderr, "error creating directory %s: %s.\n", buf, strerror(errno));
return -1;
@@ -1000,7 +994,7 @@
prelude_client_profile_set_analyzerid(profile, *analyzerid);
prelude_client_profile_get_backup_dirname(profile, buf, sizeof(buf));
- return create_directory(profile, buf);
+ return create_directory(profile, buf, S_IRWXU|S_IRWXG);
}
@@ -2128,6 +2122,8 @@
#ifndef WIN32
signal(SIGPIPE, SIG_IGN);
#endif
+
+ umask(S_IRWXO);
for ( i = 0; i < sizeof(tbl) / sizeof(*tbl); i++ ) {
if ( strcmp(tbl[i].cmd, argv[1]) != 0 )

View File

@ -1,98 +0,0 @@
--- ./src/prelude-failover.c.orig Thu Aug 30 15:24:30 2007
+++ ./src/prelude-failover.c Tue Oct 23 10:16:45 2007
@@ -292,7 +292,7 @@
struct stat jst, wst;
failover_journal_entry_t jentry;
- failover->jfd = open(filename, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
+ failover->jfd = open(filename, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
if ( failover->jfd < 0 )
return prelude_error_verbose(PRELUDE_ERROR_GENERIC, "could not open '%s': %s", filename, strerror(errno));
@@ -357,7 +357,7 @@
{
int ret;
- *fd = open(filename, flags, S_IRUSR|S_IWUSR);
+ *fd = open(filename, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
if ( *fd < 0 )
return prelude_error_verbose(PRELUDE_ERROR_GENERIC, "error opening '%s': %s", filename, strerror(errno));
@@ -498,33 +498,46 @@
int prelude_failover_new(prelude_failover_t **out, const char *dirname)
{
+ mode_t mode;
size_t flen;
int ret, wfd, rfd;
char filename[PATH_MAX];
prelude_failover_t *new;
+ mode = umask(S_IRWXO);
+
ret = mkdir(dirname, S_IRWXU|S_IRWXG);
- if ( ret < 0 && errno != EEXIST )
+ if ( ret < 0 && errno != EEXIST ) {
+ umask(mode);
return prelude_error_verbose(PRELUDE_ERROR_GENERIC, "could not create directory '%s': %s", dirname, strerror(errno));
+ }
wfd = get_failover_data_filename_and_fd(dirname, filename, sizeof(filename));
- if ( wfd < 0 )
+ if ( wfd < 0 ) {
+ umask(mode);
return wfd;
+ }
rfd = open(filename, O_RDONLY);
if ( rfd < 0 ) {
+ umask(mode);
close(wfd);
return prelude_error_verbose(PRELUDE_ERROR_GENERIC, "could not open '%s' for reading: %s", filename, strerror(errno));
}
new = calloc(1, sizeof(*new));
- if ( ! new )
+ if ( ! new ) {
+ umask(mode);
+ close(rfd);
+ close(wfd);
return prelude_error_from_errno(errno);
+ }
new->jfd = -1;
ret = prelude_io_new(&new->wfd);
if ( ret < 0 ) {
+ umask(mode);
close(rfd);
close(wfd);
free(new);
@@ -533,6 +546,7 @@
ret = prelude_io_new(&new->rfd);
if ( ret < 0 ) {
+ umask(mode);
close(rfd);
close(wfd);
free(new);
@@ -546,16 +560,19 @@
ret = snprintf(filename + flen, sizeof(filename) - flen, ".journal");
if ( ret < 0 || ret >= (sizeof(filename) - flen) ) {
+ umask(mode);
prelude_failover_destroy(new);
return -1;
}
ret = journal_initialize(new, filename);
if ( ret < 0 ) {
+ umask(mode);
prelude_failover_destroy(new);
return ret;
}
+ umask(mode);
*out = new;
return 0;