#ifdef HAVE_ICONV
#include <iconv.h>
-/*
- * Wrapper around iconv_open()
- * Our version adds aliases for non-standard Microsoft charsets
- * such as 'MS950', aliasing them to names like 'CP950'
- *
- * tocode Target encoding
- * fromcode Source encoding
- */
-iconv_t ctdl_iconv_open(const char *tocode, const char *fromcode)
-{
- iconv_t ic = (iconv_t)(-1) ;
- ic = iconv_open(tocode, fromcode);
- if (ic == (iconv_t)(-1) ) {
- char alias_fromcode[64];
- if ( (strlen(fromcode) == 5) && (!strncasecmp(fromcode, "MS", 2)) ) {
- safestrncpy(alias_fromcode, fromcode, sizeof alias_fromcode);
- alias_fromcode[0] = 'C';
- alias_fromcode[1] = 'P';
- ic = iconv_open(tocode, alias_fromcode);
- }
- }
- return(ic);
-}
-
#if 0
/* This is the non-define version in case of s.b. needing to debug */
inline void FindNextEnd (char *bptr, char *end)
if (illegal_non_rfc2047_encoding) {
const char *default_header_charset = "iso-8859-1";
if ( (strcasecmp(default_header_charset, "UTF-8")) && (strcasecmp(default_header_charset, "us-ascii")) ) {
- ic = ctdl_iconv_open("UTF-8", default_header_charset);
+ ctdl_iconv_open("UTF-8", default_header_charset, &ic);
if (ic != (iconv_t)(-1) ) {
ibuf = malloc(1024);
isav = ibuf;
ibuflen = strlen(istr);
}
- ic = ctdl_iconv_open("UTF-8", charset);
+ ctdl_iconv_open("UTF-8", charset, &ic);
if (ic != (iconv_t)(-1) ) {
obuflen = 1024;
obuf = (char *) malloc(obuflen);
int i;
char buf[256];
char host[256], type[256];
+ int found = 0;
if (fqdn == NULL) return(hostalias_nomatch);
if (IsEmptyStr(fqdn)) return(hostalias_nomatch);
extract_token(host, buf, 0, '|', sizeof host);
extract_token(type, buf, 1, '|', sizeof type);
- if ( (!strcasecmp(type, "localhost"))
- && (!strcasecmp(fqdn, host)))
- return(hostalias_localhost);
+ found = 0;
- if ( (!strcasecmp(type, "directory"))
- && (!strcasecmp(fqdn, host)))
- return(hostalias_directory);
+ /* Process these in a specific order, in case there are multiple matches.
+ * We want directory to override masq, for example.
+ */
- if ( (!strcasecmp(type, "masqdomain"))
- && (!strcasecmp(fqdn, host)))
- return(hostalias_masq);
+ if ( (!strcasecmp(type, "masqdomain")) && (!strcasecmp(fqdn, host))) {
+ found = hostalias_masq;
+ }
+ if ( (!strcasecmp(type, "localhost")) && (!strcasecmp(fqdn, host))) {
+ found = hostalias_localhost;
+ }
+ if ( (!strcasecmp(type, "directory")) && (!strcasecmp(fqdn, host))) {
+ found = hostalias_directory;
+ }
+ if (found) return(found);
}
return(hostalias_nomatch);
void CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) {
char key[SIZ];
- CtdlLogPrintf(CTDL_DEBUG, "Dir: %s --> %s\n",
- internet_addr, citadel_addr);
if (IsDirectory(internet_addr, 0) == 0) return;
-
+ CtdlLogPrintf(CTDL_DEBUG, "Dir: %s --> %s\n", internet_addr, citadel_addr);
directory_key(key, internet_addr);
-
- cdb_store(CDB_DIRECTORY, key, strlen(key),
- citadel_addr, strlen(citadel_addr)+1 );
+ cdb_store(CDB_DIRECTORY, key, strlen(key), citadel_addr, strlen(citadel_addr)+1 );
}