remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "kadm5_locl.h"
|
||||
@@ -58,7 +58,7 @@ set_funcs(kadm5_client_context *c)
|
||||
}
|
||||
|
||||
kadm5_ret_t
|
||||
_kadm5_c_init_context(kadm5_client_context **ctx,
|
||||
_kadm5_c_init_context(kadm5_client_context **ctx,
|
||||
kadm5_config_params *params,
|
||||
krb5_context context)
|
||||
{
|
||||
@@ -117,7 +117,7 @@ _kadm5_c_init_context(kadm5_client_context **ctx,
|
||||
(*ctx)->kadmind_port = htons(strtol (colon, &end, 0));
|
||||
}
|
||||
if ((*ctx)->kadmind_port == 0)
|
||||
(*ctx)->kadmind_port = krb5_getportbyname (context, "kerberos-adm",
|
||||
(*ctx)->kadmind_port = krb5_getportbyname (context, "kerberos-adm",
|
||||
"tcp", 749);
|
||||
return 0;
|
||||
}
|
||||
@@ -130,11 +130,11 @@ get_kadm_ticket(krb5_context context,
|
||||
{
|
||||
krb5_error_code ret;
|
||||
krb5_creds in, *out;
|
||||
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.client = client;
|
||||
ret = krb5_parse_name(context, server_name, &in.server);
|
||||
if(ret)
|
||||
if(ret)
|
||||
return ret;
|
||||
ret = krb5_get_credentials(context, 0, id, &in, &out);
|
||||
if(ret == 0)
|
||||
@@ -156,14 +156,14 @@ get_new_cache(krb5_context context,
|
||||
krb5_creds cred;
|
||||
krb5_get_init_creds_opt *opt;
|
||||
krb5_ccache id;
|
||||
|
||||
|
||||
ret = krb5_get_init_creds_opt_alloc (context, &opt);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
krb5_get_init_creds_opt_set_default_flags(context, "kadmin",
|
||||
krb5_principal_get_realm(context,
|
||||
client),
|
||||
krb5_get_init_creds_opt_set_default_flags(context, "kadmin",
|
||||
krb5_principal_get_realm(context,
|
||||
client),
|
||||
opt);
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ get_cache_principal(krb5_context context,
|
||||
*id = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ret = krb5_cc_get_principal(context, *id, &p1);
|
||||
if(ret) {
|
||||
krb5_cc_close(context, *id);
|
||||
@@ -254,7 +254,7 @@ get_cache_principal(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = krb5_make_principal(context, &p2, NULL,
|
||||
ret = krb5_make_principal(context, &p2, NULL,
|
||||
"kadmin", "admin", NULL);
|
||||
if (ret) {
|
||||
krb5_cc_close(context, *id);
|
||||
@@ -319,16 +319,16 @@ _kadm5_c_get_cred_cache(krb5_context context,
|
||||
krb5_error_code ret;
|
||||
krb5_ccache id = NULL;
|
||||
krb5_principal default_client = NULL, client = NULL;
|
||||
|
||||
|
||||
/* treat empty password as NULL */
|
||||
if(password && *password == '\0')
|
||||
password = NULL;
|
||||
if(server_name == NULL)
|
||||
server_name = KADM5_ADMIN_SERVICE;
|
||||
|
||||
|
||||
if(client_name != NULL) {
|
||||
ret = krb5_parse_name(context, client_name, &client);
|
||||
if(ret)
|
||||
if(ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ _kadm5_c_get_cred_cache(krb5_context context,
|
||||
|
||||
ret = get_cache_principal(context, &id, &default_client);
|
||||
if (ret) {
|
||||
/*
|
||||
/*
|
||||
* No client was specified by the caller and we cannot
|
||||
* determine the client from a credentials cache.
|
||||
*/
|
||||
@@ -354,7 +354,7 @@ _kadm5_c_get_cred_cache(krb5_context context,
|
||||
krb5_set_error_message(context, KADM5_FAILURE, "Unable to find local user name");
|
||||
return KADM5_FAILURE;
|
||||
}
|
||||
ret = krb5_make_principal(context, &default_client,
|
||||
ret = krb5_make_principal(context, &default_client,
|
||||
NULL, user, "admin", NULL);
|
||||
if(ret)
|
||||
return ret;
|
||||
@@ -369,8 +369,8 @@ _kadm5_c_get_cred_cache(krb5_context context,
|
||||
if (client == NULL && default_client != NULL)
|
||||
client = default_client;
|
||||
|
||||
|
||||
if(id && (default_client == NULL ||
|
||||
|
||||
if(id && (default_client == NULL ||
|
||||
krb5_principal_compare(context, client, default_client))) {
|
||||
ret = get_kadm_ticket(context, id, client, server_name);
|
||||
if(ret == 0) {
|
||||
@@ -390,7 +390,7 @@ _kadm5_c_get_cred_cache(krb5_context context,
|
||||
if (client != default_client)
|
||||
krb5_free_principal(context, default_client);
|
||||
|
||||
ret = get_new_cache(context, client, password, prompter, keytab,
|
||||
ret = get_new_cache(context, client, password, prompter, keytab,
|
||||
server_name, ret_cache);
|
||||
krb5_free_principal(context, client);
|
||||
return ret;
|
||||
@@ -414,7 +414,7 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
memset (&hints, 0, sizeof(hints));
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
|
||||
snprintf (portstr, sizeof(portstr), "%u", ntohs(ctx->kadmind_port));
|
||||
|
||||
hostname = ctx->admin_server;
|
||||
@@ -427,7 +427,7 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
krb5_clear_error_string(context);
|
||||
return KADM5_BAD_SERVER_NAME;
|
||||
}
|
||||
|
||||
|
||||
for (a = ai; a != NULL; a = a->ai_next) {
|
||||
s = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
|
||||
if (s < 0)
|
||||
@@ -447,11 +447,11 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
return KADM5_FAILURE;
|
||||
}
|
||||
ret = _kadm5_c_get_cred_cache(context,
|
||||
ctx->client_name,
|
||||
ctx->service_name,
|
||||
NULL, ctx->prompter, ctx->keytab,
|
||||
ctx->client_name,
|
||||
ctx->service_name,
|
||||
NULL, ctx->prompter, ctx->keytab,
|
||||
ctx->ccache, &cc);
|
||||
|
||||
|
||||
if(ret) {
|
||||
freeaddrinfo (ai);
|
||||
close(s);
|
||||
@@ -481,9 +481,9 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
}
|
||||
ctx->ac = NULL;
|
||||
|
||||
ret = krb5_sendauth(context, &ctx->ac, &s,
|
||||
KADMIN_APPL_VERSION, NULL,
|
||||
server, AP_OPTS_MUTUAL_REQUIRED,
|
||||
ret = krb5_sendauth(context, &ctx->ac, &s,
|
||||
KADMIN_APPL_VERSION, NULL,
|
||||
server, AP_OPTS_MUTUAL_REQUIRED,
|
||||
NULL, NULL, cc, NULL, NULL, NULL);
|
||||
if(ret == 0) {
|
||||
krb5_data params;
|
||||
@@ -519,9 +519,9 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
krb5_clear_error_string(context);
|
||||
return errno;
|
||||
}
|
||||
ret = krb5_sendauth(context, &ctx->ac, &s,
|
||||
KADMIN_OLD_APPL_VERSION, NULL,
|
||||
server, AP_OPTS_MUTUAL_REQUIRED,
|
||||
ret = krb5_sendauth(context, &ctx->ac, &s,
|
||||
KADMIN_OLD_APPL_VERSION, NULL,
|
||||
server, AP_OPTS_MUTUAL_REQUIRED,
|
||||
NULL, NULL, cc, NULL, NULL, NULL);
|
||||
}
|
||||
freeaddrinfo (ai);
|
||||
@@ -529,12 +529,12 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
close(s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
krb5_free_principal(context, server);
|
||||
if(ctx->ccache == NULL)
|
||||
krb5_cc_close(context, cc);
|
||||
ctx->sock = s;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -547,9 +547,9 @@ _kadm5_connect(void *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static kadm5_ret_t
|
||||
static kadm5_ret_t
|
||||
kadm5_c_init_with_context(krb5_context context,
|
||||
const char *client_name,
|
||||
const char *client_name,
|
||||
const char *password,
|
||||
krb5_prompter_fct prompter,
|
||||
const char *keytab,
|
||||
@@ -569,15 +569,15 @@ kadm5_c_init_with_context(krb5_context context,
|
||||
return ret;
|
||||
|
||||
if(password != NULL && *password != '\0') {
|
||||
ret = _kadm5_c_get_cred_cache(context,
|
||||
ret = _kadm5_c_get_cred_cache(context,
|
||||
client_name,
|
||||
service_name,
|
||||
service_name,
|
||||
password, prompter, keytab, ccache, &cc);
|
||||
if(ret)
|
||||
return ret; /* XXX */
|
||||
ccache = cc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (client_name != NULL)
|
||||
ctx->client_name = strdup(client_name);
|
||||
@@ -592,13 +592,13 @@ kadm5_c_init_with_context(krb5_context context,
|
||||
ctx->ccache = ccache;
|
||||
/* maybe we should copy the params here */
|
||||
ctx->sock = -1;
|
||||
|
||||
|
||||
*server_handle = ctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static kadm5_ret_t
|
||||
init_context(const char *client_name,
|
||||
static kadm5_ret_t
|
||||
init_context(const char *client_name,
|
||||
const char *password,
|
||||
krb5_prompter_fct prompter,
|
||||
const char *keytab,
|
||||
@@ -612,7 +612,7 @@ init_context(const char *client_name,
|
||||
krb5_context context;
|
||||
kadm5_ret_t ret;
|
||||
kadm5_server_context *ctx;
|
||||
|
||||
|
||||
ret = krb5_init_context(&context);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -636,9 +636,9 @@ init_context(const char *client_name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
kadm5_ret_t
|
||||
kadm5_ret_t
|
||||
kadm5_c_init_with_password_ctx(krb5_context context,
|
||||
const char *client_name,
|
||||
const char *client_name,
|
||||
const char *password,
|
||||
const char *service_name,
|
||||
kadm5_config_params *realm_params,
|
||||
@@ -659,8 +659,8 @@ kadm5_c_init_with_password_ctx(krb5_context context,
|
||||
server_handle);
|
||||
}
|
||||
|
||||
kadm5_ret_t
|
||||
kadm5_c_init_with_password(const char *client_name,
|
||||
kadm5_ret_t
|
||||
kadm5_c_init_with_password(const char *client_name,
|
||||
const char *password,
|
||||
const char *service_name,
|
||||
kadm5_config_params *realm_params,
|
||||
@@ -668,21 +668,21 @@ kadm5_c_init_with_password(const char *client_name,
|
||||
unsigned long api_version,
|
||||
void **server_handle)
|
||||
{
|
||||
return init_context(client_name,
|
||||
password,
|
||||
return init_context(client_name,
|
||||
password,
|
||||
krb5_prompter_posix,
|
||||
NULL,
|
||||
NULL,
|
||||
service_name,
|
||||
realm_params,
|
||||
struct_version,
|
||||
api_version,
|
||||
service_name,
|
||||
realm_params,
|
||||
struct_version,
|
||||
api_version,
|
||||
server_handle);
|
||||
}
|
||||
|
||||
kadm5_ret_t
|
||||
kadm5_ret_t
|
||||
kadm5_c_init_with_skey_ctx(krb5_context context,
|
||||
const char *client_name,
|
||||
const char *client_name,
|
||||
const char *keytab,
|
||||
const char *service_name,
|
||||
kadm5_config_params *realm_params,
|
||||
@@ -704,8 +704,8 @@ kadm5_c_init_with_skey_ctx(krb5_context context,
|
||||
}
|
||||
|
||||
|
||||
kadm5_ret_t
|
||||
kadm5_c_init_with_skey(const char *client_name,
|
||||
kadm5_ret_t
|
||||
kadm5_c_init_with_skey(const char *client_name,
|
||||
const char *keytab,
|
||||
const char *service_name,
|
||||
kadm5_config_params *realm_params,
|
||||
@@ -713,19 +713,19 @@ kadm5_c_init_with_skey(const char *client_name,
|
||||
unsigned long api_version,
|
||||
void **server_handle)
|
||||
{
|
||||
return init_context(client_name,
|
||||
return init_context(client_name,
|
||||
NULL,
|
||||
NULL,
|
||||
keytab,
|
||||
NULL,
|
||||
service_name,
|
||||
realm_params,
|
||||
struct_version,
|
||||
api_version,
|
||||
service_name,
|
||||
realm_params,
|
||||
struct_version,
|
||||
api_version,
|
||||
server_handle);
|
||||
}
|
||||
|
||||
kadm5_ret_t
|
||||
kadm5_ret_t
|
||||
kadm5_c_init_with_creds_ctx(krb5_context context,
|
||||
const char *client_name,
|
||||
krb5_ccache ccache,
|
||||
@@ -748,7 +748,7 @@ kadm5_c_init_with_creds_ctx(krb5_context context,
|
||||
server_handle);
|
||||
}
|
||||
|
||||
kadm5_ret_t
|
||||
kadm5_ret_t
|
||||
kadm5_c_init_with_creds(const char *client_name,
|
||||
krb5_ccache ccache,
|
||||
const char *service_name,
|
||||
@@ -757,20 +757,20 @@ kadm5_c_init_with_creds(const char *client_name,
|
||||
unsigned long api_version,
|
||||
void **server_handle)
|
||||
{
|
||||
return init_context(client_name,
|
||||
return init_context(client_name,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
ccache,
|
||||
service_name,
|
||||
realm_params,
|
||||
struct_version,
|
||||
api_version,
|
||||
service_name,
|
||||
realm_params,
|
||||
struct_version,
|
||||
api_version,
|
||||
server_handle);
|
||||
}
|
||||
|
||||
#if 0
|
||||
kadm5_ret_t
|
||||
kadm5_ret_t
|
||||
kadm5_init(char *client_name, char *pass,
|
||||
char *service_name,
|
||||
kadm5_config_params *realm_params,
|
||||
|
Reference in New Issue
Block a user