From 5e969ca2b3e9ee1ee25650edd60326ffc66a5443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sat, 9 Jul 2005 02:19:10 +0000 Subject: [PATCH] fix unconst and shadow warnings git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15600 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/kx/common.c | 40 ++++++++++++++++++++-------------------- appl/kx/krb5.c | 2 +- appl/kx/kx.c | 30 +++++++++++++++--------------- appl/kx/kx.h | 6 +++--- appl/kx/kxd.c | 8 ++++---- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/appl/kx/common.c b/appl/kx/common.c index b1ef850b0..5724dad4e 100644 --- a/appl/kx/common.c +++ b/appl/kx/common.c @@ -395,9 +395,9 @@ connect_local_xsocket (unsigned dnr) */ int -create_and_write_cookie (char *xauthfile, - size_t xauthfile_size, - u_char *cookie, +create_and_write_cookie (char *file, + size_t file_size, + u_char *cookie_buf, size_t cookie_sz) { Xauth auth; @@ -418,15 +418,15 @@ create_and_write_cookie (char *xauthfile, auth.name = COOKIE_TYPE; auth.name_length = strlen(auth.name); auth.data_length = cookie_sz; - auth.data = (char*)cookie; + auth.data = (char*)cookie_buf; #ifdef KRB5 - krb5_generate_random_block (cookie, cookie_sz); + krb5_generate_random_block (cookie_buf, cookie_sz); #else - krb_generate_random_block (cookie, cookie_sz); + krb_generate_random_block (cookie_buf, cookie_sz); #endif - strlcpy(xauthfile, "/tmp/AXXXXXX", xauthfile_size); - fd = mkstemp(xauthfile); + strlcpy(file, "/tmp/AXXXXXX", file_size); + fd = mkstemp(file); if(fd < 0) { saved_errno = errno; syslog(LOG_ERR, "create_and_write_cookie: mkstemp: %m"); @@ -615,7 +615,7 @@ find_auth_cookie (FILE *f) { Xauth *ret = NULL; char local_hostname[MaxHostNameLen]; - char *display = getenv("DISPLAY"); + char *display_str = getenv("DISPLAY"); char d[MaxHostNameLen + 4]; char *colon; struct addrinfo *ai; @@ -623,34 +623,34 @@ find_auth_cookie (FILE *f) int disp; int error; - if(display == NULL) - display = ":0"; - strlcpy(d, display, sizeof(d)); - display = d; - colon = strchr (display, ':'); + if(display_str == NULL) + display_str = ":0"; + strlcpy(d, display_str, sizeof(d)); + display_str = d; + colon = strchr (display_str, ':'); if (colon == NULL) disp = 0; else { *colon = '\0'; disp = atoi (colon + 1); } - if (strcmp (display, "") == 0 - || strncmp (display, "unix", 4) == 0 - || strncmp (display, "localhost", 9) == 0) { + if (strcmp (display_str, "") == 0 + || strncmp (display_str, "unix", 4) == 0 + || strncmp (display_str, "localhost", 9) == 0) { gethostname (local_hostname, sizeof(local_hostname)); - display = local_hostname; + display_str = local_hostname; } memset (&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; - error = getaddrinfo (display, NULL, &hints, &ai); + error = getaddrinfo (display_str, NULL, &hints, &ai); if (error) ai = NULL; for (; (ret = XauReadAuth (f)) != NULL; XauDisposeAuth(ret)) { - if (match_local_auth (ret, ai, display, disp) == 0) { + if (match_local_auth (ret, ai, display_str, disp) == 0) { if (ai != NULL) freeaddrinfo (ai); return ret; diff --git a/appl/kx/krb5.c b/appl/kx/krb5.c index 41b15ee62..2cfcf8da0 100644 --- a/appl/kx/krb5.c +++ b/appl/kx/krb5.c @@ -188,7 +188,7 @@ krb5_write(kx_context *kc, ret = krb5_encrypt (CONTEXT(kc), K5DATA(kc)->crypto, KRB5_KU_OTHER_ENCRYPTED, - (void *)buf, len, &data); + __UNCONST(buf), len, &data); if (ret){ krb5_warn (CONTEXT(kc), ret, "krb5_write"); return -1; diff --git a/appl/kx/kx.c b/appl/kx/kx.c index a272157b2..44e350def 100644 --- a/appl/kx/kx.c +++ b/appl/kx/kx.c @@ -349,7 +349,7 @@ doit_active (kx_context *kc) u_char msg[1024], *p; int len = strlen(kc->user); int tmp, tmp2; - char *s; + char *str; int i; size_t rem; u_int32_t other_port; @@ -383,29 +383,29 @@ doit_active (kx_context *kc) *p++ = (kc->keepalive_flag ? KEEP_ALIVE : 0); --rem; - s = getenv("DISPLAY"); - if (s == NULL || (s = strchr(s, ':')) == NULL) - s = ":0"; - len = strlen (s); + str = getenv("DISPLAY"); + if (str == NULL || (str = strchr(str, ':')) == NULL) + str = ":0"; + len = strlen (str); tmp = KRB_PUT_INT (len, p, rem, 4); if (tmp < 0) return 1; rem -= tmp; p += tmp; - memcpy (p, s, len); + memcpy (p, str, len); p += len; rem -= len; - s = getenv("XAUTHORITY"); - if (s == NULL) - s = ""; - len = strlen (s); + str = getenv("XAUTHORITY"); + if (str == NULL) + str = ""; + len = strlen (str); tmp = KRB_PUT_INT (len, p, rem, 4); if (tmp < 0) return 1; p += len; rem -= len; - memcpy (p, s, len); + memcpy (p, str, len); p += len; rem -= len; @@ -686,14 +686,14 @@ int main(int argc, char **argv) { int port = 0; - int optind = 0; + int optidx = 0; int ret = 1; char *host = NULL; setprogname (argv[0]); if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv, - &optind)) + &optidx)) usage (1); if (help_flag) @@ -704,10 +704,10 @@ main(int argc, char **argv) return 0; } - if (optind != argc - 1) + if (optidx != argc - 1) usage (1); - host = argv[optind]; + host = argv[optidx]; if (port_str) { struct servent *s = roken_getservbyname (port_str, "tcp"); diff --git a/appl/kx/kx.h b/appl/kx/kx.h index a805ce1cf..05e1ad32f 100644 --- a/appl/kx/kx.h +++ b/appl/kx/kx.h @@ -159,9 +159,9 @@ int get_xsockets (int *number, struct x_socket **sockets, int tcpp); int chown_xsockets (int n, struct x_socket *sockets, uid_t uid, gid_t gid); int connect_local_xsocket (unsigned dnr); -int create_and_write_cookie (char *xauthfile, - size_t size, - u_char *cookie, +int create_and_write_cookie (char *file, + size_t file_size, + u_char *cookie_buf, size_t sz); int verify_and_remove_cookies (int fd, int sock, int cookiesp); int replace_cookie(int xserver, int fd, char *filename, int cookiesp); diff --git a/appl/kx/kxd.c b/appl/kx/kxd.c index 6e4b2bb6b..d5a013f24 100644 --- a/appl/kx/kxd.c +++ b/appl/kx/kxd.c @@ -538,11 +538,11 @@ doit_passive (kx_context *kc, if (sockets[i].flags == TCP) { struct sockaddr_storage __ss_peer; struct sockaddr *peer = (struct sockaddr*)&__ss_peer; - socklen_t len = sizeof(__ss_peer); + socklen_t slen = sizeof(__ss_peer); fd = accept (sockets[i].fd, peer, - &len); + &slen); if (fd < 0 && errno != EINTR) syslog (LOG_ERR, "accept: %m"); @@ -724,13 +724,13 @@ int main (int argc, char **argv) { int port; - int optind = 0; + int optidx = 0; setprogname (argv[0]); roken_openlog ("kxd", LOG_ODELAY | LOG_PID, LOG_DAEMON); if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv, - &optind)) + &optidx)) usage (1); if (help_flag)