23 releases

0.1.22+2.1.28 May 13, 2024
0.1.20+2.1.28 May 26, 2022
0.1.19+2.1.27 Jan 16, 2022
0.1.17 Dec 27, 2021
0.1.12 Jul 9, 2020

#100 in Authentication

Download history 33014/week @ 2024-08-06 36316/week @ 2024-08-13 30986/week @ 2024-08-20 40087/week @ 2024-08-27 43184/week @ 2024-09-03 37559/week @ 2024-09-10 33394/week @ 2024-09-17 36303/week @ 2024-09-24 31971/week @ 2024-10-01 27970/week @ 2024-10-08 39045/week @ 2024-10-15 38298/week @ 2024-10-22 36292/week @ 2024-10-29 35195/week @ 2024-11-05 32261/week @ 2024-11-12 29799/week @ 2024-11-19

140,380 downloads per month
Used in 12 crates (4 directly)

Apache-2.0

3MB
73K SLoC

C 51K SLoC // 0.2% comments M4 9K SLoC // 0.2% comments Shell 8K SLoC // 0.2% comments Visual Studio Project 2K SLoC Rust 1.5K SLoC // 0.1% comments Visual Studio Solution 479 SLoC Automake 420 SLoC // 0.5% comments Python 104 SLoC // 0.0% comments RPM Specfile 101 SLoC Batch 43 SLoC PowerShell 23 SLoC Perl 13 SLoC // 0.4% comments ReScript 1 SLoC R 1 SLoC

Contains (autotools obfuscated code, 715KB) sasl2/configure, (obscure autoconf code, 45KB) sasl2/configure.ac

rust-sasl

crates.io CI Rust Documentation

Cyrus SASL bindings for the Rust programming language.

View documentation.

Installation

# Cargo.toml
[dependencies]
sasl2-sys = "0.1.22"

lib.rs:

Bindings to Cyrus SASL.

This crate provides raw bindings to the Cyrus SASL library, libsasl2. Each module corresponds to a public header file in the C API.

Build configuration

Vendored

If the vendored Cargo feature is enabled, a bundled copy of libsasl2 will be compiled and statically linked. The libsasl2 version will generally track the latest upstream release. Note that the version number of this crate is unrelated to the bundled version of libsasl2.

sasl2-sys is currently bundling libsasl2 v2.1.28.

When configuring the bundled library, sasl2-sys is intentionally conservative in the features it enables. All optional features are disabled by default. The following Cargo features can be used to re-enable features as necessary.

  • gssapi-vendored enables the GSSAPI plugin (--enable-gssapi) by building and statically linking a copy of MIT's Kerberos implementation using the krb5-src crate.

    This feature is not supported on Windows.

  • plain enables the PLAIN plugin (--enable-plain).

  • scram enables the SCRAM plugin (--enable-scram). This requires linking against OpenSSL via the openssl-sys crate.

Note that specifying any of these features implies vendored.

For convenience, the vendored feature of the openssl-sys crate is re-exported as the openssl-vendored feature. This feature is unlikely to be useful unless used in conjuction with the scram feature.

The eventual goal is to expose each libsasl2 feature behind a Cargo feature of the same name. Pull requests on this front are welcomed.

System

Without the vendored Cargo feature, sasl2-sys will search for the libsasl2 library and headers in several standard locations. If the pkg-config feature is enabled, as it is by default, pkg-config will be queried for the location of the sasl2 library.

To override the automatic search, set the SASL2_DIR environment variable to the path of the directory containing the desired libsasl2 directory.

If the layout of the libsasl2 directory is nonstandard, set the SASL2_LIB_DIR and SASL2_INCLUDE_DIR environment variables to the path of the directory containining the libsasl2 libraries and headers, respectively. These environment variables take precedence over SASL2_DIR if set.

When linking against a system library, dynamic linking is preferred unless the SASL2_STATIC environment variable is set.

Platform support

Upstream supports most major platforms, but sasl2-sys is only tested on recent versions of Ubuntu, macOS, and Windows. Patches that improve support for other platforms are welcome.

Dependencies

~0–5MB
~97K SLoC