Skip to content

TSDC-TEAM/samba-kos

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

127,860 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Samba for KasperskyOS

This version of Samba is adapted for use on KasperskyOS.

What is a Samba for KasperskyOS?

The Samba for KasperskyOS is based on the original Samba version 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 version 1.4. You can download it for free from os.kaspersky.com. 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. Run the source /opt/KasperskyOS-Community-Edition-<version>/common/set_env.sh to make all the required environment variables available in the current session.

⬆ Back to Top

Building the Samba for KasperskyOS

KasperskyOS Community Edition does not contain openssl headers, but this project depends on them. To obtain them, run the following commands:

$ git submodule update --init --depth=1 third_party/openssl
$ (cd third_party/openssl && ./config && make build_generated)

If you clone this repository with --recurse-submodules option, you will not need to run the git submodule update --init command.

Go to the ./kos/samba directory and run the following commands to build the Samba for KasperskyOS:

$ cmake -B build -D CMAKE_TOOLCHAIN_FILE="$KOSCEDIR/toolchain/share/toolchain-aarch64-kos.cmake" -D CMAKE_INSTALL_PREFIX="$KOSCEDIR/sysroot-aarch64-kos"
$ cmake --build build

The Samba for KasperskyOS is built using the CMake build system, which is provided in the KasperskyOS Community Edition SDK.

⬆ Back to Top

Installing and removing the Samba for KasperskyOS

To install the Samba for KasperskyOS to the KasperskyOS Community Edition SDK, go to the ./kos/samba and run the following command:

$ cmake --install build

To remove the Samba for KasperskyOS from the KasperskyOS Community Edition SDK, go to the ./kos/samba and run the following command:

$ cmake --build build --target uninstall

⬆ 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 ./CMakeLists.txt root file to find and load the samba package.
    find_package (samba REQUIRED)
    
    For more information about the ./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 ./einit/CMakeLists.txt file as follow:
    set (ENTITIES
         samba::Smbd
         ...)
    
    For more information about the ./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 VfsSdCardFs programs in the ./einit/src/init.yaml.in template file or using target properties. 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 ./einit/src/security.psl file. For more information about the security.psl file, see 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.

⬆ Back to Top

Examples

⬆ Back to Top

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_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.

kos_client_ls_stat_free

Free memory previously allocated by kos_client_ls for kos_client_ls_stat_t.

Definition

void kos_client_ls_stat_free(kos_client_ls_stat_t *stat);

Parameters

  • stat—Pointer to the structure returned by kos_client_ls

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.

⬆ Back to Top

Trademarks

Registered trademarks and endpoint marks are the property of their respective owners.

Active Directory, ActiveX, Authenticode, Azure, BitLocker, Direct3D, DirectShow, DirectX, Excel, IntelliMirror, Internet Explorer, Microsoft, MSDN, MS-DOS, OpenType, PowerShell, Visual C++, Visual Studio, Win32, Windows, Windows Media, Windows Phone, Windows Server and Windows Vista are trademarks of the Microsoft group of companies.

Adobe, PostScript are either registered trademarks or trademarks of Adobe in the United States and/or other countries.

AFS, AI X, Approach, Blue Gene, DYNIX/ptx, GPFS, IBM, ibm.com, PowerPC, RDN, THINK, Tivoli and TrueType are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide.

AMD, AMD64 are trademarks or registered trademark of Advanced Micro Devices, Inc.

Android, Chrome, Chromium, Google, PROTOBUF and YouTube are trademarks of Google LLC.

Apache is either a registered trademark or a trademark of the Apache Software Foundation in the United States and/or other countries.

Apple, AppleTalk, Carbon, Leopard, Mac, Macintosh, macOS, Mac OS, Objective-C, OS X, Safari, Spotlight, Time Machine and Xcode are trademarks of Apple Inc.

Borland is a trademark or registered trademark of Borland Software Corporation.

Catalyst, Cisco, Cisco Systems, ClamAV and Jabber are registered trademarks or trademarks of Cisco Systems, Inc. and/or its affiliates in the United States and certain other countries.

Dell Technologies, Dell, Celerra, EMC and other trademarks are trademarks of Dell Inc. or its subsidiaries.

CentOS, CEPH, Fedora and Red Hat are trademarks or registered trademark of Red Hat, Inc. or its subsidiaries in the United States and other countries.

Debian is a registered trademark of Software in the Public Interest, Inc.

Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries. Docker, Inc. and other parties may also have trademark rights in other terms used herein.

Dropbox is a trademark of Dropbox, Inc.

Elasticsearch is a trademark of Elasticsearch BV, registered in the U.S. and in other countries.

Firefox, Mozilla are trademarks of the Mozilla Foundation in the U.S. and other countries.

FreeBSD is a registered trademark of The FreeBSD Foundation.

GITLAB is a trademark of GitLab Inc. in the United States and other countries and regions.

Huawei is a trademark of Huawei Technologies Co., Ltd.

Intel, Itanium are trademarks of Intel Corporation or its subsidiaries.

Java, JavaScript, Oracle and Solaris are registered trademarks of Oracle and/or its affiliates.

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

MINIO is a trademark of the MinIO Corporation.

MIPS is a trademark or registered trademark of MIPS Technologies, Inc. in the United States and other countries.

MOTOROLA and the Stylized M Logo are trademarks or registered trademarks of Motorola Trademark Holdings, LLC.

NetApp is the registered trademark of NetApp, Inc. in the United States and/or other countries.

NetWare, Novell are registered trademarks of Novell Enterprises Inc. in the United States and other countries.

Nokia is the registered trademark of Nokia Corporation.

OpenSSL is a trademark owned by the OpenSSL Software Foundation.

PGP is a trademark or registered trademark of Symantec Corporation or its affiliates in the U.S. and other countries.

Python is a trademark or registered trademark of the Python Software Foundation.

QT is a trademark or registered trademark of The Qt Company Ltd.

Raspberry Pi is a trademark of the Raspberry Pi Foundation.

Symantec is the registered trademark of Symantec Corporation or its affiliates in the U.S. and other countries.

Texas Instruments is a trademark of Texas Instruments.

Ubuntu is a registered trademark of Canonical Ltd.

UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Limited.

Veritas is a trademark or registered trademark of Symantec Corporation or its affiliates in the U.S. and other countries.

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

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C 90.0%
  • Python 7.2%
  • Shell 1.3%
  • Perl 0.7%
  • CMake 0.6%
  • Yacc 0.1%
  • Other 0.1%