fix unconst and shadow warnings
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15600 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -395,9 +395,9 @@ connect_local_xsocket (unsigned dnr)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
create_and_write_cookie (char *xauthfile,
|
create_and_write_cookie (char *file,
|
||||||
size_t xauthfile_size,
|
size_t file_size,
|
||||||
u_char *cookie,
|
u_char *cookie_buf,
|
||||||
size_t cookie_sz)
|
size_t cookie_sz)
|
||||||
{
|
{
|
||||||
Xauth auth;
|
Xauth auth;
|
||||||
@@ -418,15 +418,15 @@ create_and_write_cookie (char *xauthfile,
|
|||||||
auth.name = COOKIE_TYPE;
|
auth.name = COOKIE_TYPE;
|
||||||
auth.name_length = strlen(auth.name);
|
auth.name_length = strlen(auth.name);
|
||||||
auth.data_length = cookie_sz;
|
auth.data_length = cookie_sz;
|
||||||
auth.data = (char*)cookie;
|
auth.data = (char*)cookie_buf;
|
||||||
#ifdef KRB5
|
#ifdef KRB5
|
||||||
krb5_generate_random_block (cookie, cookie_sz);
|
krb5_generate_random_block (cookie_buf, cookie_sz);
|
||||||
#else
|
#else
|
||||||
krb_generate_random_block (cookie, cookie_sz);
|
krb_generate_random_block (cookie_buf, cookie_sz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strlcpy(xauthfile, "/tmp/AXXXXXX", xauthfile_size);
|
strlcpy(file, "/tmp/AXXXXXX", file_size);
|
||||||
fd = mkstemp(xauthfile);
|
fd = mkstemp(file);
|
||||||
if(fd < 0) {
|
if(fd < 0) {
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
syslog(LOG_ERR, "create_and_write_cookie: mkstemp: %m");
|
syslog(LOG_ERR, "create_and_write_cookie: mkstemp: %m");
|
||||||
@@ -615,7 +615,7 @@ find_auth_cookie (FILE *f)
|
|||||||
{
|
{
|
||||||
Xauth *ret = NULL;
|
Xauth *ret = NULL;
|
||||||
char local_hostname[MaxHostNameLen];
|
char local_hostname[MaxHostNameLen];
|
||||||
char *display = getenv("DISPLAY");
|
char *display_str = getenv("DISPLAY");
|
||||||
char d[MaxHostNameLen + 4];
|
char d[MaxHostNameLen + 4];
|
||||||
char *colon;
|
char *colon;
|
||||||
struct addrinfo *ai;
|
struct addrinfo *ai;
|
||||||
@@ -623,34 +623,34 @@ find_auth_cookie (FILE *f)
|
|||||||
int disp;
|
int disp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if(display == NULL)
|
if(display_str == NULL)
|
||||||
display = ":0";
|
display_str = ":0";
|
||||||
strlcpy(d, display, sizeof(d));
|
strlcpy(d, display_str, sizeof(d));
|
||||||
display = d;
|
display_str = d;
|
||||||
colon = strchr (display, ':');
|
colon = strchr (display_str, ':');
|
||||||
if (colon == NULL)
|
if (colon == NULL)
|
||||||
disp = 0;
|
disp = 0;
|
||||||
else {
|
else {
|
||||||
*colon = '\0';
|
*colon = '\0';
|
||||||
disp = atoi (colon + 1);
|
disp = atoi (colon + 1);
|
||||||
}
|
}
|
||||||
if (strcmp (display, "") == 0
|
if (strcmp (display_str, "") == 0
|
||||||
|| strncmp (display, "unix", 4) == 0
|
|| strncmp (display_str, "unix", 4) == 0
|
||||||
|| strncmp (display, "localhost", 9) == 0) {
|
|| strncmp (display_str, "localhost", 9) == 0) {
|
||||||
gethostname (local_hostname, sizeof(local_hostname));
|
gethostname (local_hostname, sizeof(local_hostname));
|
||||||
display = local_hostname;
|
display_str = local_hostname;
|
||||||
}
|
}
|
||||||
memset (&hints, 0, sizeof(hints));
|
memset (&hints, 0, sizeof(hints));
|
||||||
hints.ai_flags = AI_CANONNAME;
|
hints.ai_flags = AI_CANONNAME;
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
hints.ai_protocol = IPPROTO_TCP;
|
hints.ai_protocol = IPPROTO_TCP;
|
||||||
|
|
||||||
error = getaddrinfo (display, NULL, &hints, &ai);
|
error = getaddrinfo (display_str, NULL, &hints, &ai);
|
||||||
if (error)
|
if (error)
|
||||||
ai = NULL;
|
ai = NULL;
|
||||||
|
|
||||||
for (; (ret = XauReadAuth (f)) != NULL; XauDisposeAuth(ret)) {
|
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)
|
if (ai != NULL)
|
||||||
freeaddrinfo (ai);
|
freeaddrinfo (ai);
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -188,7 +188,7 @@ krb5_write(kx_context *kc,
|
|||||||
|
|
||||||
ret = krb5_encrypt (CONTEXT(kc), K5DATA(kc)->crypto,
|
ret = krb5_encrypt (CONTEXT(kc), K5DATA(kc)->crypto,
|
||||||
KRB5_KU_OTHER_ENCRYPTED,
|
KRB5_KU_OTHER_ENCRYPTED,
|
||||||
(void *)buf, len, &data);
|
__UNCONST(buf), len, &data);
|
||||||
if (ret){
|
if (ret){
|
||||||
krb5_warn (CONTEXT(kc), ret, "krb5_write");
|
krb5_warn (CONTEXT(kc), ret, "krb5_write");
|
||||||
return -1;
|
return -1;
|
||||||
|
30
appl/kx/kx.c
30
appl/kx/kx.c
@@ -349,7 +349,7 @@ doit_active (kx_context *kc)
|
|||||||
u_char msg[1024], *p;
|
u_char msg[1024], *p;
|
||||||
int len = strlen(kc->user);
|
int len = strlen(kc->user);
|
||||||
int tmp, tmp2;
|
int tmp, tmp2;
|
||||||
char *s;
|
char *str;
|
||||||
int i;
|
int i;
|
||||||
size_t rem;
|
size_t rem;
|
||||||
u_int32_t other_port;
|
u_int32_t other_port;
|
||||||
@@ -383,29 +383,29 @@ doit_active (kx_context *kc)
|
|||||||
*p++ = (kc->keepalive_flag ? KEEP_ALIVE : 0);
|
*p++ = (kc->keepalive_flag ? KEEP_ALIVE : 0);
|
||||||
--rem;
|
--rem;
|
||||||
|
|
||||||
s = getenv("DISPLAY");
|
str = getenv("DISPLAY");
|
||||||
if (s == NULL || (s = strchr(s, ':')) == NULL)
|
if (str == NULL || (str = strchr(str, ':')) == NULL)
|
||||||
s = ":0";
|
str = ":0";
|
||||||
len = strlen (s);
|
len = strlen (str);
|
||||||
tmp = KRB_PUT_INT (len, p, rem, 4);
|
tmp = KRB_PUT_INT (len, p, rem, 4);
|
||||||
if (tmp < 0)
|
if (tmp < 0)
|
||||||
return 1;
|
return 1;
|
||||||
rem -= tmp;
|
rem -= tmp;
|
||||||
p += tmp;
|
p += tmp;
|
||||||
memcpy (p, s, len);
|
memcpy (p, str, len);
|
||||||
p += len;
|
p += len;
|
||||||
rem -= len;
|
rem -= len;
|
||||||
|
|
||||||
s = getenv("XAUTHORITY");
|
str = getenv("XAUTHORITY");
|
||||||
if (s == NULL)
|
if (str == NULL)
|
||||||
s = "";
|
str = "";
|
||||||
len = strlen (s);
|
len = strlen (str);
|
||||||
tmp = KRB_PUT_INT (len, p, rem, 4);
|
tmp = KRB_PUT_INT (len, p, rem, 4);
|
||||||
if (tmp < 0)
|
if (tmp < 0)
|
||||||
return 1;
|
return 1;
|
||||||
p += len;
|
p += len;
|
||||||
rem -= len;
|
rem -= len;
|
||||||
memcpy (p, s, len);
|
memcpy (p, str, len);
|
||||||
p += len;
|
p += len;
|
||||||
rem -= len;
|
rem -= len;
|
||||||
|
|
||||||
@@ -686,14 +686,14 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int port = 0;
|
int port = 0;
|
||||||
int optind = 0;
|
int optidx = 0;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
char *host = NULL;
|
char *host = NULL;
|
||||||
|
|
||||||
setprogname (argv[0]);
|
setprogname (argv[0]);
|
||||||
|
|
||||||
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
|
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
|
||||||
&optind))
|
&optidx))
|
||||||
usage (1);
|
usage (1);
|
||||||
|
|
||||||
if (help_flag)
|
if (help_flag)
|
||||||
@@ -704,10 +704,10 @@ main(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind != argc - 1)
|
if (optidx != argc - 1)
|
||||||
usage (1);
|
usage (1);
|
||||||
|
|
||||||
host = argv[optind];
|
host = argv[optidx];
|
||||||
|
|
||||||
if (port_str) {
|
if (port_str) {
|
||||||
struct servent *s = roken_getservbyname (port_str, "tcp");
|
struct servent *s = roken_getservbyname (port_str, "tcp");
|
||||||
|
@@ -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 chown_xsockets (int n, struct x_socket *sockets, uid_t uid, gid_t gid);
|
||||||
|
|
||||||
int connect_local_xsocket (unsigned dnr);
|
int connect_local_xsocket (unsigned dnr);
|
||||||
int create_and_write_cookie (char *xauthfile,
|
int create_and_write_cookie (char *file,
|
||||||
size_t size,
|
size_t file_size,
|
||||||
u_char *cookie,
|
u_char *cookie_buf,
|
||||||
size_t sz);
|
size_t sz);
|
||||||
int verify_and_remove_cookies (int fd, int sock, int cookiesp);
|
int verify_and_remove_cookies (int fd, int sock, int cookiesp);
|
||||||
int replace_cookie(int xserver, int fd, char *filename, int cookiesp);
|
int replace_cookie(int xserver, int fd, char *filename, int cookiesp);
|
||||||
|
@@ -538,11 +538,11 @@ doit_passive (kx_context *kc,
|
|||||||
if (sockets[i].flags == TCP) {
|
if (sockets[i].flags == TCP) {
|
||||||
struct sockaddr_storage __ss_peer;
|
struct sockaddr_storage __ss_peer;
|
||||||
struct sockaddr *peer = (struct sockaddr*)&__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,
|
fd = accept (sockets[i].fd,
|
||||||
peer,
|
peer,
|
||||||
&len);
|
&slen);
|
||||||
if (fd < 0 && errno != EINTR)
|
if (fd < 0 && errno != EINTR)
|
||||||
syslog (LOG_ERR, "accept: %m");
|
syslog (LOG_ERR, "accept: %m");
|
||||||
|
|
||||||
@@ -724,13 +724,13 @@ int
|
|||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int port;
|
int port;
|
||||||
int optind = 0;
|
int optidx = 0;
|
||||||
|
|
||||||
setprogname (argv[0]);
|
setprogname (argv[0]);
|
||||||
roken_openlog ("kxd", LOG_ODELAY | LOG_PID, LOG_DAEMON);
|
roken_openlog ("kxd", LOG_ODELAY | LOG_PID, LOG_DAEMON);
|
||||||
|
|
||||||
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
|
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
|
||||||
&optind))
|
&optidx))
|
||||||
usage (1);
|
usage (1);
|
||||||
|
|
||||||
if (help_flag)
|
if (help_flag)
|
||||||
|
Reference in New Issue
Block a user