| 1 |
From: Brian May <[email protected]> |
| 2 |
Date: Wed, 26 Apr 2017 06:29:22 +1000 |
| 3 |
Subject: hurd_maxhostnamelen |
| 4 |
|
| 5 |
--- |
| 6 |
appl/gssmask/gssmask.c | 4 ++-- |
| 7 |
appl/kf/kfd.c | 2 +- |
| 8 |
appl/test/tcp_server.c | 2 +- |
| 9 |
kdc/kx509.c | 2 +- |
| 10 |
lib/gssapi/spnego/accept_sec_context.c | 2 +- |
| 11 |
lib/krb5/get_addrs.c | 2 +- |
| 12 |
lib/krb5/get_host_realm.c | 4 ++-- |
| 13 |
lib/krb5/krbhst-test.c | 2 +- |
| 14 |
lib/krb5/krbhst.c | 2 +- |
| 15 |
lib/krb5/principal.c | 8 ++++---- |
| 16 |
lib/krb5/test_plugin.c | 2 +- |
| 17 |
lib/krb5/verify_init.c | 2 +- |
| 18 |
lib/roken/getaddrinfo_hostspec.c | 2 +- |
| 19 |
13 files changed, 18 insertions(+), 18 deletions(-) |
| 20 |
|
| 21 |
diff --git a/appl/gssmask/gssmask.c b/appl/gssmask/gssmask.c |
| 22 |
index b61db3d..3d5ad89 100644 |
| 23 |
--- a/appl/gssmask/gssmask.c |
| 24 |
+++ b/appl/gssmask/gssmask.c |
| 25 |
@@ -55,7 +55,7 @@ struct client { |
| 26 |
struct handle *handles; |
| 27 |
struct sockaddr_storage sa; |
| 28 |
socklen_t salen; |
| 29 |
- char servername[MAXHOSTNAMELEN]; |
| 30 |
+ char servername[MaxHostNameLen]; |
| 31 |
}; |
| 32 |
|
| 33 |
FILE *logfile; |
| 34 |
@@ -1097,7 +1097,7 @@ create_client(krb5_socket_t sock, int port, const char *moniker) |
| 35 |
if (moniker) { |
| 36 |
c->moniker = estrdup(moniker); |
| 37 |
} else { |
| 38 |
- char hostname[MAXHOSTNAMELEN]; |
| 39 |
+ char hostname[MaxHostNameLen]; |
| 40 |
gethostname(hostname, sizeof(hostname)); |
| 41 |
ret = asprintf(&c->moniker, "gssmask: %s:%d", hostname, port); |
| 42 |
if (ret == -1) |
| 43 |
diff --git a/appl/kf/kfd.c b/appl/kf/kfd.c |
| 44 |
index 9099bab..5af66a8 100644 |
| 45 |
--- a/appl/kf/kfd.c |
| 46 |
+++ b/appl/kf/kfd.c |
| 47 |
@@ -128,7 +128,7 @@ proto (int sock, const char *svc) |
| 48 |
krb5_ticket *ticket; |
| 49 |
char *name; |
| 50 |
char ret_string[10]; |
| 51 |
- char hostname[MAXHOSTNAMELEN]; |
| 52 |
+ char hostname[MaxHostNameLen]; |
| 53 |
krb5_data data; |
| 54 |
krb5_data remotename; |
| 55 |
krb5_data tk_file; |
| 56 |
diff --git a/appl/test/tcp_server.c b/appl/test/tcp_server.c |
| 57 |
index 50d1bf4..e4b4df7 100644 |
| 58 |
--- a/appl/test/tcp_server.c |
| 59 |
+++ b/appl/test/tcp_server.c |
| 60 |
@@ -52,7 +52,7 @@ proto (int sock, const char *service) |
| 61 |
krb5_principal server; |
| 62 |
krb5_ticket *ticket; |
| 63 |
char *name; |
| 64 |
- char hostname[MAXHOSTNAMELEN]; |
| 65 |
+ char hostname[MaxHostNameLen]; |
| 66 |
krb5_data packet; |
| 67 |
krb5_data data; |
| 68 |
uint32_t len, net_len; |
| 69 |
diff --git a/kdc/kx509.c b/kdc/kx509.c |
| 70 |
index 6f61a8e..2f6d5e6 100644 |
| 71 |
--- a/kdc/kx509.c |
| 72 |
+++ b/kdc/kx509.c |
| 73 |
@@ -331,7 +331,7 @@ kdc_kx509_verify_service_principal(krb5_context context, |
| 74 |
krb5_boolean bret; |
| 75 |
krb5_principal principal = NULL; |
| 76 |
char *expected = NULL; |
| 77 |
- char localhost[MAXHOSTNAMELEN]; |
| 78 |
+ char localhost[MaxHostNameLen]; |
| 79 |
|
| 80 |
ret = gethostname(localhost, sizeof(localhost) - 1); |
| 81 |
if (ret != 0) { |
| 82 |
diff --git a/lib/gssapi/spnego/accept_sec_context.c b/lib/gssapi/spnego/accept_sec_context.c |
| 83 |
index 5fe1a1a..8874648 100644 |
| 84 |
--- a/lib/gssapi/spnego/accept_sec_context.c |
| 85 |
+++ b/lib/gssapi/spnego/accept_sec_context.c |
| 86 |
@@ -366,7 +366,7 @@ select_mech(OM_uint32 *minor_status, MechType *mechType, int verify_p, |
| 87 |
if (verify_p) { |
| 88 |
gss_name_t name = GSS_C_NO_NAME; |
| 89 |
gss_buffer_desc namebuf; |
| 90 |
- char *str = NULL, *host, hostname[MAXHOSTNAMELEN]; |
| 91 |
+ char *str = NULL, *host, hostname[MaxHostNameLen]; |
| 92 |
|
| 93 |
host = getenv("GSSAPI_SPNEGO_NAME"); |
| 94 |
if (host == NULL || issuid()) { |
| 95 |
diff --git a/lib/krb5/get_addrs.c b/lib/krb5/get_addrs.c |
| 96 |
index 8246504..f25925e 100644 |
| 97 |
--- a/lib/krb5/get_addrs.c |
| 98 |
+++ b/lib/krb5/get_addrs.c |
| 99 |
@@ -47,7 +47,7 @@ static krb5_error_code |
| 100 |
gethostname_fallback (krb5_context context, krb5_addresses *res) |
| 101 |
{ |
| 102 |
krb5_error_code ret; |
| 103 |
- char hostname[MAXHOSTNAMELEN]; |
| 104 |
+ char hostname[MaxHostNameLen]; |
| 105 |
struct hostent *hostent; |
| 106 |
|
| 107 |
if (gethostname (hostname, sizeof(hostname))) { |
| 108 |
diff --git a/lib/krb5/get_host_realm.c b/lib/krb5/get_host_realm.c |
| 109 |
index 955d546..f7609d7 100644 |
| 110 |
--- a/lib/krb5/get_host_realm.c |
| 111 |
+++ b/lib/krb5/get_host_realm.c |
| 112 |
@@ -110,7 +110,7 @@ dns_find_realm(krb5_context context, |
| 113 |
krb5_realm **realms) |
| 114 |
{ |
| 115 |
static const char *default_labels[] = { "_kerberos", NULL }; |
| 116 |
- char dom[MAXHOSTNAMELEN]; |
| 117 |
+ char dom[MaxHostNameLen]; |
| 118 |
struct rk_dns_reply *r; |
| 119 |
const char **labels; |
| 120 |
char **config_labels; |
| 121 |
@@ -263,7 +263,7 @@ krb5_get_host_realm(krb5_context context, |
| 122 |
krb5_realm **realms) |
| 123 |
{ |
| 124 |
const char *host = targethost; |
| 125 |
- char hostname[MAXHOSTNAMELEN]; |
| 126 |
+ char hostname[MaxHostNameLen]; |
| 127 |
krb5_error_code ret; |
| 128 |
int use_dns; |
| 129 |
|
| 130 |
diff --git a/lib/krb5/krbhst-test.c b/lib/krb5/krbhst-test.c |
| 131 |
index 873734f..8445acf 100644 |
| 132 |
--- a/lib/krb5/krbhst-test.c |
| 133 |
+++ b/lib/krb5/krbhst-test.c |
| 134 |
@@ -85,7 +85,7 @@ main(int argc, char **argv) |
| 135 |
krb5_init_context (&context); |
| 136 |
for(i = 0; i < argc; i++) { |
| 137 |
krb5_krbhst_handle handle; |
| 138 |
- char host[MAXHOSTNAMELEN]; |
| 139 |
+ char host[MaxHostNameLen]; |
| 140 |
|
| 141 |
for (j = 0; j < sizeof(types)/sizeof(*types); ++j) { |
| 142 |
printf ("%s for %s:\n", type_str[j], argv[i]); |
| 143 |
diff --git a/lib/krb5/krbhst.c b/lib/krb5/krbhst.c |
| 144 |
index 36da64b..fb313f8 100644 |
| 145 |
--- a/lib/krb5/krbhst.c |
| 146 |
+++ b/lib/krb5/krbhst.c |
| 147 |
@@ -1077,7 +1077,7 @@ gethostlist(krb5_context context, const char *realm, |
| 148 |
krb5_error_code ret; |
| 149 |
int nhost = 0; |
| 150 |
krb5_krbhst_handle handle; |
| 151 |
- char host[MAXHOSTNAMELEN]; |
| 152 |
+ char host[MaxHostNameLen]; |
| 153 |
krb5_krbhst_info *hostinfo; |
| 154 |
|
| 155 |
ret = krb5_krbhst_init(context, realm, type, &handle); |
| 156 |
diff --git a/lib/krb5/principal.c b/lib/krb5/principal.c |
| 157 |
index 937a9a7..e2ee202 100644 |
| 158 |
--- a/lib/krb5/principal.c |
| 159 |
+++ b/lib/krb5/principal.c |
| 160 |
@@ -1049,7 +1049,7 @@ krb5_sname_to_principal_old(krb5_context context, |
| 161 |
krb5_principal *ret_princ) |
| 162 |
{ |
| 163 |
krb5_error_code ret; |
| 164 |
- char localhost[MAXHOSTNAMELEN]; |
| 165 |
+ char localhost[MaxHostNameLen]; |
| 166 |
char **realms = NULL, *host = NULL; |
| 167 |
|
| 168 |
if(type != KRB5_NT_SRV_HST && type != KRB5_NT_UNKNOWN) { |
| 169 |
@@ -1370,7 +1370,7 @@ krb5_sname_to_principal(krb5_context context, |
| 170 |
char *realm, *remote_host; |
| 171 |
krb5_error_code ret; |
| 172 |
register char *cp; |
| 173 |
- char localname[MAXHOSTNAMELEN]; |
| 174 |
+ char localname[MaxHostNameLen]; |
| 175 |
|
| 176 |
*ret_princ = NULL; |
| 177 |
|
| 178 |
@@ -1379,8 +1379,8 @@ krb5_sname_to_principal(krb5_context context, |
| 179 |
return KRB5_SNAME_UNSUPP_NAMETYPE; |
| 180 |
|
| 181 |
/* if hostname is NULL, use local hostname */ |
| 182 |
- if (hostname == NULL) { |
| 183 |
- if (gethostname(localname, MAXHOSTNAMELEN)) |
| 184 |
+ if (!hostname) { |
| 185 |
+ if (gethostname(localname, MaxHostNameLen)) |
| 186 |
return errno; |
| 187 |
hostname = localname; |
| 188 |
} |
| 189 |
diff --git a/lib/krb5/test_plugin.c b/lib/krb5/test_plugin.c |
| 190 |
index cfc3b6c..87ffc51 100644 |
| 191 |
--- a/lib/krb5/test_plugin.c |
| 192 |
+++ b/lib/krb5/test_plugin.c |
| 193 |
@@ -88,7 +88,7 @@ main(int argc, char **argv) |
| 194 |
krb5_error_code ret; |
| 195 |
krb5_context context; |
| 196 |
krb5_krbhst_handle handle; |
| 197 |
- char host[MAXHOSTNAMELEN]; |
| 198 |
+ char host[MaxHostNameLen]; |
| 199 |
int found = 0; |
| 200 |
|
| 201 |
setprogname(argv[0]); |
| 202 |
diff --git a/lib/krb5/verify_init.c b/lib/krb5/verify_init.c |
| 203 |
index 128502f..2171f53 100644 |
| 204 |
--- a/lib/krb5/verify_init.c |
| 205 |
+++ b/lib/krb5/verify_init.c |
| 206 |
@@ -89,7 +89,7 @@ krb5_verify_init_creds(krb5_context context, |
| 207 |
krb5_data_zero (&req); |
| 208 |
|
| 209 |
if (ap_req_server == NULL) { |
| 210 |
- char local_hostname[MAXHOSTNAMELEN]; |
| 211 |
+ char local_hostname[MaxHostNameLen]; |
| 212 |
|
| 213 |
if (gethostname (local_hostname, sizeof(local_hostname)) < 0) { |
| 214 |
ret = errno; |
| 215 |
diff --git a/lib/roken/getaddrinfo_hostspec.c b/lib/roken/getaddrinfo_hostspec.c |
| 216 |
index 4541219..70aca71 100644 |
| 217 |
--- a/lib/roken/getaddrinfo_hostspec.c |
| 218 |
+++ b/lib/roken/getaddrinfo_hostspec.c |
| 219 |
@@ -45,7 +45,7 @@ roken_getaddrinfo_hostspec2(const char *hostspec, |
| 220 |
{ |
| 221 |
const char *p; |
| 222 |
char portstr[NI_MAXSERV]; |
| 223 |
- char host[MAXHOSTNAMELEN]; |
| 224 |
+ char host[MaxHostNameLen]; |
| 225 |
struct addrinfo hints; |
| 226 |
int hostspec_len; |
| 227 |
|