Codebase list citadel / 11ba4c8
Imported Upstream version 8.16 Michael Meskes 11 years ago
19 changed file(s) with 338 addition(s) and 104 deletion(s). Raw diff Collapse all Expand all
33 * The condensed version:
44
55 1. Create a user on your system under which to run Citadel
6 2. Install supported versions of Berkeley DB, libical, and libsieve.
6 2. Install supported versions of all dependencies
77 3. ./configure && make && make install
88 4. Run the "setup" program
99
00 /*
11 * Main Citadel header file
22 *
3 * Copyright (c) 1987-2012 by the citadel.org team
3 * Copyright (c) 1987-2013 by the citadel.org team
44 *
55 * This program is open source software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License version 3.
4444 * usually more strict because you're not really supposed to dump/load and
4545 * upgrade at the same time.
4646 */
47 #define REV_LEVEL 814 /* This version */
47 #define REV_LEVEL 816 /* This version */
4848 #define REV_MIN 591 /* Oldest compatible database */
4949 #define EXPORT_REV_MIN 760 /* Oldest compatible export files */
50 #define LIBCITADEL_MIN 814 /* Minimum required version of libcitadel */
50 #define LIBCITADEL_MIN 816 /* Minimum required version of libcitadel */
5151
5252 #define SERVER_TYPE 0 /* zero for stock Citadel; other developers please
5353 obtain SERVER_TYPE codes for your implementations */
283283 cprintf("0\n"); /* 1 = no, this server is not LDAP-enabled */
284284 #endif
285285
286 if (config.c_auth_mode == AUTHMODE_NATIVE) {
286 if ((config.c_auth_mode == AUTHMODE_NATIVE) &&
287 (config.c_disable_newu == 0))
288 {
287289 cprintf("%d\n", config.c_disable_newu);
288290 }
289291 else {
00 #! /bin/sh
11 # From configure.ac Revision: 5108 .
22 # Guess values for system-dependent variables and create Makefiles.
3 # Generated by GNU Autoconf 2.67 for Citadel 8.14.
3 # Generated by GNU Autoconf 2.67 for Citadel 8.16.
44 #
55 # Report bugs to <http://www.citadel.org/>.
66 #
552552 # Identity of this package.
553553 PACKAGE_NAME='Citadel'
554554 PACKAGE_TARNAME='citadel'
555 PACKAGE_VERSION='8.14'
556 PACKAGE_STRING='Citadel 8.14'
555 PACKAGE_VERSION='8.16'
556 PACKAGE_STRING='Citadel 8.16'
557557 PACKAGE_BUGREPORT='http://www.citadel.org/'
558558 PACKAGE_URL=''
559559
12641264 # Omit some internal or obsolete options to make the list less imposing.
12651265 # This message is too long to be a string in the A/UX 3.1 sh.
12661266 cat <<_ACEOF
1267 \`configure' configures Citadel 8.14 to adapt to many kinds of systems.
1267 \`configure' configures Citadel 8.16 to adapt to many kinds of systems.
12681268
12691269 Usage: $0 [OPTION]... [VAR=VALUE]...
12701270
13291329
13301330 if test -n "$ac_init_help"; then
13311331 case $ac_init_help in
1332 short | recursive ) echo "Configuration of Citadel 8.14:";;
1332 short | recursive ) echo "Configuration of Citadel 8.16:";;
13331333 esac
13341334 cat <<\_ACEOF
13351335
14471447 test -n "$ac_init_help" && exit $ac_status
14481448 if $ac_init_version; then
14491449 cat <<\_ACEOF
1450 Citadel configure 8.14
1450 Citadel configure 8.16
14511451 generated by GNU Autoconf 2.67
14521452
14531453 Copyright (C) 2010 Free Software Foundation, Inc.
21052105 This file contains any messages produced by compilers while
21062106 running configure, to aid debugging if configure makes a mistake.
21072107
2108 It was created by Citadel $as_me 8.14, which was
2108 It was created by Citadel $as_me 8.16, which was
21092109 generated by GNU Autoconf 2.67. Invocation command line was
21102110
21112111 $ $0 $@
84568456 # report actual input values of CONFIG_FILES etc. instead of their
84578457 # values after options handling.
84588458 ac_log="
8459 This file was extended by Citadel $as_me 8.14, which was
8459 This file was extended by Citadel $as_me 8.16, which was
84608460 generated by GNU Autoconf 2.67. Invocation command line was
84618461
84628462 CONFIG_FILES = $CONFIG_FILES
85188518 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
85198519 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
85208520 ac_cs_version="\\
8521 Citadel config.status 8.14
8521 Citadel config.status 8.16
85228522 configured by $0, generated by GNU Autoconf 2.67,
85238523 with options \\"\$ac_cs_config\\"
85248524
00 dnl Process this file with autoconf to produce a configure script.
11 AC_PREREQ(2.52)
2 AC_INIT([Citadel], [8.14], [http://www.citadel.org/])
2 AC_INIT([Citadel], [8.16], [http://www.citadel.org/])
33 AC_REVISION([$Revision: 5108 $])
44 AC_CONFIG_SRCDIR([citserver.c])
55 AC_CONFIG_HEADER(sysdep.h)
8888 {
8989 if (!IsEmptyStr(msg)) {
9090 syslog(LOG_DEBUG, "DB: %s", msg);
91 cit_backtrace();
9192 }
9293 }
9394
9697 void cdb_verbose_err(const DB_ENV *dbenv, const char *errpfx, const char *msg)
9798 {
9899 syslog(LOG_ALERT, "DB: %s", msg);
100 cit_backtrace();
99101 }
100102
101103
141143 static void dbpanic(DB_ENV * env, int errval)
142144 {
143145 syslog(LOG_EMERG, "bdb(): PANIC: %s", db_strerror(errval));
146 cit_backtrace();
144147 }
145148
146149 static void cclose(DBC * cursor)
368368 case eSendMore:
369369 assert(IO->SendDone);
370370 IO->NextState = IO->SendDone(IO);
371 ev_io_start(event_base, &IO->send_event);
371 switch (IO->NextState)
372 {
373 case eSendFile:
374 case eSendReply:
375 case eSendMore:
376 case eReadMessage:
377 case eReadPayload:
378 case eReadMore:
379 case eReadFile:
380 ev_io_start(event_base, &IO->send_event);
381 break;
382 case eDBQuery:
383 StopClientWatchers(IO, 0);
384 default:
385 break;
386 }
372387 break;
373388 case eReadPayload:
374389 case eReadMore:
205205 if (IsEmptyStr(filename)) {
206206 cprintf("%d You must specify a file name.\n",
207207 ERROR + FILE_NOT_FOUND);
208 return;
209 }
210 if (strstr(filename, "../") != NULL)
211 {
212 cprintf("%d syntax error.\n",
213 ERROR + ILLEGAL_VALUE);
208214 return;
209215 }
210216
288294 filename[a] = '_';
289295 }
290296 }
297 if (strstr(filename, "../") != NULL)
298 {
299 cprintf("%d syntax error.\n",
300 ERROR + ILLEGAL_VALUE);
301 return;
302 }
303
291304 snprintf(pathname, sizeof pathname,
292305 "%s/%s",
293306 ctdl_image_dir,
304304
305305 void DestructCAres(AsyncIO *IO)
306306 {
307 EV_DNS_syslog(LOG_DEBUG, "C-ARES: %s\n", __FUNCTION__);
308
309 EV_DNS_LOG_STOP(DNS.recv_event);
307 EVNC_syslog(LOG_DEBUG, "C-ARES: %s\n", __FUNCTION__);
308
309 EVNC_syslog(LOG_DEBUG, "C-ARES: - stopping %s %d %p \n", "DNS.recv_event", IO->DNS.recv_event.fd, &IO->DNS.recv_event);
310310 ev_io_stop(event_base, &IO->DNS.recv_event);
311311
312 EV_DNS_LOG_STOP(DNS.send_event);
312 EVNC_syslog(LOG_DEBUG, "C-ARES: - stopping %s %d %p\n", "DNS.send_event", IO->DNS.send_event.fd, &IO->DNS.send_event);
313313 ev_io_stop(event_base, &IO->DNS.send_event);
314314
315 EV_DNS_LOGT_STOP(DNS.timeout);
315 EVNC_syslog(LOG_DEBUG, "C-ARES: - stopping %s %p\n", "DNS.timeout", &IO->DNS.send_event);
316316 ev_timer_stop (event_base, &IO->DNS.timeout);
317317
318 EV_DNS_LOGT_STOP(unwind_stack);
318 EVNC_syslog(LOG_DEBUG, "C-ARES: - stopping %s %p\n", "DNS.unwind_stack", &IO->unwind_stack);
319319 ev_idle_stop(event_base, &IO->unwind_stack);
320320 ares_destroy_options(&IO->DNS.Options);
321321 }
210210 struct cdbdata *cdboi;
211211 long usernum = 0L;
212212
213 if (config.c_disable_newu)
214 {
215 cprintf("%d this system does not support openid.\n",
216 ERROR + CMD_NOT_SUPPORTED);
217 return;
218 }
213219 if (CtdlAccessCheck(ac_logged_in)) return;
220
214221 cdb_rewind(CDB_OPENID);
215222 cprintf("%d Associated OpenIDs:\n", LISTING_FOLLOWS);
216223
235242 long usernum;
236243 struct ctdluser usbuf;
237244
245 if (config.c_disable_newu)
246 {
247 cprintf("%d this system does not support openid.\n",
248 ERROR + CMD_NOT_SUPPORTED);
249 return;
250 }
238251 if (CtdlAccessCheck(ac_aide)) return;
239252 cdb_rewind(CDB_OPENID);
240253 cprintf("%d List of all OpenIDs in the database:\n", LISTING_FOLLOWS);
264277 void cmd_oidc(char *argbuf) {
265278 ctdl_openid *oiddata = (ctdl_openid *) CC->openid_data;
266279
280 if (config.c_disable_newu)
281 {
282 cprintf("%d this system does not support openid.\n",
283 ERROR + CMD_NOT_SUPPORTED);
284 return;
285 }
267286 if ( (!oiddata) || (!oiddata->verified) ) {
268287 cprintf("%d You have not verified an OpenID yet.\n", ERROR);
269288 return;
291310 int this_is_mine = 0;
292311 long usernum = 0L;
293312
313 if (config.c_disable_newu)
314 {
315 cprintf("%d this system does not support openid.\n",
316 ERROR + CMD_NOT_SUPPORTED);
317 return;
318 }
294319 if (CtdlAccessCheck(ac_logged_in)) return;
295320 extract_token(id_to_detach, argbuf, 0, '|', sizeof id_to_detach);
296321 if (IsEmptyStr(id_to_detach)) {
806831 ctdl_openid *oiddata;
807832 int discovery_succeeded = 0;
808833
834 if (config.c_disable_newu)
835 {
836 cprintf("%d this system does not support openid.\n",
837 ERROR + CMD_NOT_SUPPORTED);
838 return;
839 }
809840 Free_ctdl_openid ((ctdl_openid**)&CCC->openid_data);
810841
811842 CCC->openid_data = oiddata = malloc(sizeof(ctdl_openid));
931962 void *Value;
932963 ctdl_openid *oiddata = (ctdl_openid *) CC->openid_data;
933964
965 if (config.c_disable_newu)
966 {
967 cprintf("%d this system does not support openid.\n",
968 ERROR + CMD_NOT_SUPPORTED);
969 return;
970 }
934971 if (oiddata == NULL) {
935972 cprintf("%d run OIDS first.\n", ERROR + INTERNAL_ERROR);
936973 return;
196196 FreeStrBuf(&ptr->IO.SendBuf.Buf);
197197 FreeStrBuf(&ptr->IO.RecvBuf.Buf);
198198 DeleteAsyncMsg(&ptr->IO.ReadMsg);
199 ((struct CitContext*)ptr->IO.CitContext)->state = CON_IDLE;
200 ((struct CitContext*)ptr->IO.CitContext)->kill_me = 1;
199 if (((struct CitContext*)ptr->IO.CitContext)) {
200 ((struct CitContext*)ptr->IO.CitContext)->state = CON_IDLE;
201 ((struct CitContext*)ptr->IO.CitContext)->kill_me = 1;
202 }
201203 FreeAsyncIOContents(&ptr->IO);
202204 free(ptr);
203205 }
152152
153153 Msg->IDestructQueItem = DecreaseQReference(Msg->MyQItem);
154154
155 Msg->nRemain = CountActiveQueueEntries(Msg->MyQItem);
155 Msg->nRemain = CountActiveQueueEntries(Msg->MyQItem, 0);
156156
157157 if (Msg->MyQEntry->Active &&
158 !Msg->MyQEntry->StillActive &&
158159 CheckQEntryIsBounce(Msg->MyQEntry))
159160 {
160161 /* are we casue for a bounce mail? */
175176 Msg->MyQItem->QueMsgID = -1;
176177
177178 if (Msg->IDestructQueItem)
178 smtpq_do_bounce(Msg->MyQItem, Msg->msgtext);
179 smtpq_do_bounce(Msg->MyQItem, Msg->msgtext, Msg->pCurrRelay);
179180
180181 if (Msg->nRemain > 0)
181182 {
245245 return 0;
246246 }
247247
248 int CountActiveQueueEntries(OneQueItem *MyQItem)
248 int CountActiveQueueEntries(OneQueItem *MyQItem, int before)
249249 {
250250 HashPos *It;
251251 long len;
257257 It = GetNewHashPos(MyQItem->MailQEntries, 0);
258258 while (GetNextHashPos(MyQItem->MailQEntries, It, &len, &Key, &vQE))
259259 {
260 int Active;
260261 MailQEntry *ThisItem = vQE;
261262
262263 if (CheckQEntryActive(ThisItem))
263264 {
264265 ActiveDeliveries++;
265 ThisItem->Active = 1;
266 Active = 1;
266267 }
267268 else
268 ThisItem->Active = 0;
269 Active = 0;
270 if (before)
271 ThisItem->Active = Active;
272 else
273 ThisItem->StillActive = Active;
269274 }
270275 DeleteHashPos(&It);
271276 return ActiveDeliveries;
504509 * instructions for "5" codes (permanent fatal errors) and produce/deliver
505510 * a "bounce" message (delivery status notification).
506511 */
507 void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt)
512 void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay)
508513 {
509514 static int seq = 0;
510515
555560 {
556561 ++num_bounces;
557562
563 StrBufAppendBufPlain(Msg, HKEY(" "), 0);
558564 StrBufAppendBuf(Msg, ThisItem->Recipient, 0);
559565 StrBufAppendBufPlain(Msg, HKEY(": "), 0);
560566 StrBufAppendBuf(Msg, ThisItem->StatusMessage, 0);
569575 if (num_bounces == 0) {
570576 FreeStrBuf(&Msg);
571577 return;
578 }
579
580 if ((StrLength(MyQItem->SenderRoom) == 0) && MyQItem->HaveRelay) {
581 /* one message that relaying is broken is enough; no extra room error message. */
582 StrBuf *RelayDetails = NewStrBuf();
583
584 StrBufPrintf(RelayDetails,
585 "Relaying via %s failed permanently. \n Reason:\n%s\n Revalidate your relay configuration.",
586 ChrPtr(Relay->URL),
587 ChrPtr(Msg));
588 CtdlAideMessage(ChrPtr(RelayDetails), "Relaying Failed");
589 FreeStrBuf(&RelayDetails);
572590 }
573591
574592 boundary = NewStrBufPlain(HKEY("=_Citadel_Multipart_"));
883901 DeleteHashPos(&It);
884902
885903 MyQItem->NotYetShutdownDeliveries =
886 MyQItem->ActiveDeliveries = CountActiveQueueEntries(MyQItem);
904 MyQItem->ActiveDeliveries = CountActiveQueueEntries(MyQItem, 1);
887905
888906 /* failsafe against overload:
889907 * will we exceed the limit set?
112112 #define SMTP_DBG_READ() \
113113 EVS_syslog(LOG_DEBUG, "< %s\n", ChrPtr(Msg->IO.IOBuf))
114114
115 /*
116 * if a Read handler wants to skip to a specific part use this macro.
117 * the -1 is here since the auto-forward following has to be taken into account.
118 */
119 #define READ_NEXT_STATE(state) Msg->State = state - 1
115120
116121 /*****************************************************************************/
117122 /* SMTP CLIENT STATE CALLBACKS */
150155 SMTP_DBG_READ();
151156
152157 if (SMTP_IS_STATE('2')) {
153 Msg->State ++;
158 READ_NEXT_STATE(eSMTPAuth);
154159
155160 if ((Msg->pCurrRelay == NULL) ||
156161 (Msg->pCurrRelay->User == NULL))
157 Msg->State ++; /* Skip auth... */
162 READ_NEXT_STATE(eFROM); /* Skip auth... */
163 if (Msg->pCurrRelay != NULL)
164 {
165 if (strstr(ChrPtr(Msg->IO.IOBuf), "LOGIN") != NULL)
166 Msg->SendLogin = 1;
167 }
158168 }
159169 /* else we fall back to 'helo' */
160170 return eSendReply;
184194 }
185195 if ((Msg->pCurrRelay == NULL) ||
186196 (Msg->pCurrRelay->User == NULL))
187 Msg->State ++; /* Skip auth... */
197 READ_NEXT_STATE(eFROM); /* Skip auth... */
188198
189199 return eSendReply;
190200 }
197207
198208 if ((Msg->pCurrRelay == NULL) ||
199209 (Msg->pCurrRelay->User == NULL))
200 Msg->State ++; /* Skip auth, shouldn't even come here!... */
210 READ_NEXT_STATE(eFROM); /* Skip auth, shouldn't even come here!... */
201211 else {
202212 /* Do an AUTH command if necessary */
203 sprintf(buf, "%s%c%s%c%s",
204 Msg->pCurrRelay->User, '\0',
205 Msg->pCurrRelay->User, '\0',
206 Msg->pCurrRelay->Pass);
207
208 CtdlEncodeBase64(encoded, buf,
209 strlen(Msg->pCurrRelay->User) * 2 +
210 strlen(Msg->pCurrRelay->Pass) + 2, 0);
211
212 StrBufPrintf(Msg->IO.SendBuf.Buf,
213 "AUTH PLAIN %s\r\n", encoded);
214 }
215 SMTP_DBG_SEND();
216 return eReadMessage;
217 }
213 if (Msg->SendLogin)
214 {
215 StrBufPlain(Msg->IO.SendBuf.Buf,
216 HKEY("AUTH LOGIN\r\n"));
217 }
218 else
219 {
220 sprintf(buf, "%s%c%s%c%s",
221 Msg->pCurrRelay->User, '\0',
222 Msg->pCurrRelay->User, '\0',
223 Msg->pCurrRelay->Pass);
224
225 CtdlEncodeBase64(encoded, buf,
226 strlen(Msg->pCurrRelay->User) * 2 +
227 strlen(Msg->pCurrRelay->Pass) + 2, 0);
228
229 StrBufPrintf(Msg->IO.SendBuf.Buf,
230 "AUTH PLAIN %s\r\n",
231 encoded);
232 }
233 }
234 SMTP_DBG_SEND();
235 return eReadMessage;
236 }
237
218238
219239 eNextState SMTPC_read_auth_reply(SmtpOutMsg *Msg)
240 {
241 AsyncIO *IO = &Msg->IO;
242 /* Do an AUTH command if necessary */
243
244 SMTP_DBG_READ();
245
246 if (Msg->SendLogin)
247 {
248 if (!SMTP_IS_STATE('3'))
249 SMTP_VERROR(5);
250 }
251 else
252 {
253 if (!SMTP_IS_STATE('2')) {
254 if (SMTP_IS_STATE('4'))
255 SMTP_VERROR(4);
256 else
257 SMTP_VERROR(5);
258 }
259 READ_NEXT_STATE(eFROM);
260 }
261 return eSendReply;
262 }
263
264
265 eNextState SMTPC_send_authplain_1(SmtpOutMsg *Msg)
266 {
267 AsyncIO *IO = &Msg->IO;
268 char buf[SIZ];
269 char encoded[1024];
270 long encodedlen;
271
272 sprintf(buf, "%s",
273 Msg->pCurrRelay->User);
274
275 encodedlen = CtdlEncodeBase64(
276 encoded,
277 Msg->pCurrRelay->User,
278 strlen(Msg->pCurrRelay->User),
279 0);
280
281 StrBufPlain(Msg->IO.SendBuf.Buf,
282 encoded,
283 encodedlen);
284
285 StrBufAppendBufPlain(Msg->IO.SendBuf.Buf,
286 HKEY("\r\n"), 0);
287
288 SMTP_DBG_SEND();
289
290 return eReadMessage;
291 }
292 eNextState SMTPC_read_auth_plain_reply_1(SmtpOutMsg *Msg)
293 {
294 AsyncIO *IO = &Msg->IO;
295 /* Do an AUTH command if necessary */
296
297 SMTP_DBG_READ();
298
299 if (!SMTP_IS_STATE('3'))
300 SMTP_VERROR(5);
301 return eSendReply;
302 }
303
304
305 eNextState SMTPC_send_authplain_2(SmtpOutMsg *Msg)
306 {
307 AsyncIO *IO = &Msg->IO;
308 char buf[SIZ];
309 char encoded[1024];
310 long encodedlen;
311
312 sprintf(buf, "%s",
313 Msg->pCurrRelay->Pass);
314
315 encodedlen = CtdlEncodeBase64(
316 encoded,
317 Msg->pCurrRelay->User,
318 strlen(Msg->pCurrRelay->User),
319 0);
320
321 StrBufPlain(Msg->IO.SendBuf.Buf,
322 encoded,
323 encodedlen);
324
325 StrBufAppendBufPlain(Msg->IO.SendBuf.Buf,
326 HKEY("\r\n"), 0);
327
328 SMTP_DBG_SEND();
329
330 return eReadMessage;
331 }
332 eNextState SMTPC_read_auth_plain_reply_2(SmtpOutMsg *Msg)
220333 {
221334 AsyncIO *IO = &Msg->IO;
222335 /* Do an AUTH command if necessary */
319432 Buf = Msg->IO.SendBuf.Buf;
320433 Msg->IO.SendBuf.Buf = Msg->msgtext;
321434 Msg->msgtext = Buf;
435 /*
436 * sending the message itself doesn't use this state machine.
437 * so we have to operate it here by ourselves.
438 */
322439 Msg->State ++;
323440
324441 return eSendMore;
402519 SMTPC_read_EHLO_reply,
403520 SMTPC_read_HELO_reply,
404521 SMTPC_read_auth_reply,
522 SMTPC_read_auth_plain_reply_1,
523 SMTPC_read_auth_plain_reply_2,
405524 SMTPC_read_FROM_reply,
406525 SMTPC_read_RCPT_reply,
407526 SMTPC_read_DATAcmd_reply,
414533 SMTPC_send_EHLO,
415534 STMPC_send_HELO,
416535 SMTPC_send_auth,
536 SMTPC_send_authplain_1,
537 SMTPC_send_authplain_2,
417538 SMTPC_send_FROM,
418539 SMTPC_send_RCPT,
419540 SMTPC_send_DATAcmd,
428549 300., /* Greeting... */
429550 30., /* EHLO */
430551 30., /* HELO */
552 30., /* Auth */
553 30., /* Auth */
431554 30., /* Auth */
432555 30., /* From */
433556 90., /* RCPT */
441564 30., /* EHLO */
442565 30., /* HELO */
443566 30., /* Auth */
567 30., /* Auth */
568 30., /* Auth */
444569 30., /* From */
445570 30., /* RCPT */
446571 30., /* DATA */
454579 {HKEY("Connection broken during SMTP EHLO")},
455580 {HKEY("Connection broken during SMTP HELO")},
456581 {HKEY("Connection broken during SMTP AUTH")},
582 {HKEY("Connection broken during SMTP AUTH PLAIN I")},
583 {HKEY("Connection broken during SMTP AUTH PLAIN II")},
457584 {HKEY("Connection broken during SMTP MAIL FROM")},
458585 {HKEY("Connection broken during SMTP RCPT")},
459586 {HKEY("Connection broken during SMTP DATA")},
2121 eEHLO,
2222 eHELO,
2323 eSMTPAuth,
24 eSMTPAuthPlain1,
25 eSMTPAuthPlain2,
2426 eFROM,
2527 eRCPT,
2628 eDATA,
6668 char name[1024];
6769 char mailfrom[1024];
6870
71 long SendLogin;
6972 long Flags;
7073 } SmtpOutMsg;
7174
3939
4040 int n;
4141 int Active;
42 int StillActive;
4243 }MailQEntry;
4344
4445 typedef struct queueitem {
7576 void DecreaseShutdownDeliveries(OneQueItem *MyQItem);
7677 int GetShutdownDeliveries(OneQueItem *MyQItem);
7778 void RemoveQItem(OneQueItem *MyQItem);
78 int CountActiveQueueEntries(OneQueItem *MyQItem);
79 int CountActiveQueueEntries(OneQueItem *MyQItem, int before);
7980 StrBuf *SerializeQueueItem(OneQueItem *MyQItem);
80 void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt);
81 void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay);
8182
8283 int CheckQEntryIsBounce(MailQEntry *ThisItem);
328328 * and in the global address book).
329329 */
330330 int vcard_upload_beforesave(struct CtdlMessage *msg) {
331 struct CitContext *CCC = CC;
331332 char *ptr;
332333 char *s;
333334 char buf[SIZ];
339340 int yes_my_citadel_config = 0;
340341 int yes_any_vcard_room = 0;
341342
342 if (!CC->logged_in) return(0); /* Only do this if logged in. */
343 if (!CCC->logged_in) return(0); /* Only do this if logged in. */
343344
344345 /* Is this some user's "My Citadel Config" room? */
345 if ( (CC->room.QRflags && QR_MAILBOX)
346 && (!strcasecmp(&CC->room.QRname[11], USERCONFIGROOM)) ) {
346 if (((CCC->room.QRflags & QR_MAILBOX) != 0) &&
347 (!strcasecmp(&CCC->room.QRname[11], USERCONFIGROOM)) ) {
347348 /* Yes, we want to do this */
348349 yes_my_citadel_config = 1;
349350
350351 #ifdef VCARD_SAVES_BY_AIDES_ONLY
351352 /* Prevent non-aides from performing registration changes */
352 if (CC->user.axlevel < AxAideU) {
353 if (CCC->user.axlevel < AxAideU) {
353354 return(1);
354355 }
355356 #endif
357358 }
358359
359360 /* Is this a room with an address book in it? */
360 if (CC->room.QRdefaultview == VIEW_ADDRESSBOOK) {
361 if (CCC->room.QRdefaultview == VIEW_ADDRESSBOOK) {
361362 yes_any_vcard_room = 1;
362363 }
363364
385386 if (v == NULL) return(0); /* no vCards were found in this message */
386387
387388 /* If users cannot create their own accounts, they cannot re-register either. */
388 if ( (yes_my_citadel_config) && (config.c_disable_newu) && (CC->user.axlevel < AxAideU) ) {
389 if ( (yes_my_citadel_config) && (config.c_disable_newu) && (CCC->user.axlevel < AxAideU) ) {
389390 return(1);
390391 }
391392
396397 * delete the old one. First, figure out which user
397398 * is being re-registered...
398399 */
399 what_user = atol(CC->room.QRname);
400
401 if (what_user == CC->user.usernum) {
400 what_user = atol(CCC->room.QRname);
401
402 if (what_user == CCC->user.usernum) {
402403 /* It's the logged in user. That was easy. */
403 memcpy(&usbuf, &CC->user, sizeof(struct ctdluser));
404 memcpy(&usbuf, &CCC->user, sizeof(struct ctdluser));
404405 }
405406
406407 else if (CtdlGetUserByNumber(&usbuf, what_user) == 0) {
420421 * vCard in the user's config room at all times.
421422 *
422423 */
423 CtdlDeleteMessages(CC->room.QRname, NULL, 0, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$");
424 CtdlDeleteMessages(CCC->room.QRname, NULL, 0, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$");
424425
425426 /* Make the author of the message the name of the user. */
426427 if (msg->cm_fields['A'] != NULL) {
507508 * address book).
508509 */
509510 int vcard_upload_aftersave(struct CtdlMessage *msg) {
511 struct CitContext *CCC = CC;
510512 char *ptr;
511513 int linelen;
512514 long I;
517519 char roomname[ROOMNAMELEN];
518520
519521 if (msg->cm_format_type != 4) return(0);
520 if (!CC->logged_in) return(0); /* Only do this if logged in. */
522 if (!CCC->logged_in) return(0); /* Only do this if logged in. */
521523
522524 /* We're interested in user config rooms only. */
523525
524 if ( (strlen(CC->room.QRname) >= 12) && (!strcasecmp(&CC->room.QRname[11], USERCONFIGROOM)) ) {
526 if ( (strlen(CCC->room.QRname) >= 12) && (!strcasecmp(&CCC->room.QRname[11], USERCONFIGROOM)) ) {
525527 is_UserConf = 1; /* It's someone's config room */
526528 }
527 CtdlMailboxName(roomname, sizeof roomname, &CC->user, USERCONFIGROOM);
528 if (!strcasecmp(CC->room.QRname, roomname)) {
529 CtdlMailboxName(roomname, sizeof roomname, &CCC->user, USERCONFIGROOM);
530 if (!strcasecmp(CCC->room.QRname, roomname)) {
529531 is_UserConf = 1;
530532 is_MY_UserConf = 1; /* It's MY config room */
531533 }
532 if (!strcasecmp(CC->room.QRname, ADDRESS_BOOK_ROOM)) {
534 if (!strcasecmp(CCC->room.QRname, ADDRESS_BOOK_ROOM)) {
533535 is_GAB = 1; /* It's the Global Address Book */
534536 }
535537
538540 ptr = msg->cm_fields['M'];
539541 if (ptr == NULL) return(0);
540542
541 NewStrBufDupAppendFlush(&CC->StatusMessage, NULL, NULL, 0);
542
543 StrBufPrintf(CC->StatusMessage, "%d\n", LISTING_FOLLOWS);
543 NewStrBufDupAppendFlush(&CCC->StatusMessage, NULL, NULL, 0);
544
545 StrBufPrintf(CCC->StatusMessage, "%d\n", LISTING_FOLLOWS);
544546
545547 while (ptr != NULL) {
546548
560562 /* Store our Internet return address in memory */
561563 if (is_MY_UserConf) {
562564 v = vcard_load(msg->cm_fields['M']);
563 extract_inet_email_addrs(CC->cs_inet_email, sizeof CC->cs_inet_email,
564 CC->cs_inet_other_emails, sizeof CC->cs_inet_other_emails,
565 extract_inet_email_addrs(CCC->cs_inet_email, sizeof CCC->cs_inet_email,
566 CCC->cs_inet_other_emails, sizeof CCC->cs_inet_other_emails,
565567 v, 1);
566 extract_friendly_name(CC->cs_inet_fn, sizeof CC->cs_inet_fn, v);
568 extract_friendly_name(CCC->cs_inet_fn, sizeof CCC->cs_inet_fn, v);
567569 vcard_free(v);
568570 }
569571
581583 * But if the user was an Aide or was edited by an Aide then we can
582584 * Assume they don't need validating.
583585 */
584 if (CC->user.axlevel >= AxAideU) {
585 CtdlGetUserLock(&CC->user, CC->curr_user);
586 CC->user.flags |= US_REGIS;
587 CtdlPutUserLock(&CC->user);
586 if (CCC->user.axlevel >= AxAideU) {
587 CtdlGetUserLock(&CCC->user, CCC->curr_user);
588 CCC->user.flags |= US_REGIS;
589 CtdlPutUserLock(&CCC->user);
588590 return (0);
589591 }
590592
591593 set_mm_valid();
592594
593595 /* ...which also means we need to flag the user */
594 CtdlGetUserLock(&CC->user, CC->curr_user);
595 CC->user.flags |= (US_REGIS|US_NEEDVALID);
596 CtdlPutUserLock(&CC->user);
596 CtdlGetUserLock(&CCC->user, CCC->curr_user);
597 CCC->user.flags |= (US_REGIS|US_NEEDVALID);
598 CtdlPutUserLock(&CCC->user);
597599
598600 return(0);
599601 }
623625 * and return an empty vCard.
624626 */
625627 struct vCard *vcard_get_user(struct ctdluser *u) {
628 struct CitContext *CCC = CC;
626629 char hold_rm[ROOMNAMELEN];
627630 char config_rm[ROOMNAMELEN];
628631 struct CtdlMessage *msg = NULL;
629632 struct vCard *v;
630633 long VCmsgnum;
631634
632 strcpy(hold_rm, CC->room.QRname); /* save current room */
635 strcpy(hold_rm, CCC->room.QRname); /* save current room */
633636 CtdlMailboxName(config_rm, sizeof config_rm, u, USERCONFIGROOM);
634637
635 if (CtdlGetRoom(&CC->room, config_rm) != 0) {
636 CtdlGetRoom(&CC->room, hold_rm);
638 if (CtdlGetRoom(&CCC->room, config_rm) != 0) {
639 CtdlGetRoom(&CCC->room, hold_rm);
637640 return vcard_new();
638641 }
639642
641644 VCmsgnum = (-1);
642645 CtdlForEachMessage(MSGS_LAST, 1, NULL, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$",
643646 NULL, vcard_gu_backend, (void *)&VCmsgnum );
644 CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */
647 CtdlGetRoom(&CCC->room, hold_rm); /* return to saved room */
645648
646649 if (VCmsgnum < 0L) return vcard_new();
647650
695698 * and enters the vCard into the user's configuration.
696699 */
697700 void cmd_regi(char *argbuf) {
701 struct CitContext *CCC = CC;
698702 int a,b,c;
699703 char buf[SIZ];
700704 struct vCard *my_vcard;
708712
709713 unbuffer_output();
710714
711 if (!(CC->logged_in)) {
715 if (!(CCC->logged_in)) {
712716 cprintf("%d Not logged in.\n",ERROR + NOT_LOGGED_IN);
713717 return;
714718 }
715719
716720 /* If users cannot create their own accounts, they cannot re-register either. */
717 if ( (config.c_disable_newu) && (CC->user.axlevel < AxAideU) ) {
721 if ( (config.c_disable_newu) && (CCC->user.axlevel < AxAideU) ) {
718722 cprintf("%d Self-service registration is not allowed here.\n",
719723 ERROR + HIGHER_ACCESS_REQUIRED);
720724 }
721725
722 my_vcard = vcard_get_user(&CC->user);
726 my_vcard = vcard_get_user(&CCC->user);
723727 strcpy(tmpaddr, "");
724728 strcpy(tmpcity, "");
725729 strcpy(tmpstate, "");
751755 snprintf(tmpaddress, sizeof tmpaddress, ";;%s;%s;%s;%s;%s",
752756 tmpaddr, tmpcity, tmpstate, tmpzip, tmpcountry);
753757 vcard_set_prop(my_vcard, "adr", tmpaddress, 0);
754 vcard_write_user(&CC->user, my_vcard);
758 vcard_write_user(&CCC->user, my_vcard);
755759 vcard_free(my_vcard);
756760 }
757761
761765 */
762766 void cmd_greg(char *argbuf)
763767 {
768 struct CitContext *CCC = CC;
764769 struct ctdluser usbuf;
765770 struct vCard *v;
766771 char *s;
770775
771776 extract_token(who, argbuf, 0, '|', sizeof who);
772777
773 if (!(CC->logged_in)) {
778 if (!(CCC->logged_in)) {
774779 cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
775780 return;
776781 }
777782
778 if (!strcasecmp(who,"_SELF_")) strcpy(who,CC->curr_user);
779
780 if ((CC->user.axlevel < AxAideU) && (strcasecmp(who,CC->curr_user))) {
783 if (!strcasecmp(who,"_SELF_")) strcpy(who,CCC->curr_user);
784
785 if ((CCC->user.axlevel < AxAideU) && (strcasecmp(who,CCC->curr_user))) {
781786 cprintf("%d Higher access required.\n",
782787 ERROR + HIGHER_ACCESS_REQUIRED);
783788 return;
9981003 */
9991004 void cmd_gvsn(char *argbuf)
10001005 {
1006 struct CitContext *CCC = CC;
1007
10011008 if (CtdlAccessCheck(ac_logged_in)) return;
10021009
10031010 cprintf("%d valid screen names:\n", LISTING_FOLLOWS);
1004 cprintf("%s\n", CC->user.fullname);
1005 if ( (!IsEmptyStr(CC->cs_inet_fn)) && (strcasecmp(CC->user.fullname, CC->cs_inet_fn)) ) {
1006 cprintf("%s\n", CC->cs_inet_fn);
1011 cprintf("%s\n", CCC->user.fullname);
1012 if ( (!IsEmptyStr(CCC->cs_inet_fn)) && (strcasecmp(CCC->user.fullname, CCC->cs_inet_fn)) ) {
1013 cprintf("%s\n", CCC->cs_inet_fn);
10071014 }
10081015 cprintf("000\n");
10091016 }
10141021 */
10151022 void cmd_gvea(char *argbuf)
10161023 {
1024 struct CitContext *CCC = CC;
10171025 int num_secondary_emails = 0;
10181026 int i;
10191027 char buf[256];
10211029 if (CtdlAccessCheck(ac_logged_in)) return;
10221030
10231031 cprintf("%d valid email addresses:\n", LISTING_FOLLOWS);
1024 if (!IsEmptyStr(CC->cs_inet_email)) {
1025 cprintf("%s\n", CC->cs_inet_email);
1026 }
1027 if (!IsEmptyStr(CC->cs_inet_other_emails)) {
1028 num_secondary_emails = num_tokens(CC->cs_inet_other_emails, '|');
1032 if (!IsEmptyStr(CCC->cs_inet_email)) {
1033 cprintf("%s\n", CCC->cs_inet_email);
1034 }
1035 if (!IsEmptyStr(CCC->cs_inet_other_emails)) {
1036 num_secondary_emails = num_tokens(CCC->cs_inet_other_emails, '|');
10291037 for (i=0; i<num_secondary_emails; ++i) {
1030 extract_token(buf, CC->cs_inet_other_emails,i,'|',sizeof CC->cs_inet_other_emails);
1038 extract_token(buf, CCC->cs_inet_other_emails,i,'|',sizeof CCC->cs_inet_other_emails);
10311039 cprintf("%s\n", buf);
10321040 }
10331041 }
14911499 if (rv == -1)
14921500 syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]",
14931501 filename, strerror(errno));
1502 rv = chmod(filename, 0600);
1503 if (rv == -1)
1504 syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]",
1505 filename, strerror(errno));
14941506 }
14951507
14961508 /* for postfix tcpdict */
203203 syslog(LOG_NOTICE,
204204 "*** Citadel server engine v%d.%02d (build %s) ***",
205205 (REV_LEVEL/100), (REV_LEVEL%100), svn_revision());
206 syslog(LOG_NOTICE, "Copyright (C) 1987-2012 by the Citadel development team.");
206 syslog(LOG_NOTICE, "Copyright (C) 1987-2013 by the Citadel development team.");
207207 syslog(LOG_NOTICE, "This program is distributed under the terms of the GNU "
208208 "General Public License.");
209209 syslog(LOG_NOTICE, " ");
88
99 const char *svn_revision (void)
1010 {
11 const char *SVN_Version = "53481be";
11 const char *SVN_Version = "05fa1ae";
1212 return SVN_Version;
1313 }