aboutsummaryrefslogtreecommitdiff
path: root/news/inn
diff options
context:
space:
mode:
authorDima Panov <fluffy@FreeBSD.org>2012-09-02 13:53:16 +0000
committerDima Panov <fluffy@FreeBSD.org>2012-09-02 13:53:16 +0000
commit5f5db2b1bc53e90a1da9b390b8d1c2db046bb3d0 (patch)
tree025ee465136f8d3ad96ee2841d6d9577186784c4 /news/inn
parentc671393334f52e65ffdee2233abef88c88aa4c24 (diff)
downloadports-5f5db2b1bc53e90a1da9b390b8d1c2db046bb3d0.tar.gz
ports-5f5db2b1bc53e90a1da9b390b8d1c2db046bb3d0.zip
- Fix innd/nnrpd semget failures
Do not set any shmem permission bits except for the six allowed bits PR: 171134 Submitted by: G. Paul Ziemba
Notes
Notes: svn path=/head/; revision=303548
Diffstat (limited to 'news/inn')
-rw-r--r--news/inn/Makefile2
-rw-r--r--news/inn/files/patch-storage_buffindexed_shmem.c73
2 files changed, 74 insertions, 1 deletions
diff --git a/news/inn/Makefile b/news/inn/Makefile
index 706472cb3f07..fde838499e2c 100644
--- a/news/inn/Makefile
+++ b/news/inn/Makefile
@@ -7,7 +7,7 @@
PORTNAME?= inn
PORTVERSION?= 2.5.2
-PORTREVISION?= 2
+PORTREVISION?= 3
CATEGORIES= news ipv6
# Master distribution broken
#MASTER_SITES?= ${MASTER_SITE_ISC}
diff --git a/news/inn/files/patch-storage_buffindexed_shmem.c b/news/inn/files/patch-storage_buffindexed_shmem.c
new file mode 100644
index 000000000000..9472e1467c65
--- /dev/null
+++ b/news/inn/files/patch-storage_buffindexed_shmem.c
@@ -0,0 +1,73 @@
+The problem seems to be that unsupported permission bits are being given to semget(2) as in the following snippet (there are several such instances):
+
+storage/buffindexed/shmem.c:
+
+ id = semget(kt, 2, IPC_CREAT|S_IRWXU|S_IRWXG|S_IRWXO);
+
+The semget(2) man page does not indicate that the usual file mode bits may be used. Instead, it allows:
+
+ SEM_R Read access for user.
+
+ SEM_A Alter access for user.
+
+ (SEM_R>>3) Read access for group.
+
+ (SEM_A>>3) Alter access for group.
+
+ (SEM_R>>6) Read access for other.
+
+ (SEM_A>>6) Alter access for other.
+
+The allowed bits correspond to read and write bits of the file mode constants. The execute bit is not among the defined bits for semget.
+
+The fix: do not set any permission bits except for the six allowed bits.
+
+Note that the documentation for linux semget differs, and seems to allow but ignore the execute bits.
+
+Patch attached with submission follows:
+
+--- storage/buffindexed/shmem.c.orig 2012-08-27 23:39:42.000000000 -0700
++++ storage/buffindexed/shmem.c 2012-08-27 23:37:50.000000000 -0700
+@@ -26,7 +26,9 @@
+ static int smcGetSemaphore(const char *name)
+ {
+ key_t kt = ftok( (char *)name, 0 );
+- int id = semget(kt, 0, S_IRWXU|S_IRWXG|S_IRWXO);
++ int perm = SEM_R | SEM_A | (SEM_R>>3) | (SEM_A>>3) |
++ (SEM_R>>6) | (SEM_A>>6);
++ int id = semget(kt, 0, perm);
+
+ if (id < 0) {
+ syswarn("semget failed to get semaphore for %s", name);
+@@ -37,15 +39,17 @@
+ static int smcCreateSemaphore(const char *name)
+ {
+ key_t kt = ftok( (char *)name, 0 );
+- int id = semget(kt, 2, IPC_CREAT|S_IRWXU|S_IRWXG|S_IRWXO);
++ int perm = SEM_R | SEM_A | (SEM_R>>3) | (SEM_A>>3) |
++ (SEM_R>>6) | (SEM_A>>6);
++ int id = semget(kt, 2, IPC_CREAT|perm);
+
+ if (id < 0) {
+ if (errno == EACCES || errno == EINVAL) {
+ /* looks like a wrong semaphore exists. remove it. */
+- id = semget(kt, 0, S_IRWXU|S_IRWXG|S_IRWXO);
++ id = semget(kt, 0, perm);
+ if (id < 0) {
+ /* couldn't even retrieve it. */
+- syswarn("cant get semaphore using %s", name);
++ syswarn("cant get semaphore using %s (key=%d)", name, kt);
+ return id;
+ }
+ /* try to remove it */
+@@ -65,7 +69,7 @@
+ }
+ #endif
+ /* and retry creating it */
+- id = semget(kt, 2, IPC_CREAT|S_IRWXU|S_IRWXG|S_IRWXO);
++ id = semget(kt, 2, IPC_CREAT|perm);
+ }
+ }
+ if (id < 0)
+
+