* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <string.h>
+
+#include "ircd_auth.h"
#include "struct_auth.h"
#include "struct_connection.h"
#include "ircd_client.h"
#include "IOHandler/IODNSLookup.h"
#include "version.h"
+static void auth_start_dnsreverse(struct Auth *auth);
static IODNS_CALLBACK(auth_dns_callback);
static void auth_free(struct Auth *auth);
auth->prev = authlist_last;
auth->next = NULL;
if(!authlist_last)
- authlist_first = auth
+ authlist_first = auth;
authlist_last = auth;
auth_start_dnsreverse(auth);
return auth;
}
-void auth_start_dnsreverse(struct Auth *auth) {
+static void auth_start_dnsreverse(struct Auth *auth) {
socket_printf(auth->conn, "NOTICE AUTH :*** Looking up your hostname");
struct IODNSAddress *sockaddr;
socket_printf(auth->conn, "NOTICE AUTH :*** Found your hostname (%s)", auth->host);
} else {
struct IODNSAddress *sockaddr = iosocket_get_remote_addr(auth->conn->socket);
- if(sockaddr->addresslen == sizeof(struct sockaddr_in)) {
- //ipv4
- inet_ntop(AF_INET, (void *)(&((struct sockaddr_in *)sockaddr->address)->sin_addr), auth->host, HOSTLEN);
- } else {
- //ipv6
- inet_ntop(AF_INET6, (void *)(&((struct sockaddr_in6 *)sockaddr->address)->sin6_addr), auth->host, HOSTLEN);
- }
+ iodns_print_address(sockaddr, auth->conn->socket->ipv6, auth->host, HOSTLEN);
socket_printf(auth->conn, "NOTICE AUTH :*** Couldn't look up your hostname. Using your IP instead (%s)", auth->host);
}
if(dnsresult)
#ifndef _ircd_auth_h
#define _ircd_auth_h
+struct Connection;
+struct Auth;
+
struct Auth *auth_new(struct Connection *conn);
-void auth_start_dnsreverse(struct Auth *auth);
void auth_try_finish(struct Auth *auth);
void auth_abort(struct Auth *auth);
#include "ircd_client.h"
#include "ircd_sock.h"
#include "struct_connection.h"
+#include "struct_client.h"
#include "struct_auth.h"
#include "ircd_config.h"
#include <stdarg.h>
#define CLIENT_MAXLEN 512
-void client_connected(struct Auth *auth) {
+struct Client *client_connected(struct Auth *auth) {
+ return NULL;
}
void client_printf(struct Client *client, const char *text, ...) {
*/
#include <stdlib.h>
+#include <string.h>
#include "tools.h"
#include "IOHandler/IOSockets.h"
#include "ircd_parse.h"
#include "ircd_auth.h"
#include "struct_connection.h"
+#include "struct_client.h"
+#include "struct_auth.h"
#include "IOHandler/IOSockets.h"
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
#include <stdio.h> // @debug
static struct Connection *sockets_listening = NULL;
// listening socket could not be opened
} else {
sockets_remove_list(connection);
- client_disconnected(connection);
sockets_free_connection(connection);
}
break;
va_start(arg_list, text);
pos = vsnprintf(sendBuf, 512 - 2, text, arg_list);
va_end(arg_list);
- if (pos < 0 || pos > (512 - 2)) pos = CLIENT_MAXLEN - 2;
+ if (pos < 0 || pos > (512 - 2)) pos = 512 - 2;
sendBuf[pos] = '\n';
sendBuf[pos+1] = '\0';
iosocket_send(conn->socket, sendBuf, pos+1);
unsigned int have_pass : 1;
unsigned int have_dnsresolv : 1;
+ unsigned int sent_ping : 1;
unsigned int have_pong : 1;
struct Auth *prev, *next;
#ifndef _struct_client_h
#define _struct_client_h
+#include <time.h>
+
#include "crypt_md5.h"
#include "struct_user.h"