Remove duplicate setting smack label for domain socket 44/324944/4 accepted/tizen_unified accepted/tizen_unified_x tizen accepted/tizen/unified/20250604.163032 accepted/tizen/unified/x/20250604.211412
authorDongik Lee <dongik.lee@samsung.com>
Thu, 29 May 2025 06:47:05 +0000 (15:47 +0900)
committerDongik Lee <dongik.lee@samsung.com>
Thu, 29 May 2025 07:35:05 +0000 (16:35 +0900)
Change-Id: I89af2e514de00f01dce48b05d9d11a5176f7b914

packaging/auth-fw.spec
src/server/CMakeLists.txt
src/server/main/include/smack-check.h [deleted file]
src/server/main/smack-check.cpp [deleted file]
src/server/main/socket-manager.cpp

index d4c6439ccb708c6058eec0e0e0717f8af6054ef2..d0cabaaf9285c138e2729d49dd0ac400ffa481b1 100644 (file)
@@ -11,7 +11,6 @@ Source1003: lib%{name}-client-admin.manifest
 Source1004: %{name}-test.manifest
 BuildRequires: cmake
 BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(libsmack)
 BuildRequires: pkgconfig(libsystemd)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(cynara-client)
index fb234260823618bfeb6f23f6616b0e252e1f74af..e6b5f400411a87ad8805b06166c0f49726b58e2c 100644 (file)
@@ -1,7 +1,6 @@
 PKG_CHECK_MODULES(SERVER_DEP
     REQUIRED
     hal-api-security
-    libsmack
     libsystemd
     cynara-client
     cynara-creds-socket
@@ -29,7 +28,6 @@ LINK_DIRECTORIES(
 SET(SERVER_SOURCES
     main/generic-socket-manager.cpp
     main/server-main.cpp
-    main/smack-check.cpp
     main/socket-manager.cpp
     service/password.cpp
     service/password-manager.cpp
diff --git a/src/server/main/include/smack-check.h b/src/server/main/include/smack-check.h
deleted file mode 100644 (file)
index 76b46b3..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Authentication password
- *
- *  Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  Contact: Jooseong Lee <jooseong.lee@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
- */
-
-#ifndef _SMACK_CHECK_H_
-#define _SMACK_CHECK_H_
-
-#include <string>
-
-namespace AuthPasswd {
-
-extern const std::string CLIENT_WHITELIST;
-extern const std::string ADMIN_CLIENT_WHITELIST;
-
-/*
- * A very simple runtime check for SMACK on the platform
- * Returns 1 if SMACK is present, 0 otherwise. If SMACK_ENABLED is not defined
- * It returns 0.
- */
-int smack_check(void);
-
-} // namespace AuthPasswd
-
-#endif // _SMACK_CHECK_H_
diff --git a/src/server/main/smack-check.cpp b/src/server/main/smack-check.cpp
deleted file mode 100644 (file)
index f78875f..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  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        smack-check.cpp
- * @author      Jooseong Lee (jooseong.lee@samsung.com)
- * @version     1.0
- * @brief       Check smck is enabled on device.
- */
-#include "smack-check.h"
-
-#include <fstream>
-#include <sys/smack.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include <dpl/log/log.h>
-#include <error-description.h>
-
-namespace AuthPasswd {
-
-const char COMMENT = '#';
-const std::string CLIENT_WHITELIST = "/etc/auth-fw/client-whitelist";
-const std::string ADMIN_CLIENT_WHITELIST = "/etc/auth-fw/admin-client-whitelist";
-
-int smack_runtime_check(void)
-{
-       static int smack_present = -1;
-
-       if (-1 == smack_present) {
-               if (NULL == smack_smackfs_path()) {
-                       LogDebug("no smack found on device");
-                       smack_present = 0;
-               } else {
-                       LogDebug("found smack on device");
-                       smack_present = 1;
-               }
-       }
-
-       return smack_present;
-}
-
-int smack_check(void)
-{
-#ifndef SMACK_ENABLED
-       return 0;
-#else
-       return smack_runtime_check();
-#endif
-}
-
-} // namespace AuthPasswd
index cdd26d47adff30bfbf9352063fe9b1491c740175..a10b8e159563931c2602882c9c418aa40a758c72 100644 (file)
@@ -29,7 +29,6 @@
 #include <sys/signalfd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/smack.h>
 #include <linux/xattr.h>
 #include <sys/un.h>
 #include <sys/stat.h>
@@ -45,7 +44,6 @@
 #include <dpl/assert.h>
 
 #include <error-description.h>
-#include <smack-check.h>
 #include <socket-manager.h>
 
 namespace {
@@ -527,17 +525,6 @@ int SocketManager::CreateDomainSocketHelp(
                ThrowMsg(Exception::InitFailed, "Error in socket: " << errnoToString(err));
        }
 
-       if (smack_check()) {
-               LogInfo("Set up smack label: " << desc.smackLabel);
-
-               if (0 != smack_set_label_for_file(sockfd, XATTR_NAME_SMACKIPIN, desc.smackLabel.c_str())) {
-                       LogError("Error in smack_set_label_for_file");
-                       ThrowMsg(Exception::InitFailed, "Error in smack_set_label_for_file");
-               }
-       } else {
-               LogInfo("No smack on platform. Socket won't be securied with smack label!");
-       }
-
        int flags;
 
        if (-1 == (flags = fcntl(sockfd, F_GETFL, 0)))