Bugzilla – Attachment 271 Details for
Bug 544
sshd w/privsep fails on Linux 2.0, mm_receive_fd: expected type 1 got 1074276337
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
fdpasstest.c: test for descriptor-passing bug on Linux 2.0
fdpasstest.c (text/plain), 1.11 KB, created by
Darren Tucker
on 2003-04-19 16:33:33 AEST
(
hide
)
Description:
fdpasstest.c: test for descriptor-passing bug on Linux 2.0
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2003-04-19 16:33:33 AEST
Size:
1.11 KB
patch
obsolete
>#include <stdio.h> >#include <sys/types.h> >#include <sys/socket.h> >#include <iovec.h> /* comment out for 2.4 kernels */ > >int >main() >{ > int pid, pair[2]; > char tmp[CMSG_SPACE(sizeof(int))]; > struct cmsghdr *cmsg; > struct msghdr msg; > struct iovec vec; > char ch = '\0'; > ssize_t n; > > if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) { > perror("socketpair"); > exit(1); > } > > memset(&msg, 0, sizeof(msg)); > msg.msg_control = (caddr_t)tmp; > msg.msg_controllen = CMSG_LEN(sizeof(int)); > cmsg = CMSG_FIRSTHDR(&msg); > cmsg->cmsg_len = CMSG_LEN(sizeof(int)); > > vec.iov_base = &ch; > vec.iov_len = 1; > msg.msg_iov = &vec; > msg.msg_iovlen = 1; > > if (fork() == 0) { /* child, send fd */ > cmsg->cmsg_level = SOL_SOCKET; > cmsg->cmsg_type = SCM_RIGHTS; > *(int *)CMSG_DATA(cmsg) = 0; /* send stdin descriptor */ > sendmsg(pair[0], &msg, 0); > exit(0); > } else { /* parent, receive fd */ > recvmsg(pair[1], &msg, 0); > cmsg = CMSG_FIRSTHDR(&msg); > if (cmsg->cmsg_type != SCM_RIGHTS) > printf("test failed, expected type %d got %d\n", SCM_RIGHTS, cmsg->cmsg_type); > else > printf("test passed, cmsg_type %d\n", cmsg->cmsg_type); > abort(); > } > >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 544
: 271 |
272