* This file contains functions which handle the mapping of Internet addresses
* to users on the Citadel system.
*
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
if (start != NULL)
FindNextEnd (start, end);
- while ((start != NULL) && (end != NULL))
- {
+ while ((start != NULL) && (end != NULL)) {
next = strstr(end, "=?");
if (next != NULL)
FindNextEnd(next, nextend);
next = NULL;
/* did we find two partitions */
- if ((next != NULL) &&
- ((next - end) > 2))
- {
+ if ((next != NULL) && ((next - end) > 2)) {
ptr = end + 2;
while ((ptr < next) &&
(isspace(*ptr) ||
*/
start = strstr(buf, "=?");
FindNextEnd((start != NULL)? start : buf, end);
- while (start != NULL && end != NULL && end > start)
- {
+ while (start != NULL && end != NULL && end > start) {
extract_token(charset, start, 1, '?', sizeof charset);
extract_token(encoding, start, 2, '?', sizeof encoding);
extract_token(istr, start, 3, '?', sizeof istr);
len = strlen(istr);
pos = 0;
- while (pos < len)
- {
+ while (pos < len) {
if (istr[pos] == '_') istr[pos] = ' ';
pos++;
}
-
ibuflen = CtdlDecodeQuotedPrintable(ibuf, istr, len);
}
else {
*/
int CtdlIsMe(char *addr, int addr_buf_len)
{
- recptypes *recp;
+ struct recptypes *recp;
int i;
recp = validate_recipients(addr, NULL, 0);
* This function is self explanatory.
* (What can I say, I'm in a weird mood today...)
*/
-void remove_any_whitespace_to_the_left_or_right_of_at_symbol(char *name)
-{
+void remove_any_whitespace_to_the_left_or_right_of_at_symbol(char *name) {
unsigned int i;
for (i = 0; i < strlen(name); ++i) {
*
* Caller needs to free the result using free_recipients()
*/
-recptypes *validate_recipients(const char *supplied_recipients, const char *RemoteIdentifier, int Flags)
-{
+struct recptypes *validate_recipients(const char *supplied_recipients, const char *RemoteIdentifier, int Flags) {
struct CitContext *CCC = CC;
- recptypes *ret;
+ struct recptypes *ret;
char *recipients = NULL;
char *org_recp;
char this_recp[256];
int in_quotes = 0;
/* Initialize */
- ret = (recptypes *) malloc(sizeof(recptypes));
+ ret = (struct recptypes *) malloc(sizeof(struct recptypes));
if (ret == NULL) return(NULL);
/* Set all strings to null and numeric values to zero */
- memset(ret, 0, sizeof(recptypes));
+ memset(ret, 0, sizeof(struct recptypes));
if (supplied_recipients == NULL) {
recipients = strdup("");
Flags,
0 /* 0 = not a reply */
);
- if (err)
- {
+ if (err) {
++ret->num_error;
invalid = 1;
}
}
free(org_recp);
- if ( (ret->num_local + ret->num_internet + ret->num_room + ret->num_error) == 0)
- {
+ if ( (ret->num_local + ret->num_internet + ret->num_room + ret->num_error) == 0) {
ret->num_error = (-1);
strcpy(ret->errormsg, "No recipients specified.");
}
/*
* Destructor for recptypes
*/
-void free_recipients(recptypes *valid) {
+void free_recipients(struct recptypes *valid) {
if (valid == NULL) {
return;
process_rfc822_addr(value, user, node, name);
syslog(LOG_DEBUG, "internet_addressing: converted to <%s@%s> (%s)", user, node, name);
snprintf(addr, sizeof(addr), "%s@%s", user, node);
- if (CM_IsEmpty(msg, eAuthor) && !IsEmptyStr(name))
- CM_SetField(msg, eAuthor, name, strlen(name));
- if (CM_IsEmpty(msg, erFc822Addr) && !IsEmptyStr(addr))
- CM_SetField(msg, erFc822Addr, addr, strlen(addr));
+ if (CM_IsEmpty(msg, eAuthor) && !IsEmptyStr(name)) {
+ CM_SetField(msg, eAuthor, name, -1);
+ }
+ if (CM_IsEmpty(msg, erFc822Addr) && !IsEmptyStr(addr)) {
+ CM_SetField(msg, erFc822Addr, addr, -1);
+ }
processed = 1;
}
}
-/* Return nonzero if the supplied address is in one of "our" domains
+/*
+ * Return nonzero if the supplied address is in one of "our" domains
*/
int IsDirectory(char *addr, int allow_masq_domains) {
char domain[256];
snprintf(synthetic_email_addr, sizeof synthetic_email_addr, "ctdl%08x@%s", i, CtdlGetConfigStr("c_fqdn"));
}
u = CtdlDirectoryLookup(NULL, synthetic_email_addr, 0);
+ syslog(LOG_DEBUG, "user_ops: address <%s> lookup returned <%d>", synthetic_email_addr, u);
}
CtdlSetEmailAddressesForUser(user->fullname, synthetic_email_addr);