X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fconn.c;h=5967fd72535f4154d11bb92018c23e124b192e4d;hb=e03d8eb7284147f7d44ff192cec18ad9716fedff;hp=3c1427d5461272ac83a68c21e769f557bc80d472;hpb=1438771124ed4730aca2d722595166e31ecd88c5;p=ngircd-alex.git diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 3c1427d5..5967fd72 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -367,13 +367,13 @@ cb_clientserver(int sock, short what) #ifdef SSL_SUPPORT /** - * IO callback for established SSL-enabled client and server connections. + * IO callback for new SSL-enabled client and server connections. * * @param sock Socket descriptor. * @param what IO specification (IO_WANTREAD/IO_WANTWRITE/...). */ static void -cb_clientserver_ssl(int sock, short what) +cb_clientserver_ssl(int sock, UNUSED short what) { CONN_ID idx = Socket2Index(sock); @@ -390,14 +390,11 @@ cb_clientserver_ssl(int sock, short what) case 0: return; /* EAGAIN: callback will be invoked again by IO layer */ default: - Conn_Close(idx, "SSL accept error, closing socket", "SSL accept error", false); + Conn_Close(idx, + "SSL accept error, closing socket", "SSL accept error", + false); return; } - if (what & IO_WANTREAD) - Read_Request(idx); - - if (what & IO_WANTWRITE) - Handle_Write(idx); io_event_setcb(sock, cb_clientserver); /* SSL handshake completed */ } @@ -856,8 +853,7 @@ Conn_Handler(void) /* Look for non-empty read buffers ... */ for (i = 0; i < Pool_Size; i++) { if ((My_Connections[i].sock > NONE) - && (array_bytes(&My_Connections[i].rbuf) > 0) - && (My_Connections[i].delaytime <= t)) { + && (array_bytes(&My_Connections[i].rbuf) > 0)) { /* ... and try to handle the received data */ bytes_processed = Handle_Buffer(i); /* if we processed data, and there might be @@ -2615,6 +2611,45 @@ Conn_UsesSSL(CONN_ID Idx) return Conn_OPTION_ISSET(&My_Connections[Idx], CONN_SSL); } + +GLOBAL char * +Conn_GetCertFp(CONN_ID Idx) +{ + if (Idx < 0) + return NULL; + assert(Idx < (int) array_length(&My_ConnArray, sizeof(CONNECTION))); + return ConnSSL_GetCertFp(&My_Connections[Idx]); +} + + +GLOBAL bool +Conn_SetCertFp(CONN_ID Idx, const char *fingerprint) +{ + if (Idx < 0) + return false; + assert(Idx < (int) array_length(&My_ConnArray, sizeof(CONNECTION))); + return ConnSSL_SetCertFp(&My_Connections[Idx], fingerprint); +} +#else +GLOBAL bool +Conn_UsesSSL(UNUSED CONN_ID Idx) +{ + return false; +} + + +GLOBAL char * +Conn_GetCertFp(UNUSED CONN_ID Idx) +{ + return NULL; +} + + +GLOBAL bool +Conn_SetCertFp(UNUSED CONN_ID Idx, UNUSED const char *fingerprint) +{ + return true; +} #endif