View | Details | Raw Unified | Return to bug 117417
Collapse All | Expand All

(-)/data2/FreeBSD/custom_ports/security/libprelude/Makefile (-1 / +1 lines)
Lines 4-10 Link Here
4
# $FreeBSD: ports/security/libprelude/Makefile,v 1.47 2007/10/05 01:44:06 clsung Exp $
4
# $FreeBSD: ports/security/libprelude/Makefile,v 1.47 2007/10/05 01:44:06 clsung Exp $
5
5
6
PORTNAME=	libprelude
6
PORTNAME=	libprelude
7
PORTVERSION=	0.9.15.2
7
PORTVERSION=	0.9.16
8
CATEGORIES=	security
8
CATEGORIES=	security
9
MASTER_SITES=	http://www.prelude-ids.org/download/releases/ \
9
MASTER_SITES=	http://www.prelude-ids.org/download/releases/ \
10
		http://www.prelude-ids.org/download/releases/old/
10
		http://www.prelude-ids.org/download/releases/old/
(-)/data2/FreeBSD/custom_ports/security/libprelude/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (libprelude-0.9.15.2.tar.gz) = dab40d05caa8e6d3b9c48e07ad245211
1
MD5 (libprelude-0.9.16.tar.gz) = d2fa3e77d9104d8ae02e7730e1180f99
2
SHA256 (libprelude-0.9.15.2.tar.gz) = c8013b9f9b572d8301a2c839abd541b4ed00996ed6c0953a5a3ce7a585bf5b4f
2
SHA256 (libprelude-0.9.16.tar.gz) = 2831740fdfbfb4299356a091bb883396188c69553dd148cc581eba35d3c00903
3
SIZE (libprelude-0.9.15.2.tar.gz) = 1949284
3
SIZE (libprelude-0.9.16.tar.gz) = 1964830
(-)/data2/FreeBSD/custom_ports/security/libprelude/files/patch-prelude-admin__prelude-admin.c (+91 lines)
Line 0 Link Here
1
--- ./prelude-admin/prelude-admin.c.orig	Mon Oct  1 12:47:42 2007
2
+++ ./prelude-admin/prelude-admin.c	Tue Oct 23 10:16:42 2007
3
@@ -69,7 +69,6 @@
4
 #ifdef WIN32
5
 # define chown(x, y, z) (0)
6
 # define fchown(x, y, z) (0)
7
-# define fchmod(x, y) (0)
8
 # define getuid(x) (0)
9
 # define getgid(x) (0)
10
 # define mkdir(x, y) mkdir(x)
11
@@ -710,10 +709,6 @@
12
                 return -1;
13
         }
14
 
15
-        ret = fchmod(fileno(fd), S_IRUSR|S_IWUSR|S_IRGRP);
16
-        if ( ret < 0 )
17
-                fprintf(stderr, "error changing '%s' permission: %s.\n", filename, strerror(errno));
18
-
19
         ret = fchown(fileno(fd), prelude_client_profile_get_uid(profile), prelude_client_profile_get_gid(profile));
20
         if ( ret < 0 )
21
                 fprintf(stderr, "error changing '%s' ownership: %s.\n", filename, strerror(errno));
22
@@ -752,19 +747,18 @@
23
 
24
         already_exist = access(filename, F_OK);
25
 
