Commit 09e92a52 09e92a52660337989381e4cd30004c6455d3466f by Sergey Poznyakoff

(read_bulletin_db,write_bulletin_db): Fix permissions.

(open_bulletin_mailbox): Open the mailbox in read-only mode
(set_bulletin_db): Do not try to open the mailbox.
1 parent 6e72726a
...@@ -50,8 +50,9 @@ open_bulletin_mailbox (mu_mailbox_t *pmbox) ...@@ -50,8 +50,9 @@ open_bulletin_mailbox (mu_mailbox_t *pmbox)
50 return 1; 50 return 1;
51 } 51 }
52 52
53 if ((status = mu_mailbox_open (tmbox, MU_STREAM_RDWR|MU_STREAM_CREAT)) != 0) 53 if ((status = mu_mailbox_open (tmbox, MU_STREAM_READ)) != 0)
54 { 54 {
55 mu_mailbox_destroy (pmbox);
55 mu_error (_("Cannot open bulletin mailbox `%s': %s"), 56 mu_error (_("Cannot open bulletin mailbox `%s': %s"),
56 bulletin_mbox_name, mu_strerror (status)); 57 bulletin_mbox_name, mu_strerror (status));
57 return 1; 58 return 1;
...@@ -66,13 +67,8 @@ open_bulletin_mailbox (mu_mailbox_t *pmbox) ...@@ -66,13 +67,8 @@ open_bulletin_mailbox (mu_mailbox_t *pmbox)
66 int 67 int
67 set_bulletin_source (char *source) 68 set_bulletin_source (char *source)
68 { 69 {
69 int rc;
70
71 bulletin_mbox_name = source; 70 bulletin_mbox_name = source;
72 rc = open_bulletin_mailbox (NULL); 71 return 0;
73 if (rc)
74 bulletin_mbox_name = NULL;
75 return rc;
76 } 72 }
77 73
78 static int 74 static int
...@@ -131,7 +127,7 @@ read_bulletin_db (size_t *pnum) ...@@ -131,7 +127,7 @@ read_bulletin_db (size_t *pnum)
131 size_t s; 127 size_t s;
132 char *p; 128 char *p;
133 129
134 rc = mu_dbm_open (bulletin_db_name, &db, MU_STREAM_READ, 0600); 130 rc = mu_dbm_open (bulletin_db_name, &db, MU_STREAM_READ, 0660);
135 if (rc) 131 if (rc)
136 { 132 {
137 mu_error (_("Unable to open bulletin db for reading: %s"), 133 mu_error (_("Unable to open bulletin db for reading: %s"),
...@@ -213,7 +209,7 @@ write_bulletin_db (size_t num) ...@@ -213,7 +209,7 @@ write_bulletin_db (size_t num)
213 int rc; 209 int rc;
214 char *p; 210 char *p;
215 211
216 rc = mu_dbm_open (bulletin_db_name, &db, MU_STREAM_RDWR, 0600); 212 rc = mu_dbm_open (bulletin_db_name, &db, MU_STREAM_RDWR, 0660);
217 if (rc) 213 if (rc)
218 { 214 {
219 mu_error (_("Unable to open bulletin db for writing: %s"), 215 mu_error (_("Unable to open bulletin db for writing: %s"),
......