Security-client removed
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 27 Nov 2013 11:06:41 +0000 (12:06 +0100)
committerMarcin Niesluchowski <m.niesluchow@samsung.com>
Thu, 23 Jan 2014 14:19:10 +0000 (15:19 +0100)
[Issue#] N/A
[Feature/Bug] N/A
[Problem] Security-client is outdated and no longer used
[Cause] N/A
[Solution] Removed

[Verification] Successfull compilation

Change-Id: I5a789109be4c4fed1c239938f9a034b7943fd3cb

packaging/security-tests.spec
tests/CMakeLists.txt
tests/security-server-client/CMakeLists.txt [deleted file]
tests/security-server-client/client.c [deleted file]

index 7e31d73..14945c0 100644 (file)
@@ -79,7 +79,6 @@ osp-installer -u V5LKqDFBXm
 /usr/bin/security-server-tests-password
 /usr/bin/security-server-tests-stress
 /usr/bin/security-server-tests-dbus
-/usr/bin/security-client
 /etc/smack/test_smack_rules_full
 /etc/smack/test_smack_rules2
 /etc/smack/test_smack_rules3
index 9aba980..251ebed 100644 (file)
@@ -52,4 +52,3 @@ ADD_SUBDIRECTORY(common)
 ADD_SUBDIRECTORY(libprivilege-control-tests)
 ADD_SUBDIRECTORY(libsmack-tests)
 ADD_SUBDIRECTORY(security-server-tests)
-ADD_SUBDIRECTORY(security-server-client)
diff --git a/tests/security-server-client/CMakeLists.txt b/tests/security-server-client/CMakeLists.txt
deleted file mode 100644 (file)
index 7c5034f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-SET(TARGET_CLIENT2 security-client)
-
-PKG_CHECK_MODULES(CLIENT2_DEP
-    libsmack
-    security-server
-    REQUIRED
-    )
-
-INCLUDE_DIRECTORIES(SYSTEM
-    ${CLIENT2_DEP_INCLUDE_DIRS}
-    )
-
-SET(CLIENT2_SOURCES
-    ${PROJECT_SOURCE_DIR}/tests/security-server-client/client.c
-    )
-
-ADD_EXECUTABLE(${TARGET_CLIENT2} ${CLIENT2_SOURCES})
-
-TARGET_LINK_LIBRARIES(${TARGET_CLIENT2}
-    ${CLIENT2_DEP_LIBRARIES}
-    )
-
-INSTALL(TARGETS ${TARGET_CLIENT2} DESTINATION bin)
-
diff --git a/tests/security-server-client/client.c b/tests/security-server-client/client.c
deleted file mode 100644 (file)
index 63163f6..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- *  Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  Contact: Bumjin Im <bj.im@samsung.com>
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- *
- * @file        client.c
- * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
- * @version     1.0
- * @brief       This file is implementation of security-server client.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <err.h>
-#include <time.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/smack.h>
-
-#include <security-server.h>
-
-#define SOCK_PATH "/tmp/security-server-api-echo"
-#define SOCK_DATA_SHARE "/tmp/security-server-api-data-share"
-#define MSG "test"
-
-int send_to_server(const char *interface, const char *snd, size_t snd_size, char *rvc, size_t rvc_size) {
-    struct sockaddr_un sockaddr = {.sun_family = AF_UNIX};
-    int sock = socket(AF_UNIX, SOCK_STREAM, 0);
-    int ret;
-
-    strcpy(sockaddr.sun_path, interface);
-
-    ret = connect(sock, (struct sockaddr *) &sockaddr, sizeof(struct sockaddr_un));
-    if (ret < 0) err(-1, "connect");
-
-    ret = write(sock, snd, snd_size);
-    if (ret < 0) err(-1, "write");
-
-    printf("%d: start read time", getpid());
-
-    rvc[0] = 0;
-    ret = read(sock, rvc, rvc_size);
-    printf("%d: read returned: %d buffer: %s\n", getpid(), ret, rvc);
-    close(sock);
-
-    return 0;
-}
-
-int echo() {
-    struct sockaddr_un sockaddr = {.sun_family = AF_UNIX, .sun_path = SOCK_PATH};
-    int sock = socket(AF_UNIX, SOCK_STREAM, 0);
-    int ret;
-
-    ret = connect(sock, (struct sockaddr *) &sockaddr, sizeof(struct sockaddr_un));
-    if (ret < 0) err(-1, "connect");
-
-    ret = write(sock, MSG, sizeof(MSG));
-    if (ret < 0) err(-1, "write");
-
-    char buffer[100];
-    ret = read(sock, buffer, 100);
-    printf("%d: read %s\n", getpid(), buffer);
-    close(sock);
-
-    return 0;
-}
-
-int timeout() {
-    struct sockaddr_un sockaddr = {.sun_family = AF_UNIX, .sun_path = SOCK_PATH};
-    int sock = socket(AF_UNIX, SOCK_STREAM, 0);
-    int ret;
-    char buffer[100] = {0};
-
-    ret = connect(sock, (struct sockaddr *) &sockaddr, sizeof(struct sockaddr_un));
-    if (ret < 0) err(-1, "connect");
-
-    time_t start;
-    printf("%d: start read time: %lld\n", getpid(), (long long)(start=time(NULL)));
-    ret = read(sock, buffer, 100);
-    printf("%d: read returned: %d timeout: %lld buffer: %s\n", getpid(), ret, (long long)(time(NULL)-start), buffer);
-    close(sock);
-
-    return 0;
-}
-
-int rule(const char *subject, const char *object) {
-    int ret = 0;
-    struct smack_accesses *accesses = NULL;
-
-    if (0 != smack_accesses_new(&accesses)) {
-        printf("%d: Error in smack_accesses_new\n", getpid());
-        goto error;
-    }
-
-    smack_accesses_add(accesses, object, "security-server::api-data-share", "w");
-    smack_accesses_apply(accesses);
-    smack_set_label_for_self(object);
-
-    if (SECURITY_SERVER_API_SUCCESS != security_server_app_give_access(subject, 15)) {
-        printf("%d: Error in app_give_access\n", getpid());
-        goto error;
-    }
-
-    goto end;
-error:
-    ret = -1;
-end:
-    smack_accesses_free(accesses);
-    return ret;
-}
-
-int fakerule(const char * subject, const char * object) {
-    (void)subject;
-    struct smack_accesses *accesses = NULL;
-
-    if (0 != smack_accesses_new(&accesses)) {
-        printf("%d: Error in smack_accesses_new\n", getpid());
-        return -1;
-    }
-
-    smack_accesses_add(accesses, object, "security-server::api-data-share", "w");
-    smack_accesses_apply(accesses);
-    smack_set_label_for_self(object);
-
-    size_t len = 10;
-    char buffer[400];
-    memcpy(buffer, &len, sizeof(size_t));
-    char buffer2[400];
-
-    send_to_server(SOCK_DATA_SHARE, buffer, 8, buffer2, 400);
-
-    memcpy(&buffer[4], &len, sizeof(size_t));
-
-    send_to_server(SOCK_DATA_SHARE, buffer, 400, buffer2, 400);
-
-    memcpy(&buffer[8], &len, sizeof(size_t));
-
-    send_to_server(SOCK_DATA_SHARE, buffer, 400, buffer2, 400);
-
-    return 0;
-}
-
-int runtest(const char *name, const char *par1, const char *par2, const char *par3) {
-    (void)par3;
-    if (0 == strcmp(name, "timeout")) {
-        return timeout();
-    } else if (0 == strcmp(name, "rule")) {
-        return rule(par1, par2);
-    } else if (0 == strcmp(name, "echo")) {
-        return echo();
-    }
-    printf("%d: Unknown command: %s\n", getpid(), name);
-    return -1;
-}
-
-void fclosep(FILE **f) {
-    if (*f) fclose(*f);
-}
-
-int filedata(const char *filename) {
-    FILE *in __attribute__ ((cleanup(fclosep))) = NULL;
-    int size;
-    char table[4][100];
-
-    if (NULL == (in = fopen(filename, "r"))) {
-        printf("Error opening file %s\n", filename);
-        return -1;
-    }
-
-    if (EOF == fscanf(in, "%d", &size)) {
-        printf("Error reading configuration file.\n");
-        return -1;
-    }
-
-    while(size--) {
-        int i, len;
-        if (EOF == fscanf(in , "%d", &len)) {
-            printf("Error reading configuration file.\n");
-            return -1;
-        }
-        for (i = 0; i < len; ++i) {
-            if (EOF == fscanf(in, "%s", table[i])) {
-                printf("Error reading configuration file.\n");
-                return -1;
-            }
-        }
-        if(0 == fork()) {
-            printf("%d: Process started. Command: %s\n", getpid(), table[0]);
-            int ret = runtest(table[0], table[1], table[2], table[3]);
-            printf("%d: Process ended.\n", getpid());
-            return ret;
-        }
-    }
-    return 0;
-}
-
-int main(int argc, const char **argv)
-{
-    if (argc < 2) {
-        printf("wrong usage. available commands: echo, rule, timeout, file, fakerule");
-        return 0;
-    }
-
-    if (0 == strcmp(argv[1], "echo")) {
-        return echo();
-    } else if (0 == strcmp(argv[1], "rule")) {
-        return rule(argv[2], argv[3]);
-    } else if (0 == strcmp(argv[1], "fakerule")) {
-        return fakerule(argv[2], argv[3]);
-    } else if (0 == strcmp(argv[1], "timeout")) {
-        return timeout();
-    } else if (0 == strcmp(argv[1], "file")) {
-        return filedata(argv[2]);
-    }
-
-    return 0;
-}
-