diff options
author | Damien Miller <djm@mindrot.org> | 2008-03-27 10:53:23 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2008-03-27 10:53:23 +1100 |
commit | f92e063872ffc12fd82be7e344e8aeeeefd7a8ee (patch) | |
tree | 67daf35ab721cfe26d901f4027b0941ae720a4d6 | |
parent | 5447eb2454961bdc1d01e6630a02bf844a799713 (diff) |
- deraadt@cvs.openbsd.org 2008/03/13 01:49:53
[monitor_fdpass.c]
Correct CMSG_SPACE and CMSG_LEN usage everywhere in the tree. Due to
an extensive discussion with otto, kettenis, millert, and hshoexer
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | monitor_fdpass.c | 17 |
2 files changed, 14 insertions, 9 deletions
@@ -9,6 +9,10 @@ | |||
9 | [ssh.1 sshd.8 sshd_config.5] | 9 | [ssh.1 sshd.8 sshd_config.5] |
10 | bump Mdocdate for pages committed in "febuary", necessary because | 10 | bump Mdocdate for pages committed in "febuary", necessary because |
11 | of a typo in rcs.c; | 11 | of a typo in rcs.c; |
12 | - deraadt@cvs.openbsd.org 2008/03/13 01:49:53 | ||
13 | [monitor_fdpass.c] | ||
14 | Correct CMSG_SPACE and CMSG_LEN usage everywhere in the tree. Due to | ||
15 | an extensive discussion with otto, kettenis, millert, and hshoexer | ||
12 | 16 | ||
13 | 20080315 | 17 | 20080315 |
14 | - (djm) [regress/test-exec.sh] Quote putty-related variables in case they are | 18 | - (djm) [regress/test-exec.sh] Quote putty-related variables in case they are |
@@ -3777,4 +3781,4 @@ | |||
3777 | OpenServer 6 and add osr5bigcrypt support so when someone migrates | 3781 | OpenServer 6 and add osr5bigcrypt support so when someone migrates |
3778 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ | 3782 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ |
3779 | 3783 | ||
3780 | $Id: ChangeLog,v 1.4882 2008/03/26 23:50:21 djm Exp $ | 3784 | $Id: ChangeLog,v 1.4883 2008/03/26 23:53:23 djm Exp $ |
diff --git a/monitor_fdpass.c b/monitor_fdpass.c index fb00ab7ab..a3e995df8 100644 --- a/monitor_fdpass.c +++ b/monitor_fdpass.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_fdpass.c,v 1.14 2008/03/02 18:19:35 deraadt Exp $ */ | 1 | /* $OpenBSD: monitor_fdpass.c,v 1.15 2008/03/13 01:49:53 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 2001 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2001 Niels Provos <provos@citi.umich.edu> |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -52,7 +52,8 @@ mm_send_fd(int sock, int fd) | |||
52 | union { | 52 | union { |
53 | struct cmsghdr hdr; | 53 | struct cmsghdr hdr; |
54 | char tmp[CMSG_SPACE(sizeof(int))]; | 54 | char tmp[CMSG_SPACE(sizeof(int))]; |
55 | } tmp; | 55 | char buf[CMSG_SPACE(sizeof(int))]; |
56 | } cmsgbuf; | ||
56 | struct cmsghdr *cmsg; | 57 | struct cmsghdr *cmsg; |
57 | #endif | 58 | #endif |
58 | 59 | ||
@@ -61,8 +62,8 @@ mm_send_fd(int sock, int fd) | |||
61 | msg.msg_accrights = (caddr_t)&fd; | 62 | msg.msg_accrights = (caddr_t)&fd; |
62 | msg.msg_accrightslen = sizeof(fd); | 63 | msg.msg_accrightslen = sizeof(fd); |
63 | #else | 64 | #else |
64 | msg.msg_control = (caddr_t)&tmp; | 65 | msg.msg_control = (caddr_t)&cmsgbuf.buf; |
65 | msg.msg_controllen = CMSG_LEN(sizeof(int)); | 66 | msg.msg_controllen = sizeof(cmsgbuf.buf); |
66 | cmsg = CMSG_FIRSTHDR(&msg); | 67 | cmsg = CMSG_FIRSTHDR(&msg); |
67 | cmsg->cmsg_len = CMSG_LEN(sizeof(int)); | 68 | cmsg->cmsg_len = CMSG_LEN(sizeof(int)); |
68 | cmsg->cmsg_level = SOL_SOCKET; | 69 | cmsg->cmsg_level = SOL_SOCKET; |
@@ -104,9 +105,9 @@ mm_receive_fd(int sock) | |||
104 | int fd; | 105 | int fd; |
105 | #ifndef HAVE_ACCRIGHTS_IN_MSGHDR | 106 | #ifndef HAVE_ACCRIGHTS_IN_MSGHDR |
106 | union { | 107 | union { |
107 | char tmp[CMSG_SPACE(sizeof(int))]; | ||
108 | struct cmsghdr hdr; | 108 | struct cmsghdr hdr; |
109 | } tmp; | 109 | char buf[CMSG_SPACE(sizeof(int))]; |
110 | } cmsgbuf; | ||
110 | struct cmsghdr *cmsg; | 111 | struct cmsghdr *cmsg; |
111 | #endif | 112 | #endif |
112 | 113 | ||
@@ -119,8 +120,8 @@ mm_receive_fd(int sock) | |||
119 | msg.msg_accrights = (caddr_t)&fd; | 120 | msg.msg_accrights = (caddr_t)&fd; |
120 | msg.msg_accrightslen = sizeof(fd); | 121 | msg.msg_accrightslen = sizeof(fd); |
121 | #else | 122 | #else |
122 | msg.msg_control = &tmp; | 123 | msg.msg_control = &cmsgbuf.buf; |
123 | msg.msg_controllen = sizeof(tmp); | 124 | msg.msg_controllen = sizeof(cmsgbuf.buf); |
124 | #endif | 125 | #endif |
125 | 126 | ||
126 | if ((n = recvmsg(sock, &msg, 0)) == -1) { | 127 | if ((n = recvmsg(sock, &msg, 0)) == -1) { |