POP3 Audit



	Hi all,
another small thing : why have we got these two different error codes :
POP_CONNECT_FAILED and POP_CONN_ERR.
POP_CONN_ERR is used by all pop functions but pop_connect that returns
POP_CONNECT_FAILED.
If we really need both error codes we should modify the following test in
fetch_pop_mail :
    if(status != POP_CONN_ERR) {
	DM("POP3 C: quit");
	/* exit gracefully */
	write (s, "quit\r\n", 6);
	getLine (s, buffer, sizeof (buffer)); /* snarf the response */
	if(status == POP_OK)
	    strcpy(last_uid, uid);/* FIXME: overflow error on hideous
reply? */
    }
    close (s);

to :

    if(status != POP_CONN_ERR && status!=POP_CONNECT_FAILED) {
	DM("POP3 C: quit");
	/* exit gracefully */
	write (s, "quit\r\n", 6);
	getLine (s, buffer, sizeof (buffer)); /* snarf the response */
	if(status == POP_OK)
	    strcpy(last_uid, uid);/* FIXME: overflow error on hideous
reply? */
    }
    if (status!=POP_CONNECT_FAILED)
	close (s);

The last if test is there to avoid calling close with "s" as file
descriptor in case "s" has not been set because of connection error (see my
previous post). So my feeling is that we need to have both codes to be able
to handle the two different types of errors : when we were enable to even
connect to the pop server, in that case we don't need to close anything,
and when we had errors during connection, in that case we have to close the
connection.
Hope it helps

Bye
Manu




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]