AC_PREFIX_DEFAULT([~/iotest])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
-AM_SILENT_RULES([no])
+AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([config.h])
LT_INIT([disable-static])
AC_CHECK_HEADERS([fcntl.h sys/socket.h sys/select.h sys/time.h sys/types.h unistd.h windows.h winsock2.h errno.h sys/epoll.h sys/event.h])
AC_CHECK_LIB(ws2_32, main, [ LIBS="$LIBS -lws2_32" ], [])
-have_gnutls="no"
-AC_CHECK_LIB(gnutls, gnutls_init, [
- AC_CHECK_HEADERS(gnutls/gnutls.h, [
- LIBS="$LIBS -lgnutls"
- have_gnutls="yes"
- ])
-])
-if test x"$have_gnutls" = xno; then
- AC_CHECK_LIB(ssl, SSL_read, [
- AC_CHECK_LIB(crypto, X509_new, [
- AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h openssl/rand.h, [
- LIBS="$LIBS -lssl -lcrypto"
- ])
+
+AC_CHECK_LIB(ssl, SSL_read, [
+ AC_CHECK_LIB(crypto, X509_new, [
+ AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h openssl/rand.h, [
+ LIBS="$LIBS -lssl -lcrypto"
])
])
-fi
+])
AC_CHECK_LIB(pthread, pthread_create, [
AC_CHECK_HEADERS(pthread.h, [
LIBS="$LIBS -lpthread"
_stop_dnsquery(query);
}
-int iodns_print_address(struct IODNSAddress *addr, int ipv6, const char *buffer, int length) {
+int iodns_print_address(struct IODNSAddress *address, int ipv6, char *buffer, int length) {
int af;
void *addr;
if(ipv6) {
af = AF_INET6;
- addr = (void *)(&((struct sockaddr_in6 *)sockaddr->address)->sin6_addr);
+ addr = (void *)(&((struct sockaddr_in6 *)address->address)->sin6_addr);
} else {
af = AF_INET;
- addr = (void *)(&((struct sockaddr_in *)sockaddr->address)->sin_addr);
+ addr = (void *)(&((struct sockaddr_in *)address->address)->sin_addr);
}
buffer = inet_ntop(af, addr, buffer, length);
if(!buffer)
struct IODNSQuery *iodns_getnameinfo(const struct sockaddr *addr, size_t addrlen, iodns_callback *callback, void *arg);
void iodns_abort(struct IODNSQuery *query);
-int iodns_print_address(struct IODNSAddress *addr, int ipv6,const char *buffer, int length);
+int iodns_print_address(struct IODNSAddress *addr, int ipv6, char *buffer, int length);
void iodns_free_result(struct IODNSResult *result);
if (encoded_data == NULL)
return NULL;
- for (int i = 0, j = 0; i < input_length;) {
+ int i, j;
+ for (i = 0, j = 0; i < input_length;) {
uint32_t octet_a = i < input_length ? (unsigned char)data[i++] : 0;
uint32_t octet_b = i < input_length ? (unsigned char)data[i++] : 0;
uint32_t octet_c = i < input_length ? (unsigned char)data[i++] : 0;
encoded_data[j++] = encoding_table[(triple >> 0 * 6) & 0x3F];
}
- for (int i = 0; i < mod_table[input_length % 3]; i++)
+ for (i = 0; i < mod_table[input_length % 3]; i++)
encoded_data[*output_length - 1 - i] = '=';
return encoded_data;
if (decoded_data == NULL)
return NULL;
- for (int i = 0, j = 0; i < input_length;) {
+ int i, j;
+ for (i = 0, j = 0; i < input_length;) {
uint32_t sextet_a = data[i] == '=' ? 0 & i++ : decoding_table[data[i++]];
uint32_t sextet_b = data[i] == '=' ? 0 & i++ : decoding_table[data[i++]];
uint32_t sextet_c = data[i] == '=' ? 0 & i++ : decoding_table[data[i++]];
void crypt_base64_init() {
decoding_table = malloc(256);
- for (int i = 0; i < 64; i++)
+ int i;
+ for (i = 0; i < 64; i++)
decoding_table[(unsigned char) encoding_table[i]] = i;
}
#ifndef _crypt_base64_h
#define _crypt_base64_h
+#include <stdlib.h>
void crypt_base64_init();
void crypt_base64_deinit();
#include <stdlib.h>
#include <string.h>
-
-int main(char *argv[], int argc) {
- crypt_init();
-
- struct crypt_rsa_privkey *privkey;
- FILE *fp;
- if(fp = fopen("privkey.pem", "r")) {
- char buffer[4096];
- fread(buffer, sizeof(buffer), 1, fp);
- fclose(fp);
-
- privkey = crypt_load_privkey(buffer);
- } else {
- privkey = crypt_generate_privkey(2048);
-
- fp = fopen("privkey.pem", "w");
- char *buffer = crypt_export_privkey(privkey, 0);
- fprintf(fp, "%s", buffer);
- free(buffer);
- fclose(fp);
- }
-
- struct crypt_rsa_pubkey *pubkey = crypt_get_pubkey(privkey);
- char plain[] = "Test String!!!";
- char *crypted = NULL;
- int len = crypt_encrypt_data(pubkey, plain, sizeof(plain), &crypted);
-
- printf("Crypt Len: %d\n", len);
- printf("Crypt: ");
- int i;
- for(i = 0; i < len; i++) {
- printf(" %02X", ((unsigned int)crypted[i] & 0xFF));
- }
- printf("\n");
-
- char *decrypted = NULL;
- len = crypt_decrypt_data(privkey, crypted, len, &decrypted);
- printf("Decrypt Len: %d\n", len);
- printf("Decrypt: %s\n", decrypted);
-}
-
-
-
/*
// GnuTLS Backend not working because of gnutls_pubkey_encrypt_data doesn't exists prior to GnuTLS 3.0
// still searching for a replacement...
* 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 "struct_auth.h"
#include "struct_connection.h"
#include "ircd_client.h"
auth->prev = authlist_last;
auth->next = NULL;
if(!authlist_last)
- authlist_first = auth
+ authlist_first = auth;
authlist_last = auth;
return auth;
client_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
+ if(auth->conn->ipv6)
inet_ntop(AF_INET6, (void *)(&((struct sockaddr_in6 *)sockaddr->address)->sin6_addr), auth->host, HOSTLEN);
- }
+ else
+ inet_ntop(AF_INET, (void *)(&((struct sockaddr_in *)sockaddr->address)->sin_addr), auth->host, HOSTLEN);
+
client_printf(auth->conn, "NOTICE AUTH :*** Couldn't look up your hostname. Using your IP instead (%s)", auth->host);
}
if(dnsresult)
#include "struct_connection.h"
#include "struct_auth.h"
#include "ircd_config.h"
+#include "ircd_auth.h"
#include <stdio.h>
#include <stdlib.h>
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdlib.h>
+#include <string.h>
+
#include "tools.h"
#include "IOHandler/IOSockets.h"
+#include "ircd_parse.h"
+struct Server;
+#include "struct_client.h"
+#include "struct_auth.h"
+#include "struct_servermsg.h"
typedef int cmd_client_t(struct Client *client, char *argv[], int argc);
typedef int cmd_auth_t(struct Auth *auth, char *argv[], int argc);
#define PARSE_CLIFLAG_OPONLY 0x01
//include all commands
-#include "cmd_ping.h"
+#include "cmd_nick.h"
struct {
unsigned int flags : 8;
} server;
-} parse_command_list {
+} parse_command_list[] = {
{{"PING", "P"}, /* Ping Command */
{NULL, 0, 1, 0}, /* Client */
{NULL, 0, 1, 0}, /* Unauthed */
char **argv = calloc(maxargs, sizeof(*argv));
while(*data) {
//skip leading spaces
- while (*line == ' ')
- *line++ = 0;
- if (*line == ':') {
+ while (*data == ' ')
+ *data++ = 0;
+ if (*data == ':') {
//the rest is a single parameter
- argv[*argc++] = line + 1;
+ argv[*argc++] = data + 1;
break;
}
- argv[*argc++] = line;
- if (argc >= maxargs)
+ argv[*argc++] = data;
+ if (*argc >= maxargs)
break;
- while (*line != ' ' && *line)
- line++;
+ while (*data != ' ' && *data)
+ data++;
}
return argv;
}
srvmsg->destinations = malloc(sizeof(struct ServerMsgDstMap));
srvmsg->destinations->dstcount = 1;
srvmsg->destinations->dst[0].destination.srvnum = ((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]);
- srvmsg->destinations->dst[0].destination.resolved_destination = 0;
+ srvmsg->destinations->dst[0].resolved_destination = 0;
break;
case SERVERMSG_TYPE_MULTICAST:
if(buflen < 5) {
srvmsg->destinations->dstcount = srvcount;
for(i = 0; i < srvcount; i++) {
srvmsg->destinations->dst[i].destination.srvnum = ((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]);
- srvmsg->destinations->dst[i].destination.resolved_destination = 0;
+ srvmsg->destinations->dst[i].resolved_destination = 0;
buf += 4;
buflen -= 4;
}
goto parse_server_data_finish;
}
- srvmsg->arglen = srvmsg->msglen - (buf - buffer->buffer);
+ srvmsg->arglen = srvmsg->msglen - (buf - (unsigned char *)buffer->buffer);
srvmsg->args = buf;
int found = 0;
memmove(buffer->buffer, buffer->buffer + srvmsg->msglen, srvmsg->msglen - buffer->bufpos);
buffer->bufpos -= srvmsg->msglen;
} else
- srvmsg->bufpos = 0;
+ buffer->bufpos = 0;
}
}
#ifndef _struct_client_h
#define _struct_client_h
-#include "crypto_md5.h"
+#include "crypt_md5.h"
#include "struct_user.h"
struct Connection;
unsigned int isonline : 1;
unsigned int isaway : 1;
- struct Client *prev, *next
+ struct Client *prev, *next;
};
struct ClientNickChange {
#ifndef _struct_user_h
#define _struct_user_h
-#include "crypto_md5.h"
+#include "crypt_md5.h"
#define NICKLEN 30
#define IDENTLEN 15