ok = strstr(ok, "for <");
else
ok = (char *)NULL;
- if (ok)
+ if (ok != 0)
{
char *sp, *tp;
*tp = '\0';
}
- if (ok)
+ if (ok != 0)
{
received_for = alloca(strlen(rbuf)+1);
strcpy(received_for, rbuf);
#ifdef KERBEROS_V4
if (ctl->authenticate == A_KERBEROS)
{
- ok = (kerberos_auth (fileno(sockfp), ctl->canonical_name));
- vtalarm(ctl->timeout);
+ ok = kerberos_auth(fileno(sockfp), ctl->canonical_name);
if (ok != 0)
goto cleanUp;
+ vtalarm(ctl->timeout);
}
#endif /* KERBEROS_V4 */
/* accept greeting message from mail server */
ok = (protocol->parse_response)(sockfp, buf);
- vtalarm(ctl->timeout);
if (ok != 0)
goto cleanUp;
+ vtalarm(ctl->timeout);
/* try to get authorized to fetch mail */
shroud = ctl->password;
ok = (protocol->getauth)(sockfp, ctl, buf);
- vtalarm(ctl->timeout);
shroud = (char *)NULL;
if (ok == PS_ERROR)
ok = PS_AUTHFAIL;
if (ok != 0)
goto cleanUp;
+ vtalarm(ctl->timeout);
/* compute number of messages and number of new messages waiting */
- if ((protocol->getrange)(sockfp, ctl, &count, &new) != 0)
+ ok = (protocol->getrange)(sockfp, ctl, &count, &new);
+ if (ok != 0)
goto cleanUp;
vtalarm(ctl->timeout);
{
msgsizes = (int *)alloca(sizeof(int) * count);
- if ((ok = (proto->getsizes)(sockfp, count, msgsizes)) != 0)
- return(PS_ERROR);
+ ok = (proto->getsizes)(sockfp, count, msgsizes);
+ if (ok != 0)
+ goto cleanUp;
+ vtalarm(ctl->timeout);
}
if (new == -1 || ctl->fetchall)
new = count;
ok = ((new > 0) ? PS_SUCCESS : PS_NOMAIL);
- goto closeUp;
+ goto cleanUp;
}
else if (count > 0)
{
else
{
/* request a message */
- (protocol->fetch)(sockfp, num, &len);
+ ok = (protocol->fetch)(sockfp, num, &len);
+ if (ok != 0)
+ goto cleanUp;
vtalarm(ctl->timeout);
if (outlevel > O_SILENT)
len,
protocol->delimited,
ctl);
- vtalarm(ctl->timeout);
if (ok != 0)
goto cleanUp;
+ vtalarm(ctl->timeout);
/* tell the server we got it OK and resynchronize */
if (protocol->trail)
- (protocol->trail)(sockfp, ctl, num);
+ {
+ ok = (protocol->trail)(sockfp, ctl, num);
+ if (ok != 0)
+ goto cleanUp;
+ vtalarm(ctl->timeout);
+ }
}
/*
if (outlevel > O_SILENT)
fprintf(stderr, " flushed\n");
ok = (protocol->delete)(sockfp, ctl, num);
- vtalarm(ctl->timeout);
if (ok != 0)
goto cleanUp;
+ vtalarm(ctl->timeout);
delete_str(&ctl->newsaved, num);
}
else if (outlevel > O_SILENT)
ok = gen_transact(sockfp, protocol->expunge_cmd);
if (ok != 0)
goto cleanUp;
+ vtalarm(ctl->timeout);
}
ok = gen_transact(sockfp, protocol->exit_cmd);
if (ok == 0)
ok = PS_SUCCESS;
+ vtalarm(0);
fclose(sockfp);
goto closeUp;
}
ok = gen_transact(sockfp, protocol->exit_cmd);
if (ok == 0)
ok = PS_NOMAIL;
+ vtalarm(0);
fclose(sockfp);
goto closeUp;
}
cleanUp:
+ vtalarm(ctl->timeout);
if (ok != 0 && ok != PS_SOCKET)
- {
gen_transact(sockfp, protocol->exit_cmd);
- fclose(sockfp);
- }
+ vtalarm(0);
+ fclose(sockfp);
}
switch (ok)