krb5 commit: Style fixes for locate_kdc.c and dnssrv.c
Greg Hudson
ghudson at mit.edu
Mon Sep 19 12:31:11 EDT 2016
https://github.com/krb5/krb5/commit/71f523aa93bb8d9a43194f452a0546ebb7ce50ab
commit 71f523aa93bb8d9a43194f452a0546ebb7ce50ab
Author: Matt Rogers <mrogers at redhat.com>
Date: Fri Aug 12 17:13:01 2016 -0400
Style fixes for locate_kdc.c and dnssrv.c
src/lib/krb5/os/dnssrv.c | 17 +++++++------
src/lib/krb5/os/locate_kdc.c | 54 ++++++++++++++++++++++-------------------
2 files changed, 38 insertions(+), 33 deletions(-)
diff --git a/src/lib/krb5/os/dnssrv.c b/src/lib/krb5/os/dnssrv.c
index 0955728..76f5b63 100644
--- a/src/lib/krb5/os/dnssrv.c
+++ b/src/lib/krb5/os/dnssrv.c
@@ -157,11 +157,12 @@ out:
return 0;
}
-/* Do DNS SRV query, return results in *answers.
-
- Make best effort to return all the data we can. On memory or
- decoding errors, just return what we've got. Always return 0,
- currently. */
+/*
+ * Do DNS SRV query, return results in *answers.
+ *
+ * Make a best effort to return all the data we can. On memory or decoding
+ * errors, just return what we've got. Always return 0, currently.
+ */
krb5_error_code
krb5int_make_srv_query_realm(const krb5_data *realm,
@@ -192,7 +193,7 @@ krb5int_make_srv_query_realm(const krb5_data *realm,
return 0;
#ifdef TEST
- fprintf (stderr, "sending DNS SRV query for %s\n", host);
+ fprintf(stderr, "sending DNS SRV query for %s\n", host);
#endif
size = krb5int_dns_init(&ds, host, C_IN, T_SRV);
@@ -224,7 +225,7 @@ krb5int_make_srv_query_realm(const krb5_data *realm,
* with the weight field
*/
- srv = (struct srv_dns_entry *) malloc(sizeof(struct srv_dns_entry));
+ srv = malloc(sizeof(struct srv_dns_entry));
if (srv == NULL)
goto out;
@@ -232,7 +233,7 @@ krb5int_make_srv_query_realm(const krb5_data *realm,
srv->weight = weight;
srv->port = port;
/* The returned names are fully qualified. Don't let the
- local resolver code do domain search path stuff. */
+ * local resolver code do domain search path stuff. */
if (asprintf(&srv->host, "%s.", host) < 0) {
free(srv);
goto out;
diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c
index ca6702e..b37dfda 100644
--- a/src/lib/krb5/os/locate_kdc.c
+++ b/src/lib/krb5/os/locate_kdc.c
@@ -55,9 +55,10 @@ maybe_use_dns (krb5_context context, const char *name, int defalt)
code = profile_get_string(context->profile, KRB5_CONF_LIBDEFAULTS,
name, 0, 0, &value);
- if (value == 0 && code == 0)
+ if (value == 0 && code == 0) {
code = profile_get_string(context->profile, KRB5_CONF_LIBDEFAULTS,
KRB5_CONF_DNS_FALLBACK, 0, 0, &value);
+ }
if (code)
return defalt;
@@ -72,19 +73,21 @@ maybe_use_dns (krb5_context context, const char *name, int defalt)
int
_krb5_use_dns_kdc(krb5_context context)
{
- return maybe_use_dns (context, KRB5_CONF_DNS_LOOKUP_KDC, DEFAULT_LOOKUP_KDC);
+ return maybe_use_dns(context, KRB5_CONF_DNS_LOOKUP_KDC,
+ DEFAULT_LOOKUP_KDC);
}
int
_krb5_use_dns_realm(krb5_context context)
{
- return maybe_use_dns (context, KRB5_CONF_DNS_LOOKUP_REALM, DEFAULT_LOOKUP_REALM);
+ return maybe_use_dns(context, KRB5_CONF_DNS_LOOKUP_REALM,
+ DEFAULT_LOOKUP_REALM);
}
#endif /* KRB5_DNS_LOOKUP */
/* Free up everything pointed to by the serverlist structure, but don't
- free the structure itself. */
+ * free the structure itself. */
void
k5_free_serverlist (struct serverlist *list)
{
@@ -227,8 +230,8 @@ locate_srv_conf_1(krb5_context context, const krb5_data *realm,
krb5_error_code code;
int i, default_port;
- Tprintf ("looking in krb5.conf for realm %s entry %s; ports %d,%d\n",
- realm->data, name, udpport);
+ Tprintf("looking in krb5.conf for realm %s entry %s; ports %d,%d\n",
+ realm->data, name, udpport);
realmstr = k5memdup0(realm->data, realm->length, &code);
if (realmstr == NULL)
@@ -240,20 +243,19 @@ locate_srv_conf_1(krb5_context context, const krb5_data *realm,
realm_srv_names[3] = 0;
code = profile_get_values(context->profile, realm_srv_names, &hostlist);
if (code) {
- Tprintf ("config file lookup failed: %s\n",
- error_message(code));
+ Tprintf("config file lookup failed: %s\n", error_message(code));
if (code == PROF_NO_SECTION || code == PROF_NO_RELATION)
code = 0;
goto cleanup;
}
- for (i=0; hostlist[i]; i++) {
+ for (i = 0; hostlist[i]; i++) {
int port_num;
k5_transport this_transport = transport;
const char *uri_path = NULL;
hostspec = hostlist[i];
- Tprintf ("entry %d is '%s'\n", i, hostspec);
+ Tprintf("entry %d is '%s'\n", i, hostspec);
parse_uri_if_https(hostspec, &this_transport, &hostspec, &uri_path);
@@ -335,7 +337,9 @@ cleanup:
#include <krb5/locate_plugin.h>
#if TARGET_OS_MAC
-static const char *objdirs[] = { KRB5_PLUGIN_BUNDLE_DIR, LIBDIR "/krb5/plugins/libkrb5", NULL }; /* should be a list */
+static const char *objdirs[] = { KRB5_PLUGIN_BUNDLE_DIR,
+ LIBDIR "/krb5/plugins/libkrb5",
+ NULL }; /* should be a list */
#else
static const char *objdirs[] = { LIBDIR "/krb5/plugins/libkrb5", NULL };
#endif
@@ -386,16 +390,16 @@ module_locate_server(krb5_context ctx, const krb5_data *realm,
Tprintf("in module_locate_server\n");
cbdata.list = serverlist;
- if (!PLUGIN_DIR_OPEN (&ctx->libkrb5_plugins)) {
+ if (!PLUGIN_DIR_OPEN(&ctx->libkrb5_plugins)) {
- code = krb5int_open_plugin_dirs (objdirs, NULL, &ctx->libkrb5_plugins,
- &ctx->err);
+ code = krb5int_open_plugin_dirs(objdirs, NULL, &ctx->libkrb5_plugins,
+ &ctx->err);
if (code)
return KRB5_PLUGIN_NO_HANDLE;
}
- code = krb5int_get_plugin_dir_data (&ctx->libkrb5_plugins,
- "service_locator", &ptrs, &ctx->err);
+ code = krb5int_get_plugin_dir_data(&ctx->libkrb5_plugins,
+ "service_locator", &ptrs, &ctx->err);
if (code) {
Tprintf("error looking up plugin symbols: %s\n",
(msg = krb5_get_error_message(ctx, code)));
@@ -419,7 +423,7 @@ module_locate_server(krb5_context ctx, const krb5_data *realm,
Tprintf("element %d is %p\n", i, ptrs[i]);
/* For now, don't keep the plugin data alive. For long-lived
- contexts, it may be desirable to change that later. */
+ * contexts, it may be desirable to change that later. */
code = vtbl->init(ctx, &blob);
if (code)
continue;
@@ -438,7 +442,8 @@ module_locate_server(krb5_context ctx, const krb5_data *realm,
if (code == KRB5_PLUGIN_NO_HANDLE) {
/* Module passes, keep going. */
/* XXX */
- Tprintf("plugin doesn't handle this realm (KRB5_PLUGIN_NO_HANDLE)\n");
+ Tprintf("plugin doesn't handle this realm (KRB5_PLUGIN_NO_HANDLE)"
+ "\n");
continue;
}
if (code != 0) {
@@ -446,7 +451,7 @@ module_locate_server(krb5_context ctx, const krb5_data *realm,
Tprintf("plugin lookup routine returned error %d: %s\n",
code, error_message(code));
free(realmz);
- krb5int_free_plugin_dir_data (ptrs);
+ krb5int_free_plugin_dir_data(ptrs);
return code;
}
break;
@@ -454,16 +459,16 @@ module_locate_server(krb5_context ctx, const krb5_data *realm,
if (ptrs[i] == NULL) {
Tprintf("ran off end of plugin list\n");
free(realmz);
- krb5int_free_plugin_dir_data (ptrs);
+ krb5int_free_plugin_dir_data(ptrs);
return KRB5_PLUGIN_NO_HANDLE;
}
Tprintf("stopped with plugin #%d, res=%p\n", i, res);
/* Got something back, yippee. */
Tprintf("now have %lu addrs in list %p\n",
- (unsigned long) serverlist->nservers, serverlist);
+ (unsigned long)serverlist->nservers, serverlist);
free(realmz);
- krb5int_free_plugin_dir_data (ptrs);
+ krb5int_free_plugin_dir_data(ptrs);
return 0;
}
@@ -479,9 +484,8 @@ prof_locate_server(krb5_context context, const krb5_data *realm,
switch (svc) {
case locate_service_kdc:
profname = KRB5_CONF_KDC;
- /* We used to use /etc/services for these, but enough systems
- have old, crufty, wrong settings that this is probably
- better. */
+ /* We used to use /etc/services for these, but enough systems have old,
+ * crufty, wrong settings that this is probably better. */
kdc_ports:
dflport = KRB5_DEFAULT_PORT;
break;
More information about the cvs-krb5
mailing list