diff options
Diffstat (limited to 'src/common/server.c')
-rw-r--r-- | src/common/server.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/common/server.c b/src/common/server.c index 87ead792..c10b0a3c 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -281,7 +281,7 @@ tcp_sendf (server *serv, const char *fmt, ...) int len; va_start (args, fmt); - len = vsnprintf (send_buf, sizeof (send_buf) - 1, fmt, args); + len = g_vsnprintf (send_buf, sizeof (send_buf) - 1, fmt, args); va_end (args); send_buf[sizeof (send_buf) - 1] = '\0'; @@ -591,7 +591,7 @@ ssl_cb_info (SSL * s, int where, int ret) return; /* FIXME: make debug level adjustable in serverlist or settings */ -/* snprintf (buf, sizeof (buf), "%s (%d)", SSL_state_string_long (s), where); +/* g_snprintf (buf, sizeof (buf), "%s (%d)", SSL_state_string_long (s), where); if (g_sess) EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0); else @@ -611,9 +611,9 @@ ssl_cb_verify (int ok, X509_STORE_CTX * ctx) X509_NAME_oneline (X509_get_issuer_name (ctx->current_cert), issuer, sizeof (issuer)); - snprintf (buf, sizeof (buf), "* Subject: %s", subject); + g_snprintf (buf, sizeof (buf), "* Subject: %s", subject); EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0); - snprintf (buf, sizeof (buf), "* Issuer: %s", issuer); + g_snprintf (buf, sizeof (buf), "* Issuer: %s", issuer); EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0); return (TRUE); /* always ok */ @@ -634,7 +634,7 @@ ssl_do_connect (server * serv) if ((err = ERR_get_error ()) > 0) { ERR_error_string (err, err_buf); - snprintf (buf, sizeof (buf), "(%d) %s", err, err_buf); + g_snprintf (buf, sizeof (buf), "(%d) %s", err, err_buf); EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL, NULL, NULL, 0); @@ -660,59 +660,59 @@ ssl_do_connect (server * serv) if (!_SSL_get_cert_info (&cert_info, serv->ssl)) { - snprintf (buf, sizeof (buf), "* Certification info:"); + g_snprintf (buf, sizeof (buf), "* Certification info:"); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); - snprintf (buf, sizeof (buf), " Subject:"); + g_snprintf (buf, sizeof (buf), " Subject:"); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); for (i = 0; cert_info.subject_word[i]; i++) { - snprintf (buf, sizeof (buf), " %s", cert_info.subject_word[i]); + g_snprintf (buf, sizeof (buf), " %s", cert_info.subject_word[i]); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); } - snprintf (buf, sizeof (buf), " Issuer:"); + g_snprintf (buf, sizeof (buf), " Issuer:"); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); for (i = 0; cert_info.issuer_word[i]; i++) { - snprintf (buf, sizeof (buf), " %s", cert_info.issuer_word[i]); + g_snprintf (buf, sizeof (buf), " %s", cert_info.issuer_word[i]); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); } - snprintf (buf, sizeof (buf), " Public key algorithm: %s (%d bits)", + g_snprintf (buf, sizeof (buf), " Public key algorithm: %s (%d bits)", cert_info.algorithm, cert_info.algorithm_bits); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); /*if (cert_info.rsa_tmp_bits) { - snprintf (buf, sizeof (buf), + g_snprintf (buf, sizeof (buf), " Public key algorithm uses ephemeral key with %d bits", cert_info.rsa_tmp_bits); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); }*/ - snprintf (buf, sizeof (buf), " Sign algorithm %s", + g_snprintf (buf, sizeof (buf), " Sign algorithm %s", cert_info.sign_algorithm/*, cert_info.sign_algorithm_bits*/); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); - snprintf (buf, sizeof (buf), " Valid since %s to %s", + g_snprintf (buf, sizeof (buf), " Valid since %s to %s", cert_info.notbefore, cert_info.notafter); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); } else { - snprintf (buf, sizeof (buf), " * No Certificate"); + g_snprintf (buf, sizeof (buf), " * No Certificate"); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); } chiper_info = _SSL_get_cipher_info (serv->ssl); /* static buffer */ - snprintf (buf, sizeof (buf), "* Cipher info:"); + g_snprintf (buf, sizeof (buf), "* Cipher info:"); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); - snprintf (buf, sizeof (buf), " Version: %s, cipher %s (%u bits)", + g_snprintf (buf, sizeof (buf), " Version: %s, cipher %s (%u bits)", chiper_info->version, chiper_info->chiper, chiper_info->chiper_bits); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, @@ -727,7 +727,7 @@ ssl_do_connect (server * serv) int hostname_err; if ((hostname_err = _SSL_check_hostname(cert, serv->hostname)) != 0) { - snprintf (buf, sizeof (buf), "* Verify E: Failed to validate hostname? (%d)%s", + g_snprintf (buf, sizeof (buf), "* Verify E: Failed to validate hostname? (%d)%s", hostname_err, serv->accept_invalid_cert ? " -- Ignored" : ""); if (serv->accept_invalid_cert) EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); @@ -736,7 +736,7 @@ ssl_do_connect (server * serv) } break; } - /* snprintf (buf, sizeof (buf), "* Verify OK (?)"); */ + /* g_snprintf (buf, sizeof (buf), "* Verify OK (?)"); */ /* EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); */ case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: @@ -745,7 +745,7 @@ ssl_do_connect (server * serv) case X509_V_ERR_CERT_HAS_EXPIRED: if (serv->accept_invalid_cert) { - snprintf (buf, sizeof (buf), "* Verify E: %s.? (%d) -- Ignored", + g_snprintf (buf, sizeof (buf), "* Verify E: %s.? (%d) -- Ignored", X509_verify_cert_error_string (verify_error), verify_error); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, @@ -753,7 +753,7 @@ ssl_do_connect (server * serv) break; } default: - snprintf (buf, sizeof (buf), "%s.? (%d)", + g_snprintf (buf, sizeof (buf), "%s.? (%d)", X509_verify_cert_error_string (verify_error), verify_error); conn_fail: @@ -775,7 +775,7 @@ conn_fail: { if (serv->ssl->session && serv->ssl->session->time + SSLTMOUT < time (NULL)) { - snprintf (buf, sizeof (buf), "SSL handshake timed out"); + g_snprintf (buf, sizeof (buf), "SSL handshake timed out"); EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL, NULL, NULL, 0); server_cleanup (serv); /* ->connecting = FALSE */ @@ -970,11 +970,11 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv) } } #else - snprintf (outbuf, sizeof (outbuf), "%s/auth/xchat_auth", + g_snprintf (outbuf, sizeof (outbuf), "%s/auth/xchat_auth", g_get_home_dir ()); if (access (outbuf, X_OK) == 0) { - snprintf (outbuf, sizeof (outbuf), "exec -d %s/auth/xchat_auth %s", + g_snprintf (outbuf, sizeof (outbuf), "exec -d %s/auth/xchat_auth %s", g_get_home_dir (), prefs.hex_irc_user_name); handle_command (serv->server_session, outbuf, FALSE); } @@ -1198,7 +1198,7 @@ traverse_socks (int print_fd, int sok, char *serverAddr, int port) if (buf[1] == 90) return 0; - snprintf (buf, sizeof (buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]); + g_snprintf (buf, sizeof (buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]); proxy_error (print_fd, buf); return 1; } @@ -1299,9 +1299,9 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port) if (buf[0] != 5 || buf[1] != 0) { if (buf[1] == 2) - snprintf (buf, sizeof (buf), "SOCKS\tProxy refused to connect to host (not allowed).\n"); + g_snprintf (buf, sizeof (buf), "SOCKS\tProxy refused to connect to host (not allowed).\n"); else - snprintf (buf, sizeof (buf), "SOCKS\tProxy failed to connect to host (error %d).\n", buf[1]); + g_snprintf (buf, sizeof (buf), "SOCKS\tProxy failed to connect to host (error %d).\n", buf[1]); proxy_error (print_fd, buf); return 1; } @@ -1334,7 +1334,7 @@ traverse_wingate (int print_fd, int sok, char *serverAddr, int port) { char buf[128]; - snprintf (buf, sizeof (buf), "%s %d\r\n", serverAddr, port); + g_snprintf (buf, sizeof (buf), "%s %d\r\n", serverAddr, port); send (sok, buf, strlen (buf), 0); return 0; @@ -1422,16 +1422,16 @@ traverse_http (int print_fd, int sok, char *serverAddr, int port) char auth_data2[252]; int n, n2; - n = snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n", + n = g_snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n", serverAddr, port); if (prefs.hex_net_proxy_auth) { - n2 = snprintf (auth_data2, sizeof (auth_data2), "%s:%s", + n2 = g_snprintf (auth_data2, sizeof (auth_data2), "%s:%s", prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass); base64_encode (auth_data, auth_data2, n2); - n += snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data); + n += g_snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data); } - n += snprintf (buf+n, sizeof (buf)-n, "\r\n"); + n += g_snprintf (buf+n, sizeof (buf)-n, "\r\n"); send (sok, buf, n, 0); n = http_read_line (print_fd, sok, buf, sizeof (buf)); @@ -1504,7 +1504,7 @@ server_child (server * serv) local_ip = net_resolve (ns_local, prefs.hex_net_bind_host, 0, &real_hostname); if (local_ip != NULL) { - snprintf (buf, sizeof (buf), "5\n%s\n", local_ip); + g_snprintf (buf, sizeof (buf), "5\n%s\n", local_ip); write (serv->childwrite, buf, strlen (buf)); net_bind (ns_local, serv->sok4, serv->sok6); bound = 1; @@ -1567,7 +1567,7 @@ server_child (server * serv) /* first resolve where we want to connect to */ if (proxy_type > 0) { - snprintf (buf, sizeof (buf), "9\n%s\n", proxy_host); + g_snprintf (buf, sizeof (buf), "9\n%s\n", proxy_host); write (serv->childwrite, buf, strlen (buf)); ip = net_resolve (ns_server, proxy_host, proxy_port, &real_hostname); g_free (proxy_host); @@ -1601,7 +1601,7 @@ server_child (server * serv) connect_port = port; } - snprintf (buf, sizeof (buf), "3\n%s\n%s\n%d\n", + g_snprintf (buf, sizeof (buf), "3\n%s\n%s\n%d\n", real_hostname, ip, connect_port); write (serv->childwrite, buf, strlen (buf)); @@ -1615,7 +1615,7 @@ server_child (server * serv) if (error != 0) { - snprintf (buf, sizeof (buf), "2\n%d\n", sock_error ()); + g_snprintf (buf, sizeof (buf), "2\n%d\n", sock_error ()); write (serv->childwrite, buf, strlen (buf)); } else { @@ -1627,11 +1627,11 @@ server_child (server * serv) case 0: /* success */ #ifdef USE_MSPROXY if (!serv->dont_use_proxy && (proxy_type == 5)) - snprintf (buf, sizeof (buf), "4\n%d %d %d %d %d\n", sok, psok, serv->msp_state.clientid, serv->msp_state.serverid, + g_snprintf (buf, sizeof (buf), "4\n%d %d %d %d %d\n", sok, psok, serv->msp_state.clientid, serv->msp_state.serverid, serv->msp_state.seq_sent); else #endif - snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */ + g_snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */ write (serv->childwrite, buf, strlen (buf)); break; case 1: /* socks traversal failed */ @@ -1640,7 +1640,7 @@ server_child (server * serv) } } else { - snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */ + g_snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */ write (serv->childwrite, buf, strlen (buf)); } } |