Qsmtp  0.37
Data Structures | Functions | Variables
auth.c File Reference

functions for SMTP AUTH More...

#include <qsmtpd/qsauth.h>
#include <qsmtpd/qsauth_backend.h>
#include <base64.h>
#include <control.h>
#include <fmt.h>
#include <log.h>
#include <netio.h>
#include <qsmtpd/antispam.h>
#include <qsmtpd/qsmtpd.h>
#include <sstring.h>
#include <tls.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>

Data Structures

struct  authcmd
 list of supported authentication methods and their handler functions More...
 

Functions

static int err_input (void)
 
static int err_base64 (void)
 
static int authgetl (string *authin)
 read in AUTH line More...
 
static int auth_login (struct string *user)
 
static int auth_plain (struct string *user)
 
int smtp_auth (void)
 
char * smtp_authstring (void)
 return a list of all enabled auth types More...
 
int auth_permitted (void)
 
void auth_setup (int argc, const char **argv)
 

Variables

const char * tempnoauth = "454 4.5.0 AUTH temporaryly not available\r\n"
 
static const char * auth_host
 
static struct authcmd authcmds []
 

Detailed Description

functions for SMTP AUTH

Function Documentation

◆ authgetl()

static int authgetl ( string authin)
static

read in AUTH line

Parameters
authinbuffer to hold authenication data
Returns
if reading data was successful
Return values
0AUTH line was read into authin
-1error (errno is set)

◆ smtp_auth()

int smtp_auth ( void  )

check if user sends valid authentication

Returns
0 if user is successfully authenticated, error code else

◆ smtp_authstring()

char* smtp_authstring ( void  )

return a list of all enabled auth types

Returns
string of enabled auth types
Return values
NULLout of memory or AUTH currently not permitted

The returned memory is allocated and has to be freed by the caller.

The returned string will contain a trailing CRLF pair.

Variable Documentation

◆ auth_host

const char* auth_host
static

hostname for auth

◆ authcmds

struct authcmd authcmds[]
static
Initial value:
= {
{ .text = "login", .fun = auth_login },
{ .text = "plain", .fun = auth_plain },
{ }
}