26
-        fd = fopen(filename, (already_exist == 0) ? "r" : "w");
27
-        if ( ! fd ) {
28
-                fprintf(stderr, "error opening %s: %s.\n", filename, strerror(errno));
29
+        ret = open(filename, (already_exist == 0) ? O_RDONLY : O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR|S_IRGRP);
30
+        if ( ret < 0 ) {
31
+                fprintf(stderr, "error opening '%s': %s.\n", filename, strerror(errno));
32
                 return -1;
33
         }
34
 
35
-        ret = fchown(fileno(fd), prelude_client_profile_get_uid(profile), prelude_client_profile_get_gid(profile));
36
-        if ( ret < 0 )
37
-                fprintf(stderr, "couldn't change %s owner.\n", filename);
38
-
39
-        ret = fchmod(fileno(fd), S_IRUSR|S_IWUSR|S_IRGRP);
40
-        if ( ret < 0 )
41
-                fprintf(stderr, "couldn't make ident file readable for all.\n");
42
+        fd = fdopen(ret, (already_exist == 0) ? "r" : "w");
43
+        if ( ! fd ) {
44
+                close(ret);
45
+                fprintf(stderr, "error opening '%s': %s.\n", filename, strerror(errno));
46
+                return -1;
47
+        }
48
 
49
         if ( already_exist == 0 ) {
50
                 if ( ! fgets(buf, sizeof(buf), fd) ) {
51
@@ -945,11 +939,11 @@
52
 
53
 
54
 
55
-static int create_directory(prelude_client_profile_t *profile, const char *dirname)
56
+static int create_directory(prelude_client_profile_t *profile, const char *dirname, int flags)
57
 {
58
         int ret;
59
 
60
-        ret = mkdir(dirname, S_IRWXU|S_IRWXG);
61
+        ret = mkdir(dirname, flags);
62
         if ( ret < 0 && errno != EEXIST ) {
63
                 fprintf(stderr, "error creating directory %s: %s.\n", dirname, strerror(errno));
64
                 return -1;
65
@@ -977,7 +971,7 @@
66
 
67
         prelude_client_profile_get_profile_dirname(profile, buf, sizeof(buf));
68
 
69
-        ret = create_directory(profile, buf);
70
+        ret = create_directory(profile, buf, S_IRWXU|S_IRGRP|S_IXGRP);
71
         if ( ret < 0 ) {
72
                 fprintf(stderr, "error creating directory %s: %s.\n", buf, strerror(errno));
73
                 return -1;
74
@@ -1000,7 +994,7 @@
75
         prelude_client_profile_set_analyzerid(profile, *analyzerid);
76
 
77
         prelude_client_profile_get_backup_dirname(profile, buf, sizeof(buf));
78
-        return create_directory(profile, buf);
79
+        return create_directory(profile, buf, S_IRWXU|S_IRWXG);
80
 }
81
 
82
 
83
@@ -2128,6 +2122,8 @@
84
 #ifndef WIN32
85
         signal(SIGPIPE, SIG_IGN);
86
 #endif
87
+
88
+        umask(S_IRWXO);
89
 
90
         for ( i = 0; i < sizeof(tbl) / sizeof(*tbl); i++ ) {
91
                 if ( strcmp(tbl[i].cmd, argv[1]) != 0 )
(-)/data2/FreeBSD/custom_ports/security/libprelude/files/patch-src__prelude-failover.c (+98 lines)
Line 0 Link Here
1
--- ./src/prelude-failover.c.orig	Thu Aug 30 15:24:30 2007
2
+++ ./src/prelude-failover.c	Tue Oct 23 10:16:45 2007
3
@@ -292,7 +292,7 @@
4
         struct stat jst, wst;
5
         failover_journal_entry_t jentry;
6
 
7
-        failover->jfd = open(filename, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
8
+        failover->jfd = open(filename, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
9
         if ( failover->jfd < 0 )
10
                 return prelude_error_verbose(PRELUDE_ERROR_GENERIC, "could not open '%s': %s", filename, strerror(errno));
11
 
12
@@ -357,7 +357,7 @@
13
 {
14
         int ret;
15
 
16
-        *fd = open(filename, flags, S_IRUSR|S_IWUSR);
17
+        *fd = open(filename, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
18
         if ( *fd < 0 )
19
                 return prelude_error_verbose(PRELUDE_ERROR_GENERIC, "error opening '%s': %s", filename, strerror(errno));
20
 
21
@@ -498,33 +498,46 @@
22
 
23
 int prelude_failover_new(prelude_failover_t **out, const char *dirname)
24
 {
25
+        mode_t mode;
26
         size_t flen;
27
         int ret, wfd, rfd;
28
         char filename[PATH_MAX];
29
         prelude_failover_t *new;
30
 
31
+        mode = umask(S_IRWXO);
32
+
33
         ret = mkdir(dirname, S_IRWXU|S_IRWXG);
34
-        if ( ret < 0 && errno != EEXIST )
35
+        if ( ret < 0 && errno != EEXIST ) {
36
+                umask(mode);
37
                 return prelude_error_verbose(PRELUDE_ERROR_GENERIC, "could not create directory '%s': %s", dirname, strerror(errno));
38
+        }
39
 
40
         wfd = get_failover_data_filename_and_fd(dirname, filename, sizeof(filename));
41
-        if ( wfd < 0 )
42
+        if ( wfd < 0 ) {
43
+                umask(mode);
44
                 return wfd;
45
+        }
46
 
47
         rfd = open(filename, O_RDONLY);
48
         if ( rfd < 0 ) {
49
+                umask(mode);
50
                 close(wfd);
51
                 return prelude_error_verbose(PRELUDE_ERROR_GENERIC, "could not open '%s' for reading: %s", filename, strerror(errno));
52
         }
53
 
54
         new = calloc(1, sizeof(*new));
55
-        if ( ! new )
56
+        if ( ! new ) {
57
+                umask(mode);
58
+                close(rfd);
59
+                close(wfd);
60
                 return prelude_error_from_errno(errno);
61
+        }
62
 
63
         new->jfd = -1;
64
 
65
         ret = prelude_io_new(&new->wfd);
66
         if ( ret < 0 ) {
67
+                umask(mode);
68
                 close(rfd);
69
                 close(wfd);
70
                 free(new);
71
@@ -533,6 +546,7 @@
72
 
73
         ret = prelude_io_new(&new->rfd);
74
         if ( ret < 0 ) {
75
+                umask(mode);
76
                 close(rfd);
77
                 close(wfd);
78
                 free(new);
79
@@ -546,16 +560,19 @@
80
 
81
         ret = snprintf(filename + flen, sizeof(filename) - flen, ".journal");
82
         if ( ret < 0 || ret >= (sizeof(filename) - flen) ) {
83
+                umask(mode);
84
                 prelude_failover_destroy(new);
85
                 return -1;
86
         }
87
 
88
         ret = journal_initialize(new, filename);
89
         if ( ret < 0 ) {
90
+                umask(mode);
91
                 prelude_failover_destroy(new);
92
                 return ret;
93
         }
94
 
95
+        umask(mode);
96
         *out = new;
97
 
98
         return 0;

Return to bug 117417