config.c (opengroupware-5.5rc2) | : | config.c (opengroupware-5.5rc3) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU Lesser General Public | You should have received a copy of the GNU Lesser General Public | |||
License along with SOPE; see the file COPYING. If not, write to the | License along with SOPE; see the file COPYING. If not, write to the | |||
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA | Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |||
02111-1307, USA. | 02111-1307, USA. | |||
*/ | */ | |||
#include "common.h" | #include "common.h" | |||
#define LOG_CONFIG 0 | #define LOG_CONFIG 0 | |||
static char *_makeString(char *buf, char *str, int max) { | static char *_makeString(char *buf, const char *str, int max) { | |||
if (buf == NULL) | if (buf == NULL) | |||
buf = calloc(max + 10, sizeof(char)); | buf = calloc(max + 10, sizeof(char)); | |||
strncpy(buf, str, max); | strncpy(buf, str, max); | |||
buf[max] = '\0'; | buf[max] = '\0'; | |||
return buf; | return buf; | |||
} | } | |||
static char *_makePort(char *port, char *str) { | static char *_makePort(char *port, const char *str) { | |||
return _makeString(port, str, MAX_PORTNAME_SIZE); | return _makeString(port, str, MAX_PORTNAME_SIZE); | |||
} | } | |||
static int _domainFromPort(char *port) { | static int _domainFromPort(char *port) { | |||
if (port == NULL) return AF_INET; | if (port == NULL) return AF_INET; | |||
return *port == '/' ? AF_UNIX : AF_INET; | return *port == '/' ? AF_UNIX : AF_INET; | |||
} | } | |||
const char *ngobjweb_set_sns_port(cmd_parms *cmd, | const char *ngobjweb_set_sns_port(cmd_parms *cmd, | |||
ngobjweb_dir_config *cfg, | void *cfg, | |||
char *arg) | const char *arg) | |||
{ | { | |||
cfg->snsPort = _makePort(cfg->snsPort, arg); | ngobjweb_dir_config* _cfg = cfg; | |||
cfg->snsPortDomain = _domainFromPort(cfg->snsPort); | _cfg->snsPort = _makePort(_cfg->snsPort, arg); | |||
_cfg->snsPortDomain = _domainFromPort(_cfg->snsPort); | ||||
#if LOG_CONFIG | #if LOG_CONFIG | |||
fprintf(stderr, "%s: 0x%08X set snsport to %s, domain %i (http=%s)\n", | fprintf(stderr, "%s: 0x%p set snsport to %s, domain %i (http=%s)\n", | |||
__PRETTY_FUNCTION__, (unsigned)cfg, | __PRETTY_FUNCTION__, _cfg, | |||
cfg->snsPort, cfg->snsPortDomain, | _cfg->snsPort, _cfg->snsPortDomain, | |||
cfg->useHTTP ? "yes" : "no"); | _cfg->useHTTP ? "yes" : "no"); | |||
#endif | #endif | |||
return NULL; | return NULL; | |||
} | } | |||
const char *ngobjweb_set_app_port(cmd_parms *cmd, | const char *ngobjweb_set_app_port(cmd_parms *cmd, | |||
ngobjweb_dir_config *cfg, | void *cfg, | |||
char *arg) | const char *arg) | |||
{ | { | |||
cfg->appPort = _makePort(cfg->appPort, arg); | ngobjweb_dir_config* _cfg = cfg; | |||
cfg->appPortDomain = _domainFromPort(cfg->appPort); | _cfg->appPort = _makePort(_cfg->appPort, arg); | |||
_cfg->appPortDomain = _domainFromPort(_cfg->appPort); | ||||
#if LOG_CONFIG | #if LOG_CONFIG | |||
fprintf(stderr, "%s: 0x%08X set appPort to %s, domain %i (http=%s)\n", | fprintf(stderr, "%s: 0x%p set appPort to %s, domain %i (http=%s)\n", | |||
__PRETTY_FUNCTION__, (unsigned)cfg, | __PRETTY_FUNCTION__, _cfg, | |||
cfg->appPort, cfg->snsPortDomain, | _cfg->appPort, _cfg->snsPortDomain, | |||
cfg->useHTTP ? "yes" : "no"); | _cfg->useHTTP ? "yes" : "no"); | |||
#endif | #endif | |||
return NULL; | return NULL; | |||
} | } | |||
const char *ngobjweb_set_app_prefix(cmd_parms *cmd, | const char *ngobjweb_set_app_prefix(cmd_parms *cmd, | |||
ngobjweb_dir_config *cfg, | void *cfg, | |||
char *arg) | const char *arg) | |||
{ | { | |||
cfg->appPrefix = _makeString(cfg->appPrefix, arg, MAX_APP_PREFIX_SIZE); | ngobjweb_dir_config* _cfg = cfg; | |||
_cfg->appPrefix = _makeString(_cfg->appPrefix, arg, MAX_APP_PREFIX_SIZE); | ||||
return NULL; | return NULL; | |||
} | } | |||
const char *ngobjweb_set_use_http(cmd_parms *cmd, | const char *ngobjweb_set_use_http(cmd_parms *cmd, | |||
ngobjweb_dir_config *cfg) | void *cfg, | |||
const char *arg) | ||||
{ | { | |||
ngobjweb_dir_config* _cfg = cfg; | ||||
#if LOG_CONFIG | #if LOG_CONFIG | |||
fprintf(stderr, "%s: using HTTP.\n", __PRETTY_FUNCTION__); | fprintf(stderr, "%s: using HTTP.\n", __PRETTY_FUNCTION__); | |||
#endif | #endif | |||
cfg->useHTTP = 1; | _cfg->useHTTP = 1; | |||
return NULL; | return NULL; | |||
} | } | |||
void *ngobjweb_create_dir_config(apr_pool_t *p, char *dummy) { | void *ngobjweb_create_dir_config(apr_pool_t *p, char *dummy) { | |||
ngobjweb_dir_config *new; | ngobjweb_dir_config *new; | |||
new = apr_palloc(p, sizeof(ngobjweb_dir_config)); | new = apr_palloc(p, sizeof(ngobjweb_dir_config)); | |||
new->snsPort = NULL; | new->snsPort = NULL; | |||
new->snsPortDomain = AF_UNIX; | new->snsPortDomain = AF_UNIX; | |||
new->appPort = NULL; | new->appPort = NULL; | |||
End of changes. 13 change blocks. | ||||
23 lines changed or deleted | 28 lines changed or added |