diff options
| author | Tom Yu <tlyu@mit.edu> | 2009-10-31 00:48:38 +0000 |
|---|---|---|
| committer | Tom Yu <tlyu@mit.edu> | 2009-10-31 00:48:38 +0000 |
| commit | 02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b (patch) | |
| tree | 61b9147863cd8be3eff63903dc36cae168254bd5 /src/util | |
| parent | 162ab371748cba0cc6f172419bd6e71fa04bb878 (diff) | |
| download | krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.gz krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.xz krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.zip | |
make mark-cstyle
make reindent
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util')
45 files changed, 751 insertions, 760 deletions
diff --git a/src/util/et/com_err.c b/src/util/et/com_err.c index c759e17b6..a483e541a 100644 --- a/src/util/et/com_err.c +++ b/src/util/et/com_err.c @@ -1,6 +1,6 @@ /* * Copyright 1997 by Massachusetts Institute of Technology - * + * * Copyright 1987, 1988 by MIT Student Information Processing Board * * Permission to use, copy, modify, and distribute this software @@ -74,7 +74,7 @@ static void default_com_err_proc (const char *whoami, errcode_t code, MessageBox ((HWND)NULL, errbuf, "Kerberos", MB_ICONEXCLAMATION); #else /* !_WIN32 */ - + if (whoami) { fputs(whoami, stderr); fputs(": ", stderr); diff --git a/src/util/et/com_err.h b/src/util/et/com_err.h index 58c43d31d..66004603b 100644 --- a/src/util/et/com_err.h +++ b/src/util/et/com_err.h @@ -26,7 +26,7 @@ typedef long errcode_t; typedef void (*et_old_error_hook_func) (const char *, errcode_t, const char *, va_list ap); - + struct error_table { /*@shared@*/ char const * const * msgs; long base; diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c index e9d681b6c..734cedf2e 100644 --- a/src/util/et/error_message.c +++ b/src/util/et/error_message.c @@ -1,6 +1,6 @@ /* * Copyright 1997,2000,2001,2004,2008 by Massachusetts Institute of Technology - * + * * Copyright 1987, 1988 by MIT Student Information Processing Board * * Permission to use, copy, modify, and distribute this software @@ -213,7 +213,7 @@ error_message(long code) divisor = WSABASEERR; } #endif -#ifdef _WIN32 +#ifdef _WIN32 { LPVOID msgbuf; diff --git a/src/util/et/et_name.c b/src/util/et/et_name.c index 64923c998..507a111c8 100644 --- a/src/util/et/et_name.c +++ b/src/util/et/et_name.c @@ -1,6 +1,6 @@ /* * Copyright 1997 by Massachusetts Institute of Technology - * + * * Copyright 1987 by MIT Student Information Processing Board * * Permission to use, copy, modify, and distribute this software diff --git a/src/util/et/init_et.c b/src/util/et/init_et.c index e397a2706..501528c0b 100644 --- a/src/util/et/init_et.c +++ b/src/util/et/init_et.c @@ -1,6 +1,6 @@ /* * Copyright 1997, 2008 by Massachusetts Institute of Technology - * + * * Copyright 1986, 1987, 1988 by MIT Student Information Processing Board * * Permission to use, copy, modify, and distribute this software @@ -69,13 +69,13 @@ extern errcode_t KRB5_CALLCONV et_init(ectx) ctx->tables = 0; ctx->hook_func = 0; ctx->hook_func_data = 0; - + *ectx = ctx; return 0; } extern void KRB5_CALLCONV et_shutdown(ectx) - et_ctx ectx; + et_ctx ectx; { struct et_list *p, *n; @@ -97,11 +97,11 @@ extern errcode_t KRB5_CALLCONV et_add_error_table(ectx, tbl) e = malloc(sizeof(struct et_list)); if (!e) return ENOMEM; - + e->table = tbl; e->next = ectx->tables; ectx->tables = e; - + return 0; } diff --git a/src/util/et/mit-sipb-copyright.h b/src/util/et/mit-sipb-copyright.h index d7c4ee096..9c4375dbc 100644 --- a/src/util/et/mit-sipb-copyright.h +++ b/src/util/et/mit-sipb-copyright.h @@ -19,4 +19,3 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ - diff --git a/src/util/exitsleep.c b/src/util/exitsleep.c index 95232e5b3..3b3737b1c 100644 --- a/src/util/exitsleep.c +++ b/src/util/exitsleep.c @@ -8,7 +8,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright diff --git a/src/util/mac/k5_mig_client.c b/src/util/mac/k5_mig_client.c index 603ffdc70..6964abcca 100644 --- a/src/util/mac/k5_mig_client.c +++ b/src/util/mac/k5_mig_client.c @@ -53,15 +53,15 @@ typedef struct k5_ipc_service_port { /* global service ports and mutex to protect it */ static k5_mutex_t g_service_ports_mutex = K5_MUTEX_PARTIAL_INITIALIZER; -static k5_ipc_service_port g_service_ports[KIPC_SERVICE_COUNT] = { +static k5_ipc_service_port g_service_ports[KIPC_SERVICE_COUNT] = { { "edu.mit.Kerberos.CCacheServer", MACH_PORT_NULL }, { "edu.mit.Kerberos.KerberosAgent", MACH_PORT_NULL } }; /* ------------------------------------------------------------------------ */ /* This struct exists to hold the per-thread connection port used for ipc - * messages to the server. Each thread is issued a separate connection - * port so that the server can distinguish between threads in the same + * messages to the server. Each thread is issued a separate connection + * port so that the server can distinguish between threads in the same * application. */ typedef struct k5_ipc_connection { @@ -76,7 +76,7 @@ typedef struct k5_ipc_connection_info { } *k5_ipc_connection_info; /* initializer for k5_ipc_request_port to fill in server names in TLS */ -static const char *k5_ipc_known_services[KIPC_SERVICE_COUNT] = { +static const char *k5_ipc_known_services[KIPC_SERVICE_COUNT] = { "edu.mit.Kerberos.CCacheServer", "edu.mit.Kerberos.KerberosAgent" }; @@ -87,11 +87,11 @@ static void k5_ipc_client_cinfo_free (void *io_cinfo) if (io_cinfo) { k5_ipc_connection_info cinfo = io_cinfo; int i; - + for (i = 0; i < KIPC_SERVICE_COUNT; i++) { if (MACH_PORT_VALID (cinfo->connections[i].port)) { - mach_port_mod_refs (mach_task_self(), - cinfo->connections[i].port, + mach_port_mod_refs (mach_task_self(), + cinfo->connections[i].port, MACH_PORT_RIGHT_SEND, -1 ); cinfo->connections[i].port = MACH_PORT_NULL; } @@ -107,29 +107,29 @@ static int k5_ipc_client_cinfo_allocate (k5_ipc_connection_info *out_cinfo) { int err = 0; k5_ipc_connection_info cinfo = NULL; - + cinfo = malloc (sizeof (*cinfo)); if (!cinfo) { err = ENOMEM; } - + if (!err) { int i; - + cinfo->server_died = 0; cinfo->reply_stream = NULL; - + for (i = 0; i < KIPC_SERVICE_COUNT; i++) { cinfo->connections[i].service_id = k5_ipc_known_services[i]; cinfo->connections[i].port = MACH_PORT_NULL; } } - + if (!err) { *out_cinfo = cinfo; cinfo = NULL; } - + k5_ipc_client_cinfo_free (cinfo); - + return err; } @@ -144,38 +144,38 @@ MAKE_FINI_FUNCTION(k5_cli_ipc_thread_fini); static int k5_cli_ipc_thread_init (void) { int err = 0; - - err = k5_key_register (K5_KEY_IPC_CONNECTION_INFO, + + err = k5_key_register (K5_KEY_IPC_CONNECTION_INFO, k5_ipc_client_cinfo_free); - + if (!err) { err = k5_mutex_finish_init (&g_service_ports_mutex); } - + return err; } /* ------------------------------------------------------------------------ */ static void k5_cli_ipc_thread_fini (void) -{ +{ int err = 0; - + err = k5_mutex_lock (&g_service_ports_mutex); if (!err) { int i; - + for (i = 0; i < KIPC_SERVICE_COUNT; i++) { if (MACH_PORT_VALID (g_service_ports[i].service_port)) { - mach_port_destroy (mach_task_self (), - g_service_ports[i].service_port); + mach_port_destroy (mach_task_self (), + g_service_ports[i].service_port); g_service_ports[i].service_port = MACH_PORT_NULL; } } k5_mutex_unlock (&g_service_ports_mutex); } - + k5_key_delete (K5_KEY_IPC_CONNECTION_INFO); k5_mutex_destroy (&g_service_ports_mutex); } @@ -187,22 +187,22 @@ static void k5_cli_ipc_thread_fini (void) static kern_return_t k5_ipc_client_lookup_server (const char *in_service_id, boolean_t in_launch_if_necessary, boolean_t in_use_cached_port, - mach_port_t *out_service_port) + mach_port_t *out_service_port) { kern_return_t err = 0; kern_return_t lock_err = 0; mach_port_t k5_service_port = MACH_PORT_NULL; boolean_t found_entry = 0; int i; - + if (!in_service_id ) { err = EINVAL; } if (!out_service_port) { err = EINVAL; } - + if (!err) { lock_err = k5_mutex_lock (&g_service_ports_mutex); if (lock_err) { err = lock_err; } } - + for (i = 0; !err && i < KIPC_SERVICE_COUNT; i++) { if (!strcmp (in_service_id, g_service_ports[i].service_id)) { found_entry = 1; @@ -212,65 +212,65 @@ static kern_return_t k5_ipc_client_lookup_server (const char *in_service_id, break; } } - + if (!err && (!MACH_PORT_VALID (k5_service_port) || !in_use_cached_port)) { mach_port_t boot_port = MACH_PORT_NULL; char *service = NULL; - + /* Get our bootstrap port */ err = task_get_bootstrap_port (mach_task_self (), &boot_port); - + if (!err && !in_launch_if_necessary) { char *lookup = NULL; mach_port_t lookup_port = MACH_PORT_NULL; - - int w = asprintf (&lookup, "%s%s", + + int w = asprintf (&lookup, "%s%s", in_service_id, K5_MIG_LOOKUP_SUFFIX); if (w < 0) { err = ENOMEM; } - + if (!err) { - /* Use the lookup name because the service name will return + /* Use the lookup name because the service name will return * a valid port even if the server isn't running */ err = bootstrap_look_up (boot_port, lookup, &lookup_port); } - + free (lookup); - if (MACH_PORT_VALID (lookup_port)) { - mach_port_deallocate (mach_task_self (), lookup_port); + if (MACH_PORT_VALID (lookup_port)) { + mach_port_deallocate (mach_task_self (), lookup_port); } } - + if (!err) { - int w = asprintf (&service, "%s%s", + int w = asprintf (&service, "%s%s", in_service_id, K5_MIG_SERVICE_SUFFIX); if (w < 0) { err = ENOMEM; } } - + if (!err) { err = bootstrap_look_up (boot_port, service, &k5_service_port); - + if (!err && found_entry) { /* Free old port if it is valid */ if (!err && MACH_PORT_VALID (g_service_ports[i].service_port)) { - mach_port_deallocate (mach_task_self (), + mach_port_deallocate (mach_task_self (), g_service_ports[i].service_port); } - + g_service_ports[i].service_port = k5_service_port; } } - + free (service); - if (MACH_PORT_VALID (boot_port)) { mach_port_deallocate (mach_task_self (), + if (MACH_PORT_VALID (boot_port)) { mach_port_deallocate (mach_task_self (), boot_port); } } - + if (!err) { *out_service_port = k5_service_port; } - + if (!lock_err) { k5_mutex_unlock (&g_service_ports_mutex); } - + return err; } @@ -278,29 +278,29 @@ static kern_return_t k5_ipc_client_lookup_server (const char *in_service_id, /* ------------------------------------------------------------------------ */ -static boolean_t k5_ipc_reply_demux (mach_msg_header_t *request, - mach_msg_header_t *reply) +static boolean_t k5_ipc_reply_demux (mach_msg_header_t *request, + mach_msg_header_t *reply) { boolean_t handled = 0; - + if (CALL_INIT_FUNCTION (k5_cli_ipc_thread_init) != 0) { return 0; - } - + } + if (!handled && request->msgh_id == MACH_NOTIFY_NO_SENDERS) { k5_ipc_connection_info cinfo = k5_getspecific (K5_KEY_IPC_CONNECTION_INFO); - if (cinfo) { + if (cinfo) { cinfo->server_died = 1; } - + handled = 1; /* server died */ } - + if (!handled) { handled = k5_ipc_reply_server (request, reply); } - - return handled; + + return handled; } /* ------------------------------------------------------------------------ */ @@ -313,34 +313,34 @@ kern_return_t k5_ipc_client_reply (mach_port_t in_reply_port, { kern_return_t err = KERN_SUCCESS; k5_ipc_connection_info cinfo = NULL; - + if (!err) { err = CALL_INIT_FUNCTION (k5_cli_ipc_thread_init); } - + if (!err) { cinfo = k5_getspecific (K5_KEY_IPC_CONNECTION_INFO); if (!cinfo || !cinfo->reply_stream) { err = EINVAL; } } - + if (!err) { if (in_inl_replyCnt) { - err = krb5int_ipc_stream_write (cinfo->reply_stream, + err = krb5int_ipc_stream_write (cinfo->reply_stream, in_inl_reply, in_inl_replyCnt); - + } else if (in_ool_replyCnt) { - err = krb5int_ipc_stream_write (cinfo->reply_stream, + err = krb5int_ipc_stream_write (cinfo->reply_stream, in_ool_reply, in_ool_replyCnt); - + } else { err = EINVAL; } } - - if (in_ool_replyCnt) { vm_deallocate (mach_task_self (), - (vm_address_t) in_ool_reply, + + if (in_ool_replyCnt) { vm_deallocate (mach_task_self (), + (vm_address_t) in_ool_reply, in_ool_replyCnt); } - + return err; } @@ -367,29 +367,29 @@ int32_t k5_ipc_send_request (const char *in_service_id, if (!in_request_stream) { err = EINVAL; } if (!out_reply_stream ) { err = EINVAL; } - + if (!err) { err = CALL_INIT_FUNCTION (k5_cli_ipc_thread_init); - } - + } + if (!err) { - /* depending on how big the message is, use the fast inline buffer or + /* depending on how big the message is, use the fast inline buffer or * the slow dynamically allocated buffer */ mach_msg_type_number_t request_length = krb5int_ipc_stream_size (in_request_stream); - + if (request_length > K5_IPC_MAX_INL_MSG_SIZE) { - /*dprintf ("%s choosing out of line buffer (size is %d)", + /*dprintf ("%s choosing out of line buffer (size is %d)", * __FUNCTION__, request_length); */ - - err = vm_read (mach_task_self (), - (vm_address_t) krb5int_ipc_stream_data (in_request_stream), - request_length, - (vm_address_t *) &ool_request, - &ool_request_length); + + err = vm_read (mach_task_self (), + (vm_address_t) krb5int_ipc_stream_data (in_request_stream), + request_length, + (vm_address_t *) &ool_request, + &ool_request_length); } else { /*dprintf ("%s choosing in line buffer (size is %d)", * __FUNCTION__, request_length); */ - + inl_request_length = request_length; inl_request = krb5int_ipc_stream_data (in_request_stream); } @@ -405,7 +405,7 @@ int32_t k5_ipc_send_request (const char *in_service_id, err = k5_setspecific (K5_KEY_IPC_CONNECTION_INFO, cinfo); } } - + if (!err) { int i, found = 0; @@ -416,114 +416,114 @@ int32_t k5_ipc_send_request (const char *in_service_id, break; } } - + if (!found) { err = EINVAL; } } } - + if (!err) { - err = k5_ipc_client_lookup_server (in_service_id, in_launch_server, + err = k5_ipc_client_lookup_server (in_service_id, in_launch_server, TRUE, &server_port); } if (!err) { - err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, + err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &reply_port); } - + while (!err && !done) { if (!err && !MACH_PORT_VALID (connection->port)) { - err = k5_ipc_client_create_client_connection (server_port, + err = k5_ipc_client_create_client_connection (server_port, &connection->port); } - + if (!err) { err = k5_ipc_client_request (connection->port, reply_port, inl_request, inl_request_length, ool_request, ool_request_length); - + } - + if (err == MACH_SEND_INVALID_DEST) { - if (try_count < 2) { + if (try_count < 2) { try_count++; err = 0; } if (MACH_PORT_VALID (connection->port)) { - mach_port_mod_refs (mach_task_self(), connection->port, + mach_port_mod_refs (mach_task_self(), connection->port, MACH_PORT_RIGHT_SEND, -1 ); connection->port = MACH_PORT_NULL; - } - + } + /* Look up server name again without using the cached copy */ - err = k5_ipc_client_lookup_server (in_service_id, - in_launch_server, + err = k5_ipc_client_lookup_server (in_service_id, + in_launch_server, FALSE, &server_port); - + } else { /* Talked to server, though we may have gotten an error */ done = 1; - - /* Because we use ",dealloc" ool_request will be freed by mach. + + /* Because we use ",dealloc" ool_request will be freed by mach. * Don't double free it. */ - ool_request = NULL; - ool_request_length = 0; - } + ool_request = NULL; + ool_request_length = 0; + } } - + if (!err) { err = krb5int_ipc_stream_new (&cinfo->reply_stream); } - + if (!err) { mach_port_t old_notification_target = MACH_PORT_NULL; /* request no-senders notification so we know when server dies */ - err = mach_port_request_notification (mach_task_self (), reply_port, - MACH_NOTIFY_NO_SENDERS, 1, - reply_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, + err = mach_port_request_notification (mach_task_self (), reply_port, + MACH_NOTIFY_NO_SENDERS, 1, + reply_port, + MACH_MSG_TYPE_MAKE_SEND_ONCE, &old_notification_target); - + if (!err && old_notification_target != MACH_PORT_NULL) { mach_port_deallocate (mach_task_self (), old_notification_target); } } - + if (!err) { cinfo->server_died = 0; - - err = mach_msg_server_once (k5_ipc_reply_demux, K5_IPC_MAX_MSG_SIZE, + + err = mach_msg_server_once (k5_ipc_reply_demux, K5_IPC_MAX_MSG_SIZE, reply_port, MACH_MSG_TIMEOUT_NONE); - + if (!err && cinfo->server_died) { err = ENOTCONN; } } - + if (err == BOOTSTRAP_UNKNOWN_SERVICE && !in_launch_server) { err = 0; /* If server is not running just return an empty stream. */ } - + if (!err) { *out_reply_stream = cinfo->reply_stream; cinfo->reply_stream = NULL; } - - if (reply_port != MACH_PORT_NULL) { - mach_port_destroy (mach_task_self (), reply_port); + + if (reply_port != MACH_PORT_NULL) { + mach_port_destroy (mach_task_self (), reply_port); } - if (ool_request_length) { - vm_deallocate (mach_task_self (), - (vm_address_t) ool_request, ool_request_length); + if (ool_request_length) { + vm_deallocate (mach_task_self (), + (vm_address_t) ool_request, ool_request_length); } - if (cinfo && cinfo->reply_stream) { - krb5int_ipc_stream_release (cinfo->reply_stream); + if (cinfo && cinfo->reply_stream) { + krb5int_ipc_stream_release (cinfo->reply_stream); cinfo->reply_stream = NULL; } - - return err; + + return err; } #endif /* LEAN CLIENT */ diff --git a/src/util/mac/k5_mig_server.c b/src/util/mac/k5_mig_server.c index 03a7a8130..815fbed71 100644 --- a/src/util/mac/k5_mig_server.c +++ b/src/util/mac/k5_mig_server.c @@ -44,15 +44,15 @@ static boolean_t g_ready_to_quit = 0; /* ------------------------------------------------------------------------ */ -static boolean_t k5_ipc_request_demux (mach_msg_header_t *request, - mach_msg_header_t *reply) +static boolean_t k5_ipc_request_demux (mach_msg_header_t *request, + mach_msg_header_t *reply) { boolean_t handled = 0; - + if (!handled) { handled = k5_ipc_request_server (request, reply); } - + /* Our session has a send right. If that goes away it's time to quit. */ if (!handled && (request->msgh_id == MACH_NOTIFY_NO_SENDERS && request->msgh_local_port == g_notify_port)) { @@ -63,21 +63,21 @@ static boolean_t k5_ipc_request_demux (mach_msg_header_t *request, /* Check here for a client death. If so remove it */ if (!handled && request->msgh_id == MACH_NOTIFY_NO_SENDERS) { kern_return_t err = KERN_SUCCESS; - + err = k5_ipc_server_remove_client (request->msgh_local_port); - + if (!err) { - err = mach_port_mod_refs (mach_task_self (), - request->msgh_local_port, + err = mach_port_mod_refs (mach_task_self (), + request->msgh_local_port, MACH_PORT_RIGHT_RECEIVE, -1); } - + if (!err) { handled = 1; /* was a port we are tracking */ } } - - return handled; + + return handled; } /* ------------------------------------------------------------------------ */ @@ -88,39 +88,39 @@ kern_return_t k5_ipc_server_create_client_connection (mach_port_t in_server_p kern_return_t err = KERN_SUCCESS; mach_port_t connection_port = MACH_PORT_NULL; mach_port_t old_notification_target = MACH_PORT_NULL; - + if (!err) { - err = mach_port_allocate (mach_task_self (), + err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &connection_port); } - + if (!err) { - err = mach_port_move_member (mach_task_self (), + err = mach_port_move_member (mach_task_self (), connection_port, g_listen_port_set); } - + if (!err) { /* request no-senders notification so we can tell when client quits/crashes */ - err = mach_port_request_notification (mach_task_self (), - connection_port, - MACH_NOTIFY_NO_SENDERS, 1, - connection_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, + err = mach_port_request_notification (mach_task_self (), + connection_port, + MACH_NOTIFY_NO_SENDERS, 1, + connection_port, + MACH_MSG_TYPE_MAKE_SEND_ONCE, &old_notification_target ); } - + if (!err) { err = k5_ipc_server_add_client (connection_port); } - + if (!err) { *out_connection_port = connection_port; connection_port = MACH_PORT_NULL; } - + if (MACH_PORT_VALID (connection_port)) { mach_port_deallocate (mach_task_self (), connection_port); } - - return err; + + return err; } /* ------------------------------------------------------------------------ */ @@ -134,36 +134,36 @@ kern_return_t k5_ipc_server_request (mach_port_t in_connection_port, { kern_return_t err = KERN_SUCCESS; k5_ipc_stream request_stream = NULL; - + if (!err) { err = krb5int_ipc_stream_new (&request_stream); } - + if (!err) { if (in_inl_requestCnt) { err = krb5int_ipc_stream_write (request_stream, in_inl_request, in_inl_requestCnt); - + } else if (in_ool_requestCnt) { err = krb5int_ipc_stream_write (request_stream, in_ool_request, in_ool_requestCnt); - + } else { err = EINVAL; } } - + if (!err) { err = k5_ipc_server_handle_request (in_connection_port, in_reply_port, request_stream); } - + krb5int_ipc_stream_release (request_stream); if (in_ool_requestCnt) { vm_deallocate (mach_task_self (), (vm_address_t) in_ool_request, in_ool_requestCnt); } - + return err; } /* ------------------------------------------------------------------------ */ -static kern_return_t k5_ipc_server_get_lookup_and_service_names (char **out_lookup, +static kern_return_t k5_ipc_server_get_lookup_and_service_names (char **out_lookup, char **out_service) { kern_return_t err = KERN_SUCCESS; @@ -173,32 +173,32 @@ static kern_return_t k5_ipc_server_get_lookup_and_service_names (char **out_look char *service_id = NULL; char *lookup = NULL; char *service = NULL; - + if (!out_lookup ) { err = EINVAL; } if (!out_service) { err = EINVAL; } - + if (!err) { bundle = CFBundleGetMainBundle (); if (!bundle) { err = ENOENT; } } - + if (!err) { id_string = CFBundleGetIdentifier (bundle); if (!id_string) { err = ENOMEM; } } - + if (!err) { - len = CFStringGetMaximumSizeForEncoding (CFStringGetLength (id_string), + len = CFStringGetMaximumSizeForEncoding (CFStringGetLength (id_string), kCFStringEncodingUTF8) + 1; } - + if (!err) { service_id = calloc (len, sizeof (char)); if (!service_id) { err = errno; } } - - if (!err && !CFStringGetCString (id_string, service_id, len, - kCFStringEncodingUTF8)) { + + if (!err && !CFStringGetCString (id_string, service_id, len, + kCFStringEncodingUTF8)) { err = ENOMEM; } @@ -206,23 +206,23 @@ static kern_return_t k5_ipc_server_get_lookup_and_service_names (char **out_look int w = asprintf (&lookup, "%s%s", service_id, K5_MIG_LOOKUP_SUFFIX); if (w < 0) { err = ENOMEM; } } - + if (!err) { int w = asprintf (&service, "%s%s", service_id, K5_MIG_SERVICE_SUFFIX); if (w < 0) { err = ENOMEM; } } - + if (!err) { *out_lookup = lookup; lookup = NULL; *out_service = service; service = NULL; } - + free (service); free (lookup); free (service_id); - + return err; } @@ -232,101 +232,101 @@ static kern_return_t k5_ipc_server_get_lookup_and_service_names (char **out_look int32_t k5_ipc_server_listen_loop (void) { - /* Run the Mach IPC listen loop. + /* Run the Mach IPC listen loop. * This will call k5_ipc_server_create_client_connection for new clients * and k5_ipc_server_request for existing clients */ - + kern_return_t err = KERN_SUCCESS; char *service = NULL; char *lookup = NULL; mach_port_t lookup_port = MACH_PORT_NULL; mach_port_t boot_port = MACH_PORT_NULL; mach_port_t previous_notify_port = MACH_PORT_NULL; - + if (!err) { err = k5_ipc_server_get_lookup_and_service_names (&lookup, &service); } - + if (!err) { /* Get the bootstrap port */ err = task_get_bootstrap_port (mach_task_self (), &boot_port); } - + if (!err) { /* We are an on-demand server so our lookup port already exists. */ err = bootstrap_check_in (boot_port, lookup, &lookup_port); - } - + } + if (!err) { /* We are an on-demand server so our service port already exists. */ err = bootstrap_check_in (boot_port, service, &g_service_port); - } + } if (!err) { /* Create the port set that the server will listen on */ - err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, + err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &g_notify_port); - } - + } + if (!err) { /* Ask for notification when the server port has no more senders - * A send-once right != a send right so our send-once right will + * A send-once right != a send right so our send-once right will * not interfere with the notification */ - err = mach_port_request_notification (mach_task_self (), g_service_port, - MACH_NOTIFY_NO_SENDERS, true, - g_notify_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, + err = mach_port_request_notification (mach_task_self (), g_service_port, + MACH_NOTIFY_NO_SENDERS, true, + g_notify_port, + MACH_MSG_TYPE_MAKE_SEND_ONCE, &previous_notify_port); } - + if (!err) { /* Create the port set that the server will listen on */ - err = mach_port_allocate (mach_task_self (), + err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_PORT_SET, &g_listen_port_set); - } - + } + if (!err) { /* Add the lookup port to the port set */ - err = mach_port_move_member (mach_task_self (), + err = mach_port_move_member (mach_task_self (), lookup_port, g_listen_port_set); - } - + } + if (!err) { /* Add the service port to the port set */ - err = mach_port_move_member (mach_task_self (), + err = mach_port_move_member (mach_task_self (), g_service_port, g_listen_port_set); - } - + } + if (!err) { /* Add the notify port to the port set */ - err = mach_port_move_member (mach_task_self (), + err = mach_port_move_member (mach_task_self (), g_notify_port, g_listen_port_set); - } - + } + while (!err && !g_ready_to_quit) { - /* Handle one message at a time so we can check to see if + /* Handle one message at a time so we can check to see if * the server wants to quit */ - err = mach_msg_server_once (k5_ipc_request_demux, K5_IPC_MAX_MSG_SIZE, + err = mach_msg_server_once (k5_ipc_request_demux, K5_IPC_MAX_MSG_SIZE, g_listen_port_set, MACH_MSG_OPTION_NONE); } - + /* Clean up the ports and strings */ - if (MACH_PORT_VALID (g_notify_port)) { - mach_port_destroy (mach_task_self (), g_notify_port); + if (MACH_PORT_VALID (g_notify_port)) { + mach_port_destroy (mach_task_self (), g_notify_port); g_notify_port = MACH_PORT_NULL; } - if (MACH_PORT_VALID (g_listen_port_set)) { - mach_port_destroy (mach_task_self (), g_listen_port_set); - g_listen_port_set = MACH_PORT_NULL; + if (MACH_PORT_VALID (g_listen_port_set)) { + mach_port_destroy (mach_task_self (), g_listen_port_set); + g_listen_port_set = MACH_PORT_NULL; } - if (MACH_PORT_VALID (boot_port)) { - mach_port_deallocate (mach_task_self (), boot_port); + if (MACH_PORT_VALID (boot_port)) { + mach_port_deallocate (mach_task_self (), boot_port); } - + free (service); free (lookup); - - return err; + + return err; } /* ------------------------------------------------------------------------ */ @@ -339,46 +339,46 @@ int32_t k5_ipc_server_send_reply (mach_port_t in_reply_port, mach_msg_type_number_t inl_reply_length = 0; k5_ipc_ool_reply_t ool_reply = NULL; mach_msg_type_number_t ool_reply_length = 0; - + if (!MACH_PORT_VALID (in_reply_port)) { err = EINVAL; } if (!in_reply_stream ) { err = EINVAL; } - + if (!err) { - /* depending on how big the message is, use the fast inline buffer or + /* depending on how big the message is, use the fast inline buffer or * the slow dynamically allocated buffer */ mach_msg_type_number_t reply_length = krb5int_ipc_stream_size (in_reply_stream); - - if (reply_length > K5_IPC_MAX_INL_MSG_SIZE) { - //dprintf ("%s choosing out of line buffer (size is %d)", + + if (reply_length > K5_IPC_MAX_INL_MSG_SIZE) { + //dprintf ("%s choosing out of line buffer (size is %d)", // __FUNCTION__, reply_length); - - err = vm_read (mach_task_self (), - (vm_address_t) krb5int_ipc_stream_data (in_reply_stream), reply_length, + + err = vm_read (mach_task_self (), + (vm_address_t) krb5int_ipc_stream_data (in_reply_stream), reply_length, (vm_address_t *) &ool_reply, &ool_reply_length); - + } else { //cci_debug_printf ("%s choosing in line buffer (size is %d)", // __FUNCTION__, reply_length); - + inl_reply_length = reply_length; memcpy (inl_reply, krb5int_ipc_stream_data (in_reply_stream), reply_length); } } - + if (!err) { - err = k5_ipc_server_reply (in_reply_port, + err = k5_ipc_server_reply (in_reply_port, inl_reply, inl_reply_length, ool_reply, ool_reply_length); } - + if (!err) { /* Because we use ",dealloc" ool_reply will be freed by mach. Don't double free it. */ ool_reply = NULL; ool_reply_length = 0; } - + if (ool_reply_length) { vm_deallocate (mach_task_self (), (vm_address_t) ool_reply, ool_reply_length); } - + return err; } diff --git a/src/util/mac/k5_mig_server.h b/src/util/mac/k5_mig_server.h index 0c66ae5bf..4bd4c2c02 100644 --- a/src/util/mac/k5_mig_server.h +++ b/src/util/mac/k5_mig_server.h @@ -35,8 +35,8 @@ int32_t k5_ipc_server_add_client (mach_port_t in_client_port); int32_t k5_ipc_server_remove_client (mach_port_t in_client_port); -int32_t k5_ipc_server_handle_request (mach_port_t in_connection_port, - mach_port_t in_reply_port, +int32_t k5_ipc_server_handle_request (mach_port_t in_connection_port, + mach_port_t in_reply_port, k5_ipc_stream in_request_stream); /* Server control functions */ diff --git a/src/util/mac/k5_mig_types.h b/src/util/mac/k5_mig_types.h index 0f877a314..87c786b1f 100644 --- a/src/util/mac/k5_mig_types.h +++ b/src/util/mac/k5_mig_types.h @@ -1,14 +1,14 @@ /* $Copyright: * * Copyright 2004-2006 by the Massachusetts Institute of Technology. -* +* * All rights reserved. -* +* * Export of this software from the United States of America may require a * specific license from the United States Government. It is the * responsibility of any person or organization contemplating export to * obtain such a license before exporting. -* +* * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute * this software and its documentation for any purpose and without fee is * hereby granted, provided that the above copyright notice appear in all @@ -21,19 +21,19 @@ * the original MIT software. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. -* +* * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -* +* * Individual source code files are copyright MIT, Cygnus Support, * OpenVision, Oracle, Sun Soft, FundsXpress, and others. -* +* * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, * and Zephyr are trademarks of the Massachusetts Institute of Technology * (MIT). No commercial use of these trademarks may be made without prior * written permission of MIT. -* +* * "Commercial use" means use of a name in a product or other for-profit * manner. It does NOT prevent a commercial firm from referring to the MIT * trademarks in order to convey information (although in doing so, diff --git a/src/util/profile/argv_parse.c b/src/util/profile/argv_parse.c index 7740d5345..acdced8a3 100644 --- a/src/util/profile/argv_parse.c +++ b/src/util/profile/argv_parse.c @@ -1,7 +1,7 @@ /* * argv_parse.c --- utility function for parsing a string into a * argc, argv array. - * + * * This file defines a function argv_parse() which parsing a * passed-in string, handling double quotes and backslashes, and * creates an allocated argv vector which can be freed using the @@ -10,7 +10,7 @@ * See argv_parse.h for the formal definition of the functions. * * Copyright 1999 by Theodore Ts'o. - * + * * Permission to use, copy, modify, and distribute this software for * any purpose with or without fee is hereby granted, provided that * the above copyright notice and this permission notice appear in all diff --git a/src/util/profile/argv_parse.h b/src/util/profile/argv_parse.h index 84568e7bd..86f4564e5 100644 --- a/src/util/profile/argv_parse.h +++ b/src/util/profile/argv_parse.h @@ -3,7 +3,7 @@ * * This file defines the interface for the functions argv_parse() and * argv_free(). - * + * *********************************************************************** * int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv) * @@ -16,12 +16,12 @@ * ret_argc and ret_argv, respectively. *********************************************************************** * extern void argv_free(char **argv); - * + * * This function frees the argument vector created by argv_parse(). *********************************************************************** * * Copyright 1999 by Theodore Ts'o. - * + * * Permission to use, copy, modify, and distribute this software for * any purpose with or without fee is hereby granted, provided that * the above copyright notice and this permission notice appear in all diff --git a/src/util/profile/prof_FSp_glue.c b/src/util/profile/prof_FSp_glue.c index 511c85f15..6b9b5f063 100644 --- a/src/util/profile/prof_FSp_glue.c +++ b/src/util/profile/prof_FSp_glue.c @@ -29,22 +29,22 @@ FSp_profile_init(files, ret_profile) break; fileCount++; } - + pathArray = (profile_filespec_t *) malloc ((fileCount + 1) * sizeof(const_profile_filespec_t)); if (pathArray == NULL) { retval = ENOMEM; } - + if (retval == 0) { for (i = 0; i < fileCount + 1; i++) { pathArray [i] = NULL; } } - + if (retval == 0) { for (i = 0; i < fileCount; i++) { OSStatus err = noErr; - + if (err == noErr) { pathArray[i] = (char *) malloc (sizeof(char) * PATH_MAX); if (pathArray[i] == NULL) { @@ -65,12 +65,12 @@ FSp_profile_init(files, ret_profile) } } } - + if (retval == 0) { - retval = profile_init ((const_profile_filespec_t *) pathArray, + retval = profile_init ((const_profile_filespec_t *) pathArray, ret_profile); } - + if (pathArray != NULL) { for (i = 0; i < fileCount; i++) { if (pathArray [i] != 0) @@ -78,7 +78,7 @@ FSp_profile_init(files, ret_profile) } free (pathArray); } - + return retval; } diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c index b24fa59f9..13aa18c4c 100644 --- a/src/util/profile/prof_file.c +++ b/src/util/profile/prof_file.c @@ -24,7 +24,7 @@ #if defined(_WIN32) #include <io.h> -#define HAVE_STAT +#define HAVE_STAT #define stat _stat #endif @@ -409,7 +409,7 @@ static errcode_t write_data_to_file(prf_data_t data, const char *outfile, errcode_t retval = 0; retval = ENOMEM; - + new_file = old_file = 0; if (asprintf(&new_file, "%s.$$$", outfile) < 0) { new_file = NULL; @@ -504,7 +504,7 @@ errcode_t profile_flush_file_data(prf_data_t data) retval = k5_mutex_lock(&data->lock); if (retval) return retval; - + if ((data->flags & PROFILE_FILE_DIRTY) == 0) { k5_mutex_unlock(&data->lock); return 0; @@ -600,7 +600,7 @@ static void profile_free_file_data(prf_data_t data) errcode_t profile_close_file(prf_file_t prf) { errcode_t retval; - + retval = profile_flush_file(prf); if (retval) return retval; diff --git a/src/util/profile/prof_get.c b/src/util/profile/prof_get.c index 6c94d96cc..87861fce3 100644 --- a/src/util/profile/prof_get.c +++ b/src/util/profile/prof_get.c @@ -76,7 +76,7 @@ static errcode_t add_to_list(struct profile_string_list *list, const char *str) { char *newstr, **newlist; unsigned int newmax; - + if (list->num+1 >= list->max) { newmax = list->max + 10; newlist = realloc(list->list, newmax * sizeof(char *)); @@ -109,8 +109,8 @@ static int is_list_member(struct profile_string_list *list, const char *str) return 1; } return 0; -} - +} + /* * This function frees a null-terminated list as returned by * profile_get_values. @@ -121,7 +121,7 @@ void KRB5_CALLCONV profile_free_list(char **list) if (list == 0) return; - + for (cp = list; *cp; cp++) free(*cp); free(list); @@ -158,7 +158,7 @@ profile_get_values(profile_t profile, const char *const *names, end_list(&values, ret_values); return 0; - + cleanup: end_list(&values, 0); return retval; @@ -187,7 +187,7 @@ errcode_t profile_get_value(profile_t profile, const char **names, *ret_value = value; else retval = PROF_NO_RELATION; - + cleanup: profile_node_iterator_free(&state); return retval; @@ -214,7 +214,7 @@ profile_get_string(profile_t profile, const char *name, const char *subname, return retval; } else value = def_val; - + if (value) { *ret_string = strdup(value); if (*ret_string == 0) @@ -264,8 +264,8 @@ profile_get_integer(profile_t profile, const char *name, const char *subname, /* Garbage in string. */ if (end_value != value + strlen (value)) return PROF_BAD_INTEGER; - - + + *ret_int = ret_long; return 0; } @@ -284,7 +284,7 @@ static errcode_t profile_parse_boolean(const char *s, int *ret_boolean) { const char *const *p; - + if (ret_boolean == NULL) return PROF_EINVAL; @@ -301,7 +301,7 @@ profile_parse_boolean(const char *s, int *ret_boolean) return 0; } } - + return PROF_BAD_BOOLEAN; } @@ -328,7 +328,7 @@ profile_get_boolean(profile_t profile, const char *name, const char *subname, return 0; } else if (retval) return retval; - + return profile_parse_boolean (value, ret_boolean); } @@ -362,7 +362,7 @@ profile_get_subsection_names(profile_t profile, const char **names, end_list(&values, ret_names); return 0; - + cleanup: end_list(&values, 0); return retval; @@ -398,7 +398,7 @@ profile_get_relation_names(profile_t profile, const char **names, end_list(&values, ret_names); return 0; - + cleanup: end_list(&values, 0); return retval; @@ -422,7 +422,7 @@ profile_iterator(void **iter_p, char **ret_name, char **ret_value) { char *name, *value; errcode_t retval; - + retval = profile_node_iterator(iter_p, 0, &name, &value); if (retval) return retval; diff --git a/src/util/profile/prof_init.c b/src/util/profile/prof_init.c index d8653049c..91ace9810 100644 --- a/src/util/profile/prof_init.c +++ b/src/util/profile/prof_init.c @@ -118,7 +118,7 @@ profile_init_path(const_profile_filespec_list_t filepath, if (*s == ':') n_entries++; } - + /* the array is NULL terminated */ filenames = (profile_filespec_t*) malloc((n_entries+1) * sizeof(char*)); if (filenames == 0) @@ -144,7 +144,7 @@ profile_init_path(const_profile_filespec_list_t filepath, /* cap the array */ filenames[i] = 0; - retval = profile_init((const_profile_filespec_t *) filenames, + retval = profile_init((const_profile_filespec_t *) filenames, ret_profile); /* count back down and free the entries */ @@ -159,13 +159,13 @@ profile_is_writable(profile_t profile, int *writable) { if (!profile || profile->magic != PROF_MAGIC_PROFILE) return PROF_MAGIC_PROFILE; - - if (!writable) + + if (!writable) return EINVAL; - + if (profile->first_file) *writable = profile_file_is_writable(profile->first_file); - + return 0; } @@ -174,13 +174,13 @@ profile_is_modified(profile_t profile, int *modified) { if (!profile || profile->magic != PROF_MAGIC_PROFILE) return PROF_MAGIC_PROFILE; - - if (!modified) + + if (!modified) return EINVAL; - + if (profile->first_file) *modified = (profile->first_file->data->flags & PROFILE_FILE_DIRTY); - + return 0; } @@ -350,19 +350,19 @@ errcode_t profile_ser_internalize(const char *unused, profile_t *profilep, (void) unpack_int32(&tmp, &bp, &remain); else tmp = 0; - + if (tmp != PROF_MAGIC_PROFILE) { retval = EINVAL; goto cleanup; } - + (void) unpack_int32(&fcount, &bp, &remain); retval = ENOMEM; flist = (profile_filespec_t *) malloc(sizeof(profile_filespec_t) * (size_t) (fcount + 1)); if (!flist) goto cleanup; - + memset(flist, 0, sizeof(char *) * (size_t) (fcount+1)); for (i=0; i<fcount; i++) { if (!unpack_int32(&tmp, &bp, &remain)) { @@ -382,13 +382,13 @@ errcode_t profile_ser_internalize(const char *unused, profile_t *profilep, goto cleanup; } - if ((retval = profile_init((const_profile_filespec_t *) flist, + if ((retval = profile_init((const_profile_filespec_t *) flist, profilep))) goto cleanup; - + *bufpp = bp; *remainp = remain; - + cleanup: if (flist) { for (i=0; i<fcount; i++) { @@ -399,4 +399,3 @@ cleanup: } return(retval); } - diff --git a/src/util/profile/prof_int.h b/src/util/profile/prof_int.h index 216c5986d..9dc7d940d 100644 --- a/src/util/profile/prof_int.h +++ b/src/util/profile/prof_int.h @@ -73,7 +73,7 @@ typedef struct _prf_file_t *prf_file_t; /* * The profile flags * - * Deprecated use of read/write profile flag. + * Deprecated use of read/write profile flag. * Check whether file is writable lazily so we don't call access as often. */ #define PROFILE_FILE_DEPRECATED_RW 0x0001 @@ -136,7 +136,7 @@ errcode_t profile_add_node errcode_t profile_make_node_final (struct profile_node *node); - + int profile_is_node_final (struct profile_node *node); @@ -161,11 +161,11 @@ errcode_t profile_find_node_subsection (struct profile_node *section, const char *name, void **state, char **ret_name, struct profile_node **subsection); - + errcode_t profile_get_node_parent (struct profile_node *section, struct profile_node **parent); - + errcode_t profile_delete_node_relation (struct profile_node *section, const char *name); @@ -249,5 +249,5 @@ errcode_t profile_get_value (profile_t profile, const char **names, const char **ret_value); /* Others included from profile.h */ - + /* prof_set.c -- included from profile.h */ diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c index 701d5e4a9..a48ae58e1 100644 --- a/src/util/profile/prof_parse.c +++ b/src/util/profile/prof_parse.c @@ -81,7 +81,7 @@ static errcode_t parse_std_line(char *line, struct parse_state *state) struct profile_node *node; int do_subsection = 0; void *iter = 0; - + if (*line == 0) return 0; cp = skip_over_blanks(line); @@ -120,7 +120,7 @@ static errcode_t parse_std_line(char *line, struct parse_state *state) cp++; } /* - * A space after ']' should not be fatal + * A space after ']' should not be fatal */ cp = skip_over_blanks(cp); if (*cp) @@ -203,7 +203,7 @@ static errcode_t parse_std_line(char *line, struct parse_state *state) static errcode_t parse_line(char *line, struct parse_state *state) { char *cp; - + switch (state->state) { case STATE_INIT_COMMENT: if (line[0] != '[') @@ -380,7 +380,7 @@ static void dump_profile(struct profile_node *root, int level, void *iter; long retval; char *name, *value; - + iter = 0; do { retval = profile_find_node_relation(root, 0, &iter, diff --git a/src/util/profile/prof_set.c b/src/util/profile/prof_set.c index 85f228630..a08bfd757 100644 --- a/src/util/profile/prof_set.c +++ b/src/util/profile/prof_set.c @@ -7,7 +7,7 @@ * In the future it may be necessary to modify this public interface, * or possibly add higher level functions to support this correctly. * - * WARNING: We're not yet doing locking yet, either. + * WARNING: We're not yet doing locking yet, either. * */ @@ -74,15 +74,15 @@ static errcode_t rw_setup(profile_t profile) } -/* - * Delete or update a particular child node - * +/* + * Delete or update a particular child node + * * ADL - 2/23/99, rewritten TYT 2/25/99 */ errcode_t KRB5_CALLCONV profile_update_relation(profile_t profile, const char **names, const char *old_value, const char *new_value) -{ +{ errcode_t retval; struct profile_node *section, *node; void *state; @@ -91,7 +91,7 @@ profile_update_relation(profile_t profile, const char **names, retval = rw_setup(profile); if (retval) return retval; - + if (names == 0 || names[0] == 0 || names[1] == 0) return PROF_BAD_NAMESET; @@ -123,18 +123,18 @@ profile_update_relation(profile_t profile, const char **names, if (retval == 0) profile->first_file->data->flags |= PROFILE_FILE_DIRTY; k5_mutex_unlock(&profile->first_file->data->lock); - + return retval; } -/* +/* * Clear a particular all of the relations with a specific name. - * + * * TYT - 2/25/99 */ errcode_t KRB5_CALLCONV profile_clear_relation(profile_t profile, const char **names) -{ +{ errcode_t retval; struct profile_node *section, *node; void *state; @@ -143,7 +143,7 @@ profile_clear_relation(profile_t profile, const char **names) retval = rw_setup(profile); if (retval) return retval; - + if (names == 0 || names[0] == 0 || names[1] == 0) return PROF_BAD_NAMESET; @@ -167,29 +167,29 @@ profile_clear_relation(profile_t profile, const char **names) } while (state); profile->first_file->data->flags |= PROFILE_FILE_DIRTY; - + return 0; } -/* +/* * Rename a particular section; if the new_section name is NULL, * delete it. - * + * * ADL - 2/23/99, rewritten TYT 2/25/99 */ errcode_t KRB5_CALLCONV profile_rename_section(profile_t profile, const char **names, const char *new_name) -{ +{ errcode_t retval; struct profile_node *section, *node; void *state; const char **cpp; - + retval = rw_setup(profile); if (retval) return retval; - + if (names == 0 || names[0] == 0 || names[1] == 0) return PROF_BAD_NAMESET; @@ -242,7 +242,7 @@ profile_add_relation(profile_t profile, const char **names, retval = rw_setup(profile); if (retval) return retval; - + if (names == 0 || names[0] == 0 || names[1] == 0) return PROF_BAD_NAMESET; @@ -283,4 +283,3 @@ profile_add_relation(profile_t profile, const char **names, k5_mutex_unlock(&profile->first_file->data->lock); return 0; } - diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c index d8db45daf..6663dc1b5 100644 --- a/src/util/profile/prof_tree.c +++ b/src/util/profile/prof_tree.c @@ -1,16 +1,16 @@ /* * prof_tree.c --- these routines maintain the parse tree of the * config file. - * + * * All of the details of how the tree is stored is abstracted away in * this file; all of the other profile routines build, access, and * modify the tree via the accessor functions found in this file. * * Each node may represent either a relation or a section header. - * + * * A section header must have its value field set to 0, and may a one * or more child nodes, pointed to by first_child. - * + * * A relation has as its value a pointer to allocated memory * containing a string. Its first_child pointer must be null. * @@ -52,7 +52,7 @@ void profile_free_node(struct profile_node *node) if (node->magic != PROF_MAGIC_NODE) return; - + if (node->name) free(node->name); if (node->value) @@ -63,7 +63,7 @@ void profile_free_node(struct profile_node *node) profile_free_node(child); } node->magic = 0; - + free(node); } @@ -159,7 +159,7 @@ errcode_t profile_add_node(struct profile_node *section, const char *name, /* * Find the place to insert the new node. We look for the - * place *after* the last match of the node name, since + * place *after* the last match of the node name, since * order matters. */ for (p=section->first_child, last = 0; p; last = p, p = p->next) { @@ -233,7 +233,7 @@ const char *profile_get_node_value(struct profile_node *node) * section which matches the name; don't return relations. If value * is non-NULL, then only return relations which match the requested * value. (The value argument is ignored if section_flag is non-zero.) - * + * * The first time this routine is called, the state pointer must be * null. When this profile_find_node_relation() returns, if the state * pointer is non-NULL, then this routine should be called again. @@ -252,7 +252,7 @@ errcode_t profile_find_node(struct profile_node *section, const char *name, CHECK_MAGIC(p); } else p = section->first_child; - + for (; p; p = p->next) { if (name && (strcmp(p->name, name))) continue; @@ -344,7 +344,7 @@ errcode_t profile_find_node_relation(struct profile_node *section, * * This is (plus accessor functions for the name and value given a * profile node) makes this function mostly syntactic sugar for - * profile_find_node. + * profile_find_node. */ errcode_t profile_find_node_subsection(struct profile_node *section, const char *name, void **state, @@ -379,7 +379,7 @@ errcode_t profile_get_node_parent(struct profile_node *section, /* * This is a general-purpose iterator for returning all nodes that - * match the specified name array. + * match the specified name array. */ struct profile_iterator { prf_magic_t magic; @@ -601,9 +601,9 @@ get_new_file: return 0; } -/* +/* * Remove a particular node. - * + * * TYT, 2/25/99 */ errcode_t profile_remove_node(struct profile_node *node) @@ -612,7 +612,7 @@ errcode_t profile_remove_node(struct profile_node *node) if (node->parent == 0) return PROF_EINVAL; /* Can't remove the root! */ - + node->deleted = 1; return 0; @@ -627,7 +627,7 @@ errcode_t profile_set_relation_value(struct profile_node *node, const char *new_value) { char *cp; - + CHECK_MAGIC(node); if (!node->value) diff --git a/src/util/profile/profile.hin b/src/util/profile/profile.hin index 10abe725a..128676c6f 100644 --- a/src/util/profile/profile.hin +++ b/src/util/profile/profile.hin @@ -72,7 +72,7 @@ void KRB5_CALLCONV profile_free_list (char **list); long KRB5_CALLCONV profile_get_string - (profile_t profile, const char *name, const char *subname, + (profile_t profile, const char *name, const char *subname, const char *subsubname, const char *def_val, char **ret_string); long KRB5_CALLCONV profile_get_integer @@ -97,25 +97,25 @@ long KRB5_CALLCONV profile_iterator_create void KRB5_CALLCONV profile_iterator_free (void **iter_p); - + long KRB5_CALLCONV profile_iterator (void **iter_p, char **ret_name, char **ret_value); void KRB5_CALLCONV profile_release_string (char *str); long KRB5_CALLCONV profile_update_relation - (profile_t profile, const char **names, + (profile_t profile, const char **names, const char *old_value, const char *new_value); long KRB5_CALLCONV profile_clear_relation (profile_t profile, const char **names); long KRB5_CALLCONV profile_rename_section - (profile_t profile, const char **names, + (profile_t profile, const char **names, const char *new_name); long KRB5_CALLCONV profile_add_relation - (profile_t profile, const char **names, + (profile_t profile, const char **names, const char *new_value); #ifdef __cplusplus diff --git a/src/util/profile/profile_tcl.c b/src/util/profile/profile_tcl.c index 6a2476e47..199c01b29 100644 --- a/src/util/profile/profile_tcl.c +++ b/src/util/profile/profile_tcl.c @@ -1,11 +1,11 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.21 - * - * This file is not intended to be easily readable and contains a number of + * + * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. * ----------------------------------------------------------------------------- */ /*************************************************************** -*- c -*- @@ -23,8 +23,8 @@ #define SWIG_TypeName SWIG_Tcl_TypeName #define SWIG_TypeQuery SWIG_Tcl_TypeQuery #define SWIG_TypeClientData SWIG_Tcl_TypeClientData -#define SWIG_PackData SWIG_Tcl_PackData -#define SWIG_UnpackData SWIG_Tcl_UnpackData +#define SWIG_PackData SWIG_Tcl_PackData +#define SWIG_UnpackData SWIG_Tcl_UnpackData /*********************************************************************** @@ -37,7 +37,7 @@ * Author : David Beazley (beazley@cs.uchicago.edu) * * Copyright (c) 1999-2000, The University of Chicago - * + * * This file may be freely redistributed without license or fee provided * this copyright message remains intact. ************************************************************************/ @@ -146,7 +146,7 @@ SWIG_TypeRegister(swig_type_info *ti) { } /* Check the typename */ -SWIGRUNTIME(swig_type_info *) +SWIGRUNTIME(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *ty) { swig_type_info *s; if (!ty) return 0; /* Void pointer */ @@ -172,14 +172,14 @@ SWIG_TypeCheck(char *c, swig_type_info *ty) { } /* Cast a pointer up an inheritance hierarchy */ -SWIGRUNTIME(void *) +SWIGRUNTIME(void *) SWIG_TypeCast(swig_type_info *ty, void *ptr) { if ((!ty) || (!ty->converter)) return ptr; return (*ty->converter)(ptr); } /* Dynamic pointer casting. Down an inheritance hierarchy */ -SWIGRUNTIME(swig_type_info *) +SWIGRUNTIME(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; @@ -274,7 +274,7 @@ SWIG_UnpackData(char *c, void *ptr, int sz) { /* * $Header: /cvsroot/SWIG/Lib/tcl/swigtcl8.swg,v 1.19 2003/12/09 12:44:49 beazley Exp $ - * + * * swigtcl8.swg */ @@ -453,7 +453,7 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, char *c, void **ptr, swig_type continue; } Tcl_ResetResult(interp); - if (flags & SWIG_POINTER_EXCEPTION) + if (flags & SWIG_POINTER_EXCEPTION) Tcl_SetResult(interp, (char *) "Type error. Expected a pointer", TCL_STATIC); return TCL_ERROR; } @@ -1036,13 +1036,13 @@ typedef struct { /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_p_p_char swig_types[0] -#define SWIGTYPE_p_p_p_char swig_types[1] -#define SWIGTYPE_p_iter_t swig_types[2] -#define SWIGTYPE_iter_t swig_types[3] -#define SWIGTYPE_p_profile_t swig_types[4] -#define SWIGTYPE_profile_t swig_types[5] -#define SWIGTYPE_p_int swig_types[6] +#define SWIGTYPE_p_p_char swig_types[0] +#define SWIGTYPE_p_p_p_char swig_types[1] +#define SWIGTYPE_p_iter_t swig_types[2] +#define SWIGTYPE_iter_t swig_types[3] +#define SWIGTYPE_p_profile_t swig_types[4] +#define SWIGTYPE_profile_t swig_types[5] +#define SWIGTYPE_p_int swig_types[6] static swig_type_info *swig_types[8]; /* -------- TYPES TABLE (END) -------- */ @@ -1077,7 +1077,7 @@ SWIGEXPORT(int) SWIG_init(Tcl_Interp *); * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -1179,7 +1179,7 @@ extern int MacintoshInit _ANSI_ARGS_((void)); int Tcl_AppInit(Tcl_Interp *interp){ - if (Tcl_Init(interp) == TCL_ERROR) + if (Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR; /* Now initialize our functions */ @@ -1194,7 +1194,7 @@ int Tcl_AppInit(Tcl_Interp *interp){ #ifdef SWIG_RcRsrcName Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL); #endif - + return TCL_OK; } @@ -1202,7 +1202,7 @@ int Tcl_AppInit(Tcl_Interp *interp){ int main(int argc, char **argv) { #ifdef MAC_TCL char *newArgv[2]; - + if (MacintoshInit() != TCL_OK) { Tcl_Exit(1); } @@ -1231,13 +1231,13 @@ _wrap_profile_init_path(ClientData clientData, Tcl_Interp *interp, int objc, Tcl profile_t *arg2 = (profile_t *) 0 ; errcode_t result; profile_t tmp2 ; - + { /*generic swigtype hack*/ arg2 = &tmp2; } if (SWIG_GetArgs(interp, objc, objv,"|s:profile_init_path ?path? ",&arg1) == TCL_ERROR) SWIG_fail; result = (errcode_t)profile_init_path((char const *)arg1,arg2); - + { /* out errcode_t result */ if (result) { @@ -1260,7 +1260,7 @@ _wrap_profile_init(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj profile_t *arg2 = (profile_t *) 0 ; errcode_t result; profile_t tmp2 ; - + { /*generic swigtype hack*/ arg2 = &tmp2; } @@ -1273,7 +1273,7 @@ _wrap_profile_init(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj } } result = (errcode_t)profile_init((char const **)arg1,arg2); - + { /* out errcode_t result */ if (result) { @@ -1287,7 +1287,7 @@ _wrap_profile_init(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj { /* freearg char **nullterm */ if (arg1) { - Tcl_Free((char *)arg1); arg1 = (char **) NULL; + Tcl_Free((char *)arg1); arg1 = (char **) NULL; } } return TCL_OK; @@ -1295,7 +1295,7 @@ _wrap_profile_init(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj { /* freearg char **nullterm */ if (arg1) { - Tcl_Free((char *)arg1); arg1 = (char **) NULL; + Tcl_Free((char *)arg1); arg1 = (char **) NULL; } } return TCL_ERROR; @@ -1306,11 +1306,11 @@ static int _wrap_profile_flush(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { profile_t arg1 = (profile_t) 0 ; errcode_t result; - + if (SWIG_GetArgs(interp, objc, objv,"o:profile_flush profile_t ",0) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; result = (errcode_t)profile_flush(arg1); - + { /* out errcode_t result */ if (result) { @@ -1331,11 +1331,11 @@ _wrap_profile_flush_to_file(ClientData clientData, Tcl_Interp *interp, int objc, profile_t arg1 = (profile_t) 0 ; char *arg2 ; errcode_t result; - + if (SWIG_GetArgs(interp, objc, objv,"os:profile_flush_to_file profile_t path ",0,&arg2) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; result = (errcode_t)profile_flush_to_file(arg1,(char const *)arg2); - + { /* out errcode_t result */ if (result) { @@ -1354,12 +1354,12 @@ _wrap_profile_flush_to_file(ClientData clientData, Tcl_Interp *interp, int objc, static int _wrap_profile_abandon(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { profile_t arg1 = (profile_t) 0 ; - + if (SWIG_GetArgs(interp, objc, objv,"o:profile_abandon profile_t ",0) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; profile_abandon(arg1); - - + + return TCL_OK; fail: return TCL_ERROR; @@ -1369,12 +1369,12 @@ _wrap_profile_abandon(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_O static int _wrap_profile_release(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { profile_t arg1 = (profile_t) 0 ; - + if (SWIG_GetArgs(interp, objc, objv,"o:profile_release profile_t ",0) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; profile_release(arg1); - - + + return TCL_OK; fail: return TCL_ERROR; @@ -1388,7 +1388,7 @@ _wrap_profile_get_values(ClientData clientData, Tcl_Interp *interp, int objc, Tc char ***arg3 = (char ***) 0 ; errcode_t result; char **tmp3 ; - + { /* in char ***OUTPUT */ tmp3 = NULL; @@ -1402,7 +1402,7 @@ _wrap_profile_get_values(ClientData clientData, Tcl_Interp *interp, int objc, Tc if (Tcl_SplitList(interp, Tcl_GetStringFromObj(objv[2],NULL), &n, &arg2) == TCL_ERROR) SWIG_fail; } result = (errcode_t)profile_get_values(arg1,(char const **)arg2,arg3); - + { /* out errcode_t result */ if (result) { @@ -1421,7 +1421,7 @@ _wrap_profile_get_values(ClientData clientData, Tcl_Interp *interp, int objc, Tc { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } { @@ -1433,7 +1433,7 @@ _wrap_profile_get_values(ClientData clientData, Tcl_Interp *interp, int objc, Tc { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } { @@ -1454,7 +1454,7 @@ _wrap_profile_get_string(ClientData clientData, Tcl_Interp *interp, int objc, Tc char **arg6 = (char **) 0 ; errcode_t result; char *tmp6 ; - + { /* in char **OUTPUT */ tmp6 = NULL; @@ -1463,7 +1463,7 @@ _wrap_profile_get_string(ClientData clientData, Tcl_Interp *interp, int objc, Tc if (SWIG_GetArgs(interp, objc, objv,"oss|ss:profile_get_string p name subname ?subsubname? ?defval? ",0,&arg2,&arg3,&arg4,&arg5) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; result = (errcode_t)profile_get_string(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,arg6); - + { /* out errcode_t result */ if (result) { @@ -1506,12 +1506,12 @@ _wrap_profile_get_integer(ClientData clientData, Tcl_Interp *interp, int objc, T int *arg6 = (int *) 0 ; errcode_t result; int temp6 ; - + arg6 = &temp6; if (SWIG_GetArgs(interp, objc, objv,"oss|si:profile_get_integer p name subname ?subsubname? ?defval? ",0,&arg2,&arg3,&arg4,&arg5) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; result = (errcode_t)profile_get_integer(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6); - + { /* out errcode_t result */ if (result) { @@ -1542,12 +1542,12 @@ _wrap_profile_get_boolean(ClientData clientData, Tcl_Interp *interp, int objc, T int *arg6 = (int *) 0 ; errcode_t result; int temp6 ; - + arg6 = &temp6; if (SWIG_GetArgs(interp, objc, objv,"oss|si:profile_get_boolean p name subname ?subsubname? ?defval? ",0,&arg2,&arg3,&arg4,&arg5) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; result = (errcode_t)profile_get_boolean(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6); - + { /* out errcode_t result */ if (result) { @@ -1575,7 +1575,7 @@ _wrap_profile_get_relation_names(ClientData clientData, Tcl_Interp *interp, int char ***arg3 = (char ***) 0 ; errcode_t result; char **tmp3 ; - + { /* in char ***OUTPUT */ tmp3 = NULL; @@ -1589,7 +1589,7 @@ _wrap_profile_get_relation_names(ClientData clientData, Tcl_Interp *interp, int if (Tcl_SplitList(interp, Tcl_GetStringFromObj(objv[2],NULL), &n, &arg2) == TCL_ERROR) SWIG_fail; } result = (errcode_t)profile_get_relation_names(arg1,(char const **)arg2,arg3); - + { /* out errcode_t result */ if (result) { @@ -1608,7 +1608,7 @@ _wrap_profile_get_relation_names(ClientData clientData, Tcl_Interp *interp, int { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } { @@ -1620,7 +1620,7 @@ _wrap_profile_get_relation_names(ClientData clientData, Tcl_Interp *interp, int { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } { @@ -1638,7 +1638,7 @@ _wrap_profile_get_subsection_names(ClientData clientData, Tcl_Interp *interp, in char ***arg3 = (char ***) 0 ; errcode_t result; char **tmp3 ; - + { /* in char ***OUTPUT */ tmp3 = NULL; @@ -1652,7 +1652,7 @@ _wrap_profile_get_subsection_names(ClientData clientData, Tcl_Interp *interp, in if (Tcl_SplitList(interp, Tcl_GetStringFromObj(objv[2],NULL), &n, &arg2) == TCL_ERROR) SWIG_fail; } result = (errcode_t)profile_get_subsection_names(arg1,(char const **)arg2,arg3); - + { /* out errcode_t result */ if (result) { @@ -1671,7 +1671,7 @@ _wrap_profile_get_subsection_names(ClientData clientData, Tcl_Interp *interp, in { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } { @@ -1683,7 +1683,7 @@ _wrap_profile_get_subsection_names(ClientData clientData, Tcl_Interp *interp, in { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } { @@ -1702,7 +1702,7 @@ _wrap_profile_iterator_create(ClientData clientData, Tcl_Interp *interp, int obj iter_t *arg4 = (iter_t *) 0 ; errcode_t result; iter_t tmp4 ; - + { /*generic swigtype hack*/ arg4 = &tmp4; } @@ -1714,7 +1714,7 @@ _wrap_profile_iterator_create(ClientData clientData, Tcl_Interp *interp, int obj if (Tcl_SplitList(interp, Tcl_GetStringFromObj(objv[2],NULL), &n, &arg2) == TCL_ERROR) SWIG_fail; } result = (errcode_t)iter_create(arg1,(char const **)arg2,arg3,arg4); - + { /* out errcode_t result */ if (result) { @@ -1728,7 +1728,7 @@ _wrap_profile_iterator_create(ClientData clientData, Tcl_Interp *interp, int obj { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_OK; @@ -1736,7 +1736,7 @@ _wrap_profile_iterator_create(ClientData clientData, Tcl_Interp *interp, int obj { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_ERROR; @@ -1747,11 +1747,11 @@ static int _wrap_profile_iterator_free(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { iter_t arg1 = (iter_t) 0 ; errcode_t result; - + if (SWIG_GetArgs(interp, objc, objv,"o:profile_iterator_free i ",0) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_iter_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; result = (errcode_t)iter_free(arg1); - + { /* out errcode_t result */ if (result) { @@ -1775,7 +1775,7 @@ _wrap_profile_iterator(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_ errcode_t result; char *tmp2 ; char *tmp3 ; - + { /* in char **OUTPUT */ tmp2 = NULL; @@ -1789,7 +1789,7 @@ _wrap_profile_iterator(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_ if (SWIG_GetArgs(interp, objc, objv,"o:profile_iterator iter_t ",0) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_iter_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; result = (errcode_t)profile_iterator(arg1,arg2,arg3); - + { /* out errcode_t result */ if (result) { @@ -1846,7 +1846,7 @@ _wrap_profile_update_relation(ClientData clientData, Tcl_Interp *interp, int obj char *arg3 ; char *arg4 = (char *) NULL ; errcode_t result; - + if (SWIG_GetArgs(interp, objc, objv,"oos|s:profile_update_relation p nullterm oldval ?newval? ",0,0,&arg3,&arg4) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; { @@ -1855,7 +1855,7 @@ _wrap_profile_update_relation(ClientData clientData, Tcl_Interp *interp, int obj if (Tcl_SplitList(interp, Tcl_GetStringFromObj(objv[2],NULL), &n, &arg2) == TCL_ERROR) SWIG_fail; } result = (errcode_t)profile_update_relation(arg1,(char const **)arg2,(char const *)arg3,(char const *)arg4); - + { /* out errcode_t result */ if (result) { @@ -1868,7 +1868,7 @@ _wrap_profile_update_relation(ClientData clientData, Tcl_Interp *interp, int obj { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_OK; @@ -1876,7 +1876,7 @@ _wrap_profile_update_relation(ClientData clientData, Tcl_Interp *interp, int obj { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_ERROR; @@ -1888,7 +1888,7 @@ _wrap_profile_clear_relation(ClientData clientData, Tcl_Interp *interp, int objc profile_t arg1 = (profile_t) 0 ; char **arg2 = (char **) 0 ; errcode_t result; - + if (SWIG_GetArgs(interp, objc, objv,"oo:profile_clear_relation p nullterm ",0,0) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; { @@ -1897,7 +1897,7 @@ _wrap_profile_clear_relation(ClientData clientData, Tcl_Interp *interp, int objc if (Tcl_SplitList(interp, Tcl_GetStringFromObj(objv[2],NULL), &n, &arg2) == TCL_ERROR) SWIG_fail; } result = (errcode_t)profile_clear_relation(arg1,(char const **)arg2); - + { /* out errcode_t result */ if (result) { @@ -1910,7 +1910,7 @@ _wrap_profile_clear_relation(ClientData clientData, Tcl_Interp *interp, int objc { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_OK; @@ -1918,7 +1918,7 @@ _wrap_profile_clear_relation(ClientData clientData, Tcl_Interp *interp, int objc { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_ERROR; @@ -1931,7 +1931,7 @@ _wrap_profile_rename_section(ClientData clientData, Tcl_Interp *interp, int objc char **arg2 = (char **) 0 ; char *arg3 = (char *) NULL ; errcode_t result; - + if (SWIG_GetArgs(interp, objc, objv,"oo|s:profile_rename_section p nullterm ?new_name? ",0,0,&arg3) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; { @@ -1940,7 +1940,7 @@ _wrap_profile_rename_section(ClientData clientData, Tcl_Interp *interp, int objc if (Tcl_SplitList(interp, Tcl_GetStringFromObj(objv[2],NULL), &n, &arg2) == TCL_ERROR) SWIG_fail; } result = (errcode_t)profile_rename_section(arg1,(char const **)arg2,(char const *)arg3); - + { /* out errcode_t result */ if (result) { @@ -1953,7 +1953,7 @@ _wrap_profile_rename_section(ClientData clientData, Tcl_Interp *interp, int objc { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_OK; @@ -1961,7 +1961,7 @@ _wrap_profile_rename_section(ClientData clientData, Tcl_Interp *interp, int objc { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_ERROR; @@ -1974,7 +1974,7 @@ _wrap_profile_add_relation(ClientData clientData, Tcl_Interp *interp, int objc, char **arg2 = (char **) 0 ; char *arg3 = (char *) NULL ; errcode_t result; - + if (SWIG_GetArgs(interp, objc, objv,"oo|s:profile_add_relation p nullterm ?new_val? ",0,0,&arg3) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; { @@ -1983,7 +1983,7 @@ _wrap_profile_add_relation(ClientData clientData, Tcl_Interp *interp, int objc, if (Tcl_SplitList(interp, Tcl_GetStringFromObj(objv[2],NULL), &n, &arg2) == TCL_ERROR) SWIG_fail; } result = (errcode_t)profile_add_relation(arg1,(char const **)arg2,(char const *)arg3); - + { /* out errcode_t result */ if (result) { @@ -1996,7 +1996,7 @@ _wrap_profile_add_relation(ClientData clientData, Tcl_Interp *interp, int objc, { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_OK; @@ -2004,7 +2004,7 @@ _wrap_profile_add_relation(ClientData clientData, Tcl_Interp *interp, int objc, { /* freearg char **nullterm */ if (arg2) { - Tcl_Free((char *)arg2); arg2 = (char **) NULL; + Tcl_Free((char *)arg2); arg2 = (char **) NULL; } } return TCL_ERROR; @@ -2017,7 +2017,7 @@ _wrap_profile_flush_to_buffer(ClientData clientData, Tcl_Interp *interp, int obj char **arg2 = (char **) 0 ; errcode_t result; char *tmp2 ; - + { /* in char **OUTPUT */ tmp2 = NULL; @@ -2026,7 +2026,7 @@ _wrap_profile_flush_to_buffer(ClientData clientData, Tcl_Interp *interp, int obj if (SWIG_GetArgs(interp, objc, objv,"o:profile_flush_to_buffer p ",0) == TCL_ERROR) SWIG_fail; if ((SWIG_ConvertPtr(objv[1], (void **) &arg1, SWIGTYPE_profile_t,SWIG_POINTER_EXCEPTION | 0) != TCL_OK)) SWIG_fail; result = (errcode_t)profile_flush_to_buffer(arg1,arg2); - + { /* out errcode_t result */ if (result) { @@ -2103,13 +2103,13 @@ static swig_type_info _swigt__profile_t[] = {{"_profile_t", 0, "profile_t", 0},{ static swig_type_info _swigt__p_int[] = {{"_p_int", 0, "int *", 0},{"_p_int"},{0}}; static swig_type_info *swig_types_initial[] = { -_swigt__p_p_char, -_swigt__p_p_p_char, -_swigt__p_iter_t, -_swigt__iter_t, -_swigt__p_profile_t, -_swigt__profile_t, -_swigt__p_int, +_swigt__p_p_char, +_swigt__p_p_p_char, +_swigt__p_iter_t, +_swigt__iter_t, +_swigt__p_profile_t, +_swigt__profile_t, +_swigt__p_int, 0 }; @@ -2129,9 +2129,9 @@ SWIGEXPORT(int) SWIG_init(Tcl_Interp *interp) { return TCL_ERROR; } #endif - + Tcl_PkgProvide(interp, (char*)SWIG_name, (char*)SWIG_version); - + #ifdef SWIG_namespace Tcl_Eval(interp, "namespace eval " SWIG_namespace " { }"); #endif @@ -2150,10 +2150,9 @@ SWIGEXPORT(int) SWIG_init(Tcl_Interp *interp) { Tcl_TraceVar(interp, (char *) swig_variables[i].name, TCL_TRACE_WRITES | TCL_GLOBAL_ONLY, (Tcl_VarTraceProc *) swig_variables[i].set, (ClientData) swig_variables[i].addr); } SWIG_InstallConstants(interp, swig_constants); - + return TCL_OK; } SWIGEXPORT(int) Profile_SafeInit(Tcl_Interp *interp) { return SWIG_init(interp); } - diff --git a/src/util/profile/test_parse.c b/src/util/profile/test_parse.c index 961149c80..f524c90f2 100644 --- a/src/util/profile/test_parse.c +++ b/src/util/profile/test_parse.c @@ -32,15 +32,15 @@ int main(argc, argv) retval = profile_parse_file(f, &root); if (retval) { - printf("profile_parse_file error %s\n", + printf("profile_parse_file error %s\n", error_message((errcode_t) retval)); exit(1); } fclose(f); - + printf("\n\nDebugging dump.\n"); profile_write_tree_file(root, stdout); - + retval = profile_verify_node(root); if (retval) { printf("profile_verify_node reported an error: %s\n", diff --git a/src/util/profile/test_profile.c b/src/util/profile/test_profile.c index 5cdbf7689..6f47a7d4e 100644 --- a/src/util/profile/test_profile.c +++ b/src/util/profile/test_profile.c @@ -53,11 +53,11 @@ static void do_batchmode(profile) retval = profile_get_value(profile, names, &value); print_status = PRINT_VALUE; } else if (!strcmp(cmd, "list_sections")) { - retval = profile_get_subsection_names(profile, names, + retval = profile_get_subsection_names(profile, names, &values); print_status = PRINT_VALUES; } else if (!strcmp(cmd, "list_relations")) { - retval = profile_get_relation_names(profile, names, + retval = profile_get_relation_names(profile, names, &values); print_status = PRINT_VALUES; } else if (!strcmp(cmd, "dump")) { @@ -104,7 +104,7 @@ static void do_batchmode(profile) } profile_release(profile); exit(0); - + } @@ -119,14 +119,14 @@ int main(argc, argv) const char **names; char *cmd; int print_value = 0; - + if (argc < 2) { fprintf(stderr, "Usage: %s filename [cmd argset]\n", program_name); exit(1); } initialize_prof_error_table(); - + retval = profile_init_path(argv[1], &profile); if (retval) { com_err(program_name, retval, "while initializing profile"); @@ -165,5 +165,3 @@ int main(argc, argv) return 0; } - - diff --git a/src/util/ss/copyright.h b/src/util/ss/copyright.h index d118f10bf..07d487f9d 100644 --- a/src/util/ss/copyright.h +++ b/src/util/ss/copyright.h @@ -19,4 +19,3 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ - diff --git a/src/util/ss/error.c b/src/util/ss/error.c index 72bf989e5..ee2738aef 100644 --- a/src/util/ss/error.c +++ b/src/util/ss/error.c @@ -6,7 +6,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -38,7 +38,7 @@ char * ss_name(sci_idx) int sci_idx; { register ss_data *infop; - + infop = ss_info(sci_idx); if (infop->current_request == (char const *)NULL) { return strdup(infop->subsystem_name); diff --git a/src/util/ss/invocation.c b/src/util/ss/invocation.c index f4efe0288..a7e17bd42 100644 --- a/src/util/ss/invocation.c +++ b/src/util/ss/invocation.c @@ -6,7 +6,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright diff --git a/src/util/ss/list_rqs.c b/src/util/ss/list_rqs.c index fd863bbf4..f7d03c5eb 100644 --- a/src/util/ss/list_rqs.c +++ b/src/util/ss/list_rqs.c @@ -58,7 +58,7 @@ ss_list_requests(argc, argv, sci_idx, info_ptr) sigemptyset(&nmask); sigaddset(&nmask, SIGINT); sigprocmask(SIG_BLOCK, &nmask, &omask); - + nsig.sa_handler = SIG_IGN; sigemptyset(&nsig.sa_mask); nsig.sa_flags = 0; diff --git a/src/util/ss/listen.c b/src/util/ss/listen.c index ae9700757..36f261961 100644 --- a/src/util/ss/listen.c +++ b/src/util/ss/listen.c @@ -2,7 +2,7 @@ * Listener loop for subsystem library libss.a. * * util/ss/listen.c - * + * * Copyright 1987, 1988 by MIT Student Information Processing Board * * For copyright information, see copyright.h. @@ -57,7 +57,7 @@ int ss_listen (sci_idx) RETSIGTYPE (*sig_int)(), (*old_sig_cont)(); int mask; #endif - + current_info = info = ss_info(sci_idx); info->abort = 0; @@ -156,7 +156,7 @@ void ss_abort_subsystem(sci_idx, code) { ss_info(sci_idx)->abort = 1; ss_info(sci_idx)->exit_status = code; - + } void ss_quit(argc, argv, sci_idx, infop) diff --git a/src/util/ss/mit-sipb-copyright.h b/src/util/ss/mit-sipb-copyright.h index d6d5f1edc..5e8ec1731 100644 --- a/src/util/ss/mit-sipb-copyright.h +++ b/src/util/ss/mit-sipb-copyright.h @@ -19,4 +19,3 @@ the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ - diff --git a/src/util/ss/pager.c b/src/util/ss/pager.c index 49e8eb6ed..8e8aeeda4 100644 --- a/src/util/ss/pager.c +++ b/src/util/ss/pager.c @@ -29,10 +29,10 @@ extern char *getenv(); void ss_page_stdin(); #ifndef NO_FORK -int ss_pager_create() +int ss_pager_create() { int filedes[2]; - + if (pipe(filedes) != 0) return(-1); diff --git a/src/util/ss/parse.c b/src/util/ss/parse.c index 7ff39512b..28507b1d1 100644 --- a/src/util/ss/parse.c +++ b/src/util/ss/parse.c @@ -6,7 +6,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright diff --git a/src/util/support/cache-addrinfo.h b/src/util/support/cache-addrinfo.h index 0a4e44385..95f522dcb 100644 --- a/src/util/support/cache-addrinfo.h +++ b/src/util/support/cache-addrinfo.h @@ -1,42 +1,42 @@ /* * Copyright (C) 2004 by the Massachusetts Institute of Technology, * Cambridge, MA, USA. All Rights Reserved. - * - * This software is being provided to you, the LICENSEE, by the - * Massachusetts Institute of Technology (M.I.T.) under the following - * license. By obtaining, using and/or copying this software, you agree - * that you have read, understood, and will comply with these terms and - * conditions: - * + * + * This software is being provided to you, the LICENSEE, by the + * Massachusetts Institute of Technology (M.I.T.) under the following + * license. By obtaining, using and/or copying this software, you agree + * that you have read, understood, and will comply with these terms and + * conditions: + * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute - * this software and its documentation for any purpose and without fee or - * royalty is hereby granted, provided that you agree to comply with the - * following copyright notice and statements, including the disclaimer, and - * that the same appear on ALL copies of the software and documentation, - * including modifications that you make for internal use or for + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute + * this software and its documentation for any purpose and without fee or + * royalty is hereby granted, provided that you agree to comply with the + * following copyright notice and statements, including the disclaimer, and + * that the same appear on ALL copies of the software and documentation, + * including modifications that you make for internal use or for * distribution: - * - * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS - * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not - * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF - * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY - * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. - * - * The name of the Massachusetts Institute of Technology or M.I.T. may NOT - * be used in advertising or publicity pertaining to distribution of the - * software. Title to copyright in this software and any associated - * documentation shall at all times remain with M.I.T., and USER agrees to + * + * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS + * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not + * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF + * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF + * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY + * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + * + * The name of the Massachusetts Institute of Technology or M.I.T. may NOT + * be used in advertising or publicity pertaining to distribution of the + * software. Title to copyright in this software and any associated + * documentation shall at all times remain with M.I.T., and USER agrees to * preserve same. * * Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a - * fashion that it might be confused with the original M.I.T. software. + * fashion that it might be confused with the original M.I.T. software. */ /* Approach overview: diff --git a/src/util/support/errors.c b/src/util/support/errors.c index 8d523b98b..e89d8ad45 100644 --- a/src/util/support/errors.c +++ b/src/util/support/errors.c @@ -69,7 +69,7 @@ krb5int_vset_error_fl (struct errinfo *ep, long code, va_list args2; char *str = NULL, *str2, *slash; const char *loc_fmt = NULL; - + #ifdef USE_KIM /* Try to localize the format string */ if (kim_os_string_create_localized(&loc_fmt, fmt) != KIM_NO_ERROR) { @@ -78,7 +78,7 @@ krb5int_vset_error_fl (struct errinfo *ep, long code, #else loc_fmt = fmt; #endif - + /* try vasprintf first */ va_copy(args2, args); if (vasprintf(&str, loc_fmt, args2) < 0) { @@ -96,21 +96,21 @@ krb5int_vset_error_fl (struct errinfo *ep, long code, str = str2; } } - + /* If that failed, try using scratch_buf */ if (str == NULL) { vsnprintf(ep->scratch_buf, sizeof(ep->scratch_buf), loc_fmt, args); str = strdup(ep->scratch_buf); /* try allocating again */ } - + /* free old string before setting new one */ if (ep->msg && ep->msg != ep->scratch_buf) { free ((char *) ep->msg); ep->msg = NULL; - } + } ep->code = code; ep->msg = str ? str : ep->scratch_buf; - + #ifdef USE_KIM if (loc_fmt != fmt) { kim_string_free(&loc_fmt); } #else @@ -197,7 +197,7 @@ krb5int_get_error (struct errinfo *ep, long code) unlock(); goto format_number; } - + r2 = strdup(r); if (r2 == NULL) { strncpy(ep->scratch_buf, r, sizeof(ep->scratch_buf)); diff --git a/src/util/support/fake-addrinfo.c b/src/util/support/fake-addrinfo.c index 34ce7701b..5d90e7217 100644 --- a/src/util/support/fake-addrinfo.c +++ b/src/util/support/fake-addrinfo.c @@ -1,42 +1,42 @@ /* * Copyright (C) 2001,2002,2003,2004,2005,2006 by the Massachusetts Institute of Technology, * Cambridge, MA, USA. All Rights Reserved. - * - * This software is being provided to you, the LICENSEE, by the - * Massachusetts Institute of Technology (M.I.T.) under the following - * license. By obtaining, using and/or copying this software, you agree - * that you have read, understood, and will comply with these terms and - * conditions: - * + * + * This software is being provided to you, the LICENSEE, by the + * Massachusetts Institute of Technology (M.I.T.) under the following + * license. By obtaining, using and/or copying this software, you agree + * that you have read, understood, and will comply with these terms and + * conditions: + * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute - * this software and its documentation for any purpose and without fee or - * royalty is hereby granted, provided that you agree to comply with the - * following copyright notice and statements, including the disclaimer, and - * that the same appear on ALL copies of the software and documentation, - * including modifications that you make for internal use or for + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute + * this software and its documentation for any purpose and without fee or + * royalty is hereby granted, provided that you agree to comply with the + * following copyright notice and statements, including the disclaimer, and + * that the same appear on ALL copies of the software and documentation, + * including modifications that you make for internal use or for * distribution: - * - * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS - * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not - * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF - * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY - * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. - * - * The name of the Massachusetts Institute of Technology or M.I.T. may NOT - * be used in advertising or publicity pertaining to distribution of the - * software. Title to copyright in this software and any associated - * documentation shall at all times remain with M.I.T., and USER agrees to + * + * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS + * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not + * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF + * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF + * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY + * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + * + * The name of the Massachusetts Institute of Technology or M.I.T. may NOT + * be used in advertising or publicity pertaining to distribution of the + * software. Title to copyright in this software and any associated + * documentation shall at all times remain with M.I.T., and USER agrees to * preserve same. * * Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a - * fashion that it might be confused with the original M.I.T. software. + * fashion that it might be confused with the original M.I.T. software. */ /* Approach overview: @@ -383,7 +383,7 @@ static const char *protoname (int p, char *buf, size_t bufsize) { snprintf(buf, bufsize, " %-2d", p); return buf; -} +} static const char *socktypename (int t, char *buf, size_t bufsize) { switch (t) { diff --git a/src/util/support/init-addrinfo.c b/src/util/support/init-addrinfo.c index 186950fb8..af8746762 100644 --- a/src/util/support/init-addrinfo.c +++ b/src/util/support/init-addrinfo.c @@ -1,42 +1,42 @@ /* * Copyright (C) 2004 by the Massachusetts Institute of Technology, * Cambridge, MA, USA. All Rights Reserved. - * - * This software is being provided to you, the LICENSEE, by the - * Massachusetts Institute of Technology (M.I.T.) under the following - * license. By obtaining, using and/or copying this software, you agree - * that you have read, understood, and will comply with these terms and - * conditions: - * + * + * This software is being provided to you, the LICENSEE, by the + * Massachusetts Institute of Technology (M.I.T.) under the following + * license. By obtaining, using and/or copying this software, you agree + * that you have read, understood, and will comply with these terms and + * conditions: + * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute - * this software and its documentation for any purpose and without fee or - * royalty is hereby granted, provided that you agree to comply with the - * following copyright notice and statements, including the disclaimer, and - * that the same appear on ALL copies of the software and documentation, - * including modifications that you make for internal use or for + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute + * this software and its documentation for any purpose and without fee or + * royalty is hereby granted, provided that you agree to comply with the + * following copyright notice and statements, including the disclaimer, and + * that the same appear on ALL copies of the software and documentation, + * including modifications that you make for internal use or for * distribution: - * - * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS - * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not - * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF - * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY - * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. - * - * The name of the Massachusetts Institute of Technology or M.I.T. may NOT - * be used in advertising or publicity pertaining to distribution of the - * software. Title to copyright in this software and any associated - * documentation shall at all times remain with M.I.T., and USER agrees to + * + * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS + * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not + * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF + * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF + * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY + * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + * + * The name of the Massachusetts Institute of Technology or M.I.T. may NOT + * be used in advertising or publicity pertaining to distribution of the + * software. Title to copyright in this software and any associated + * documentation shall at all times remain with M.I.T., and USER agrees to * preserve same. * * Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a - * fashion that it might be confused with the original M.I.T. software. + * fashion that it might be confused with the original M.I.T. software. */ /* Stuff that needs initialization for fake-addrinfo.c. diff --git a/src/util/support/ipc_stream.c b/src/util/support/ipc_stream.c index 92d47e6ec..778d6f1f2 100644 --- a/src/util/support/ipc_stream.c +++ b/src/util/support/ipc_stream.c @@ -57,20 +57,20 @@ static uint32_t krb5int_ipc_stream_reallocate (k5_ipc_stream io_stream, { int32_t err = 0; uint64_t new_max_size = 0; - + if (!io_stream) { err = k5_check_error (EINVAL); } - + if (!err) { uint64_t old_max_size = io_stream->max_size; new_max_size = io_stream->max_size; - + if (in_new_size > old_max_size) { /* Expand the stream */ while (in_new_size > new_max_size) { new_max_size += K5_IPC_STREAM_SIZE_INCREMENT; } - - + + } else if ((in_new_size + K5_IPC_STREAM_SIZE_INCREMENT) < old_max_size) { /* Shrink the array, but never drop below K5_IPC_STREAM_SIZE_INCREMENT */ while ((in_new_size + K5_IPC_STREAM_SIZE_INCREMENT) < new_max_size && @@ -79,25 +79,25 @@ static uint32_t krb5int_ipc_stream_reallocate (k5_ipc_stream io_stream, } } } - + if (!err && new_max_size != io_stream->max_size) { char *data = io_stream->data; - + if (!data) { data = malloc (new_max_size * sizeof (*data)); } else { data = realloc (data, new_max_size * sizeof (*data)); } - - if (data) { + + if (data) { io_stream->data = data; io_stream->max_size = new_max_size; } else { - err = k5_check_error (ENOMEM); + err = k5_check_error (ENOMEM); } } - - return k5_check_error (err); + + return k5_check_error (err); } /* ------------------------------------------------------------------------ */ @@ -106,41 +106,41 @@ int32_t krb5int_ipc_stream_new (k5_ipc_stream *out_stream) { int32_t err = 0; k5_ipc_stream stream = NULL; - + if (!out_stream) { err = k5_check_error (EINVAL); } - + if (!err) { stream = malloc (sizeof (*stream)); - if (stream) { + if (stream) { *stream = k5_ipc_stream_initializer; } else { - err = k5_check_error (ENOMEM); + err = k5_check_error (ENOMEM); } } - + if (!err) { *out_stream = stream; stream = NULL; } - + krb5int_ipc_stream_release (stream); - - return k5_check_error (err); + + return k5_check_error (err); } /* ------------------------------------------------------------------------ */ uint32_t krb5int_ipc_stream_release (k5_ipc_stream io_stream) -{ +{ int32_t err = 0; - + if (!err && io_stream) { free (io_stream->data); free (io_stream); } - - return err; + + return err; } /* ------------------------------------------------------------------------ */ @@ -164,63 +164,63 @@ const char *krb5int_ipc_stream_data (k5_ipc_stream in_stream) /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_read (k5_ipc_stream io_stream, - void *io_data, +uint32_t krb5int_ipc_stream_read (k5_ipc_stream io_stream, + void *io_data, uint64_t in_size) { int32_t err = 0; - + if (!io_stream) { err = k5_check_error (EINVAL); } if (!io_data ) { err = k5_check_error (EINVAL); } - + if (!err) { - if (in_size > io_stream->size) { - err = k5_check_error (EINVAL); + if (in_size > io_stream->size) { + err = k5_check_error (EINVAL); } } - + if (!err) { memcpy (io_data, io_stream->data, in_size); - memmove (io_stream->data, &io_stream->data[in_size], + memmove (io_stream->data, &io_stream->data[in_size], io_stream->size - in_size); - + err = krb5int_ipc_stream_reallocate (io_stream, io_stream->size - in_size); - + if (!err) { io_stream->size -= in_size; } } - + return k5_check_error (err); } /* ------------------------------------------------------------------------ */ uint32_t krb5int_ipc_stream_write (k5_ipc_stream io_stream, - const void *in_data, + const void *in_data, uint64_t in_size) { int32_t err = 0; - + if (!io_stream) { err = k5_check_error (EINVAL); } if (!in_data ) { err = k5_check_error (EINVAL); } - + if (!err) { /* Security check: Do not let the caller overflow the length */ if (in_size > (UINT64_MAX - io_stream->size)) { err = k5_check_error (EINVAL); } } - + if (!err) { err = krb5int_ipc_stream_reallocate (io_stream, io_stream->size + in_size); } - + if (!err) { memcpy (&io_stream->data[io_stream->size], in_data, in_size); io_stream->size += in_size; } - + return k5_check_error (err); } @@ -237,60 +237,60 @@ void krb5int_ipc_stream_free_string (char *in_string) /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_read_string (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_read_string (k5_ipc_stream io_stream, char **out_string) { int32_t err = 0; uint32_t length = 0; char *string = NULL; - + if (!io_stream ) { err = k5_check_error (EINVAL); } if (!out_string) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_read_uint32 (io_stream, &length); } - + if (!err) { string = malloc (length); if (!string) { err = k5_check_error (ENOMEM); } } - + if (!err) { err = krb5int_ipc_stream_read (io_stream, string, length); } - + if (!err) { *out_string = string; string = NULL; } - + free (string); - + return k5_check_error (err); } /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_write_string (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_write_string (k5_ipc_stream io_stream, const char *in_string) { int32_t err = 0; uint32_t length = 0; - + if (!io_stream) { err = k5_check_error (EINVAL); } if (!in_string) { err = k5_check_error (EINVAL); } - + if (!err) { length = strlen (in_string) + 1; - + err = krb5int_ipc_stream_write_uint32 (io_stream, length); } - + if (!err) { err = krb5int_ipc_stream_write (io_stream, in_string, length); } - + return k5_check_error (err); } @@ -300,40 +300,40 @@ uint32_t krb5int_ipc_stream_write_string (k5_ipc_stream io_stream, /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_read_int32 (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_read_int32 (k5_ipc_stream io_stream, int32_t *out_int32) { int32_t err = 0; int32_t int32 = 0; - + if (!io_stream) { err = k5_check_error (EINVAL); } if (!out_int32) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_read (io_stream, &int32, sizeof (int32)); } - + if (!err) { *out_int32 = ntohl (int32); } - + return k5_check_error (err); } /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_write_int32 (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_write_int32 (k5_ipc_stream io_stream, int32_t in_int32) { int32_t err = 0; int32_t int32 = htonl (in_int32); - + if (!io_stream) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_write (io_stream, &int32, sizeof (int32)); } - + return k5_check_error (err); } @@ -343,40 +343,40 @@ uint32_t krb5int_ipc_stream_write_int32 (k5_ipc_stream io_stream, /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_read_uint32 (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_read_uint32 (k5_ipc_stream io_stream, uint32_t *out_uint32) { int32_t err = 0; uint32_t uint32 = 0; - + if (!io_stream) { err = k5_check_error (EINVAL); } if (!out_uint32) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_read (io_stream, &uint32, sizeof (uint32)); } - + if (!err) { *out_uint32 = ntohl (uint32); } - + return k5_check_error (err); } /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_write_uint32 (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_write_uint32 (k5_ipc_stream io_stream, uint32_t in_uint32) { int32_t err = 0; int32_t uint32 = htonl (in_uint32); - + if (!io_stream) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_write (io_stream, &uint32, sizeof (uint32)); } - + return k5_check_error (err); } @@ -386,40 +386,40 @@ uint32_t krb5int_ipc_stream_write_uint32 (k5_ipc_stream io_stream, /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_read_int64 (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_read_int64 (k5_ipc_stream io_stream, int64_t *out_int64) { int32_t err = 0; uint64_t int64 = 0; - + if (!io_stream) { err = k5_check_error (EINVAL); } if (!out_int64) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_read (io_stream, &int64, sizeof (int64)); } - + if (!err) { *out_int64 = ntohll (int64); } - + return k5_check_error (err); } /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_write_int64 (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_write_int64 (k5_ipc_stream io_stream, int64_t in_int64) { int32_t err = 0; int64_t int64 = htonll (in_int64); - + if (!io_stream) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_write (io_stream, &int64, sizeof (int64)); } - + return k5_check_error (err); } @@ -430,39 +430,39 @@ uint32_t krb5int_ipc_stream_write_int64 (k5_ipc_stream io_stream, /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_read_uint64 (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_read_uint64 (k5_ipc_stream io_stream, uint64_t *out_uint64) { int32_t err = 0; uint64_t uint64 = 0; - + if (!io_stream) { err = k5_check_error (EINVAL); } if (!out_uint64) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_read (io_stream, &uint64, sizeof (uint64)); } - + if (!err) { *out_uint64 = ntohll (uint64); } - + return k5_check_error (err); } /* ------------------------------------------------------------------------ */ -uint32_t krb5int_ipc_stream_write_uint64 (k5_ipc_stream io_stream, +uint32_t krb5int_ipc_stream_write_uint64 (k5_ipc_stream io_stream, uint64_t in_uint64) { int32_t err = 0; int64_t uint64 = htonll (in_uint64); - + if (!io_stream) { err = k5_check_error (EINVAL); } - + if (!err) { err = krb5int_ipc_stream_write (io_stream, &uint64, sizeof (uint64)); } - + return k5_check_error (err); } diff --git a/src/util/support/plugins.c b/src/util/support/plugins.c index 26ec3912f..8c7fb5ffe 100644 --- a/src/util/support/plugins.c +++ b/src/util/support/plugins.c @@ -8,7 +8,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -22,7 +22,7 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * * * Plugin module support, and shims around dlopen/whatever. */ @@ -192,10 +192,10 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct #endif /* USE_CFBUNDLE */ )) { void *handle = NULL; - + #if USE_CFBUNDLE char executablepath[MAXPATHLEN]; - + if ((statbuf.st_mode & S_IFMT) == S_IFDIR) { int lock_err = 0; CFStringRef pluginString = NULL; @@ -208,51 +208,51 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct * because this code is Mac-specific */ lock_err = pthread_mutex_lock(&krb5int_bundle_mutex); if (lock_err) { err = lock_err; } - + if (!err) { - pluginString = CFStringCreateWithCString (kCFAllocatorDefault, - filepath, + pluginString = CFStringCreateWithCString (kCFAllocatorDefault, + filepath, kCFStringEncodingASCII); if (pluginString == NULL) { err = ENOMEM; } } - + if (!err) { - pluginURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, - pluginString, - kCFURLPOSIXPathStyle, + pluginURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, + pluginString, + kCFURLPOSIXPathStyle, true); if (pluginURL == NULL) { err = ENOMEM; } } - + if (!err) { pluginBundle = CFBundleCreate (kCFAllocatorDefault, pluginURL); if (pluginBundle == NULL) { err = ENOENT; } /* XXX need better error */ } - + if (!err) { executableURL = CFBundleCopyExecutableURL (pluginBundle); if (executableURL == NULL) { err = ENOMEM; } } - + if (!err) { if (!CFURLGetFileSystemRepresentation (executableURL, true, /* absolute */ - (UInt8 *)executablepath, + (UInt8 *)executablepath, sizeof (executablepath))) { err = ENOMEM; } } - + if (!err) { /* override the path the caller passed in */ filepath = executablepath; } - + if (executableURL != NULL) { CFRelease (executableURL); } if (pluginBundle != NULL) { CFRelease (pluginBundle); } if (pluginURL != NULL) { CFRelease (pluginURL); } if (pluginString != NULL) { CFRelease (pluginString); } - + /* unlock after CFRelease calls since they modify refcounts */ if (!lock_err) { pthread_mutex_unlock (&krb5int_bundle_mutex); } } @@ -282,7 +282,7 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct if (handle != NULL) { dlclose (handle); } } #endif /* USE_DLOPEN */ - + #ifdef _WIN32 if (!err && (statbuf.st_mode & S_IFMT) == S_IFREG) { HMODULE handle = NULL; @@ -300,33 +300,33 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct handle = NULL; } - if (handle != NULL) - FreeLibrary(handle); + if (handle != NULL) + FreeLibrary(handle); } #endif if (!err && !got_plugin) { err = ENOENT; /* no plugin or no way to load plugins */ } - + if (!err) { *h = htmp; htmp = NULL; /* h takes ownership */ } - + if (htmp != NULL) { free (htmp); } - + return err; } static long -krb5int_get_plugin_sym (struct plugin_file_handle *h, +krb5int_get_plugin_sym (struct plugin_file_handle *h, const char *csymname, int isfunc, void **ptr, struct errinfo *ep) { long err = 0; void *sym = NULL; - + #if USE_DLOPEN if (!err && !sym && (h->dlhandle != NULL)) { /* XXX Do we need to add a leading "_" to the symbol name on any @@ -340,7 +340,7 @@ krb5int_get_plugin_sym (struct plugin_file_handle *h, } } #endif - + #ifdef _WIN32 LPVOID lpMsgBuf; DWORD dw; @@ -354,7 +354,7 @@ krb5int_get_plugin_sym (struct plugin_file_handle *h, krb5int_set_error(ep, err, "%s", e); dw = GetLastError(); - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw, @@ -372,11 +372,11 @@ krb5int_get_plugin_sym (struct plugin_file_handle *h, if (!err && (sym == NULL)) { err = ENOENT; /* unimplemented */ } - + if (!err) { *ptr = sym; } - + return err; } @@ -391,7 +391,7 @@ long KRB5_CALLCONV krb5int_get_plugin_func (struct plugin_file_handle *h, const char *csymname, void (**ptr)(), struct errinfo *ep) { - void *dptr = NULL; + void *dptr = NULL; long err = krb5int_get_plugin_sym (h, csymname, 1, &dptr, ep); if (!err) { /* Cast function pointers to avoid code duplication */ @@ -453,15 +453,15 @@ krb5int_plugin_file_handle_array_init (struct plugin_file_handle ***harray) } static long -krb5int_plugin_file_handle_array_add (struct plugin_file_handle ***harray, size_t *count, +krb5int_plugin_file_handle_array_add (struct plugin_file_handle ***harray, size_t *count, struct plugin_file_handle *p) { long err = 0; struct plugin_file_handle **newharray = NULL; size_t newcount = *count + 1; - + newharray = realloc (*harray, ((newcount + 1) * sizeof (**harray))); /* +1 for NULL */ - if (newharray == NULL) { + if (newharray == NULL) { err = ENOMEM; } else { newharray[newcount - 1] = p; @@ -470,7 +470,7 @@ krb5int_plugin_file_handle_array_add (struct plugin_file_handle ***harray, size_ *harray = newharray; } - return err; + return err; } static void @@ -494,20 +494,20 @@ krb5int_plugin_file_handle_array_free (struct plugin_file_handle **harray) #endif -static void +static void krb5int_free_plugin_filenames (char **filenames) { - if (filenames != NULL) { + if (filenames != NULL) { int i; for (i = 0; filenames[i] != NULL; i++) { free (filenames[i]); } - free (filenames); - } + free (filenames); + } } -static long +static long krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames) { long err = 0; @@ -519,7 +519,7 @@ krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames) if (!filebases) { err = EINVAL; } if (!filenames) { err = EINVAL; } - + if (!err) { for (i = 0; filebases[i]; i++) { bases_count++; } for (i = 0; fileexts[i]; i++) { exts_count++; } @@ -531,7 +531,7 @@ krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames) size_t j; for (i = 0; !err && filebases[i]; i++) { for (j = 0; !err && fileexts[j]; j++) { - if (asprintf(&tempnames[(i*exts_count)+j], "%s%s", + if (asprintf(&tempnames[(i*exts_count)+j], "%s%s", filebases[i], fileexts[j]) < 0) { tempnames[(i*exts_count)+j] = NULL; err = ENOMEM; @@ -540,20 +540,20 @@ krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames) } tempnames[bases_count * exts_count] = NULL; /* NUL-terminate */ } - + if (!err) { *filenames = tempnames; tempnames = NULL; } - + if (tempnames) { krb5int_free_plugin_filenames (tempnames); } - + return err; } /* Takes a NULL-terminated list of directories. If filebases is NULL, filebases is ignored - * all plugins in the directories are loaded. If filebases is a NULL-terminated array of names, + * all plugins in the directories are loaded. If filebases is a NULL-terminated array of names, * only plugins in the directories with those name (plus any platform extension) are loaded. */ long KRB5_CALLCONV @@ -571,52 +571,52 @@ krb5int_open_plugin_dirs (const char * const *dirnames, if (!err) { err = krb5int_plugin_file_handle_array_init (&h); } - + if (!err && (filebases != NULL)) { err = krb5int_get_plugin_filenames (filebases, &filenames); } - + for (i = 0; !err && dirnames[i] != NULL; i++) { if (filenames != NULL) { /* load plugins with names from filenames from each directory */ int j; - + for (j = 0; !err && filenames[j] != NULL; j++) { struct plugin_file_handle *handle = NULL; char *filepath = NULL; - + if (!err) { if (asprintf(&filepath, "%s/%s", dirnames[i], filenames[j]) < 0) { filepath = NULL; err = ENOMEM; } } - + if (krb5int_open_plugin (filepath, &handle, ep) == 0) { err = krb5int_plugin_file_handle_array_add (&h, &count, handle); if (!err) { handle = NULL; } /* h takes ownership */ } - + if (filepath != NULL) { free (filepath); } if (handle != NULL) { krb5int_close_plugin (handle); } } } else { /* load all plugins in each directory */ DIR *dir = opendir (dirnames[i]); - + while (dir != NULL && !err) { struct dirent *d = NULL; char *filepath = NULL; struct plugin_file_handle *handle = NULL; - + d = readdir (dir); if (d == NULL) { break; } - - if ((strcmp (d->d_name, ".") == 0) || + + if ((strcmp (d->d_name, ".") == 0) || (strcmp (d->d_name, "..") == 0)) { continue; } - + if (!err) { int len = NAMELEN (d); if (asprintf(&filepath, "%s/%*s", dirnames[i], len, d->d_name) < 0) { @@ -624,34 +624,34 @@ krb5int_open_plugin_dirs (const char * const *dirnames, err = ENOMEM; } } - - if (!err) { + + if (!err) { if (krb5int_open_plugin (filepath, &handle, ep) == 0) { err = krb5int_plugin_file_handle_array_add (&h, &count, handle); if (!err) { handle = NULL; } /* h takes ownership */ } } - + if (filepath != NULL) { free (filepath); } if (handle != NULL) { krb5int_close_plugin (handle); } } - + if (dir != NULL) { closedir (dir); } } } - + if (err == ENOENT) { err = 0; /* ran out of plugins -- do nothing */ } - + if (!err) { dirhandle->files = h; h = NULL; /* dirhandle->files takes ownership */ } - + if (filenames != NULL) { krb5int_free_plugin_filenames (filenames); } if (h != NULL) { krb5int_plugin_file_handle_array_free (h); } - + return err; } @@ -687,14 +687,14 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle, /* XXX Do we need to add a leading "_" to the symbol name on any modern platforms? */ - + Tprintf("get_plugin_data_sym(%s)\n", symname); if (!err) { p = calloc (1, sizeof (*p)); /* calloc initializes to NULL */ if (p == NULL) { err = ENOMEM; } } - + if (!err && (dirhandle != NULL) && (dirhandle->files != NULL)) { int i = 0; @@ -706,8 +706,8 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle, count++; newp = realloc (p, ((count + 1) * sizeof (*p))); /* +1 for NULL */ - if (newp == NULL) { - err = ENOMEM; + if (newp == NULL) { + err = ENOMEM; } else { p = newp; p[count - 1] = sym; @@ -716,14 +716,14 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle, } } } - + if (!err) { *ptrs = p; p = NULL; /* ptrs takes ownership */ } - + if (p != NULL) { free (p); } - + return err; } @@ -743,29 +743,29 @@ krb5int_get_plugin_dir_func (struct plugin_dir_handle *dirhandle, long err = 0; void (**p)() = NULL; size_t count = 0; - + /* XXX Do we need to add a leading "_" to the symbol name on any modern platforms? */ - + Tprintf("get_plugin_data_sym(%s)\n", symname); - + if (!err) { p = calloc (1, sizeof (*p)); /* calloc initializes to NULL */ if (p == NULL) { err = ENOMEM; } } - + if (!err && (dirhandle != NULL) && (dirhandle->files != NULL)) { int i = 0; - + for (i = 0; !err && (dirhandle->files[i] != NULL); i++) { void (*sym)() = NULL; - + if (krb5int_get_plugin_func (dirhandle->files[i], symname, &sym, ep) == 0) { void (**newp)() = NULL; count++; newp = realloc (p, ((count + 1) * sizeof (*p))); /* +1 for NULL */ - if (newp == NULL) { + if (newp == NULL) { err = ENOMEM; } else { p = newp; @@ -775,13 +775,13 @@ krb5int_get_plugin_dir_func (struct plugin_dir_handle *dirhandle, } } } - + if (!err) { *ptrs = p; p = NULL; /* ptrs takes ownership */ } - + if (p != NULL) { free (p); } - + return err; } diff --git a/src/util/support/printf.c b/src/util/support/printf.c index 0df8c84ca..88552d297 100644 --- a/src/util/support/printf.c +++ b/src/util/support/printf.c @@ -8,7 +8,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -22,7 +22,7 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * * * Provide {,v}asprintf for platforms that don't have them. */ diff --git a/src/util/support/supp-int.h b/src/util/support/supp-int.h index ffc0e6455..85641005f 100644 --- a/src/util/support/supp-int.h +++ b/src/util/support/supp-int.h @@ -8,7 +8,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -22,7 +22,7 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * * * Internal prototypes for the krb5support library */ diff --git a/src/util/support/threads.c b/src/util/support/threads.c index 316be8a1c..12b549286 100644 --- a/src/util/support/threads.c +++ b/src/util/support/threads.c @@ -8,7 +8,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -22,7 +22,7 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * * * Preliminary thread support. */ @@ -83,7 +83,7 @@ void krb5int_thread_detach_hook (void) } } -/* Stub function not used on Windows. */ +/* Stub function not used on Windows. */ int krb5int_pthread_loaded (void) { return 0; @@ -187,15 +187,15 @@ static void thread_termination (void *tptr) if (err == 0) { int i, pass, none_found; struct tsd_block *t = tptr; - + /* Make multiple passes in case, for example, a libkrb5 cleanup function wants to print out an error message, which causes com_err to allocate a thread-specific buffer, after we just freed up the old one. - + Shouldn't actually happen, if we're careful, but check just in case. */ - + pass = 0; none_found = 0; while (pass < 4 && !none_found) { @@ -212,7 +212,7 @@ static void thread_termination (void *tptr) free (t); err = k5_mutex_unlock(&key_lock); } - + /* remove thread from global linked list */ } diff --git a/src/util/support/utf8.c b/src/util/support/utf8.c index 4468673dc..3d9021317 100644 --- a/src/util/support/utf8.c +++ b/src/util/support/utf8.c @@ -8,7 +8,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -117,7 +117,7 @@ int krb5int_utf8_charlen(const char *p) /* * Make sure the UTF-8 char used the shortest possible encoding - * returns charlen if valid, 0 if not. + * returns charlen if valid, 0 if not. * * Here are the valid UTF-8 encodings, taken from RFC 2279 page 4. * The table is slightly modified from that of the RFC. @@ -336,7 +336,7 @@ int krb5int_utf8_copy(char* dst, const char *src) for (i=1; i<6; i++) { if ((u[i] & 0xc0) != 0x80) { - return i; + return i; } dst[i] = src[i]; } diff --git a/src/util/support/utf8_conv.c b/src/util/support/utf8_conv.c index f972565f9..03303d744 100644 --- a/src/util/support/utf8_conv.c +++ b/src/util/support/utf8_conv.c @@ -8,7 +8,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -37,7 +37,7 @@ * <http://www.OpenLDAP.org/license.html>. */ /* Portions Copyright (C) 1999, 2000 Novell, Inc. All Rights Reserved. - * + * * THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND * TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT * TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS @@ -45,7 +45,7 @@ * IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION * OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP * PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT - * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. + * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. */ /* @@ -86,22 +86,22 @@ k5_utf8s_to_ucs2s(krb5_ucs2 *ucs2str, while (*utf8str && ucs2len < count) { /* Get UTF-8 sequence length from 1st byte */ utflen = KRB5_UTF8_CHARLEN2(utf8str, utflen); - + if (utflen == 0 || utflen > KRB5_MAX_UTF8_LEN) return -1; /* First byte minus length tag */ ch = (krb5_ucs2)(utf8str[0] & mask[utflen]); - + for (i = 1; i < utflen; i++) { /* Subsequent bytes must start with 10 */ if ((utf8str[i] & 0xc0) != 0x80) return -1; - + ch <<= 6; /* 6 bits of data in each subsequent byte */ ch |= (krb5_ucs2)(utf8str[i] & 0x3f); } - + if (ucs2str != NULL) { #ifdef K5_BE #ifndef SWAP16 @@ -119,7 +119,7 @@ k5_utf8s_to_ucs2s(krb5_ucs2 *ucs2str, } assert(ucs2len < count); - + if (ucs2str != NULL) { /* Add null terminator if there's room in the buffer. */ ucs2str[ucs2len] = 0; @@ -284,7 +284,7 @@ k5_ucs2s_to_utf8s(char *utf8str, const krb5_ucs2 *ucs2str, return len; } - + /* Do the actual conversion. */ n = 1; /* In case of empty ucs2str */ @@ -296,10 +296,10 @@ k5_ucs2s_to_utf8s(char *utf8str, const krb5_ucs2 *ucs2str, #endif n = krb5int_ucs2_to_utf8(ch, p); - + if (n < 1) break; - + p += n; count -= n; /* Space left in output buffer */ } @@ -317,7 +317,7 @@ k5_ucs2s_to_utf8s(char *utf8str, const krb5_ucs2 *ucs2str, if (n == -1) /* Conversion encountered invalid wide char. */ return -1; - /* Return the number of bytes written to output buffer, excl null. */ + /* Return the number of bytes written to output buffer, excl null. */ return (p - utf8str); } @@ -453,4 +453,3 @@ krb5int_ucs2lecs_to_utf8s(const unsigned char *ucs2les, return 0; } - diff --git a/src/util/windows/getopt_long.c b/src/util/windows/getopt_long.c index bb819628e..d22ac23f1 100644 --- a/src/util/windows/getopt_long.c +++ b/src/util/windows/getopt_long.c @@ -149,7 +149,7 @@ getopt2(nargc, nargv, ostr) if ((retval = getopt_internal(nargc, nargv, ostr)) == -2) { retval = -1; - ++optind; + ++optind; } return(retval); } @@ -187,11 +187,11 @@ getopt_long(nargc, nargv, options, long_options, index) } else current_argv_len = strlen(current_argv); - for (i = 0; long_options[i].name; i++) { + for (i = 0; long_options[i].name; i++) { if (strncmp(current_argv, long_options[i].name, current_argv_len)) continue; - if (strlen(long_options[i].name) == (unsigned)current_argv_len) { + if (strlen(long_options[i].name) == (unsigned)current_argv_len) { match = i; break; } @@ -227,7 +227,7 @@ getopt_long(nargc, nargv, options, long_options, index) if (long_options[match].flag) { *long_options[match].flag = long_options[match].val; retval = 0; - } else + } else retval = long_options[match].val; if (index) *index = match; |
