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[...])
132 * e - perform EXPUNGE and expunge as a part of CLOSE
134 if ( (ra & UA_KNOWN) /* known rooms */
135 || ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED)) /* zapped rooms */
142 /* Only output the remaining flags if the room is known */
144 /* w - write (set or clear arbitrary flags; not supported in Citadel) */
146 /* i - insert (perform APPEND, COPY into mailbox) */
147 /* p - post (send mail to submission address for mailbox - not enforced) */
148 if (ra & UA_POSTALLOWED) {
153 /* k - create mailboxes in this hierarchy */
155 /* t - delete messages (set/clear \Deleted flag) */
157 /* a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) */
158 /* x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) */
159 if (ra & UA_ADMINALLOWED) {
165 if (strlen(rights) > 0) {
167 imap_strout(temp.fullname);
168 cprintf(" %s", rights);
176 * If another folder is selected, go back to that room so we can resume
177 * our happy day without violent explosions.
179 if (IMAP->selected) {
180 usergoto(savedroom, 0, 0, &msgs, &new);
183 cprintf("%s OK GETACL completed\r\n", parms[0]);
188 * Implements the LISTRIGHTS command.
190 void imap_listrights(int num_parms, char *parms[]) {
192 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
198 * Implements the MYRIGHTS command.
200 void imap_myrights(int num_parms, char *parms[]) {
202 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);