summaryrefslogtreecommitdiffstats
path: root/recipes-mac
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2021-07-29 16:31:12 -0700
committerArmin Kuster <akuster808@gmail.com>2021-08-01 08:47:08 -0700
commit11a67b861af74d59ccfd609d6d943e966ccff731 (patch)
treece619cf42798050439a4c04ed471ed293f17ede4 /recipes-mac
parentd3a484abf81fc196389480df89cf5c82d13e6381 (diff)
downloadmeta-security-11a67b861af74d59ccfd609d6d943e966ccff731.tar.gz
meta-security: Convert to new override syntax
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'recipes-mac')
-rw-r--r--recipes-mac/AppArmor/apparmor_3.0.1.bb34
-rw-r--r--recipes-mac/ccs-tools/README2
-rw-r--r--recipes-mac/ccs-tools/ccs-tools_1.8.4.bb6
-rw-r--r--recipes-mac/smack/smack-test_1.0.bb2
-rw-r--r--recipes-mac/smack/smack_1.3.1.bb14
-rw-r--r--recipes-mac/smack/tcp-smack-test/tcp_client.c222
-rw-r--r--recipes-mac/smack/tcp-smack-test/tcp_server.c236
-rw-r--r--recipes-mac/smack/udp-smack-test/udp_client.c150
-rw-r--r--recipes-mac/smack/udp-smack-test/udp_server.c186
9 files changed, 426 insertions, 426 deletions
diff --git a/recipes-mac/AppArmor/apparmor_3.0.1.bb b/recipes-mac/AppArmor/apparmor_3.0.1.bb
index ff5b39b..dca53a3 100644
--- a/recipes-mac/AppArmor/apparmor_3.0.1.bb
+++ b/recipes-mac/AppArmor/apparmor_3.0.1.bb
@@ -29,7 +29,7 @@ S = "${WORKDIR}/git"
29 29
30PARALLEL_MAKE = "" 30PARALLEL_MAKE = ""
31 31
32COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*" 32COMPATIBLE_MACHINE:mips64 = "(!.*mips64).*"
33 33
34inherit pkgconfig autotools-brokensep update-rc.d python3native python3targetconfig perlnative cpan systemd features_check bash-completion 34inherit pkgconfig autotools-brokensep update-rc.d python3native python3targetconfig perlnative cpan systemd features_check bash-completion
35 35
@@ -106,11 +106,11 @@ do_install () {
106} 106}
107 107
108#Building ptest on arm fails. 108#Building ptest on arm fails.
109do_compile_ptest_aarch64 () { 109do_compile_ptest:aarch64 () {
110 : 110 :
111} 111}
112 112
113do_compile_ptest_arm () { 113do_compile_ptest:arm () {
114 : 114 :
115} 115}
116 116
@@ -140,11 +140,11 @@ do_install_ptest () {
140} 140}
141 141
142#Building ptest on arm fails. 142#Building ptest on arm fails.
143do_install_ptest_aarch64 () { 143do_install_ptest:aarch64 () {
144 : 144 :
145} 145}
146 146
147do_install_ptest_arm() { 147do_install_ptest:arm() {
148 : 148 :
149} 149}
150 150
@@ -153,23 +153,23 @@ INITSCRIPT_NAME = "apparmor"
153INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ." 153INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ."
154 154
155SYSTEMD_PACKAGES = "${PN}" 155SYSTEMD_PACKAGES = "${PN}"
156SYSTEMD_SERVICE_${PN} = "apparmor.service" 156SYSTEMD_SERVICE:${PN} = "apparmor.service"
157SYSTEMD_AUTO_ENABLE ?= "enable" 157SYSTEMD_AUTO_ENABLE ?= "enable"
158 158
159PACKAGES += "mod-${PN}" 159PACKAGES += "mod-${PN}"
160 160
161FILES_${PN} += "${nonarch_base_libdir}/apparmor/ ${base_libdir}/security/ ${sysconfdir}/apparmor ${nonarch_libdir}/${PYTHON_DIR}/site-packages" 161FILES:${PN} += "${nonarch_base_libdir}/apparmor/ ${base_libdir}/security/ ${sysconfdir}/apparmor ${nonarch_libdir}/${PYTHON_DIR}/site-packages"
162FILES_mod-${PN} = "${libdir}/apache2/modules/*" 162FILES:mod-${PN} = "${libdir}/apache2/modules/*"
163FILES_${PN}-dbg += "${base_libdir}/security/.debug" 163FILES:${PN}-dbg += "${base_libdir}/security/.debug"
164 164
165DEPENDS_append_libc-musl = " fts " 165DEPENDS:append:libc-musl = " fts "
166RDEPENDS_${PN}_libc-musl += "musl-utils" 166RDEPENDS:${PN}:libc-musl += "musl-utils"
167RDEPENDS_${PN}_libc-glibc += "glibc-utils" 167RDEPENDS:${PN}:libc-glibc += "glibc-utils"
168 168
169# Add coreutils and findutils only if sysvinit scripts are in use 169# Add coreutils and findutils only if sysvinit scripts are in use
170RDEPENDS_${PN} += "${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" 170RDEPENDS:${PN} += "${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}"
171RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" 171RDEPENDS:${PN}:remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}"
172RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash" 172RDEPENDS:${PN}-ptest += "perl coreutils dbus-lib bash"
173 173
174INSANE_SKIP_${PN} = "ldflags" 174INSANE_SKIP:${PN} = "ldflags"
175PRIVATE_LIBS_${PN}-ptest = "libapparmor.so*" 175PRIVATE_LIBS:${PN}-ptest = "libapparmor.so*"
diff --git a/recipes-mac/ccs-tools/README b/recipes-mac/ccs-tools/README
index 4a4faa7..0381814 100644
--- a/recipes-mac/ccs-tools/README
+++ b/recipes-mac/ccs-tools/README
@@ -9,4 +9,4 @@ To start via command line add:
9To initialize: 9To initialize:
10/usr/lib/ccs/init_policy 10/usr/lib/ccs/init_policy
11 11
12DISTRO_FEATURES_append = " tomoyo" 12DISTRO_FEATURES:append = " tomoyo"
diff --git a/recipes-mac/ccs-tools/ccs-tools_1.8.4.bb b/recipes-mac/ccs-tools/ccs-tools_1.8.4.bb
index 79af6a5..08da24a 100644
--- a/recipes-mac/ccs-tools/ccs-tools_1.8.4.bb
+++ b/recipes-mac/ccs-tools/ccs-tools_1.8.4.bb
@@ -29,17 +29,17 @@ do_install(){
29 29
30PACKAGE="${PN} ${PN}-dbg ${PN}-doc" 30PACKAGE="${PN} ${PN}-dbg ${PN}-doc"
31 31
32FILES_${PN} = "\ 32FILES:${PN} = "\
33 ${sbindir}/* \ 33 ${sbindir}/* \
34 ${base_sbindir}/* \ 34 ${base_sbindir}/* \
35 ${libdir}/* \ 35 ${libdir}/* \
36" 36"
37 37
38FILES_${PN}-doc = "\ 38FILES:${PN}-doc = "\
39 ${mandir}/man8/* \ 39 ${mandir}/man8/* \
40" 40"
41 41
42FILES_${PN}-dbg = "\ 42FILES:${PN}-dbg = "\
43 ${base_sbindir}/.debug/* \ 43 ${base_sbindir}/.debug/* \
44 ${sbindir}/.debug/* \ 44 ${sbindir}/.debug/* \
45 ${libdir}/.debug/* \ 45 ${libdir}/.debug/* \
diff --git a/recipes-mac/smack/smack-test_1.0.bb b/recipes-mac/smack/smack-test_1.0.bb
index d5de607..d7824ae 100644
--- a/recipes-mac/smack/smack-test_1.0.bb
+++ b/recipes-mac/smack/smack-test_1.0.bb
@@ -22,4 +22,4 @@ do_install() {
22 install -m 0755 *.sh ${D}${sbindir} 22 install -m 0755 *.sh ${D}${sbindir}
23} 23}
24 24
25RDEPENDS_${PN} = "smack python mmap-smack-test tcp-smack-test udp-smack-test" 25RDEPENDS:${PN} = "smack python mmap-smack-test tcp-smack-test udp-smack-test"
diff --git a/recipes-mac/smack/smack_1.3.1.bb b/recipes-mac/smack/smack_1.3.1.bb
index 88ae56c..6c2f041 100644
--- a/recipes-mac/smack/smack_1.3.1.bb
+++ b/recipes-mac/smack/smack_1.3.1.bb
@@ -28,15 +28,15 @@ REQUIRED_DISTRO_FEATURES = "smack"
28S = "${WORKDIR}/git" 28S = "${WORKDIR}/git"
29 29
30PACKAGECONFIG ??= "" 30PACKAGECONFIG ??= ""
31PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" 31PACKAGECONFIG:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
32 32
33PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemdsystemunitdir, systemd" 33PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemdsystemunitdir, systemd"
34 34
35do_compile_append () { 35do_compile:append () {
36 oe_runmake -C ${S}/tests generator 36 oe_runmake -C ${S}/tests generator
37} 37}
38 38
39do_install_append () { 39do_install:append () {
40 install -d ${D}${sysconfdir}/init.d 40 install -d ${D}${sysconfdir}/init.d
41 install -d ${D}${sysconfdir}/smack 41 install -d ${D}${sysconfdir}/smack
42 install -d ${D}${sysconfdir}/smack/accesses.d 42 install -d ${D}${sysconfdir}/smack/accesses.d
@@ -55,10 +55,10 @@ INITSCRIPT_PACKAGES = "${PN}"
55INITSCRIPT_NAME = "smack" 55INITSCRIPT_NAME = "smack"
56INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ." 56INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ."
57 57
58FILES_${PN} += "${sysconfdir}/init.d/smack" 58FILES:${PN} += "${sysconfdir}/init.d/smack"
59FILES_${PN}-ptest += "generator" 59FILES:${PN}-ptest += "generator"
60 60
61RDEPENDS_${PN} += "coreutils python3-core" 61RDEPENDS:${PN} += "coreutils python3-core"
62RDEPENDS_${PN}-ptest += "make bash bc" 62RDEPENDS:${PN}-ptest += "make bash bc"
63 63
64BBCLASSEXTEND = "native" 64BBCLASSEXTEND = "native"
diff --git a/recipes-mac/smack/tcp-smack-test/tcp_client.c b/recipes-mac/smack/tcp-smack-test/tcp_client.c
index 185f973..6c0a474 100644
--- a/recipes-mac/smack/tcp-smack-test/tcp_client.c
+++ b/recipes-mac/smack/tcp-smack-test/tcp_client.c
@@ -1,111 +1,111 @@
1// (C) Copyright 2015 Intel Corporation 1// (C) Copyright 2015 Intel Corporation
2// 2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy 3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal 4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights 5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is 7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions: 8// furnished to do so, subject to the following conditions:
9// 9//
10// The above copyright notice and this permission notice shall be included in 10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software. 11// all copies or substantial portions of the Software.
12// 12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19// THE SOFTWARE. 19// THE SOFTWARE.
20#include <stdio.h> 20#include <stdio.h>
21#include <sys/socket.h> 21#include <sys/socket.h>
22#include <sys/types.h> 22#include <sys/types.h>
23#include <errno.h> 23#include <errno.h>
24#include <netinet/in.h> 24#include <netinet/in.h>
25#include <unistd.h> 25#include <unistd.h>
26#include <netdb.h> 26#include <netdb.h>
27#include <string.h> 27#include <string.h>
28#include <sys/xattr.h> 28#include <sys/xattr.h>
29 29
30int main(int argc, char* argv[]) 30int main(int argc, char* argv[])
31{ 31{
32 32
33 int sock; 33 int sock;
34 char message[255] = "hello"; 34 char message[255] = "hello";
35 struct sockaddr_in server_addr; 35 struct sockaddr_in server_addr;
36 char* label_in; 36 char* label_in;
37 char* label_out; 37 char* label_out;
38 char* attr_out = "security.SMACK64IPOUT"; 38 char* attr_out = "security.SMACK64IPOUT";
39 char* attr_in = "security.SMACK64IPIN"; 39 char* attr_in = "security.SMACK64IPIN";
40 char out[256]; 40 char out[256];
41 int port; 41 int port;
42 42
43 struct timeval timeout; 43 struct timeval timeout;
44 timeout.tv_sec = 15; 44 timeout.tv_sec = 15;
45 timeout.tv_usec = 0; 45 timeout.tv_usec = 0;
46 46
47 struct hostent* host = gethostbyname("localhost"); 47 struct hostent* host = gethostbyname("localhost");
48 48
49 if (argc != 4) 49 if (argc != 4)
50 { 50 {
51 perror("Client: Arguments missing, please provide socket labels"); 51 perror("Client: Arguments missing, please provide socket labels");
52 return 2; 52 return 2;
53 } 53 }
54 54
55 port = atoi(argv[1]); 55 port = atoi(argv[1]);
56 label_in = argv[2]; 56 label_in = argv[2];
57 label_out = argv[3]; 57 label_out = argv[3];
58 58
59 if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) 59 if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
60 { 60 {
61 perror("Client: Socket failure"); 61 perror("Client: Socket failure");
62 return 2; 62 return 2;
63 } 63 }
64 64
65 65
66 if(fsetxattr(sock, attr_out, label_out, strlen(label_out), 0) < 0) 66 if(fsetxattr(sock, attr_out, label_out, strlen(label_out), 0) < 0)
67 { 67 {
68 perror("Client: Unable to set attribute SMACK64IPOUT"); 68 perror("Client: Unable to set attribute SMACK64IPOUT");
69 return 2; 69 return 2;
70 } 70 }
71 71
72 if(fsetxattr(sock, attr_in, label_in, strlen(label_in), 0) < 0) 72 if(fsetxattr(sock, attr_in, label_in, strlen(label_in), 0) < 0)
73 { 73 {
74 perror("Client: Unable to set attribute SMACK64IPIN"); 74 perror("Client: Unable to set attribute SMACK64IPIN");
75 return 2; 75 return 2;
76 } 76 }
77 77
78 server_addr.sin_family = AF_INET; 78 server_addr.sin_family = AF_INET;
79 server_addr.sin_port = htons(port); 79 server_addr.sin_port = htons(port);
80 bcopy((char*) host->h_addr, (char*) &server_addr.sin_addr.s_addr,host->h_length); 80 bcopy((char*) host->h_addr, (char*) &server_addr.sin_addr.s_addr,host->h_length);
81 bzero(&(server_addr.sin_zero),8); 81 bzero(&(server_addr.sin_zero),8);
82 82
83 if(setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)) < 0) 83 if(setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)) < 0)
84 { 84 {
85 perror("Client: Set timeout failed\n"); 85 perror("Client: Set timeout failed\n");
86 return 2; 86 return 2;
87 } 87 }
88 88
89 if (connect(sock, (struct sockaddr *)&server_addr,sizeof(struct sockaddr)) == -1) 89 if (connect(sock, (struct sockaddr *)&server_addr,sizeof(struct sockaddr)) == -1)
90 { 90 {
91 perror("Client: Connection failure"); 91 perror("Client: Connection failure");
92 close(sock); 92 close(sock);
93 return 1; 93 return 1;
94 } 94 }
95 95
96 96
97 if(write(sock, message, strlen(message)) < 0) 97 if(write(sock, message, strlen(message)) < 0)
98 { 98 {
99 perror("Client: Error sending data\n"); 99 perror("Client: Error sending data\n");
100 close(sock); 100 close(sock);
101 return 1; 101 return 1;
102 } 102 }
103 close(sock); 103 close(sock);
104 return 0; 104 return 0;
105} 105}
106 106
107 107
108 108
109 109
110 110
111 111
diff --git a/recipes-mac/smack/tcp-smack-test/tcp_server.c b/recipes-mac/smack/tcp-smack-test/tcp_server.c
index 9285dc6..3c8921f 100644
--- a/recipes-mac/smack/tcp-smack-test/tcp_server.c
+++ b/recipes-mac/smack/tcp-smack-test/tcp_server.c
@@ -1,118 +1,118 @@
1// (C) Copyright 2015 Intel Corporation 1// (C) Copyright 2015 Intel Corporation
2// 2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy 3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal 4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights 5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is 7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions: 8// furnished to do so, subject to the following conditions:
9// 9//
10// The above copyright notice and this permission notice shall be included in 10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software. 11// all copies or substantial portions of the Software.
12// 12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19// THE SOFTWARE. 19// THE SOFTWARE.
20#include <stdio.h> 20#include <stdio.h>
21#include <sys/socket.h> 21#include <sys/socket.h>
22#include <sys/types.h> 22#include <sys/types.h>
23#include <errno.h> 23#include <errno.h>
24#include <netinet/in.h> 24#include <netinet/in.h>
25#include <unistd.h> 25#include <unistd.h>
26#include <string.h> 26#include <string.h>
27 27
28int main(int argc, char* argv[]) 28int main(int argc, char* argv[])
29{ 29{
30 30
31 int sock; 31 int sock;
32 int clientsock; 32 int clientsock;
33 char message[255]; 33 char message[255];
34 socklen_t client_length; 34 socklen_t client_length;
35 struct sockaddr_in server_addr, client_addr; 35 struct sockaddr_in server_addr, client_addr;
36 char* label_in; 36 char* label_in;
37 char* attr_in = "security.SMACK64IPIN"; 37 char* attr_in = "security.SMACK64IPIN";
38 int port; 38 int port;
39 39
40 struct timeval timeout; 40 struct timeval timeout;
41 timeout.tv_sec = 15; 41 timeout.tv_sec = 15;
42 timeout.tv_usec = 0; 42 timeout.tv_usec = 0;
43 43
44 if (argc != 3) 44 if (argc != 3)
45 { 45 {
46 perror("Server: Argument missing please provide port and label for SMACK64IPIN"); 46 perror("Server: Argument missing please provide port and label for SMACK64IPIN");
47 return 2; 47 return 2;
48 } 48 }
49 49
50 port = atoi(argv[1]); 50 port = atoi(argv[1]);
51 label_in = argv[2]; 51 label_in = argv[2];
52 bzero(message,255); 52 bzero(message,255);
53 53
54 54
55 if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) 55 if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
56 { 56 {
57 perror("Server: Socket failure"); 57 perror("Server: Socket failure");
58 return 2; 58 return 2;
59 } 59 }
60 60
61 61
62 if(fsetxattr(sock, attr_in, label_in, strlen(label_in),0) < 0) 62 if(fsetxattr(sock, attr_in, label_in, strlen(label_in),0) < 0)
63 { 63 {
64 perror("Server: Unable to set attribute ipin 2"); 64 perror("Server: Unable to set attribute ipin 2");
65 return 2; 65 return 2;
66 } 66 }
67 67
68 server_addr.sin_family = AF_INET; 68 server_addr.sin_family = AF_INET;
69 server_addr.sin_port = htons(port); 69 server_addr.sin_port = htons(port);
70 server_addr.sin_addr.s_addr = INADDR_ANY; 70 server_addr.sin_addr.s_addr = INADDR_ANY;
71 bzero(&(server_addr.sin_zero),8); 71 bzero(&(server_addr.sin_zero),8);
72 72
73 if(setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) < 0) 73 if(setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) < 0)
74 { 74 {
75 perror("Server: Set timeout failed\n"); 75 perror("Server: Set timeout failed\n");
76 return 2; 76 return 2;
77 } 77 }
78 78
79 if(bind(sock, (struct sockaddr*) &server_addr, sizeof(server_addr)) < 0) 79 if(bind(sock, (struct sockaddr*) &server_addr, sizeof(server_addr)) < 0)
80 { 80 {
81 perror("Server: Bind failure "); 81 perror("Server: Bind failure ");
82 return 2; 82 return 2;
83 } 83 }
84 84
85 listen(sock, 1); 85 listen(sock, 1);
86 client_length = sizeof(client_addr); 86 client_length = sizeof(client_addr);
87 87
88 clientsock = accept(sock,(struct sockaddr*) &client_addr, &client_length); 88 clientsock = accept(sock,(struct sockaddr*) &client_addr, &client_length);
89 89
90 if (clientsock < 0) 90 if (clientsock < 0)
91 { 91 {
92 perror("Server: Connection failed"); 92 perror("Server: Connection failed");
93 close(sock); 93 close(sock);
94 return 1; 94 return 1;
95 } 95 }
96 96
97 97
98 if(fsetxattr(clientsock, "security.SMACK64IPIN", label_in, strlen(label_in),0) < 0) 98 if(fsetxattr(clientsock, "security.SMACK64IPIN", label_in, strlen(label_in),0) < 0)
99 { 99 {
100 perror(" Server: Unable to set attribute ipin 2"); 100 perror(" Server: Unable to set attribute ipin 2");
101 close(sock); 101 close(sock);
102 return 2; 102 return 2;
103 } 103 }
104 104
105 if(read(clientsock, message, 254) < 0) 105 if(read(clientsock, message, 254) < 0)
106 { 106 {
107 perror("Server: Error when reading from socket"); 107 perror("Server: Error when reading from socket");
108 close(clientsock); 108 close(clientsock);
109 close(sock); 109 close(sock);
110 return 1; 110 return 1;
111 } 111 }
112 112
113 113
114 close(clientsock); 114 close(clientsock);
115 close(sock); 115 close(sock);
116 116
117 return 0; 117 return 0;
118} 118}
diff --git a/recipes-mac/smack/udp-smack-test/udp_client.c b/recipes-mac/smack/udp-smack-test/udp_client.c
index 4d3afbe..23f3e00 100644
--- a/recipes-mac/smack/udp-smack-test/udp_client.c
+++ b/recipes-mac/smack/udp-smack-test/udp_client.c
@@ -1,75 +1,75 @@
1// (C) Copyright 2015 Intel Corporation 1// (C) Copyright 2015 Intel Corporation
2// 2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy 3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal 4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights 5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is 7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions: 8// furnished to do so, subject to the following conditions:
9// 9//
10// The above copyright notice and this permission notice shall be included in 10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software. 11// all copies or substantial portions of the Software.
12// 12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19// THE SOFTWARE. 19// THE SOFTWARE.
20#include <sys/socket.h> 20#include <sys/socket.h>
21#include <stdio.h> 21#include <stdio.h>
22#include <netinet/in.h> 22#include <netinet/in.h>
23#include <netdb.h> 23#include <netdb.h>
24#include <string.h> 24#include <string.h>
25 25
26int main(int argc, char* argv[]) 26int main(int argc, char* argv[])
27{ 27{
28 char* message = "hello"; 28 char* message = "hello";
29 int sock, ret; 29 int sock, ret;
30 struct sockaddr_in server_addr; 30 struct sockaddr_in server_addr;
31 struct hostent* host = gethostbyname("localhost"); 31 struct hostent* host = gethostbyname("localhost");
32 char* label; 32 char* label;
33 char* attr = "security.SMACK64IPOUT"; 33 char* attr = "security.SMACK64IPOUT";
34 int port; 34 int port;
35 if (argc != 3) 35 if (argc != 3)
36 { 36 {
37 perror("Client: Argument missing, please provide port and label for SMACK64IPOUT"); 37 perror("Client: Argument missing, please provide port and label for SMACK64IPOUT");
38 return 2; 38 return 2;
39 } 39 }
40 40
41 port = atoi(argv[1]); 41 port = atoi(argv[1]);
42 label = argv[2]; 42 label = argv[2];
43 sock = socket(AF_INET, SOCK_DGRAM,0); 43 sock = socket(AF_INET, SOCK_DGRAM,0);
44 if(sock < 0) 44 if(sock < 0)
45 { 45 {
46 perror("Client: Socket failure"); 46 perror("Client: Socket failure");
47 return 2; 47 return 2;
48 } 48 }
49 49
50 50
51 if(fsetxattr(sock, attr, label, strlen(label),0) < 0) 51 if(fsetxattr(sock, attr, label, strlen(label),0) < 0)
52 { 52 {
53 perror("Client: Unable to set attribute "); 53 perror("Client: Unable to set attribute ");
54 return 2; 54 return 2;
55 } 55 }
56 56
57 57
58 server_addr.sin_family = AF_INET; 58 server_addr.sin_family = AF_INET;
59 server_addr.sin_port = htons(port); 59 server_addr.sin_port = htons(port);
60 bcopy((char*) host->h_addr, (char*) &server_addr.sin_addr.s_addr,host->h_length); 60 bcopy((char*) host->h_addr, (char*) &server_addr.sin_addr.s_addr,host->h_length);
61 bzero(&(server_addr.sin_zero),8); 61 bzero(&(server_addr.sin_zero),8);
62 62
63 ret = sendto(sock, message, strlen(message),0,(const struct sockaddr*)&server_addr, 63 ret = sendto(sock, message, strlen(message),0,(const struct sockaddr*)&server_addr,
64 sizeof(struct sockaddr_in)); 64 sizeof(struct sockaddr_in));
65 65
66 close(sock); 66 close(sock);
67 if(ret < 0) 67 if(ret < 0)
68 { 68 {
69 perror("Client: Error sending message\n"); 69 perror("Client: Error sending message\n");
70 return 1; 70 return 1;
71 } 71 }
72 72
73 return 0; 73 return 0;
74} 74}
75 75
diff --git a/recipes-mac/smack/udp-smack-test/udp_server.c b/recipes-mac/smack/udp-smack-test/udp_server.c
index cbab71e..7d2fcf5 100644
--- a/recipes-mac/smack/udp-smack-test/udp_server.c
+++ b/recipes-mac/smack/udp-smack-test/udp_server.c
@@ -1,93 +1,93 @@
1// (C) Copyright 2015 Intel Corporation 1// (C) Copyright 2015 Intel Corporation
2// 2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy 3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal 4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights 5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is 7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions: 8// furnished to do so, subject to the following conditions:
9// 9//
10// The above copyright notice and this permission notice shall be included in 10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software. 11// all copies or substantial portions of the Software.
12// 12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19// THE SOFTWARE. 19// THE SOFTWARE.
20#include <sys/socket.h> 20#include <sys/socket.h>
21#include <stdio.h> 21#include <stdio.h>
22#include <netinet/in.h> 22#include <netinet/in.h>
23#include <netdb.h> 23#include <netdb.h>
24#include <string.h> 24#include <string.h>
25 25
26int main(int argc, char* argv[]) 26int main(int argc, char* argv[])
27{ 27{
28 int sock,ret; 28 int sock,ret;
29 struct sockaddr_in server_addr, client_addr; 29 struct sockaddr_in server_addr, client_addr;
30 socklen_t len; 30 socklen_t len;
31 char message[5]; 31 char message[5];
32 char* label; 32 char* label;
33 char* attr = "security.SMACK64IPIN"; 33 char* attr = "security.SMACK64IPIN";
34 int port; 34 int port;
35 35
36 if(argc != 3) 36 if(argc != 3)
37 { 37 {
38 perror("Server: Argument missing, please provide port and label for SMACK64IPIN"); 38 perror("Server: Argument missing, please provide port and label for SMACK64IPIN");
39 return 2; 39 return 2;
40 } 40 }
41 41
42 port = atoi(argv[1]); 42 port = atoi(argv[1]);
43 label = argv[2]; 43 label = argv[2];
44 44
45 struct timeval timeout; 45 struct timeval timeout;
46 timeout.tv_sec = 15; 46 timeout.tv_sec = 15;
47 timeout.tv_usec = 0; 47 timeout.tv_usec = 0;
48 48
49 sock = socket(AF_INET,SOCK_DGRAM,0); 49 sock = socket(AF_INET,SOCK_DGRAM,0);
50 if(sock < 0) 50 if(sock < 0)
51 { 51 {
52 perror("Server: Socket error"); 52 perror("Server: Socket error");
53 return 2; 53 return 2;
54 } 54 }
55 55
56 56
57 if(fsetxattr(sock, attr, label, strlen(label), 0) < 0) 57 if(fsetxattr(sock, attr, label, strlen(label), 0) < 0)
58 { 58 {
59 perror("Server: Unable to set attribute "); 59 perror("Server: Unable to set attribute ");
60 return 2; 60 return 2;
61 } 61 }
62 62
63 server_addr.sin_family = AF_INET; 63 server_addr.sin_family = AF_INET;
64 server_addr.sin_port = htons(port); 64 server_addr.sin_port = htons(port);
65 server_addr.sin_addr.s_addr = INADDR_ANY; 65 server_addr.sin_addr.s_addr = INADDR_ANY;
66 bzero(&(server_addr.sin_zero),8); 66 bzero(&(server_addr.sin_zero),8);
67 67
68 68
69 if(setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) < 0) 69 if(setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) < 0)
70 { 70 {
71 perror("Server: Set timeout failed\n"); 71 perror("Server: Set timeout failed\n");
72 return 2; 72 return 2;
73 } 73 }
74 74
75 if(bind(sock, (struct sockaddr*) &server_addr, sizeof(server_addr)) < 0) 75 if(bind(sock, (struct sockaddr*) &server_addr, sizeof(server_addr)) < 0)
76 { 76 {
77 perror("Server: Bind failure"); 77 perror("Server: Bind failure");
78 return 2; 78 return 2;
79 } 79 }
80 80
81 len = sizeof(client_addr); 81 len = sizeof(client_addr);
82 ret = recvfrom(sock, message, sizeof(message), 0, (struct sockaddr*)&client_addr, 82 ret = recvfrom(sock, message, sizeof(message), 0, (struct sockaddr*)&client_addr,
83 &len); 83 &len);
84 close(sock); 84 close(sock);
85 if(ret < 0) 85 if(ret < 0)
86 { 86 {
87 perror("Server: Error receiving"); 87 perror("Server: Error receiving");
88 return 1; 88 return 1;
89 89
90 } 90 }
91 return 0; 91 return 0;
92} 92}
93 93