long HKLen;
const char *HKey;
HashPos *Cursor;
+ int len;
Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
serv_puts("000");
linecount = 0;
- while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))
+ while (len = StrBuf_ServGetln(Buf),
+ ((len >= 0) &&
+ ((len != 3) || strcmp(ChrPtr(Buf), "000") )))
{
if (linecount == 0) result = NewStrBufDup(Buf);
if (!strcasecmp(ChrPtr(result), "authenticate")) {
{
StrBuf *Buf;
StrBuf *r;
+ int len;
struct bltr bltr = { 0, 0 } ;
Buf = NewStrBuf();
r = NewStrBuf();
serv_printf("MSG0 %ld|1", msgnum); /* top level citadel headers only */
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 1) {
- while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+ while (len = StrBuf_ServGetln(Buf),
+ ((len >= 0) &&
+ ((len != 3) || strcmp(ChrPtr(Buf), "000") )))
+ {
if (!strncasecmp(ChrPtr(Buf), "msgn=", 5)) {
StrBufCutLeft(Buf, 5);
bltr.id = HashLittle(ChrPtr(Buf), StrLength(Buf));
StrBuf_ServGetln(MsgNum);
if (GetServerStatus(MsgNum, NULL) == 1)
- while (BufLen = StrBuf_ServGetln(MsgNum), strcmp(ChrPtr(MsgNum), "000")) {
+ while (BufLen = StrBuf_ServGetln(MsgNum),
+ ((BufLen >= 0) &&
+ ((BufLen != 3) || strcmp(ChrPtr(MsgNum), "000")) ))
+ {
msgs = realloc(msgs, ++num_msgs * sizeof(long));
msgs[num_msgs-1] = StrTol(MsgNum);
}
serv_printf("MSG0 %ld|3", msgs[i]);
StrBuf_ServGetln(MsgNum);
if (GetServerStatus(MsgNum, NULL) == 1)
- while (BufLen = StrBuf_ServGetln(MsgNum), strcmp(ChrPtr(MsgNum), "000"))
+ while (BufLen = StrBuf_ServGetln(MsgNum),
+ ((BufLen >= 0) &&
+ ((BufLen != 3) || strcmp(ChrPtr(MsgNum), "000")) ))
{
if (!strncasecmp(ChrPtr(MsgNum), "exti=", 5)) {
strcpy(uid, &ChrPtr(MsgNum)[5]);
if (GetServerStatus(Buf, NULL) == 1) {
CfgToken = NewStrBuf();
while ((len = StrBuf_ServGetln(Buf),
- strcmp(ChrPtr(Buf), "000"))) {
+ ((len >= 0) &&
+ ((len != 3) ||
+ strcmp(ChrPtr(Buf), "000")))))
+ {
Value = NewStrBuf();
StrBufExtract_token(CfgToken, Buf, 1, '|');
LineBuf = NewStrBuf();
StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
while (!Done) {
- StrBuf_ServGetln(LineBuf);
+ if (StrBuf_ServGetln(LineBuf) < 0)
+ break;
if ( (StrLength(LineBuf)==3) &&
!strcmp(ChrPtr(LineBuf), "000")) {
Done = 1;
Msg = (message_summary*)malloc(sizeof(message_summary));
memset(Msg, 0, sizeof(message_summary));
while (len = StrBuf_ServGetln(Buf),
+ (len >= 0) &&
((len != 3) ||
- strcmp(ChrPtr(Buf), "000")== 0)){
+ strcmp(ChrPtr(Buf), "000")))
+ {
buf = ChrPtr(Buf);
ebuf = strchr(ChrPtr(Buf), '=');
nBuf = ebuf - buf;
return (Stat->nummsgs);
}
Buf2 = NewStrBuf();
- while (len = StrBuf_ServGetln(Buf), ((len != 3) || strcmp(ChrPtr(Buf), "000")!= 0))
+ while (len = StrBuf_ServGetln(Buf),
+ ((len >= 0) &&
+ ((len != 3) ||
+ strcmp(ChrPtr(Buf), "000")!= 0)))
{
if (Stat->nummsgs < Stat->maxload) {
skipit = 0;
Preference *LastData = NULL;
while (!Done) {
- StrBuf_ServGetln(ReadBuf);
+ if (StrBuf_ServGetln(ReadBuf) < 0)
+ break;
if ( (StrLength(ReadBuf)==3) &&
!strcmp(ChrPtr(ReadBuf), "000")) {
Done = 1;
serv_puts("000");
}
while (!Done &&
- StrBuf_ServGetln(ReadBuf)) {
+ (StrBuf_ServGetln(ReadBuf) >= 0)) {
if ( (StrLength(ReadBuf)==3) &&
!strcmp(ChrPtr(ReadBuf), "000")) {
Done = 1;
serv_printf("MSG0 %ld", msgnum);
StrBuf_ServGetln(ReadBuf);
if (GetServerStatus(ReadBuf, NULL) == 1) {
- while (StrBuf_ServGetln(ReadBuf),
+ while ((StrBuf_ServGetln(ReadBuf) >= 0) &&
(strcmp(ChrPtr(ReadBuf), "text") &&
strcmp(ChrPtr(ReadBuf), "000"))) {
}
serv_puts("000");
}
while (!Done &&
- StrBuf_ServGetln(ReadBuf)) {
+ (StrBuf_ServGetln(ReadBuf) >= 0)) {
if ( (StrLength(ReadBuf)==3) &&
!strcmp(ChrPtr(ReadBuf), "000")) {
Done = 1;
serv_puts("subj|__ Push email settings __");
serv_puts("000");
while (!Done &&
- StrBuf_ServGetln(Buf)) {
+ StrBuf_ServGetln(Buf) >= 0) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
Done = 1;
int i =0;
Done = 0;
while (!Done &&
- StrBuf_ServGetln(Buf)) {
+ StrBuf_ServGetln(Buf) >= 0) {
if (( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000"))||
((StrLength(Buf)==4) &&
if (!strcmp(ChrPtr(Buf), "text")) {
Done = 0;
while (!Done &&
- StrBuf_ServGetln(Buf)) {
+ StrBuf_ServGetln(Buf) >= 0) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
Done = 1;
}
while (!Done &&
- StrBuf_ServGetln(Buf)) {
+ StrBuf_ServGetln(Buf) >= 0) {
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
Done = 1;
if (GetServerStatus(Line, &State) == 1)
{
Whok = NewHash(1, Flathash);
- while(!Done && StrBuf_ServGetln(Line))
+ while(!Done && (StrBuf_ServGetln(Line) >= 0) )
if ( (StrLength(Line)==3) &&
!strcmp(ChrPtr(Line), "000"))
{
StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); /* '100', we hope */
if (GetServerStatus(Buf, NULL) == 1)
{
- while(!Done && StrBuf_ServGetln(Buf))
+ while(!Done && StrBuf_ServGetln(Buf) >= 0)
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000"))
{
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 1)
{
- while(!Done && StrBuf_ServGetln(Buf))
+ while(!Done && (StrBuf_ServGetln(Buf) >= 0))
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000"))
{
const char *Pos = NULL;
int Done = 0;
- while(!Done && StrBuf_ServGetln(Line))
+ while(!Done && (StrBuf_ServGetln(Line) >= 0))
if ( (StrLength(Line)==3) &&
!strcmp(ChrPtr(Line), "000"))
{
if ((StrLength(User) > 0) && (Kick))
{
serv_printf("KICK %s", ChrPtr(User));
- StrBuf_ServGetln(Buf);
+ if (StrBuf_ServGetln(Buf) < 0)
+ break;
if (GetServerStatus(Buf, NULL) != 2) {
StrBufCutLeft(Buf, 4);
AppendImportantMessage(SKEY(Buf));
else if ((StrLength(User) > 0) && (Invite))
{
serv_printf("INVT %s", ChrPtr(User));
- StrBuf_ServGetln(Buf);
+ if (StrBuf_ServGetln(Buf) < 0)
+ break;
if (GetServerStatus(Buf, NULL) != 2) {
StrBufCutLeft(Buf, 4);
AppendImportantMessage(SKEY(Buf));
ServInfo *info;
StrBuf *Buf;
int a;
+ int rc;
Buf = NewStrBuf();
info = (ServInfo*)malloc(sizeof(ServInfo));
memset(info, 0, sizeof(ServInfo));
a = 0;
- while (StrBuf_ServGetln(Buf), (strcmp(ChrPtr(Buf), "000")!= 0)) {
+ while (rc = StrBuf_ServGetln(Buf),
+ (rc >= 0) &&
+ ((rc != 3) ||
+ strcmp(ChrPtr(Buf), "000")))
+ {
switch (a) {
case 0:
info->serv_pid = StrToi(Buf);
}
i = 0;
while (len = StrBuf_ServGetln(Buf),
+ (len >= 0) &&
(i <= (sizeof(ServerConfig) / sizeof(CfgMapping))) &&
- ((len != 3) || (strcmp(ChrPtr(Buf), "000")!= 0))
- )
+ ((len != 3) || strcmp(ChrPtr(Buf), "000")))
{
Put(Cfg,
ServerConfig[i].Key,
}
serv_printf("READ %d|%d", bytes_read, total_len-bytes_read);
- if ( (StrBuf_ServGetln(Buf) > 0) && (GetServerStatus(Buf, NULL) == 6) ) {
+ if ( (rc = StrBuf_ServGetln(Buf) > 0) && (GetServerStatus(Buf, NULL) == 6) )
+ {
+ if (rc < 0)
+ return rc;
StrBufCutLeft(Buf, 4);
this_block = StrTol(Buf);
rc = StrBuf_ServGetBLOBBuffered(Ret, this_block);
while (!Done) {
len = StrBuf_ServGetln(Buf);
- if ((len == 3) &&
- (strcmp(ChrPtr(Buf), "000")==0)) {
+ if ((len <0) ||
+ ((len == 3) &&
+ strcmp(ChrPtr(Buf), "000")))
+ {
Done = 1;
break;
}
}
case 1:
while (!Done) {
- StrBuf_ServGetln(Buf);
+ if (StrBuf_ServGetln(Buf) < 0)
+ break;
if ( (StrLength(Buf)==3) &&
!strcmp(ChrPtr(Buf), "000")) {
Done = 1;
serv_puts("RWHO");
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 1) {
- while (BufLen = StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+ while (BufLen = StrBuf_ServGetln(Buf),
+ ((BufLen >= 0) &&
+ ((BufLen != 3) || strcmp(ChrPtr(Buf), "000"))))
+ {
if (BufLen <= 0)
continue;
Pos = NULL;
wc_printf("<th>%s</th>", _("Date"));
wc_printf("<th>%s</th>", _("Author"));
- while(StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+ while((StrBuf_ServGetln(Buf) >= 0) && strcmp(ChrPtr(Buf), "000")) {
rev_date = extract_long(ChrPtr(Buf), 1);
webcit_fmt_date(rev_date_displayed, sizeof rev_date_displayed, rev_date, DATEFMT_FULL);
wc_printf("<table class=\"wiki_pagelist_background\">");
wc_printf("<th>%s</th>", _("Page title"));
- while(StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+ while((StrBuf_ServGetln(Buf) >= 0) && strcmp(ChrPtr(Buf), "000")) {
StrBufExtract_token(pagetitle, Buf, 1, '|');
if (!bmstrcasestr((char *)ChrPtr(pagetitle), "_HISTORY_")) { /* no history pages */