Remove API function security_server_launch_debug_tool()
authorJanusz Kozerski <j.kozerski@samsung.com>
Fri, 19 Jul 2013 11:55:14 +0000 (13:55 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Thu, 6 Feb 2014 16:13:21 +0000 (17:13 +0100)
[Issue#]        SSDWSSP-369
[Bug]           Function give an access to run any command as root.
[Cause]         Re-witing security-server.
[Solution]      Remove function.
[Verification]  Build, install, run tests.

Change-Id: I19f202608d54bdd70b4bfd5edc9dcba816854d68

src/client/security-server-client.c
src/communication/security-server-comm.c
src/include/security-server-comm.h
src/include/security-server-common.h
src/include/security-server.h
src/server/security-server-main.c
src/server/security-server-password.c

index 927254b..5cea695 100644 (file)
@@ -519,82 +519,6 @@ error:
 }
 
 
-
-SECURITY_SERVER_API
-int security_server_launch_debug_tool(int argc, const char **argv)
-{
-    int sockfd = -1, retval;
-    response_header hdr;
-
-    if (argc < 1 || argv == NULL || argv[0] == NULL)
-    {
-        retval = SECURITY_SERVER_ERROR_INPUT_PARAM;
-        goto error;
-    }
-
-    if (argc == 1)
-    {
-        if (strcmp(argv[0], SECURITY_SERVER_KILL_APP_PATH) != 0)
-        {
-            retval = SECURITY_SERVER_ERROR_INPUT_PARAM;
-            goto error;
-        }
-    }
-
-    /* Check the caller is developer shell */
-    retval = getuid();
-    if (retval != SECURITY_SERVER_DEVELOPER_UID)
-    {
-        SEC_SVR_ERR("Client: It's not allowed to call this API by uid %d", retval);
-        retval = SECURITY_SERVER_ERROR_AUTHENTICATION_FAILED;
-        goto error;
-    }
-
-    retval = connect_to_server(&sockfd);
-    if (retval != SECURITY_SERVER_SUCCESS)
-    {
-        /* Error on socket */
-        goto error;
-    }
-
-    /* make request packet */
-    retval = send_launch_tool_request(sockfd, argc, argv);
-    if (retval != SECURITY_SERVER_SUCCESS)
-    {
-        /* Error on socket */
-        SEC_SVR_ERR("Client: Send failed: %d", retval);
-        goto error;
-    }
-
-    retval = recv_generic_response(sockfd, &hdr);
-
-    retval = return_code_to_error_code(hdr.return_code);
-    if (hdr.basic_hdr.msg_id != SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE)  /* Wrong response */
-    {
-        if (hdr.basic_hdr.msg_id == SECURITY_SERVER_MSG_TYPE_GENERIC_RESPONSE)
-        {
-            /* There must be some error */
-            SEC_SVR_ERR("Client: Error has been received. return code:%d", hdr.return_code);
-        }
-        else
-        {
-            /* Something wrong with response */
-            SEC_SVR_ERR("Client ERROR: Unexpected error occurred:%d", retval);
-            retval = SECURITY_SERVER_ERROR_BAD_RESPONSE;
-        }
-        goto error;
-    }
-
-error:
-    if (sockfd > 0)
-        close(sockfd);
-
-    retval = convert_to_public_error_code(retval);
-    return retval;
-}
-
-
-
 SECURITY_SERVER_API
 int security_server_is_pwd_valid(unsigned int *current_attempts,
                                  unsigned int *max_attempts,
index 2039f14..9ccda0d 100644 (file)
@@ -1309,123 +1309,6 @@ int send_pid_request(int sock_fd, const char *cookie)
 }
 
 
-/* Send debug tool launch request message to security server *
- *
- * Message format
- *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * |---------------------------------------------------------------|
- * | version=0x01  |MessageID=0x0b |       Message Length          |
- * |---------------------------------------------------------------|
- * |                        total # of args                        |
- * |---------------------------------------------------------------|
- * |                        1st argv length                        |
- * |---------------------------------------------------------------|
- * |                                                               |
- * |                            1st argv                           |
- * |                                                               |
- * |---------------------------------------------------------------|
- * |                        2nd argv length                        |
- * |---------------------------------------------------------------|
- * |                                                               |
- * |                            2nd argv                           |
- * |                                                               |
- * |---------------------------------------------------------------|
- * |                                ...                            |
- * |---------------------------------------------------------------|
- * |                        nth argv length                        |
- * |---------------------------------------------------------------|
- * |                                                               |
- * |                            nth argv                           |
- * |                                                               |
- * |---------------------------------------------------------------|
- */
-int send_launch_tool_request(int sock_fd, int argc, const char **argv)
-{
-    basic_header hdr;
-    int retval, total_length = 0, ptr, i, tempnum;
-    unsigned char *buf = NULL;
-
-    for (i = 0; i < argc; i++)
-    {
-        if (argv[i] == NULL)
-        {
-            SEC_SVR_ERR("Error: %dth argv is NULL", i);
-            return SECURITY_SERVER_ERROR_INPUT_PARAM;
-        }
-        total_length += strlen(argv[i]);
-    }
-
-    if (total_length < 1)
-    {
-        SEC_SVR_ERR("Error: There is a problem in argv. [%d]", total_length);
-        return SECURITY_SERVER_ERROR_INPUT_PARAM;
-    }
-    total_length += sizeof(hdr) + sizeof(int) + (argc * sizeof(int));
-
-    if (total_length > 0xffff)
-    {
-        SEC_SVR_ERR("Buffer overflow. too big payload. [%d]", total_length);
-        return SECURITY_SERVER_ERROR_INPUT_PARAM;
-    }
-
-    buf = malloc(total_length);
-    if (buf == NULL)
-    {
-        SEC_SVR_ERR("%s", "Error: failed to malloc()");
-        return SECURITY_SERVER_ERROR_OUT_OF_MEMORY;
-    }
-
-    /* Assemble header */
-    hdr.version = SECURITY_SERVER_MSG_VERSION;
-    hdr.msg_id = SECURITY_SERVER_MSG_TYPE_TOOL_REQUEST;
-    hdr.msg_len = (unsigned short)total_length;
-    memcpy(buf, &hdr, sizeof(hdr));
-    ptr = sizeof(hdr);
-    memcpy(buf + ptr, &argc, sizeof(int));
-    ptr += sizeof(hdr);
-
-    /* Assemple each argv length and value */
-    for (i = 0; i < argc; i++)
-    {
-        tempnum = strlen(argv[i]);
-        memcpy(buf + ptr, &tempnum, sizeof(int));
-        ptr += sizeof(int);
-        memcpy(buf + ptr, argv[i], tempnum);
-        ptr += tempnum;
-    }
-
-    /* Check poll */
-    retval = check_socket_poll(sock_fd, POLLOUT, SECURITY_SERVER_SOCKET_TIMEOUT_MILISECOND);
-    if (retval == SECURITY_SERVER_ERROR_POLL)
-    {
-        SEC_SVR_ERR("%s", "poll() error");
-        retval = SECURITY_SERVER_ERROR_SEND_FAILED;
-        goto error;
-    }
-    if (retval == SECURITY_SERVER_ERROR_TIMEOUT)
-    {
-        SEC_SVR_ERR("%s", "poll() timeout");
-        retval = SECURITY_SERVER_ERROR_SEND_FAILED;
-        goto error;
-    }
-
-    /* Send to server */
-    retval = TEMP_FAILURE_RETRY(write(sock_fd, buf, total_length));
-    if (retval < sizeof(buf))
-    {
-        /* Write error */
-        SEC_SVR_ERR("Error on write(): %d", retval);
-        retval = SECURITY_SERVER_ERROR_SEND_FAILED;
-        goto error;
-    }
-    retval = SECURITY_SERVER_SUCCESS;
-
-error:
-    if (buf != NULL)
-        free(buf);
-    return retval;
-}
-
 /* Send validate password request message to security server *
  *
  * Message format
@@ -2102,49 +1985,6 @@ error:
 }
 #endif
 
-/* Receive pid request packet body */
-/* Table argv and content will be freed by function caller */
-int recv_launch_tool_request(int sockfd, int argc, char *argv[])
-{
-    int retval, i, argv_len;
-
-    argv[0] = malloc(strlen(SECURITY_SERVER_DEBUG_TOOL_PATH) + 1);
-    strncpy(argv[0], SECURITY_SERVER_DEBUG_TOOL_PATH, (strlen(SECURITY_SERVER_DEBUG_TOOL_PATH) + 1));
-
-    for (i = 1; i < argc; i++)
-    {
-        retval = TEMP_FAILURE_RETRY(read(sockfd, &argv_len, sizeof(int)));
-        if (retval < sizeof(int))
-        {
-            SEC_SVR_ERR("Error: argv length recieve failed: %d", retval);
-            return SECURITY_SERVER_ERROR_RECV_FAILED;
-        }
-
-        if (argv_len <= 0 || argv_len >= INT_MAX)
-        {
-            SEC_SVR_ERR("Error: argv length out of boundaries");
-            return SECURITY_SERVER_ERROR_RECV_FAILED;
-        }
-
-        argv[i] = malloc(argv_len + 1);
-        if (argv[i] == NULL)
-        {
-            SEC_SVR_ERR("Error: malloc() failed: %d", retval);
-            return SECURITY_SERVER_ERROR_OUT_OF_MEMORY;
-        }
-
-        memset(argv[i], 0x00, argv_len + 1);
-        retval = TEMP_FAILURE_RETRY(read(sockfd, argv[i], argv_len));
-        if (retval < argv_len)
-        {
-            SEC_SVR_ERR("Error: argv recieve failed: %d", retval);
-            return SECURITY_SERVER_ERROR_RECV_FAILED;
-        }
-    }
-
-    return SECURITY_SERVER_SUCCESS;
-}
-
 int recv_generic_response(int sockfd, response_header *hdr)
 {
     int retval;
@@ -2620,20 +2460,3 @@ int get_client_gid_list(int sockfd, int **privileges)
     return ret;
 }
 
-int free_argv(char **argv, int argc)
-{
-    int i;
-    if (argv == NULL)
-    {
-        SEC_SVR_ERR("%s", "Cannot free NULL pointer");
-        return SECURITY_SERVER_ERROR_INPUT_PARAM;
-    }
-    for (i = 0; i < argc; i++)
-    {
-        if (argv[i] != NULL)
-            free(argv[i]);
-    }
-    free(argv);
-    return SECURITY_SERVER_SUCCESS;
-}
-
index 0813462..785f57f 100644 (file)
@@ -49,8 +49,6 @@ typedef struct
 #define SECURITY_SERVER_MSG_TYPE_GID_RESPONSE                   0x08
 #define SECURITY_SERVER_MSG_TYPE_PID_REQUEST                    0x09
 #define SECURITY_SERVER_MSG_TYPE_PID_RESPONSE                   0x0a
-#define SECURITY_SERVER_MSG_TYPE_TOOL_REQUEST                   0x0b
-#define SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE                  0x0c
 #define SECURITY_SERVER_MSG_TYPE_VALID_PWD_REQUEST              0x0d
 #define SECURITY_SERVER_MSG_TYPE_VALID_PWD_RESPONSE             0x0e
 #define SECURITY_SERVER_MSG_TYPE_SET_PWD_REQUEST                0x0f
@@ -100,7 +98,6 @@ int accept_client(int server_sockfd);
 int authenticate_client_application(int sockfd, int *pid, int *uid);
 int authenticate_client_middleware(int sockfd, int *pid);
 int get_client_gid_list(int sockfd, int **privileges);
-int authenticate_developer_shell(int sockfd);
 int send_generic_response (int sockfd, unsigned char msgid, unsigned char return_code);
 int send_cookie(int sockfd, unsigned char *cookie);
 int send_object_name(int sockfd, char *obj);
@@ -140,9 +137,7 @@ int recv_pid_privilege_request(int sockfd, int datasize, int *pid, char **object
 int recv_pid_privilege_response(int sockfdi, response_header *hdr);
 #endif
 
-int send_launch_tool_request(int sock_fd, int argc, const char **argv);
 int recv_generic_response(int sockfd, response_header *hdr);
-int recv_launch_tool_request(int sockfd, int argc, char *argv[]);
 int recv_pwd_response(int sockfd, response_header *hdr, unsigned int *current_attempts,
                       unsigned int *max_attempts, unsigned int *valid_days);
 int send_set_pwd_request(int sock_fd, const char *cur_pwd, const char *new_pwd,
index 1c33432..1bf5697 100644 (file)
@@ -70,8 +70,6 @@ extern "C" {
 #define SECURITY_SERVER_ACCEPT_TIMEOUT_MILISECOND          10000
 #define SECURITY_SERVER_SOCKET_TIMEOUT_MILISECOND          3000
 #define SECURITY_SERVER_DEVELOPER_UID                      5100
-#define SECURITY_SERVER_DEBUG_TOOL_PATH                    "/usr/bin/debug-util"
-#define SECURITY_SERVER_KILL_APP_PATH                      "/usr/bin/kill_app"
 #define SECURITY_SERVER_DATA_DIRECTORY_PATH                "/opt/data/security-server"
 #define SECURITY_SERVER_ATTEMPT_FILE_NAME                  "attempts"
 #define SECURITY_SERVER_HISTORY_FILE_NAME                  "history"
index 9e53891..bcea29c 100644 (file)
@@ -915,78 +915,6 @@ int security_server_chk_pwd(const char *challenge,
 */
 int security_server_set_pwd_history(int number_of_history);
 
-
-
-/**
- * \par Description:
- * This API launches /usr/bin/debug-util as root privilege.
- *
- * \par Purpose:
- * This API will be used only by SDK with developer privilege to launch debugging tool to debug as the developing applicaion's privilege.
- *
- * \par Typical use case:
- * During appliation development, SDK opens a shell to install, launch, and debug the developing application. But the shell will not have any privilege to control platform. Therefore we need a special utility to manage debugging environement as same privilege level of the application. If this API is called, security server will launch the debug utility as root privilege and the utility will drop its privilege same as developing application
- *
- *
- * \par Method of function operation:
- * When Security Server receives this request, it checks uid of the client, and launches /usr/bin/debug-util with given arguements.
- *
- * \par Sync (or) Async:
- * This is a Synchronous API.
- *
- * \par Important notes:
- * Caller process of this API must be owned by developer user.\n
- * The caller process will be pre-defined.
- * /usr/bin/debug-util itself must be omitted in the argv. Security server will put this as first argv in the execution procedure
- *
- * \param[in] argc Number of arguements.
- *
- * \param[in] argv Arguements
- *
- * \return 0 on success, negative integer error code on error.
- *
- * \par Prospective clients:
- * Only pre-defiend debugging utility.
- *
- * \par Known issues/bugs:
- * None
- *
- * \pre None
- *
- * \post None
- *
- * \see None
- *
- * \remarks Calling this API, you have to put argv[1] of the debug-util as argv[0] of this API. Security server will put argv[0] automatically
- *
- * \par Sample code:
- * \code
- * #include <security-server.h>
- * #define DEVELOPER_UID 5500
- *
- * int main(int argc, char **argv)
- * {
- *      int my_uid, ret;
- *      uid = getuid();
- *      if(uid != DEVELOPER_UID)
- *      {
- *              // You must be developer user
- *              exit(1);
- *      }
- *
- *      ret = security_server_launch_debug_tool(argc -1, argv++)
- *      if(ret != SECURITY_SERVER_SUCCESS)
- *      {
- *              // Some error occurred
- *              exit(1);
- *      }
- *      ...
- * }
- *
- * \endcode
-*/
-int security_server_launch_debug_tool(int argc, const char **argv);
-
 /*
  * This function allows to get process SMACK label by passing cookie assigned
  * to process. Function returns pointer to allocated buffer with label.
index e4726d0..9f78994 100644 (file)
@@ -298,91 +298,6 @@ static void security_server_sig_child(int signo, siginfo_t *info, void *data)
     return;
 }
 
-/* Execute a debugging tool by fork() and execve() */
-int execute_debug_tool(int argc, char*const *argv, int server_sockfd, int client_sockfd)
-{
-    int ret, i;
-    SEC_SVR_DBG("%s", "Executing tool");
-
-    (void)argc;
-
-    ret = fork();
-    if (ret == 0)
-    {
-        close(client_sockfd);
-        close(server_sockfd);
-        setsid();
-
-        for (i = 0; i < _NSIG; i++)
-            signal(i, SIG_DFL);
-
-        ret = execv(argv[0], argv);
-        if (ret == -1)
-        {
-            SEC_SVR_ERR("Error:Failed to execute [%d]", errno);
-            exit(-1);
-        }
-    }
-    if (ret < 0)
-    {
-        SEC_SVR_ERR("Error: Failed to fork [%d]", errno);
-        return SECURITY_SERVER_ERROR_SERVER_ERROR;
-    }
-    return SECURITY_SERVER_SUCCESS;
-}
-
-/* Authenticate the application is middleware daemon
- * The middleware must run as root and the cmd line must be pre listed */
-int authenticate_developer_shell(int sockfd)
-{
-    int retval = SECURITY_SERVER_ERROR_AUTHENTICATION_FAILED;
-    struct ucred cr;
-    unsigned int cl = sizeof(cr);
-    char *exe = NULL;
-
-    /* get PID of socket peer */
-    if (getsockopt(sockfd, SOL_SOCKET, SO_PEERCRED, &cr, &cl) != 0)
-    {
-        retval = SECURITY_SERVER_ERROR_SOCKET;
-        SEC_SVR_ERR("%s", "Error on getsockopt");
-        goto error;
-    }
-
-    /* All middlewares will run as root */
-    if (cr.uid != SECURITY_SERVER_DEVELOPER_UID)
-    {
-        retval = SECURITY_SERVER_ERROR_AUTHENTICATION_FAILED;
-        SEC_SVR_ERR("Non root process has called API: %d", cr.uid);
-        goto error;
-    }
-
-    /* Read executable path of the PID from proc fs */
-    exe = read_exe_path_from_proc(cr.pid);
-    if (exe == NULL)
-    {
-        /* It's weired. no file in proc file system, */
-        retval = SECURITY_SERVER_ERROR_FILE_OPERATION;
-        SEC_SVR_ERR("Error on opening /proc/%d/exe", cr.pid);
-        goto error;
-    }
-
-    /* Search exe of the peer that is really debug tool */
-    if (strcmp(exe, SECURITY_SERVER_DEBUG_TOOL_PATH) != 0)
-    {
-        SEC_SVR_ERR("Error: Wrong exe path [%s]", exe);
-        retval = SECURITY_SERVER_ERROR_AUTHENTICATION_FAILED;
-        goto error;
-    }
-    retval = SECURITY_SERVER_SUCCESS;
-    SEC_SVR_DBG("%s", "Client Authenticated");
-
-error:
-    if (exe != NULL)
-        free(exe);
-
-    return retval;
-}
-
 int process_cookie_request(int sockfd)
 {
     int retval, client_pid, client_uid;
@@ -1048,110 +963,6 @@ error:
 }
 #endif
 
-int process_tool_request(int client_sockfd, int server_sockfd)
-{
-    int retval, argcnum = 0;
-    char **recved_argv = NULL;
-
-    /* Authenticate client */
-    retval = authenticate_developer_shell(client_sockfd);
-    if (retval != SECURITY_SERVER_SUCCESS)
-    {
-        SEC_SVR_ERR("%s", "Client Authentication Failed");
-        retval = send_generic_response(client_sockfd,
-            SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-            SECURITY_SERVER_RETURN_CODE_AUTHENTICATION_FAILED);
-        if (retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_ERR("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-
-    /* Receive Total number of argv */
-    retval = TEMP_FAILURE_RETRY(read(client_sockfd, &argcnum, sizeof(int)));
-    if ((retval < (int)sizeof(int)) || argcnum > (UINT_MAX / sizeof(char*)) - 2 || argcnum < 0)
-    {
-        SEC_SVR_ERR("Error: argc recieve failed: %d", retval);
-        retval = send_generic_response(client_sockfd,
-            SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-            SECURITY_SERVER_RETURN_CODE_BAD_REQUEST);
-        if (retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_ERR("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-    argcnum += 2;
-    recved_argv = (char**)malloc(sizeof(char*) * argcnum);
-    if (recved_argv == NULL)
-    {
-        SEC_SVR_ERR("Error: malloc() failed: %d", retval);
-        retval = send_generic_response(client_sockfd,
-            SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-            SECURITY_SERVER_RETURN_CODE_SERVER_ERROR);
-        if (retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_ERR("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-    memset(recved_argv, 0, sizeof(char*) * argcnum);
-
-    retval = recv_launch_tool_request(client_sockfd, argcnum - 1, recved_argv);
-    if (retval == SECURITY_SERVER_ERROR_RECV_FAILED || retval == SECURITY_SERVER_ERROR_OUT_OF_MEMORY)
-    {
-        SEC_SVR_ERR("%s", "Receiving request failed");
-        retval = send_generic_response(client_sockfd,
-            SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-            SECURITY_SERVER_RETURN_CODE_BAD_REQUEST);
-        if (retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_ERR("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-    if (argcnum < 2)
-    {
-        SEC_SVR_ERR("Error: Too small number of argv [%d]", argcnum);
-        retval = send_generic_response(client_sockfd,
-            SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-            SECURITY_SERVER_RETURN_CODE_BAD_REQUEST);
-        if (retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_ERR("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-    /* Execute the command */
-    retval = execute_debug_tool(argcnum, recved_argv, server_sockfd, client_sockfd);
-    if (retval != SECURITY_SERVER_SUCCESS)
-    {
-        SEC_SVR_ERR("Error: Cannot execute debug tool [%d]", retval);
-        retval = send_generic_response(client_sockfd,
-            SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-            SECURITY_SERVER_RETURN_CODE_SERVER_ERROR);
-        if (retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_ERR("ERROR: Cannot send generic response: %d", retval);
-        }
-    }
-    else
-    {
-        SEC_SVR_DBG("%s", "Tool has been executed");
-        retval = send_generic_response(client_sockfd,
-            SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-            SECURITY_SERVER_RETURN_CODE_SUCCESS);
-        if (retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_ERR("ERROR: Cannot send generic response: %d", retval);
-        }
-    }
-error:
-    free_argv(recved_argv, argcnum);
-    return retval;
-}
-
 
 int client_has_access(int sockfd, const char *object)
 {
@@ -1287,12 +1098,6 @@ void *security_server_thread(void *param)
             break;
 #endif
 
-        case SECURITY_SERVER_MSG_TYPE_TOOL_REQUEST:
-            SEC_SVR_DBG("%s", "launch tool request received");
-            authorize_SS_API_caller_socket(client_sockfd, API_MIDDLEWARE, API_RULE_REQUIRED);
-            process_tool_request(client_sockfd, server_sockfd);
-            break;
-
         case SECURITY_SERVER_MSG_TYPE_VALID_PWD_REQUEST:
             SECURE_SLOGD("%s", "Server: validate password request received");
             authorize_SS_API_caller_socket(client_sockfd, API_PASSWD_CHECK, API_RULE_REQUIRED);
index c67c96d..fe13d94 100644 (file)
@@ -591,21 +591,6 @@ int process_valid_pwd_request(int sockfd)
     unsigned char cur_pwd[SECURITY_SERVER_HASHED_PWD_LEN];
     unsigned int max_attempt, expire_time;
 
-/*
-    if(retval != SECURITY_SERVER_SUCCESS)
-    {
-        SEC_SVR_DBG("%s", "Client Authentication Failed");
-        retval = send_generic_response(client_sockfd,
-                SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-                SECURITY_SERVER_RETURN_CODE_AUTHENTICATION_FAILED);
-        if(retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_DBG("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-*/
-
     /* Check retry timer */
     gettimeofday(&cur_try, NULL);
     retval = check_retry(cur_try);
@@ -702,20 +687,6 @@ int process_set_pwd_request(int sockfd)
     /* Authenticate client that peer is setting app goes here*/
     /* Check SMACK 'rw' rule for the set password */
     retval = SECURITY_SERVER_SUCCESS;
-/*
-    if(retval != SECURITY_SERVER_SUCCESS)
-    {
-        SEC_SVR_DBG("%s", "Client Authentication Failed");
-        retval = send_generic_response(client_sockfd,
-                SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-                SECURITY_SERVER_RETURN_CODE_AUTHENTICATION_FAILED);
-        if(retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_DBG("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-*/
 
     /* Check retry timer */
     gettimeofday(&cur_try, NULL);
@@ -995,20 +966,6 @@ int process_reset_pwd_request(int sockfd)
     SHA256_CTX context;
 
     /* Authenticate client that peer is setting app goes here*/
-/*
-    if(retval != SECURITY_SERVER_SUCCESS)
-    {
-        SEC_SVR_DBG("%s", "Client Authentication Failed");
-        retval = send_generic_response(client_sockfd,
-                SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-                SECURITY_SERVER_RETURN_CODE_AUTHENTICATION_FAILED);
-        if(retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_DBG("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-*/
 
     /* Check retry timer */
     gettimeofday(&cur_try, NULL);
@@ -1155,20 +1112,7 @@ int process_chk_pwd_request(int sockfd)
     /* Authenticate client that peer is proper app goes here*/
     /* Check SMACK rule for the 'r' for password */
     retval = SECURITY_SERVER_SUCCESS;
-/*
-    if(retval != SECURITY_SERVER_SUCCESS)
-    {
-        SEC_SVR_DBG("%s", "Client Authentication Failed");
-        retval = send_generic_response(sockfd,
-                SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-                SECURITY_SERVER_RETURN_CODE_AUTHENTICATION_FAILED);
-        if(retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_DBG("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-*/
+
     /* Check retry timer */
     gettimeofday(&cur_try, NULL);
     retval = check_retry(cur_try);
@@ -1341,20 +1285,6 @@ int process_set_pwd_history_request(int sockfd)
     struct timeval cur_try;
 
     /* Authenticate client that peer is setting app goes here*/
-/*
-    f(retval != SECURITY_SERVER_SUCCESS)
-    {
-        SEC_SVR_DBG("%s", "Client Authentication Failed");
-        retval = send_generic_response(client_sockfd,
-                SECURITY_SERVER_MSG_TYPE_TOOL_RESPONSE,
-                SECURITY_SERVER_RETURN_CODE_AUTHENTICATION_FAILED);
-        if(retval != SECURITY_SERVER_SUCCESS)
-        {
-            SEC_SVR_DBG("ERROR: Cannot send generic response: %d", retval);
-        }
-        goto error;
-    }
-*/
 
     /* Check retry timer */
     gettimeofday(&cur_try, NULL);