s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
Macros | Functions | Variables
srs2.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <string.h>
#include "srs2.h"
#include "sha1.h"
Include dependency graph for srs2.c:

Go to the source code of this file.

Macros

#define STRINGP(s)   ((s != NULL) && (*(s) != '\0'))
 
#define X(e, s)   if (code == e) return s;
 
#define SRS_PARAM_DEFINE(n, t)
 
#define SRS_TIME_PRECISION   (60 * 60 * 24) /* One day */
 
#define SRS_TIME_BASEBITS   5 /* 2^5 = 32 = strlen(CHARS) */
 
#define SRS_TIME_SIZE   2
 
#define SRS_TIME_SLOTS   (1<<(SRS_TIME_BASEBITS<<(SRS_TIME_SIZE-1)))
 

Functions

int srs_set_malloc (srs_malloc_t m, srs_realloc_t r, srs_free_t f)
 
const char * srs_strerror (int code)
 
srs_tsrs_new ()
 
void srs_init (srs_t *srs)
 
void srs_free (srs_t *srs)
 
int srs_add_secret (srs_t *srs, const char *secret)
 
const char * srs_get_secret (srs_t *srs, int idx)
 
int srs_set_separator (srs_t *srs, char value)
 
char srs_get_separator (srs_t *srs)
 
int srs_timestamp_create (srs_t *srs, char *buf, time_t now)
 
int srs_timestamp_check (srs_t *srs, const char *stamp)
 
int srs_hash_create (srs_t *srs, char *buf, int nargs,...)
 
int srs_hash_check (srs_t *srs, char *hash, int nargs,...)
 
int srs_compile_shortcut (srs_t *srs, char *buf, int buflen, char *sendhost, char *senduser, const char *aliashost)
 
int srs_compile_guarded (srs_t *srs, char *buf, int buflen, char *sendhost, char *senduser, const char *aliashost)
 
int srs_parse_shortcut (srs_t *srs, char *buf, int buflen, char *senduser)
 
int srs_parse_guarded (srs_t *srs, char *buf, int buflen, char *senduser)
 
int srs_forward (srs_t *srs, char *buf, int buflen, const char *sender, const char *alias)
 
int srs_forward_alloc (srs_t *srs, char **sptr, const char *sender, const char *alias)
 
int srs_reverse (srs_t *srs, char *buf, int buflen, const char *sender)
 
int srs_reverse_alloc (srs_t *srs, char **sptr, const char *sender)
 

Variables

const char * SRS_TIME_BASECHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
 
const char * SRS_HASH_BASECHARS
 

Macro Definition Documentation

◆ SRS_PARAM_DEFINE

#define SRS_PARAM_DEFINE (   n,
 
)
Value:
int srs_set_ ## n (srs_t *srs, t value) { \
srs->n = value; \
return SRS_SUCCESS; \
} \
t srs_get_ ## n (srs_t *srs) { \
return srs->n; \
}
#define SRS_SUCCESS
Definition: srs2.h:40
Definition: srs2.h:79

Definition at line 144 of file srs2.c.

◆ SRS_TIME_BASEBITS

#define SRS_TIME_BASEBITS   5 /* 2^5 = 32 = strlen(CHARS) */

Definition at line 179 of file srs2.c.

◆ SRS_TIME_PRECISION

#define SRS_TIME_PRECISION   (60 * 60 * 24) /* One day */

Definition at line 178 of file srs2.c.

◆ SRS_TIME_SIZE

#define SRS_TIME_SIZE   2

Definition at line 183 of file srs2.c.

◆ SRS_TIME_SLOTS

#define SRS_TIME_SLOTS   (1<<(SRS_TIME_BASEBITS<<(SRS_TIME_SIZE-1)))

Definition at line 184 of file srs2.c.

◆ STRINGP

#define STRINGP (   s)    ((s != NULL) && (*(s) != '\0'))

Definition at line 48 of file srs2.c.

◆ X

#define X (   e,
 
)    if (code == e) return s;

Definition at line 64 of file srs2.c.

Function Documentation

◆ srs_add_secret()

int srs_add_secret ( srs_t srs,
const char *  secret 
)

Definition at line 129 of file srs2.c.

Here is the caller graph for this function:

◆ srs_compile_guarded()

int srs_compile_guarded ( srs_t srs,
char *  buf,
int  buflen,
char *  sendhost,
char *  senduser,
const char *  aliashost 
)

Definition at line 384 of file srs2.c.

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

◆ srs_compile_shortcut()

int srs_compile_shortcut ( srs_t srs,
char *  buf,
int  buflen,
char *  sendhost,
char *  senduser,
const char *  aliashost 
)

Definition at line 340 of file srs2.c.

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

◆ srs_forward()

int srs_forward ( srs_t srs,
char *  buf,
int  buflen,
const char *  sender,
const char *  alias 
)

Definition at line 520 of file srs2.c.

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

◆ srs_forward_alloc()

int srs_forward_alloc ( srs_t srs,
char **  sptr,
const char *  sender,
const char *  alias 
)

Definition at line 562 of file srs2.c.

Here is the call graph for this function:

◆ srs_free()

void srs_free ( srs_t srs)

Definition at line 118 of file srs2.c.

◆ srs_get_secret()

const char * srs_get_secret ( srs_t srs,
int  idx 
)

Definition at line 137 of file srs2.c.

◆ srs_get_separator()

char srs_get_separator ( srs_t srs)

Definition at line 161 of file srs2.c.

◆ srs_hash_check()

int srs_hash_check ( srs_t srs,
char *  hash,
int  nargs,
  ... 
)

Definition at line 309 of file srs2.c.

Here is the caller graph for this function:

◆ srs_hash_create()

int srs_hash_create ( srs_t srs,
char *  buf,
int  nargs,
  ... 
)

Definition at line 291 of file srs2.c.

Here is the caller graph for this function:

◆ srs_init()

void srs_init ( srs_t srs)

Definition at line 106 of file srs2.c.

Here is the caller graph for this function:

◆ srs_new()

srs_t * srs_new ( )

Definition at line 99 of file srs2.c.

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

◆ srs_parse_guarded()

int srs_parse_guarded ( srs_t srs,
char *  buf,
int  buflen,
char *  senduser 
)

Definition at line 490 of file srs2.c.

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

◆ srs_parse_shortcut()

int srs_parse_shortcut ( srs_t srs,
char *  buf,
int  buflen,
char *  senduser 
)

Definition at line 452 of file srs2.c.

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

◆ srs_reverse()

int srs_reverse ( srs_t srs,
char *  buf,
int  buflen,
const char *  sender 
)

Definition at line 591 of file srs2.c.

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

◆ srs_reverse_alloc()

int srs_reverse_alloc ( srs_t srs,
char **  sptr,
const char *  sender 
)

Definition at line 616 of file srs2.c.

Here is the call graph for this function:

◆ srs_set_malloc()

int srs_set_malloc ( srs_malloc_t  m,
srs_realloc_t  r,
srs_free_t  f 
)

Definition at line 56 of file srs2.c.

◆ srs_set_separator()

int srs_set_separator ( srs_t srs,
char  value 
)

Definition at line 153 of file srs2.c.

Here is the caller graph for this function:

◆ srs_strerror()

const char * srs_strerror ( int  code)

Definition at line 66 of file srs2.c.

Here is the caller graph for this function:

◆ srs_timestamp_check()

int srs_timestamp_check ( srs_t srs,
const char *  stamp 
)

Definition at line 196 of file srs2.c.

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

◆ srs_timestamp_create()

int srs_timestamp_create ( srs_t srs,
char *  buf,
time_t  now 
)

Definition at line 186 of file srs2.c.

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

Variable Documentation

◆ SRS_HASH_BASECHARS

const char* SRS_HASH_BASECHARS
Initial value:
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/"

Definition at line 224 of file srs2.c.

◆ SRS_TIME_BASECHARS

const char* SRS_TIME_BASECHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"

Definition at line 182 of file srs2.c.