The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions
perm.c File Reference

Implementation of filed semaphores that release on exit. More...

#include <freeradius-devel/util/perm.h>
#include <freeradius-devel/util/strerror.h>
#include <freeradius-devel/util/syserror.h>
+ Include dependency graph for perm.c:

Go to the source code of this file.

Functions

void fr_perm_file_error (int num)
 Write a file access error to the fr_strerror buffer, including euid/egid. More...
 
int fr_perm_getgrgid (TALLOC_CTX *ctx, struct group **out, gid_t gid)
 Resolve a gid to a group database entry. More...
 
int fr_perm_getgrnam (TALLOC_CTX *ctx, struct group **out, char const *name)
 Resolve a group name to a group database entry. More...
 
int fr_perm_getpwnam (TALLOC_CTX *ctx, struct passwd **out, char const *name)
 Resolve a username to a passwd entry. More...
 
int fr_perm_getpwuid (TALLOC_CTX *ctx, struct passwd **out, uid_t uid)
 Resolve a uid to a passwd entry. More...
 
int fr_perm_gid_from_str (TALLOC_CTX *ctx, gid_t *out, char const *name)
 Resolve a group name to a GID. More...
 
char * fr_perm_gid_to_str (TALLOC_CTX *ctx, uid_t gid)
 Print gid to a string. More...
 
char const * fr_perm_mode_to_oct (char out[static 5], mode_t mode)
 
char const * fr_perm_mode_to_str (char out[static 10], mode_t mode)
 Convert mode_t into humanly readable permissions flags. More...
 
int fr_perm_uid_from_str (TALLOC_CTX *ctx, uid_t *out, char const *name)
 Resolve a user name to a GID. More...
 
char * fr_perm_uid_to_str (TALLOC_CTX *ctx, uid_t uid)
 Print uid to a string. More...
 

Detailed Description

Implementation of filed semaphores that release on exit.

Definition in file perm.c.

Function Documentation

◆ fr_perm_file_error()

void fr_perm_file_error ( int  num)

Write a file access error to the fr_strerror buffer, including euid/egid.

Note
retrieve error with fr_strerror()
Parameters
numUsually errno, unless the error is returned by the function.

Definition at line 403 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_getgrgid()

int fr_perm_getgrgid ( TALLOC_CTX *  ctx,
struct group **  out,
gid_t  gid 
)

Resolve a gid to a group database entry.

Resolves a gid to a group database entry. The memory to hold the group entry is talloced under ctx, and must be freed when no longer required.

Parameters
ctxto allocate passwd entry in.
outWhere to write pointer to entry.
gidto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 201 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_getgrnam()

int fr_perm_getgrnam ( TALLOC_CTX *  ctx,
struct group **  out,
char const *  name 
)

Resolve a group name to a group database entry.

Resolves a group name to a group database entry. The memory to hold the group entry is talloced under ctx, and must be freed when no longer required.

Parameters
ctxto allocate passwd entry in.
outWhere to write pointer to entry.
nameto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 264 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_getpwnam()

int fr_perm_getpwnam ( TALLOC_CTX *  ctx,
struct passwd **  out,
char const *  name 
)

Resolve a username to a passwd entry.

Resolves a username to a passwd entry. The memory to hold the passwd entry is talloced under ctx, and must be freed when no longer required.

Parameters
ctxto allocate passwd entry in.
outWhere to write pointer to entry.
nameto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 138 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_getpwuid()

int fr_perm_getpwuid ( TALLOC_CTX *  ctx,
struct passwd **  out,
uid_t  uid 
)

Resolve a uid to a passwd entry.

Resolves a uid to a passwd entry. The memory to hold the passwd entry is talloced under ctx, and must be freed when no longer required.

Parameters
ctxto allocate passwd entry in.
outWhere to write pointer to entry.
uidto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 75 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_gid_from_str()

int fr_perm_gid_from_str ( TALLOC_CTX *  ctx,
gid_t *  out,
char const *  name 
)

Resolve a group name to a GID.

Parameters
[in]ctxTALLOC_CTX for temporary allocations.
[in]outwhere to write gid.
[in]nameof group.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 345 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_gid_to_str()

char* fr_perm_gid_to_str ( TALLOC_CTX *  ctx,
uid_t  gid 
)

Print gid to a string.

Parameters
ctxTALLOC_CTX for temporary allocations.
gidto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 386 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_mode_to_oct()

char const* fr_perm_mode_to_oct ( char  out[static 5],
mode_t  mode 
)

Definition at line 51 of file perm.c.

+ Here is the caller graph for this function:

◆ fr_perm_mode_to_str()

char const* fr_perm_mode_to_str ( char  out[static 10],
mode_t  mode 
)

Convert mode_t into humanly readable permissions flags.

Author
Jonathan Leffler.
Parameters
modeto convert.
outWhere to write the string to, must be exactly 10 bytes long.

Definition at line 36 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_uid_from_str()

int fr_perm_uid_from_str ( TALLOC_CTX *  ctx,
uid_t *  out,
char const *  name 
)

Resolve a user name to a GID.

Parameters
[in]ctxTALLOC_CTX for temporary allocations.
[in]outwhere to write gid.
[in]nameof user.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 323 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_perm_uid_to_str()

char* fr_perm_uid_to_str ( TALLOC_CTX *  ctx,
uid_t  uid 
)

Print uid to a string.

Parameters
ctxTALLOC_CTX for temporary allocations.
uidto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 366 of file perm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: