src/user.c file

Enums

enum UserAttributeIndex { CN = 1, UID = 2, UID_NUMBER = 3, GID_NUMBER = 4, HOME_DIRECTORY = 5, LOGIN_SHELL = 6, GECOS = 7, USER_PASSWORD = 8 }

Functions

static auto create_user_parent(TALLOC_CTX* talloc_ctx, LDHandle* handle) -> const char*
create_user_parent Get user parent string allocated with talloc.
static auto create_lockout_time_attributes_openldap(TALLOC_CTX* ctx, const char* value) -> LDAPAttribute_t**
create_lockout_time_attributes_openldap Create lockout time attributes for OpenLDAP
static auto create_lockout_time_attributes_ad(TALLOC_CTX* ctx, const char* value) -> LDAPAttribute_t**
create_lockout_time_attributes_openldap Create lockout time attributes for Active Directory
auto ld_add_user(LDHandle* handle, const char* name, LDAPAttribute_t** user_attrs, const char* parent) -> enum OperationReturnCode
ld_add_user Creates user.
auto ld_del_user(LDHandle* handle, const char* name, const char* parent) -> enum OperationReturnCode
ld_del_user Deletes user.
auto ld_mod_user(LDHandle* handle, const char* name, const char* parent, LDAPAttribute_t** user_attrs) -> enum OperationReturnCode
ld_mod_user Modifies the user.
auto ld_rename_user(LDHandle* handle, const char* old_name, const char* new_name, const char* parent) -> enum OperationReturnCode
ld_rename_user Renames the user.
auto ld_block_user(LDHandle* handle, const char* name, const char* parent) -> enum OperationReturnCode
ld_unblock_user Blocks user based on the type of directory service which we are connected to.
auto ld_unblock_user(LDHandle* handle, const char* name, const char* parent) -> enum OperationReturnCode
ld_unblock_user Unblocks user based on the type of directory service which we are connected to.

Function documentation

static const char* create_user_parent(TALLOC_CTX* talloc_ctx, LDHandle* handle)

create_user_parent Get user parent string allocated with talloc.

Parameters
talloc_ctx in Pointer to talloc context.
handle
Returns
  • User Parent if exist.
  • "" if user parent doesn't exist.
  • NULL on out of memory

static LDAPAttribute_t** create_lockout_time_attributes_openldap(TALLOC_CTX* ctx, const char* value)

create_lockout_time_attributes_openldap Create lockout time attributes for OpenLDAP

Parameters
ctx in Pointer to talloc context.
value in lockout time.
Returns
  • Pointer to array with already created lockout time attribute.
  • NULL on out of memory

static LDAPAttribute_t** create_lockout_time_attributes_ad(TALLOC_CTX* ctx, const char* value)

create_lockout_time_attributes_openldap Create lockout time attributes for Active Directory

Parameters
ctx in Pointer to talloc context.
value in lockout time.
Returns
  • Pointer to array with already created lockout time attribute.
  • NULL on out of memory

enum OperationReturnCode ld_add_user(LDHandle* handle, const char* name, LDAPAttribute_t** user_attrs, const char* parent)

ld_add_user Creates user.

Parameters
handle in Pointer to libdomain session handle.
name in Name of the user.
user_attrs in Attributes of a user.
parent
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_del_user(LDHandle* handle, const char* name, const char* parent)

ld_del_user Deletes user.

Parameters
handle in Pointer to libdomain session handle.
name in Name of the user.
parent in Container that holds the user.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_mod_user(LDHandle* handle, const char* name, const char* parent, LDAPAttribute_t** user_attrs)

ld_mod_user Modifies the user.

Parameters
handle Pointer to libdomain session handle.
name Name of the user.
parent Container that holds the user.
user_attrs List of user attributes.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_rename_user(LDHandle* handle, const char* old_name, const char* new_name, const char* parent)

ld_rename_user Renames the user.

Parameters
handle Pointer to libdomain session handle.
old_name Old name of the user.
new_name New name of the user.
parent Container that holds the user.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_block_user(LDHandle* handle, const char* name, const char* parent)

ld_unblock_user Blocks user based on the type of directory service which we are connected to.

Parameters
handle in Pointer to libdomain session handle.
name in Name of the user to block.
parent in Parent dn of the user. Can be NULL than default parent will be selected.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_unblock_user(LDHandle* handle, const char* name, const char* parent)

ld_unblock_user Unblocks user based on the type of directory service which we are connected to.

Parameters
handle in Pointer to libdomain session handle.
name in Name of the user to unblock.
parent in Parent dn of the user. Can be NULL than default parent will be selected.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.