This version of the Samba is adapted for use on KasperskyOS.
The Samba for KasperskyOS is based on the original version of Samba 4.15. Please refer to README.md for more information about the original Samba that is not related to this project.
Currently, subprocess creation isn't available in KasperskyOS Community Edition. Therefore, separate threads are created to execute client requests. A thread executes a client request and then terminates. Other limitations and known issues are described in the KasperskyOS Community Edition Online Help.
- Samba for KasperskyOS
- Install the KasperskyOS Community Edition SDK. You can download the latest version of KasperskyOS Community Edition for free from os.kaspersky.com. Minimum required version of the KasperskyOS Community Edition SDK is 1.2. For more information, see System requirements.
- Copy source files to your project directory. All files that are required to build the Samba
for KasperskyOS and examples of KasperskyOS-based solutions are located in the
./kos
directory. - Set the environment variable
SDK_PREFIX
to/opt/KasperskyOS-Community-Edition-<version>
, whereversion
is the version of the KasperskyOS Community Edition SDK that you installed. To do this, run the following command:$ export SDK_PREFIX=/opt/KasperskyOS-Community-Edition-<version>
Run the following script to build the Samba for KasperskyOS:
./kos/samba/cross-build.sh
The Samba for KasperskyOS is built using the CMake build system, which is provided in the KasperskyOS Community Edition SDK.
To install the Samba for KasperskyOS to the KasperskyOS Community Edition SDK, run the following script with root privileges:
./kos/samba/install.sh
To remove the Samba for KasperskyOS from the KasperskyOS Community Edition SDK, run the following script with root privileges:
./kos/samba/uninstall.sh
When you develop a KasperskyOS-based solution, use the recommended structure of project directories to simplify usage of CMake scripts.
To include a Samba server in your KasperskyOS-based solution, follow these steps:
- Add the
find_package()
command to the./kos/example/smbd/CMakeLists.txt
root file to find and load thesmbd
package.For more information about thefind_package (smbd REQUIRED)
./kos/example/smbd/CMakeLists.txt
root file, see the KasperskyOS Community Edition Online Help. - Add the
Smbd
program to a list of program executable files defined in the./kos/example/smbd/einit/CMakeLists.txt
file as follows:For more information about theset (ENTITIES Smbd ...)
./kos/example/smbd/einit/CMakeLists.txt
file for building theEinit
initializing program, see the KasperskyOS Community Edition Online Help. - Specify a list of IPC channels that connect the
Smbd
program toVfsNet
andVfsRamFs
programs in the./kos/example/smbd/einit/src/init.yaml.in
template file. For more information about theinit.yaml.in
template file, see the KasperskyOS Community Edition Online Help. - Create a solution security policy description in the
./kos/example/smbd/einit/src/security.psl
file. For more information about thesecurity.psl
file, see the KasperskyOS Community Edition Online Help. - Add Samba configuration files to the directory
./kos/example/smbd/resources
.
A Samba client can be included in your KasperskyOS-based solution in a similar way.
./kos/example/smbclient
—Example of developing a solution using the Samba client in KasperskyOS../kos/example/smbd
—Example of developing a solution using the Samba server in KasperskyOS.
See the ./kos/smbdtest/README.md
file for instructions on how to run tests
for the Samba server.
API is defined in the header file ./source3/client/kos_client.h
.
API is designed for server-client interactions.
Connect to the Samba server.
int kos_client_connect(const char *address, int port, const char *user, const char *password)
- address—IP-address of the Samba server
- port—Port of the Samba server
- user—User name
- password—User password
0 if successful; an error code otherwise.
Disconnect from the Samba server.
void kos_client_disconnect()
Copy a file from the Samba server to a local machine.
int kos_client_get_file(const char *remote_name, const char *local_name)
- remote_name—Path to the file on the Samba server
- local_name—Path to the file on a local machine
0 if successful; an error code otherwise.
Copy a file from a local machine to the Samba server.
int kos_client_put_file(const char *remote_name, const char *local_name)
- remote_name—Path to the file on the Samba server
- local_name—Path to the file on a local machine
0 if successful; an error code otherwise.
Delete files on the Samba server.
int kos_client_rm(const char *mask)
- mask—Mask used to delete files on the Samba server
0 if successful; an error code otherwise.
Create a directory on the Samba server.
int kos_client_mkdir(const char *remote_name)
- remote_name—Path to the directory on the Samba server
0 if successful; an error code otherwise.
Delete directories on the Samba server.
int kos_client_rmdir(const char *mask)
- mask—Mask used to delete directories on the Samba server
0 if successful; an error code otherwise.
Get contents of a directory on the Samba server.
int kos_client_ls(const char *mask, kos_client_ls_stat_t **stat)
- mask—Mask used to get the contents of the directory on the Samba server
- stat—Pointer to a structure that will store information about the contents of the directory
0 if successful; an error code otherwise.
Registered trademarks and endpoint marks are the property of their respective owners.
Python is a trademark or registered trademark of the Python Software Foundation.
Raspberry Pi is a trademark of the Raspberry Pi Foundation.
Only KasperskyOS-specific changes can be approved. See CONTRIBUTING.md for detailed instructions on code contribution.
This project is distributable for free under the GNU public license. See COPYING for more information.