Use rk_socket_t in lib/kadm5/init_c.c

This commit is contained in:
Asanka Herath
2010-06-02 21:17:21 -04:00
parent dba793110b
commit 869e970f5d

View File

@@ -408,7 +408,7 @@ kadm_connect(kadm5_client_context *ctx)
kadm5_ret_t ret; kadm5_ret_t ret;
krb5_principal server; krb5_principal server;
krb5_ccache cc; krb5_ccache cc;
int s; rk_socket_t s = rk_INVALID_SOCKET;
struct addrinfo *ai, *a; struct addrinfo *ai, *a;
struct addrinfo hints; struct addrinfo hints;
int error; int error;
@@ -441,7 +441,7 @@ kadm_connect(kadm5_client_context *ctx)
if (connect (s, a->ai_addr, a->ai_addrlen) < 0) { if (connect (s, a->ai_addr, a->ai_addrlen) < 0) {
krb5_clear_error_message(context); krb5_clear_error_message(context);
krb5_warn (context, errno, "connect(%s)", hostname); krb5_warn (context, errno, "connect(%s)", hostname);
close (s); rk_closesocket (s);
continue; continue;
} }
break; break;
@@ -460,7 +460,7 @@ kadm_connect(kadm5_client_context *ctx)
if(ret) { if(ret) {
freeaddrinfo (ai); freeaddrinfo (ai);
close(s); rk_closesocket(s);
return ret; return ret;
} }
@@ -471,7 +471,7 @@ kadm_connect(kadm5_client_context *ctx)
if (service_name == NULL) { if (service_name == NULL) {
freeaddrinfo (ai); freeaddrinfo (ai);
close(s); rk_closesocket(s);
krb5_clear_error_message(context); krb5_clear_error_message(context);
return ENOMEM; return ENOMEM;
} }
@@ -482,7 +482,7 @@ kadm_connect(kadm5_client_context *ctx)
freeaddrinfo (ai); freeaddrinfo (ai);
if(ctx->ccache == NULL) if(ctx->ccache == NULL)
krb5_cc_close(context, cc); krb5_cc_close(context, cc);
close(s); rk_closesocket(s);
return ret; return ret;
} }
ctx->ac = NULL; ctx->ac = NULL;
@@ -505,13 +505,13 @@ kadm_connect(kadm5_client_context *ctx)
krb5_data_free(&params); krb5_data_free(&params);
if(ret) { if(ret) {
freeaddrinfo (ai); freeaddrinfo (ai);
close(s); rk_closesocket(s);
if(ctx->ccache == NULL) if(ctx->ccache == NULL)
krb5_cc_close(context, cc); krb5_cc_close(context, cc);
return ret; return ret;
} }
} else if(ret == KRB5_SENDAUTH_BADAPPLVERS) { } else if(ret == KRB5_SENDAUTH_BADAPPLVERS) {
close(s); rk_closesocket(s);
s = socket (a->ai_family, a->ai_socktype, a->ai_protocol); s = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
if (s < 0) { if (s < 0) {
@@ -520,7 +520,7 @@ kadm_connect(kadm5_client_context *ctx)
return errno; return errno;
} }
if (connect (s, a->ai_addr, a->ai_addrlen) < 0) { if (connect (s, a->ai_addr, a->ai_addrlen) < 0) {
close (s); rk_closesocket (s);
freeaddrinfo (ai); freeaddrinfo (ai);
krb5_clear_error_message(context); krb5_clear_error_message(context);
return errno; return errno;
@@ -532,7 +532,7 @@ kadm_connect(kadm5_client_context *ctx)
} }
freeaddrinfo (ai); freeaddrinfo (ai);
if(ret) { if(ret) {
close(s); rk_closesocket(s);
return ret; return ret;
} }