static int seq = 0;
int i;
- journal_recps = validate_recipients(config.c_journal_dest);
+ journal_recps = validate_recipients(config.c_journal_dest, 0);
if (journal_recps != NULL) {
if ( (journal_recps->num_local > 0)
if (!strncasecmp(attendee_string, "MAILTO:", 7)) {
strcpy(attendee_string, &attendee_string[7]);
striplt(attendee_string);
- recp = validate_recipients(attendee_string);
+ recp = validate_recipients(attendee_string, 0);
if (recp != NULL) {
if (!strcasecmp(recp->recp_local, CC->user.fullname)) {
if (me_attend) icalproperty_free(me_attend);
reply_message_text);
if (msg != NULL) {
- valid = validate_recipients(organizer_string);
+ valid = validate_recipients(organizer_string, 0);
CtdlSubmitMsg(msg, valid, "");
CtdlFreeMessage(msg);
free_recipients(valid);
/* If not found, try it as an unqualified email address. */
if (found_user != 0) {
strcpy(buf, who);
- recp = validate_recipients(buf);
+ recp = validate_recipients(buf, 0);
lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
if (recp != NULL) {
if (recp->num_local == 1) {
if (found_user != 0) {
snprintf(buf, sizeof buf, "%s@%s", who, config.c_fqdn);
lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
- recp = validate_recipients(buf);
+ recp = validate_recipients(buf, 0);
if (recp != NULL) {
if (recp->num_local == 1) {
found_user = getuser(&usbuf, recp->recp_local);
|| (!strcasecmp(type, "directory")) ) {
snprintf(buf, sizeof buf, "%s@%s", who, host);
lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
- recp = validate_recipients(buf);
+ recp = validate_recipients(buf, 0);
if (recp != NULL) {
if (recp->num_local == 1) {
found_user = getuser(&usbuf, recp->recp_local);
request_message_text);
if (msg != NULL) {
- valid = validate_recipients(attendees_string);
+ valid = validate_recipients(attendees_string, 0);
CtdlSubmitMsg(msg, valid, "");
CtdlFreeMessage(msg);
free_recipients(valid);
* Search for the specified user
*/
ret = (-1);
- valid = validate_recipients(parms[3]);
+ valid = validate_recipients(parms[3], 0);
if (valid != NULL) {
if (valid->num_local == 1) {
ret = getuser(&temp, valid->recp_local);
}
/* Now submit the message */
- valid = validate_recipients(recps);
+ valid = validate_recipients(recps, 0);
free(recps);
CtdlSubmitMsg(msg, valid, NULL);
CtdlFreeMessage(msg);
}
/* Now submit the message */
- valid = validate_recipients(recps);
+ valid = validate_recipients(recps, 0);
free(recps);
CtdlSubmitMsg(msg, valid, NULL);
free_recipients(valid);
}
msg->cm_fields['R'] = strdup(nptr->name);
- valid = validate_recipients(nptr->name);
+ valid = validate_recipients(nptr->name, 0);
CtdlSubmitMsg(msg, valid, "");
free_recipients(valid);
}
free(oldpath);
/* Now submit the message */
- valid = validate_recipients(recipient);
+ valid = validate_recipients(recipient, 0);
if (valid != NULL) if (valid->num_error != 0) {
free_recipients(valid);
valid = NULL;
/* Otherwise, does it have a recipient? If so, validate it... */
else if (msg->cm_fields['R'] != NULL) {
- recp = validate_recipients(msg->cm_fields['R']);
+ recp = validate_recipients(msg->cm_fields['R'], 0);
if (recp != NULL) if (recp->num_error != 0) {
network_bounce(msg,
"A message you sent could not be delivered due to an invalid address.\n"
lprintf(CTDL_DEBUG, "Action is REDIRECT, recipient <%s>\n", recp);
- valid = validate_recipients(recp);
+ valid = validate_recipients(recp, 0);
if (valid == NULL) {
lprintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
return SIEVE2_ERROR_BADARGS;
}
}
- valid = validate_recipients(recp);
+ valid = validate_recipients(recp,
+ (CC->logged_in)? POST_LOGGED_IN:POST_EXTERNAL);
if (valid->num_error != 0) {
cprintf("599 5.1.1 Error: %s\r\n", valid->errormsg);
free_recipients(valid);
msg->cm_fields['V'] = strdup(SMTP->recipients);
/* Submit the message into the Citadel system. */
- valid = validate_recipients(SMTP->recipients);
+ valid = validate_recipients(SMTP->recipients,
+ (CC->logged_in)? POST_LOGGED_IN:POST_EXTERNAL);
/* If there are modules that want to scan this message before final
* submission (such as virus checkers or spam filters), call them now
}
/* Can we deliver the bounce to the original sender? */
- valid = validate_recipients(bounceto);
+ valid = validate_recipients(bounceto, 0);
if (valid != NULL) {
if (valid->num_error == 0) {
CtdlSubmitMsg(bmsg, valid, "");
char *argbuf = &cmdbuf[4];
extract_token(internet_addr, argbuf, 0, '|', sizeof internet_addr);
- rcpt = validate_recipients(internet_addr);
+ rcpt = validate_recipients(internet_addr, CHECK_EXISTANCE);
if ((rcpt != NULL)&&
(
(*rcpt->recp_local != '\0')||
msg->cm_fields['N'] = strdup(NODENAME);
if (to != NULL) {
msg->cm_fields['R'] = strdup(to);
- recp = validate_recipients(to);
+ recp = validate_recipients(to, 0);
}
if (subject != NULL) {
msg->cm_fields['U'] = strdup(subject);
*
* Caller needs to free the result using free_recipients()
*/
-struct recptypes *validate_recipients(char *supplied_recipients) {
+struct recptypes *validate_recipients(char *supplied_recipients, int Flags) {
struct recptypes *ret;
char *recipients = NULL;
char this_recp[256];
CC->room = tempQR;
/* Check permissions to send mail to this room */
- err = CtdlDoIHavePermissionToPostInThisRoom(errmsg, sizeof errmsg, POST_EXTERNAL);
- //// TODO: CHECK_EXISTANCE for dict_tcp
+ err = CtdlDoIHavePermissionToPostInThisRoom(errmsg, sizeof errmsg, Flags);
if (err)
{
cprintf("%d %s\n", err, errmsg);
strcpy(bcc, "");
}
- valid_to = validate_recipients(recp);
+ valid_to = validate_recipients(recp, 0);
if (valid_to->num_error > 0) {
cprintf("%d Invalid recipient (To)\n", ERROR + NO_SUCH_USER);
free_recipients(valid_to);
return;
}
- valid_cc = validate_recipients(cc);
+ valid_cc = validate_recipients(cc, 0);
if (valid_cc->num_error > 0) {
cprintf("%d Invalid recipient (CC)\n", ERROR + NO_SUCH_USER);
free_recipients(valid_to);
return;
}
- valid_bcc = validate_recipients(bcc);
+ valid_bcc = validate_recipients(bcc, 0);
if (valid_bcc->num_error > 0) {
cprintf("%d Invalid recipient (BCC)\n", ERROR + NO_SUCH_USER);
free_recipients(valid_to);
strcat(all_recps, bcc);
}
if (!IsEmptyStr(all_recps)) {
- valid = validate_recipients(all_recps);
+ valid = validate_recipients(all_recps, 0);
}
else {
valid = NULL;
struct recptypes *recp;
int i;
- recp = validate_recipients(addr);
+ recp = validate_recipients(addr, 0);
if (recp == NULL) return(0);
if (recp->num_local == 0) {
struct ctdluser *which_user, struct ctdlroom *which_room);
void CtdlGetSeen(char *buf, int which_set);
-struct recptypes *validate_recipients(char *recipients);
+struct recptypes *validate_recipients(char *recipients, int Flags);
void free_recipients(struct recptypes *);
struct CtdlMessage *CtdlMakeMessage(
* is an e-mail address
*/
if (found_user != 0) {
- valid = validate_recipients(username);
+ valid = validate_recipients(username, 0);
if (valid != NULL) {
if (valid->num_local == 1) {
found_user = getuser(&CC->user, valid->recp_local);