Skip to content

TSDC-TEAM/samba-kos

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Samba for KasperskyOS

This version of the Samba is adapted for use on KasperskyOS.

What is a Samba for 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.

Table of contents

Getting started

Prerequisites

  1. 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.
  2. 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.
  3. Set the environment variable SDK_PREFIX to /opt/KasperskyOS-Community-Edition-<version>, where version 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>
    

Building the Samba for KasperskyOS

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.

Installing and removing the Samba for KasperskyOS

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

⬆ Back to Top

Usage

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:

  1. Add the find_package() command to the ./kos/example/smbd/CMakeLists.txt root file to find and load the smbd package.
    find_package (smbd REQUIRED)
    
    For more information about the ./kos/example/smbd/CMakeLists.txt root file, see the KasperskyOS Community Edition Online Help.
  2. Add the Smbd program to a list of program executable files defined in the ./kos/example/smbd/einit/CMakeLists.txt file as follows:
    set (ENTITIES
         Smbd
         ...)
    
    For more information about the ./kos/example/smbd/einit/CMakeLists.txt file for building the Einit initializing program, see the KasperskyOS Community Edition Online Help.
  3. Specify a list of IPC channels that connect the Smbd program to VfsNet and VfsRamFs programs in the ./kos/example/smbd/einit/src/init.yaml.in template file. For more information about the init.yaml.in template file, see the KasperskyOS Community Edition Online Help.
  4. Create a solution security policy description in the ./kos/example/smbd/einit/src/security.psl file. For more information about the security.psl file, see the KasperskyOS Community Edition Online Help.
  5. 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.

Examples

Tests

See the ./kos/smbdtest/README.md file for instructions on how to run tests for the Samba server.

⬆ Back to Top

API

API is defined in the header file ./source3/client/kos_client.h. API is designed for server-client interactions.

kos_client_connect

Connect to the Samba server.

Definition

int kos_client_connect(const char *address, int port, const char *user, const char *password)

Parameters

  • address—IP-address of the Samba server
  • port—Port of the Samba server
  • user—User name
  • password—User password

Return value

0 if successful; an error code otherwise.

kos_client_disconnect

Disconnect from the Samba server.

Definition

void kos_client_disconnect()

kos_client_get_file

Copy a file from the Samba server to a local machine.

Definition

int kos_client_get_file(const char *remote_name, const char *local_name)

Parameters

  • remote_name—Path to the file on the Samba server
  • local_name—Path to the file on a local machine

Return value

0 if successful; an error code otherwise.

kos_client_put_file

Copy a file from a local machine to the Samba server.

Definition

int kos_client_put_file(const char *remote_name, const char *local_name)

Parameters

  • remote_name—Path to the file on the Samba server
  • local_name—Path to the file on a local machine

Return value

0 if successful; an error code otherwise.

kos_client_rm

Delete files on the Samba server.

Definition

int kos_client_rm(const char *mask)

Parameters

  • mask—Mask used to delete files on the Samba server

Return value

0 if successful; an error code otherwise.

kos_client_mkdir

Create a directory on the Samba server.

Definition

int kos_client_mkdir(const char *remote_name)

Parameters

  • remote_name—Path to the directory on the Samba server

Return value

0 if successful; an error code otherwise.

kos_client_rmdir

Delete directories on the Samba server.

Definition

int kos_client_rmdir(const char *mask)

Parameters

  • mask—Mask used to delete directories on the Samba server

Return value

0 if successful; an error code otherwise.

kos_client_ls

Get contents of a directory on the Samba server.

Definition

int kos_client_ls(const char *mask, kos_client_ls_stat_t **stat)

Parameters

  • 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

Return value

0 if successful; an error code otherwise.

Trademarks

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.

Contributing

Only KasperskyOS-specific changes can be approved. See CONTRIBUTING.md for detailed instructions on code contribution.

License

This project is distributable for free under the GNU public license. See COPYING for more information.

⬆ Back to Top

About

https://gitlab.com/samba-team/samba is the Official GitLab mirror of https://git.samba.org/samba.git -- Merge requests should be made on GitLab (not on GitHub)

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 90.1%
  • Python 7.2%
  • Shell 1.3%
  • Perl 0.7%
  • CMake 0.5%
  • Yacc 0.1%
  • Other 0.1%