4 * Functions which implement RFC2086/RFC4314 (IMAP ACL extension)
17 #include <sys/types.h>
19 #if TIME_WITH_SYS_TIME
20 # include <sys/time.h>
24 # include <sys/time.h>
36 #include "sysdep_decls.h"
37 #include "citserver.h"
40 #include "serv_extensions.h"
47 #include "internet_addressing.h"
48 #include "serv_imap.h"
49 #include "imap_tools.h"
50 #include "imap_fetch.h"
51 #include "imap_misc.h"
57 * Implements the SETACL command.
59 void imap_setacl(int num_parms, char *parms[]) {
61 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
67 * Implements the DELETEACL command.
69 void imap_deleteacl(int num_parms, char *parms[]) {
71 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
78 * Implements the GETACL command.
80 void imap_getacl(int num_parms, char *parms[]) {
81 char roomname[ROOMNAMELEN];
82 char savedroom[ROOMNAMELEN];
86 struct cdbdata *cdbus;
91 cprintf("%s BAD usage error\r\n", parms[0]);
95 ret = imap_grabroom(roomname, parms[2], 0);
97 cprintf("%s NO Invalid mailbox name or access denied\r\n",
103 * usergoto() formally takes us to the desired room. (If another
104 * folder is selected, save its name so we can return there!!!!!)
106 if (IMAP->selected) {
107 strcpy(savedroom, CC->room.QRname);
109 usergoto(roomname, 0, 0, &msgs, &new);
113 imap_strout(parms[2]);
116 * Traverse the userlist
118 cdb_rewind(CDB_USERS);
119 while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) {
120 memset(&temp, 0, sizeof temp);
121 memcpy(&temp, cdbus->ptr, sizeof temp);
124 CtdlRoomAccess(&CC->room, &temp, &ra, NULL);
125 if (strlen(temp.fullname) > 0) {
128 /* l - lookup (mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox)
129 * r - read (SELECT the mailbox, perform STATUS)
130 * s - keep seen/unseen information across sessions (set or clear \SEEN flag
131 * via STORE, also set \SEEN during APPEND/COPY/ FETCH BODY[...])
133 if ( (ra & UA_KNOWN) /* known rooms */
134 || ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED)) /* zapped rooms */
141 /* w - write (set or clear flags other than \SEEN and \DELETED via
142 * STORE, also set them during APPEND/COPY)
144 /* Never granted in Citadel because our store doesn't support other flags */
146 /* i - insert (perform APPEND, COPY into mailbox)
147 * p - post (send mail to submission address for mailbox, not enforced by IMAP)
149 if (ra & UA_POSTALLOWED) {
154 /* k - create mailboxes (CREATE new sub-mailboxes in any
155 * implementation-defined hierarchy, parent mailbox for the new
156 * mailbox name in RENAME) */
158 /* x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) */
160 /* t - delete messages (set or clear \DELETED flag via STORE, set
161 * \DELETED flag during APPEND/COPY) */
163 /* e - perform EXPUNGE and expunge as a part of CLOSE */
165 /* a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) */
167 if (strlen(rights) > 0) {
169 imap_strout(temp.fullname);
170 cprintf(" %s", rights);
178 * If another folder is selected, go back to that room so we can resume
179 * our happy day without violent explosions.
181 if (IMAP->selected) {
182 usergoto(savedroom, 0, 0, &msgs, &new);
185 cprintf("%s OK GETACL completed\r\n", parms[0]);
190 * Implements the LISTRIGHTS command.
192 void imap_listrights(int num_parms, char *parms[]) {
194 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
200 * Implements the MYRIGHTS command.
202 void imap_myrights(int num_parms, char *parms[]) {
204 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);