projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
01aa134
)
* load_siteconfig(): revalidate what the server gives us as siteconfig, and bail...
author
Wilfried Göesgens
<willi@citadel.org>
Wed, 11 Aug 2010 11:15:15 +0000
(11:15 +0000)
committer
Wilfried Göesgens
<willi@citadel.org>
Wed, 11 Aug 2010 11:15:15 +0000
(11:15 +0000)
webcit/siteconfig.c
patch
|
blob
|
history
diff --git
a/webcit/siteconfig.c
b/webcit/siteconfig.c
index 6a5eea83ba186cf3550e4b70b485c0c6527baa84..24f97212c3abf30c57f4bb40a99ef99690498295 100644
(file)
--- a/
webcit/siteconfig.c
+++ b/
webcit/siteconfig.c
@@
-213,7
+213,6
@@
void load_siteconfig(void)
wcsession *WCC = WC;
StrBuf *Buf;
HashList *Cfg;
wcsession *WCC = WC;
StrBuf *Buf;
HashList *Cfg;
- char buf[SIZ];
long len;
int i;
long len;
int i;
@@
-221,14
+220,21
@@
void load_siteconfig(void)
WCC->ServCfg = NewHash(1, NULL);
Cfg = WCC->ServCfg;
WCC->ServCfg = NewHash(1, NULL);
Cfg = WCC->ServCfg;
+ Buf = NewStrBuf();
+
serv_printf("CONF get");
serv_printf("CONF get");
- serv_getln(buf, sizeof buf);
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) != 1) {
+ StrBufCutLeft(Buf, 4);
+ AppendImportantMessage(SKEY(Buf));
+ return;
+
+ }
i = 0;
i = 0;
- Buf = NewStrBuf();
- while ((sizeof(ServerConfig) / sizeof(CfgMapping)) &&
- (len = StrBuf_ServGetln(Buf),
- strcmp(ChrPtr(Buf), "000")) &&
- (i <= sizeof(ServerConfig)))
+ while (len = StrBuf_ServGetln(Buf),
+ (i <= (sizeof(ServerConfig) / sizeof(CfgMapping))) &&
+ ((len != 3) || (strcmp(ChrPtr(Buf), "000")!= 0))
+ )
{
Put(Cfg,
ServerConfig[i].Key,
{
Put(Cfg,
ServerConfig[i].Key,
@@
-241,6
+247,14
@@
void load_siteconfig(void)
else
Buf = NULL;
}
else
Buf = NULL;
}
+ if (strcmp(ChrPtr(Buf), "000")!=0)
+ {
+ /* WHOOOOPSI??? burn the lines we don't understand */
+ while ((len = StrBuf_ServGetln(Buf),
+ strcmp(ChrPtr(Buf), "000"))) {}
+ AppendImportantMessage(_("WARNING: Failed to parse Server Config; do you run a to new citserver?"), -1);
+ return;
+ }
FreeStrBuf(&Buf);
LoadExpirePolicy(sitepolicy);
FreeStrBuf(&Buf);
LoadExpirePolicy(sitepolicy);