Merge branch 'master' into wip/win32-port2
This commit is contained in:
@@ -195,6 +195,9 @@ AM_CONDITIONAL(KRB4, false)
|
||||
AM_CONDITIONAL(KRB5, true)
|
||||
AM_CONDITIONAL(do_roken_rename, true)
|
||||
|
||||
AC_DEFINE(SUPPORT_INETD, 1, [Enable use of inetd style startup.])dnl
|
||||
|
||||
|
||||
AC_DEFINE(KRB5, 1, [Enable Kerberos 5 support in applications.])dnl
|
||||
AC_SUBST(LIB_kdb)dnl
|
||||
|
||||
|
@@ -1362,9 +1362,6 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
|
||||
/* Define if the Unix rand method is not defined */
|
||||
#define NO_RAND_UNIX_METHOD 1
|
||||
|
||||
/* Define if fd_sets aren't limited to FD_SETSIZE sockets */
|
||||
#define NO_LIMIT_FD_SETSIZE 1
|
||||
|
||||
/* Define if PID files should not be used. */
|
||||
#define NO_PIDFILES 1
|
||||
|
||||
|
@@ -175,7 +175,7 @@ wait_for_connection(krb5_context context,
|
||||
FD_ZERO(&orig_read_set);
|
||||
|
||||
for(i = 0; i < num_socks; i++) {
|
||||
#ifndef NO_LIMIT_FD_SETSIZE
|
||||
#ifdef FD_SETSIZE
|
||||
if (socks[i] >= FD_SETSIZE)
|
||||
errx (1, "fd too large");
|
||||
#endif
|
||||
|
@@ -110,8 +110,8 @@ main(int argc, char **argv)
|
||||
heim_sipc mach;
|
||||
heim_sipc_launchd_mach_init(service_name, kcm_service, NULL, &mach);
|
||||
} else {
|
||||
heim_sipc unix;
|
||||
heim_sipc_service_unix(service_name, kcm_service, NULL, &unix);
|
||||
heim_sipc un;
|
||||
heim_sipc_service_unix(service_name, kcm_service, NULL, &un);
|
||||
}
|
||||
|
||||
heim_ipc_main();
|
||||
|
10
kdc/config.c
10
kdc/config.c
@@ -356,11 +356,11 @@ configure(krb5_context context, int argc, char **argv)
|
||||
if (config->pkinit_kdc_anchors == NULL)
|
||||
krb5_errx(context, 1, "pkinit enabled but no X509 anchors");
|
||||
|
||||
_kdc_pk_initialize(context, config,
|
||||
config->pkinit_kdc_identity,
|
||||
config->pkinit_kdc_anchors,
|
||||
config->pkinit_kdc_cert_pool,
|
||||
config->pkinit_kdc_revoke);
|
||||
krb5_kdc_pk_initialize(context, config,
|
||||
config->pkinit_kdc_identity,
|
||||
config->pkinit_kdc_anchors,
|
||||
config->pkinit_kdc_cert_pool,
|
||||
config->pkinit_kdc_revoke);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -270,7 +270,7 @@ init_socket(krb5_context context,
|
||||
ret = krb5_addr2sockaddr (context, a, sa, &sa_size, port);
|
||||
if (ret) {
|
||||
krb5_warn(context, ret, "krb5_addr2sockaddr");
|
||||
closesocket(d->s);
|
||||
rk_closesocket(d->s);
|
||||
d->s = rk_INVALID_SOCKET;
|
||||
return;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ init_socket(krb5_context context,
|
||||
|
||||
krb5_print_address (a, a_str, sizeof(a_str), &len);
|
||||
krb5_warn(context, errno, "bind %s/%d", a_str, ntohs(port));
|
||||
closesocket(d->s);
|
||||
rk_closesocket(d->s);
|
||||
d->s = rk_INVALID_SOCKET;
|
||||
return;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ init_socket(krb5_context context,
|
||||
|
||||
krb5_print_address (a, a_str, sizeof(a_str), &len);
|
||||
krb5_warn(context, errno, "listen %s/%d", a_str, ntohs(port));
|
||||
closesocket(d->s);
|
||||
rk_closesocket(d->s);
|
||||
d->s = rk_INVALID_SOCKET;
|
||||
return;
|
||||
}
|
||||
@@ -489,7 +489,7 @@ handle_udp(krb5_context context,
|
||||
}
|
||||
|
||||
d->sock_len = sizeof(d->__ss);
|
||||
n = recvfrom(d->s, buf, max_request, 0, d->sa, &d->sock_len);
|
||||
n = recvfrom(d->s, buf, max_request_udp, 0, d->sa, &d->sock_len);
|
||||
if(rk_IS_SOCKET_ERROR(n))
|
||||
krb5_warn(context, rk_SOCK_ERRNO, "recvfrom");
|
||||
else {
|
||||
@@ -525,7 +525,7 @@ clear_descr(struct descr *d)
|
||||
memset(d->buf, 0, d->size);
|
||||
d->len = 0;
|
||||
if(d->s != rk_INVALID_SOCKET)
|
||||
closesocket(d->s);
|
||||
rk_closesocket(d->s);
|
||||
d->s = rk_INVALID_SOCKET;
|
||||
}
|
||||
|
||||
@@ -572,10 +572,10 @@ add_new_tcp (krb5_context context,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NO_LIMIT_FD_SETSIZE
|
||||
#ifdef FD_SETSIZE
|
||||
if (s >= FD_SETSIZE) {
|
||||
krb5_warnx(context, "socket FD too large");
|
||||
closesocket (s);
|
||||
rk_closesocket (s);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -880,6 +880,7 @@ loop(krb5_context context,
|
||||
#ifndef NO_LIMIT_FD_SETSIZE
|
||||
if(max_fd < d[i].s)
|
||||
max_fd = d[i].s;
|
||||
#ifdef FD_SETSIZE
|
||||
if (max_fd >= FD_SETSIZE)
|
||||
krb5_errx(context, 1, "fd too large");
|
||||
#endif
|
||||
@@ -923,7 +924,7 @@ loop(krb5_context context,
|
||||
}
|
||||
}
|
||||
if (0);
|
||||
#ifndef NO_SIGXCPU
|
||||
#ifdef SIGXCPU
|
||||
else if(exit_flag == SIGXCPU)
|
||||
kdc_log(context, config, 0, "CPU time limit exceeded");
|
||||
#endif
|
||||
|
18
kdc/hpropd.c
18
kdc/hpropd.c
@@ -50,7 +50,7 @@ struct getargs args[] = {
|
||||
{ "database", 'd', arg_string, &database, "database", "file" },
|
||||
{ "stdin", 'n', arg_flag, &from_stdin, "read from stdin" },
|
||||
{ "print", 0, arg_flag, &print_dump, "print dump to stdout" },
|
||||
#ifndef NO_INETD
|
||||
#ifdef SUPPORT_INETD
|
||||
{ "inetd", 'i', arg_negative_flag, &inetd_flag,
|
||||
"Not started from inetd" },
|
||||
#endif
|
||||
@@ -79,7 +79,6 @@ main(int argc, char **argv)
|
||||
krb5_authenticator authent;
|
||||
krb5_keytab keytab;
|
||||
krb5_socket_t sock = rk_INVALID_SOCKET;
|
||||
int close_socket = 0;
|
||||
HDB *db = NULL;
|
||||
int optidx = 0;
|
||||
char *tmp_db;
|
||||
@@ -130,24 +129,21 @@ main(int argc, char **argv)
|
||||
char *server;
|
||||
|
||||
sock = STDIN_FILENO;
|
||||
#ifndef NO_INETD
|
||||
#ifdef SUPPORT_INETD
|
||||
if (inetd_flag == -1) {
|
||||
if (getpeername (sock, sa, &sin_len) < 0) {
|
||||
inetd_flag = 0;
|
||||
close_socket = 0;
|
||||
} else {
|
||||
inetd_flag = 1;
|
||||
close_socket = 0;
|
||||
}
|
||||
}
|
||||
if (!inetd_flag) {
|
||||
#else
|
||||
inetd_flag = 0;
|
||||
#endif
|
||||
if (!inetd_flag) {
|
||||
mini_inetd (krb5_getportbyname (context, "hprop", "tcp",
|
||||
HPROP_PORT), &sock);
|
||||
close_socket = 1;
|
||||
#ifndef NO_INETD
|
||||
}
|
||||
#endif
|
||||
sin_len = sizeof(ss);
|
||||
if(getpeername(sock, sa, &sin_len) < 0)
|
||||
krb5_err(context, 1, errno, "getpeername");
|
||||
@@ -281,8 +277,8 @@ main(int argc, char **argv)
|
||||
if (!print_dump)
|
||||
krb5_log(context, fac, 0, "Received %d principals", nprincs);
|
||||
|
||||
if (close_socket)
|
||||
closesocket(sock);
|
||||
if (inetd_flag == 0)
|
||||
rk_closesocket(sock);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@@ -95,11 +95,11 @@ main(int argc, char **argv)
|
||||
if (config->pkinit_kdc_anchors == NULL)
|
||||
krb5_errx(context, 1, "pkinit enabled but no X509 anchors");
|
||||
|
||||
_kdc_pk_initialize(context, config,
|
||||
config->pkinit_kdc_identity,
|
||||
config->pkinit_kdc_anchors,
|
||||
config->pkinit_kdc_cert_pool,
|
||||
config->pkinit_kdc_revoke);
|
||||
krb5_kdc_pk_initialize(context, config,
|
||||
config->pkinit_kdc_identity,
|
||||
config->pkinit_kdc_anchors,
|
||||
config->pkinit_kdc_cert_pool,
|
||||
config->pkinit_kdc_revoke);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -122,18 +122,22 @@ main(int argc, char **argv)
|
||||
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
#ifdef SIGXCPU
|
||||
sigaction(SIGXCPU, &sa, NULL);
|
||||
#endif
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
#ifdef SIGPIPE
|
||||
sigaction(SIGPIPE, &sa, NULL);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
signal(SIGINT, sigterm);
|
||||
signal(SIGTERM, sigterm);
|
||||
#ifndef NO_SIGXCPU
|
||||
#ifdef SIGXCPU
|
||||
signal(SIGXCPU, sigterm);
|
||||
#endif
|
||||
#ifndef NO_SIGPIPE
|
||||
#ifdef SIGPIPE
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
#endif
|
||||
|
12
kdc/pkinit.c
12
kdc/pkinit.c
@@ -1945,12 +1945,12 @@ load_mappings(krb5_context context, const char *fn)
|
||||
*/
|
||||
|
||||
krb5_error_code
|
||||
_kdc_pk_initialize(krb5_context context,
|
||||
krb5_kdc_configuration *config,
|
||||
const char *user_id,
|
||||
const char *anchors,
|
||||
char **pool,
|
||||
char **revoke_list)
|
||||
krb5_kdc_pk_initialize(krb5_context context,
|
||||
krb5_kdc_configuration *config,
|
||||
const char *user_id,
|
||||
const char *anchors,
|
||||
char **pool,
|
||||
char **revoke_list)
|
||||
{
|
||||
const char *file;
|
||||
char *fn = NULL;
|
||||
|
@@ -13,6 +13,7 @@ HEIMDAL_KDC_1.0 {
|
||||
krb5_kdc_process_request;
|
||||
krb5_kdc_save_request;
|
||||
krb5_kdc_update_time;
|
||||
krb5_kdc_pk_initialize;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
@@ -66,6 +66,8 @@ const int hdb_interface_version = HDB_INTERFACE_VERSION;
|
||||
static struct hdb_method methods[] = {
|
||||
#if HAVE_DB1 || HAVE_DB3
|
||||
{ HDB_INTERFACE_VERSION, "db:", hdb_db_create},
|
||||
#endif
|
||||
#if HAVE_DB1
|
||||
{ HDB_INTERFACE_VERSION, "mit-db:", hdb_mdb_create},
|
||||
#endif
|
||||
#if HAVE_NDBM
|
||||
|
@@ -1023,9 +1023,12 @@ certificate_is_self_signed(hx509_context context,
|
||||
ret = _hx509_name_cmp(&cert->tbsCertificate.subject,
|
||||
&cert->tbsCertificate.issuer, &diff);
|
||||
*self_signed = (diff == 0);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
hx509_set_error_string(context, 0, ret,
|
||||
"Failed to check if self signed");
|
||||
} else
|
||||
ret = _hx509_self_signed_valid(context, &cert->signatureAlgorithm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -87,8 +87,9 @@ struct signature_alg {
|
||||
const heim_oid *key_oid;
|
||||
const AlgorithmIdentifier *digest_alg;
|
||||
int flags;
|
||||
#define PROVIDE_CONF 1
|
||||
#define REQUIRE_SIGNER 2
|
||||
#define PROVIDE_CONF 0x1
|
||||
#define REQUIRE_SIGNER 0x2
|
||||
#define SELF_SIGNED_OK 0x4
|
||||
|
||||
#define SIG_DIGEST 0x100
|
||||
#define SIG_PUBLIC_SIG 0x200
|
||||
@@ -1200,7 +1201,7 @@ static const struct signature_alg ecdsa_with_sha256_alg = {
|
||||
&_hx509_signature_ecdsa_with_sha256_data,
|
||||
&asn1_oid_id_ecPublicKey,
|
||||
&_hx509_signature_sha256_data,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG|SELF_SIGNED_OK,
|
||||
0,
|
||||
NULL,
|
||||
ecdsa_verify_signature,
|
||||
@@ -1214,7 +1215,7 @@ static const struct signature_alg ecdsa_with_sha1_alg = {
|
||||
&_hx509_signature_ecdsa_with_sha1_data,
|
||||
&asn1_oid_id_ecPublicKey,
|
||||
&_hx509_signature_sha1_data,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG|SELF_SIGNED_OK,
|
||||
0,
|
||||
NULL,
|
||||
ecdsa_verify_signature,
|
||||
@@ -1243,7 +1244,7 @@ static const struct signature_alg pkcs1_rsa_sha1_alg = {
|
||||
&_hx509_signature_rsa_with_sha1_data,
|
||||
&asn1_oid_id_pkcs1_rsaEncryption,
|
||||
NULL,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG|SELF_SIGNED_OK,
|
||||
0,
|
||||
NULL,
|
||||
rsa_verify_signature,
|
||||
@@ -1256,7 +1257,7 @@ static const struct signature_alg rsa_with_sha256_alg = {
|
||||
&_hx509_signature_rsa_with_sha256_data,
|
||||
&asn1_oid_id_pkcs1_rsaEncryption,
|
||||
&_hx509_signature_sha256_data,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG|SELF_SIGNED_OK,
|
||||
0,
|
||||
NULL,
|
||||
rsa_verify_signature,
|
||||
@@ -1269,7 +1270,7 @@ static const struct signature_alg rsa_with_sha1_alg = {
|
||||
&_hx509_signature_rsa_with_sha1_data,
|
||||
&asn1_oid_id_pkcs1_rsaEncryption,
|
||||
&_hx509_signature_sha1_data,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG,
|
||||
PROVIDE_CONF|REQUIRE_SIGNER|RA_RSA_USES_DIGEST_INFO|SIG_PUBLIC_SIG|SELF_SIGNED_OK,
|
||||
0,
|
||||
NULL,
|
||||
rsa_verify_signature,
|
||||
@@ -1481,6 +1482,27 @@ _hx509_signature_best_before(hx509_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_hx509_self_signed_valid(hx509_context context,
|
||||
const AlgorithmIdentifier *alg)
|
||||
{
|
||||
const struct signature_alg *md;
|
||||
|
||||
md = find_sig_alg(&alg->algorithm);
|
||||
if (md == NULL) {
|
||||
hx509_clear_error_string(context);
|
||||
return HX509_SIG_ALG_NO_SUPPORTED;
|
||||
}
|
||||
if ((md->flags & SELF_SIGNED_OK) == 0) {
|
||||
hx509_set_error_string(context, 0, HX509_CRYPTO_ALGORITHM_BEST_BEFORE,
|
||||
"Algorithm %s not trusted for self signatures",
|
||||
md->name);
|
||||
return HX509_CRYPTO_ALGORITHM_BEST_BEFORE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_hx509_verify_signature(hx509_context context,
|
||||
const hx509_cert cert,
|
||||
|
@@ -473,6 +473,21 @@ krb5_config_parse_file_multi (krb5_context context,
|
||||
return ENOENT;
|
||||
#endif
|
||||
} else {
|
||||
#ifdef KRB5_USE_PATH_TOKENS
|
||||
char * exp_fname = NULL;
|
||||
|
||||
ret = _krb5_expand_path_tokens(context, fname, &exp_fname);
|
||||
if (ret) {
|
||||
if (newfname)
|
||||
free(newfname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (newfname)
|
||||
free(newfname);
|
||||
fname = newfname = exp_fname;
|
||||
#endif
|
||||
|
||||
f.f = fopen(fname, "r");
|
||||
f.s = NULL;
|
||||
if(f.f == NULL) {
|
||||
@@ -493,46 +508,7 @@ krb5_config_parse_file_multi (krb5_context context,
|
||||
free(newfname);
|
||||
return ret;
|
||||
}
|
||||
=======
|
||||
#ifdef KRB5_USE_PATH_TOKENS
|
||||
{
|
||||
char * exp_fname = NULL;
|
||||
|
||||
ret = _krb5_expand_path_tokens(context, fname, &exp_fname);
|
||||
if (ret) {
|
||||
if (newfname)
|
||||
free(newfname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (newfname)
|
||||
free(newfname);
|
||||
fname = newfname = exp_fname;
|
||||
}
|
||||
#endif
|
||||
|
||||
f.f = fopen(fname, "r");
|
||||
f.s = NULL;
|
||||
if(f.f == NULL) {
|
||||
ret = errno;
|
||||
krb5_set_error_message (context, ret, "open %s: %s",
|
||||
fname, strerror(ret));
|
||||
if (newfname)
|
||||
free(newfname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = krb5_config_parse_debug (&f, res, &lineno, &str);
|
||||
fclose(f.f);
|
||||
if (ret) {
|
||||
krb5_set_error_message (context, ret, "%s:%u: %s", fname, lineno, str);
|
||||
if (newfname)
|
||||
free(newfname);
|
||||
return ret;
|
||||
>>>>>>> Initial Windows port
|
||||
}
|
||||
if (newfname)
|
||||
free(newfname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -94,6 +94,7 @@ HEIMDAL_KRB5_2.0 {
|
||||
krb5_cc_get_config;
|
||||
krb5_cc_get_friendly_name;
|
||||
krb5_cc_get_full_name;
|
||||
krb5_cc_get_kdc_offset;
|
||||
krb5_cc_get_lifetime;
|
||||
krb5_cc_get_name;
|
||||
krb5_cc_get_ops;
|
||||
@@ -113,8 +114,10 @@ HEIMDAL_KRB5_2.0 {
|
||||
krb5_cc_set_config;
|
||||
krb5_cc_set_default_name;
|
||||
krb5_cc_set_flags;
|
||||
krb5_cc_set_kdc_offset;
|
||||
krb5_cc_start_seq_get;
|
||||
krb5_cc_store_cred;
|
||||
krb5_cc_support_switch
|
||||
krb5_cc_switch;
|
||||
krb5_cc_set_friendly_name;
|
||||
krb5_change_password;
|
||||
|
@@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef ROKEN_LIB_FUNCTION
|
||||
#ifdef _WIN32
|
||||
#define ROKEN_LIB_FUNCTION __declspec(dllimport)
|
||||
#define ROKEN_LIB_FUNCTION
|
||||
#define ROKEN_LIB_CALL __stdcall
|
||||
#else
|
||||
#define ROKEN_LIB_FUNCTION
|
||||
|
@@ -40,11 +40,7 @@
|
||||
|
||||
#include <ifaddrs.h>
|
||||
|
||||
<<<<<<< HEAD
|
||||
void
|
||||
=======
|
||||
static void
|
||||
>>>>>>> master
|
||||
print_addr(const char *s, struct sockaddr *sa)
|
||||
{
|
||||
int i;
|
||||
@@ -59,11 +55,7 @@ print_addr(const char *s, struct sockaddr *sa)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
void
|
||||
=======
|
||||
static void
|
||||
>>>>>>> master
|
||||
print_ifaddrs(struct ifaddrs *x)
|
||||
{
|
||||
struct ifaddrs *p;
|
||||
@@ -87,11 +79,7 @@ main(int argc, char **argv)
|
||||
struct ifaddrs *addrs = NULL;
|
||||
int ret;
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (SOCK_INIT)
|
||||
=======
|
||||
if (rk_SOCK_INIT())
|
||||
>>>>>>> master
|
||||
errx(1, "Couldn't initialize sockets. Err=%d\n", rk_SOCK_ERRNO);
|
||||
|
||||
ret = getifaddrs(&addrs);
|
||||
|
@@ -37,9 +37,11 @@
|
||||
|
||||
#ifndef ROKEN_LIB_FUNCTION
|
||||
#ifdef _WIN32
|
||||
#define ROKEN_LIB_FUNCTION _stdcall
|
||||
#define ROKEN_LIB_FUNCTION
|
||||
#define ROKEN_LIB_CALL _stdcall
|
||||
#else
|
||||
#define ROKEN_LIB_FUNCTION
|
||||
#define ROKEN_LIB_CALL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@@ -38,9 +38,11 @@
|
||||
|
||||
#ifndef ROKEN_LIB_FUNCTION
|
||||
#ifdef _WIN32
|
||||
#define ROKEN_LIB_FUNCTION _stdcall
|
||||
#define ROKEN_LIB_FUNCTION
|
||||
#define ROKEN_LIB_CALL _stdcall
|
||||
#else
|
||||
#define ROKEN_LIB_FUNCTION
|
||||
#define ROKEN_LIB_CALL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@@ -114,25 +114,17 @@ mini_inetd_addrinfo (struct addrinfo *ai, rk_socket_t *ret_socket)
|
||||
socket_set_ipv6only(fds[i], 1);
|
||||
if (rk_IS_SOCKET_ERROR(bind (fds[i], a->ai_addr, a->ai_addrlen))) {
|
||||
warn ("bind af = %d", a->ai_family);
|
||||
<<<<<<< HEAD
|
||||
closesocket(fds[i]);
|
||||
=======
|
||||
rk_closesocket(fds[i]);
|
||||
>>>>>>> master
|
||||
fds[i] = rk_INVALID_SOCKET;
|
||||
continue;
|
||||
}
|
||||
if (rk_IS_SOCKET_ERROR(listen (fds[i], SOMAXCONN))) {
|
||||
warn ("listen af = %d", a->ai_family);
|
||||
<<<<<<< HEAD
|
||||
closesocket(fds[i]);
|
||||
=======
|
||||
rk_closesocket(fds[i]);
|
||||
>>>>>>> master
|
||||
fds[i] = rk_INVALID_SOCKET;
|
||||
continue;
|
||||
}
|
||||
#ifndef NO_LIMIT_FD_SETSIZE
|
||||
#ifdef FD_SETSIZE
|
||||
if (fds[i] >= FD_SETSIZE)
|
||||
errx (1, "fd too large");
|
||||
#endif
|
||||
@@ -156,11 +148,7 @@ mini_inetd_addrinfo (struct addrinfo *ai, rk_socket_t *ret_socket)
|
||||
if (FD_ISSET (fds[i], &read_set)) {
|
||||
accept_it (fds[i], ret_socket);
|
||||
for (i = 0; i < n; ++i)
|
||||
<<<<<<< HEAD
|
||||
closesocket(fds[i]);
|
||||
=======
|
||||
rk_closesocket(fds[i]);
|
||||
>>>>>>> master
|
||||
free(fds);
|
||||
return;
|
||||
}
|
||||
@@ -185,11 +173,7 @@ mini_inetd_addrinfo (struct addrinfo *ai, rk_socket_t *ret_socket)
|
||||
* @see mini_inetd_addrinfo()
|
||||
*/
|
||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
||||
<<<<<<< HEAD
|
||||
mini_inetd (int port, rk_socket_t * ret_socket)
|
||||
=======
|
||||
mini_inetd(int port, rk_socket_t * ret_socket)
|
||||
>>>>>>> master
|
||||
{
|
||||
int error;
|
||||
struct addrinfo *ai, hints;
|
||||
|
@@ -72,8 +72,8 @@ typedef SOCKET rk_socket_t;
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define ENOTSOCK WSAENOTSOCK
|
||||
|
||||
#define rk_SOCK_INIT rk_WSAStartup()
|
||||
#define rk_SOCK_EXIT rk_WSACleanup()
|
||||
#define rk_SOCK_INIT() rk_WSAStartup()
|
||||
#define rk_SOCK_EXIT() rk_WSACleanup()
|
||||
|
||||
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSAStartup(void);
|
||||
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSACleanup(void);
|
||||
@@ -89,13 +89,8 @@ typedef int rk_socket_t;
|
||||
#define rk_SOCK_ERRNO errno
|
||||
#define rk_INVALID_SOCKET (-1)
|
||||
|
||||
<<<<<<< HEAD
|
||||
#define rk_SOCK_INIT 0
|
||||
#define rk_SOCK_EXIT 0
|
||||
=======
|
||||
#define rk_SOCK_INIT() 0
|
||||
#define rk_SOCK_EXIT() 0
|
||||
>>>>>>> master
|
||||
|
||||
#endif
|
||||
|
||||
@@ -933,11 +928,7 @@ extern const char *__progname;
|
||||
#endif
|
||||
|
||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
||||
<<<<<<< HEAD
|
||||
mini_inetd_addrinfo (struct addrinfo*, rk_socket *);
|
||||
=======
|
||||
mini_inetd_addrinfo (struct addrinfo*, rk_socket_t *);
|
||||
>>>>>>> master
|
||||
|
||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
||||
mini_inetd (int, rk_socket_t *);
|
||||
|
@@ -87,11 +87,7 @@ get_connected_socket(rk_socket_t * s_ret)
|
||||
|
||||
done:
|
||||
if (!rk_IS_BAD_SOCKET(s))
|
||||
<<<<<<< HEAD
|
||||
closesocket(s);
|
||||
=======
|
||||
rk_closesocket(s);
|
||||
>>>>>>> master
|
||||
|
||||
if (ai)
|
||||
freeaddrinfo(ai);
|
||||
@@ -129,11 +125,7 @@ test_simple_echo_client(void)
|
||||
if (rk_IS_SOCKET_ERROR(rv)) {
|
||||
fprintf(stderr, "[%s] send() failure (%s)\n",
|
||||
getprogname(), strerror(rk_SOCK_ERRNO));
|
||||
<<<<<<< HEAD
|
||||
closesocket(s);
|
||||
=======
|
||||
rk_closesocket(s);
|
||||
>>>>>>> master
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -141,41 +133,25 @@ test_simple_echo_client(void)
|
||||
if (rk_IS_SOCKET_ERROR(rv)) {
|
||||
fprintf (stderr, "[%s] recv() failure (%s)\n",
|
||||
getprogname(), strerror(rk_SOCK_ERRNO));
|
||||
<<<<<<< HEAD
|
||||
closesocket(s);
|
||||
=======
|
||||
rk_closesocket(s);
|
||||
>>>>>>> master
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (rv == 0) {
|
||||
fprintf (stderr, "[%s] No data received\n", prog);
|
||||
<<<<<<< HEAD
|
||||
closesocket(s);
|
||||
=======
|
||||
rk_closesocket(s);
|
||||
>>>>>>> master
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (rv != strlen(test_strings[i])) {
|
||||
fprintf (stderr, "[%s] Data length mismatch %d != %d\n", prog, rv, strlen(test_strings[i]));
|
||||
<<<<<<< HEAD
|
||||
closesocket(s);
|
||||
=======
|
||||
rk_closesocket(s);
|
||||
>>>>>>> master
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (stderr, "[%s] Done\n", prog);
|
||||
<<<<<<< HEAD
|
||||
closesocket(s);
|
||||
=======
|
||||
rk_closesocket(s);
|
||||
>>>>>>> master
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -222,11 +198,7 @@ test_simple_echo_socket(void)
|
||||
if (!strcmp(buf, "exit")) {
|
||||
fprintf(stderr, "[%s] Exiting...\n", prog);
|
||||
shutdown(s, SD_SEND);
|
||||
<<<<<<< HEAD
|
||||
closesocket(s);
|
||||
=======
|
||||
rk_closesocket(s);
|
||||
>>>>>>> master
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -236,11 +208,7 @@ test_simple_echo_socket(void)
|
||||
strerror(rk_SOCK_ERRNO));
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
closesocket(s);
|
||||
=======
|
||||
rk_closesocket(s);
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user