Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
elogd.h File Reference
#include "elog-version.h"
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#include <locale.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <dirent.h>
#include <errno.h>
#include <pwd.h>
#include <grp.h>
#include <syslog.h>
#include <termios.h>
#include "regex.h"
#include "mxml.h"
#include "strlcpy.h"

Go to the source code of this file.

Classes

struct  EL_INDEX
 
struct  LOGBOOK
 
struct  MD5_INDEX
 
struct  LBLIST
 
struct  MSG_LIST
 
struct  SESSION_ID
 

Macros

#define _GNU_SOURCE
 
#define CFGFILE   "elogd.cfg"
 
#define DEFAULT_PORT   80
 
#define OS_UNIX
 
#define TRUE   1
 
#define FALSE   0
 
#define O_TEXT   0
 
#define O_BINARY   0
 
#define DIR_SEPARATOR   '/'
 
#define DIR_SEPARATOR_STR   "/"
 
#define DEFAULT_USER   "nobody"
 
#define DEFAULT_GROUP   "nogroup"
 
#define PIDFILE   "/var/run/elogd.pid"
 
#define closesocket(s)
 
#define stricmp(s1, s2)
 
#define SYSLOG_PRIORITY   LOG_NOTICE /* Default priority for syslog facility */
 
#define TELL(fh)
 
#define TRUNCATE(fh)
 
#define NAME_LENGTH   1500
 
#define DEFAULT_TIME_FORMAT   "%c"
 
#define DEFAULT_DATE_FORMAT   "%x"
 
#define DEFAULT_HTTP_CHARSET   "ISO-8859-1"
 
#define SUCCESS   1
 
#define FAILURE   0
 
#define EL_SUCCESS   1
 
#define EL_FIRST_MSG   2
 
#define EL_LAST_MSG   3
 
#define EL_NO_MSG   4
 
#define EL_FILE_ERROR   5
 
#define EL_UPGRADE   6
 
#define EL_EMPTY   7
 
#define EL_MEM_ERROR   8
 
#define EL_DUPLICATE   9
 
#define EL_INVAL_FILE   10
 
#define EL_FIRST   1
 
#define EL_LAST   2
 
#define EL_NEXT   3
 
#define EL_PREV   4
 
#define MAX_GROUPS   32
 
#define MAX_PARAM   200
 
#define MAX_ATTACHMENTS   50
 
#define MAX_N_LIST   100
 
#define MAX_N_ATTR   100
 
#define MAX_N_EMAIL   500
 
#define MAX_REPLY_TO   100
 
#define CMD_SIZE   10000
 
#define TEXT_SIZE   250000
 
#define MAX_PATH_LENGTH   256
 
#define MAX_CONTENT_LENGTH   10*1024*1024
 
#define AF_REQUIRED   (1<<0)
 
#define AF_LOCKED   (1<<1)
 
#define AF_MULTI   (1<<2)
 
#define AF_FIXED_EDIT   (1<<3)
 
#define AF_FIXED_REPLY   (1<<4)
 
#define AF_ICON   (1<<5)
 
#define AF_RADIO   (1<<6)
 
#define AF_EXTENDABLE   (1<<7)
 
#define AF_DATE   (1<<8)
 
#define AF_DATETIME   (1<<9)
 
#define AF_TIME   (1<<10)
 
#define AF_NUMERIC   (1<<11)
 
#define AF_USERLIST   (1<<12)
 
#define AF_MUSERLIST   (1<<13)
 
#define AF_USEREMAIL   (1<<14)
 
#define AF_MUSEREMAIL   (1<<15)
 
#define AFF_SAME_LINE   1
 
#define AFF_MULTI_LINE   2
 
#define AFF_DATE   4
 
#define AFF_EXTENDABLE   8
 

Typedefs

typedef int BOOL
 

Functions

void show_error (char *error)
 
int is_verbose (void)
 
void eprintf (const char *,...)
 
BOOL enum_user_line (LOGBOOK *lbs, int n, char *user, int size)
 
int get_user_line (LOGBOOK *lbs, char *user, char *password, char *full_name, char *email, BOOL email_notify[1000], time_t *last_access, int *inactive)
 
int get_full_name (LOGBOOK *lbs, char *uname, char *full_name)
 
int set_user_inactive (LOGBOOK *lbs, char *user, int inactive)
 
int strbreak (char *str, char list[][NAME_LENGTH], int size, char *brk, BOOL ignore_quotes)
 
int execute_shell (LOGBOOK *lbs, int message_id, char attrib[MAX_N_ATTR][NAME_LENGTH], char att_file[MAX_ATTACHMENTS][256], char *sh_cmd)
 
BOOL isparam (char *param)
 
char * getparam (char *param)
 
void write_logfile (LOGBOOK *lbs, const char *str)
 
BOOL check_login_user (LOGBOOK *lbs, char *user)
 
LBLIST get_logbook_hierarchy (void)
 
BOOL is_logbook_in_group (LBLIST pgrp, char *logbook)
 
BOOL is_admin_user (LOGBOOK *lbs, char *user)
 
BOOL is_admin_user_global (char *user)
 
void free_logbook_hierarchy (LBLIST root)
 
void show_top_text (LOGBOOK *lbs)
 
void show_bottom_text (LOGBOOK *lbs)
 
int set_attributes (LOGBOOK *lbs, char attributes[][NAME_LENGTH], int n)
 
void show_elog_list (LOGBOOK *lbs, int past_n, int last_n, int page_n, BOOL default_page, char *info)
 
int change_config_line (LOGBOOK *lbs, char *option, char *old_value, char *new_value)
 
int read_password (char *pwd, int size)
 
int getcfg (char *group, char *param, char *value, int vsize)
 
int build_subst_list (LOGBOOK *lbs, char list[][NAME_LENGTH], char value[][NAME_LENGTH], char attrib[][NAME_LENGTH], BOOL format_date)
 
void highlight_searchtext (regex_t *re_buf, char *src, char *dst, BOOL hidden)
 
int parse_config_file (char *config_file)
 
PMXML_NODE load_password_file (LOGBOOK *lbs, char *error, int error_size)
 
int load_password_files (void)
 
BOOL check_login (LOGBOOK *lbs, char *sid)
 
void compose_base_url (LOGBOOK *lbs, char *base_url, int size, BOOL email_notify)
 
void show_elog_entry (LOGBOOK *lbs, char *dec_path, char *command)
 
char * loc (char *orig)
 
void strencode (char *text)
 
void strencode_nouml (char *text)
 
char * stristr (const char *str, const char *pattern)
 
int scan_attributes (char *logbook)
 
int is_inline_attachment (char *encoding, int message_id, char *text, int i, char *att)
 
int setgroup (char *str)
 
int setuser (char *str)
 
int setegroup (char *str)
 
int seteuser (char *str)
 
void strencode2 (char *b, const char *text, int size)
 
void load_config_section (char *section, char **buffer, char *error)
 
void remove_crlf (char *buffer)
 
time_t convert_date (char *date_string)
 
time_t convert_datetime (char *date_string)
 
int get_thumb_name (const char *file_name, char *thumb_name, int size, int index)
 
int create_thumbnail (LOGBOOK *lbs, char *file_name)
 
int ascii_compare (const void *s1, const void *s2)
 
int ascii_compare2 (const void *s1, const void *s2)
 
void do_crypt (const char *s, char *d, int size)
 
BOOL get_password_file (LOGBOOK *lbs, char *file_name, int size)
 
LOGBOOKget_first_lbs_with_global_passwd (void)
 
int auth_verify_password (LOGBOOK *lbs, const char *user, const char *password, char *error_str, int error_size)
 
int auth_change_password (LOGBOOK *lbs, const char *user, const char *old_pwd, const char *new_pwd, char *error_str, int error_size)
 
int auth_verify_password_krb5 (LOGBOOK *lbs, const char *user, const char *password, char *error_str, int error_size)
 
int auth_change_password_krb5 (LOGBOOK *lbs, const char *user, const char *old_pwd, const char *new_pwd, char *error, int error_size)
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 41 of file elogd.h.

◆ CFGFILE

#define CFGFILE   "elogd.cfg"

Definition at line 54 of file elogd.h.

◆ DEFAULT_PORT

#define DEFAULT_PORT   80

Definition at line 59 of file elogd.h.

◆ OS_UNIX

#define OS_UNIX

Definition at line 81 of file elogd.h.

◆ TRUE

#define TRUE   1

Definition at line 87 of file elogd.h.

◆ FALSE

#define FALSE   0

Definition at line 88 of file elogd.h.

◆ O_TEXT

#define O_TEXT   0

Definition at line 91 of file elogd.h.

◆ O_BINARY

#define O_BINARY   0

Definition at line 92 of file elogd.h.

◆ DIR_SEPARATOR

#define DIR_SEPARATOR   '/'

Definition at line 95 of file elogd.h.

◆ DIR_SEPARATOR_STR

#define DIR_SEPARATOR_STR   "/"

Definition at line 96 of file elogd.h.

◆ DEFAULT_USER

#define DEFAULT_USER   "nobody"

Definition at line 99 of file elogd.h.

◆ DEFAULT_GROUP

#define DEFAULT_GROUP   "nogroup"

Definition at line 103 of file elogd.h.

◆ PIDFILE

#define PIDFILE   "/var/run/elogd.pid"

Definition at line 107 of file elogd.h.

◆ closesocket

#define closesocket ( s)
Value:
close(s)

Definition at line 131 of file elogd.h.

◆ stricmp

#define stricmp ( s1,
s2 )
Value:
strcasecmp(s1, s2)

Definition at line 134 of file elogd.h.

◆ SYSLOG_PRIORITY

#define SYSLOG_PRIORITY   LOG_NOTICE /* Default priority for syslog facility */

Definition at line 149 of file elogd.h.

◆ TELL

#define TELL ( fh)
Value:
lseek(fh, 0, SEEK_CUR)

Definition at line 151 of file elogd.h.

◆ TRUNCATE

#define TRUNCATE ( fh)
Value:
ftruncate(fh, TELL(fh))
#define TELL(fh)
Definition elogd.h:151

Definition at line 156 of file elogd.h.

◆ NAME_LENGTH

#define NAME_LENGTH   1500

Definition at line 159 of file elogd.h.

◆ DEFAULT_TIME_FORMAT

#define DEFAULT_TIME_FORMAT   "%c"

Definition at line 161 of file elogd.h.

◆ DEFAULT_DATE_FORMAT

#define DEFAULT_DATE_FORMAT   "%x"

Definition at line 162 of file elogd.h.

◆ DEFAULT_HTTP_CHARSET

#define DEFAULT_HTTP_CHARSET   "ISO-8859-1"

Definition at line 164 of file elogd.h.

◆ SUCCESS

#define SUCCESS   1

Definition at line 166 of file elogd.h.

◆ FAILURE

#define FAILURE   0

Definition at line 167 of file elogd.h.

◆ EL_SUCCESS

#define EL_SUCCESS   1

Definition at line 169 of file elogd.h.

◆ EL_FIRST_MSG

#define EL_FIRST_MSG   2

Definition at line 170 of file elogd.h.

◆ EL_LAST_MSG

#define EL_LAST_MSG   3

Definition at line 171 of file elogd.h.

◆ EL_NO_MSG

#define EL_NO_MSG   4

Definition at line 172 of file elogd.h.

◆ EL_FILE_ERROR

#define EL_FILE_ERROR   5

Definition at line 173 of file elogd.h.

◆ EL_UPGRADE

#define EL_UPGRADE   6

Definition at line 174 of file elogd.h.

◆ EL_EMPTY

#define EL_EMPTY   7

Definition at line 175 of file elogd.h.

◆ EL_MEM_ERROR

#define EL_MEM_ERROR   8

Definition at line 176 of file elogd.h.

◆ EL_DUPLICATE

#define EL_DUPLICATE   9

Definition at line 177 of file elogd.h.

◆ EL_INVAL_FILE

#define EL_INVAL_FILE   10

Definition at line 178 of file elogd.h.

◆ EL_FIRST

#define EL_FIRST   1

Definition at line 180 of file elogd.h.

◆ EL_LAST

#define EL_LAST   2

Definition at line 181 of file elogd.h.

◆ EL_NEXT

#define EL_NEXT   3

Definition at line 182 of file elogd.h.

◆ EL_PREV

#define EL_PREV   4

Definition at line 183 of file elogd.h.

◆ MAX_GROUPS

#define MAX_GROUPS   32

Definition at line 185 of file elogd.h.

◆ MAX_PARAM

#define MAX_PARAM   200

Definition at line 186 of file elogd.h.

◆ MAX_ATTACHMENTS

#define MAX_ATTACHMENTS   50

Definition at line 187 of file elogd.h.

◆ MAX_N_LIST

#define MAX_N_LIST   100

Definition at line 188 of file elogd.h.

◆ MAX_N_ATTR

#define MAX_N_ATTR   100

Definition at line 189 of file elogd.h.

◆ MAX_N_EMAIL

#define MAX_N_EMAIL   500

Definition at line 190 of file elogd.h.

◆ MAX_REPLY_TO

#define MAX_REPLY_TO   100

Definition at line 191 of file elogd.h.

◆ CMD_SIZE

#define CMD_SIZE   10000

Definition at line 192 of file elogd.h.

◆ TEXT_SIZE

#define TEXT_SIZE   250000

Definition at line 193 of file elogd.h.

◆ MAX_PATH_LENGTH

#define MAX_PATH_LENGTH   256

Definition at line 194 of file elogd.h.

◆ MAX_CONTENT_LENGTH

#define MAX_CONTENT_LENGTH   10*1024*1024

Definition at line 196 of file elogd.h.

◆ AF_REQUIRED

#define AF_REQUIRED   (1<<0)

Definition at line 199 of file elogd.h.

◆ AF_LOCKED

#define AF_LOCKED   (1<<1)

Definition at line 200 of file elogd.h.

◆ AF_MULTI

#define AF_MULTI   (1<<2)

Definition at line 201 of file elogd.h.

◆ AF_FIXED_EDIT

#define AF_FIXED_EDIT   (1<<3)

Definition at line 202 of file elogd.h.

◆ AF_FIXED_REPLY

#define AF_FIXED_REPLY   (1<<4)

Definition at line 203 of file elogd.h.

◆ AF_ICON

#define AF_ICON   (1<<5)

Definition at line 204 of file elogd.h.

◆ AF_RADIO

#define AF_RADIO   (1<<6)

Definition at line 205 of file elogd.h.

◆ AF_EXTENDABLE

#define AF_EXTENDABLE   (1<<7)

Definition at line 206 of file elogd.h.

◆ AF_DATE

#define AF_DATE   (1<<8)

Definition at line 207 of file elogd.h.

◆ AF_DATETIME

#define AF_DATETIME   (1<<9)

Definition at line 208 of file elogd.h.

◆ AF_TIME

#define AF_TIME   (1<<10)

Definition at line 209 of file elogd.h.

◆ AF_NUMERIC

#define AF_NUMERIC   (1<<11)

Definition at line 210 of file elogd.h.

◆ AF_USERLIST

#define AF_USERLIST   (1<<12)

Definition at line 211 of file elogd.h.

◆ AF_MUSERLIST

#define AF_MUSERLIST   (1<<13)

Definition at line 212 of file elogd.h.

◆ AF_USEREMAIL

#define AF_USEREMAIL   (1<<14)

Definition at line 213 of file elogd.h.

◆ AF_MUSEREMAIL

#define AF_MUSEREMAIL   (1<<15)

Definition at line 214 of file elogd.h.

◆ AFF_SAME_LINE

#define AFF_SAME_LINE   1

Definition at line 217 of file elogd.h.

◆ AFF_MULTI_LINE

#define AFF_MULTI_LINE   2

Definition at line 218 of file elogd.h.

◆ AFF_DATE

#define AFF_DATE   4

Definition at line 219 of file elogd.h.

◆ AFF_EXTENDABLE

#define AFF_EXTENDABLE   8

Definition at line 220 of file elogd.h.

Typedef Documentation

◆ BOOL

typedef int BOOL

Definition at line 110 of file elogd.h.

Function Documentation

◆ show_error()

void show_error ( char * error)

◆ is_verbose()

int is_verbose ( void )

◆ eprintf()

void eprintf ( const char * ,
... )
extern

◆ enum_user_line()

BOOL enum_user_line ( LOGBOOK * lbs,
int n,
char * user,
int size )

◆ get_user_line()

int get_user_line ( LOGBOOK * lbs,
char * user,
char * password,
char * full_name,
char * email,
BOOL email_notify[1000],
time_t * last_access,
int * inactive )

◆ get_full_name()

int get_full_name ( LOGBOOK * lbs,
char * uname,
char * full_name )

◆ set_user_inactive()

int set_user_inactive ( LOGBOOK * lbs,
char * user,
int inactive )

◆ strbreak()

int strbreak ( char * str,
char list[][NAME_LENGTH],
int size,
char * brk,
BOOL ignore_quotes )

◆ execute_shell()

int execute_shell ( LOGBOOK * lbs,
int message_id,
char attrib[MAX_N_ATTR][NAME_LENGTH],
char att_file[MAX_ATTACHMENTS][256],
char * sh_cmd )

◆ isparam()

BOOL isparam ( char * param)

◆ getparam()

char * getparam ( char * param)

◆ write_logfile()

void write_logfile ( LOGBOOK * lbs,
const char * str )

◆ check_login_user()

BOOL check_login_user ( LOGBOOK * lbs,
char * user )

◆ get_logbook_hierarchy()

LBLIST get_logbook_hierarchy ( void )

◆ is_logbook_in_group()

BOOL is_logbook_in_group ( LBLIST pgrp,
char * logbook )

◆ is_admin_user()

BOOL is_admin_user ( LOGBOOK * lbs,
char * user )

◆ is_admin_user_global()

BOOL is_admin_user_global ( char * user)

◆ free_logbook_hierarchy()

void free_logbook_hierarchy ( LBLIST root)

◆ show_top_text()

void show_top_text ( LOGBOOK * lbs)

◆ show_bottom_text()

void show_bottom_text ( LOGBOOK * lbs)

◆ set_attributes()

int set_attributes ( LOGBOOK * lbs,
char attributes[][NAME_LENGTH],
int n )

◆ show_elog_list()

void show_elog_list ( LOGBOOK * lbs,
int past_n,
int last_n,
int page_n,
BOOL default_page,
char * info )

◆ change_config_line()

int change_config_line ( LOGBOOK * lbs,
char * option,
char * old_value,
char * new_value )

◆ read_password()

int read_password ( char * pwd,
int size )

◆ getcfg()

int getcfg ( char * group,
char * param,
char * value,
int vsize )

◆ build_subst_list()

int build_subst_list ( LOGBOOK * lbs,
char list[][NAME_LENGTH],
char value[][NAME_LENGTH],
char attrib[][NAME_LENGTH],
BOOL format_date )

◆ highlight_searchtext()

void highlight_searchtext ( regex_t * re_buf,
char * src,
char * dst,
BOOL hidden )

◆ parse_config_file()

int parse_config_file ( char * config_file)

◆ load_password_file()

PMXML_NODE load_password_file ( LOGBOOK * lbs,
char * error,
int error_size )

◆ load_password_files()

int load_password_files ( void )

◆ check_login()

BOOL check_login ( LOGBOOK * lbs,
char * sid )

◆ compose_base_url()

void compose_base_url ( LOGBOOK * lbs,
char * base_url,
int size,
BOOL email_notify )

◆ show_elog_entry()

void show_elog_entry ( LOGBOOK * lbs,
char * dec_path,
char * command )

◆ loc()

char * loc ( char * orig)

◆ strencode()

void strencode ( char * text)

◆ strencode_nouml()

void strencode_nouml ( char * text)

◆ stristr()

char * stristr ( const char * str,
const char * pattern )

◆ scan_attributes()

int scan_attributes ( char * logbook)

◆ is_inline_attachment()

int is_inline_attachment ( char * encoding,
int message_id,
char * text,
int i,
char * att )

◆ setgroup()

int setgroup ( char * str)

◆ setuser()

int setuser ( char * str)

◆ setegroup()

int setegroup ( char * str)

◆ seteuser()

int seteuser ( char * str)

◆ strencode2()

void strencode2 ( char * b,
const char * text,
int size )

◆ load_config_section()

void load_config_section ( char * section,
char ** buffer,
char * error )

◆ remove_crlf()

void remove_crlf ( char * buffer)

◆ convert_date()

time_t convert_date ( char * date_string)

◆ convert_datetime()

time_t convert_datetime ( char * date_string)

◆ get_thumb_name()

int get_thumb_name ( const char * file_name,
char * thumb_name,
int size,
int index )

◆ create_thumbnail()

int create_thumbnail ( LOGBOOK * lbs,
char * file_name )

◆ ascii_compare()

int ascii_compare ( const void * s1,
const void * s2 )

◆ ascii_compare2()

int ascii_compare2 ( const void * s1,
const void * s2 )

◆ do_crypt()

void do_crypt ( const char * s,
char * d,
int size )

◆ get_password_file()

BOOL get_password_file ( LOGBOOK * lbs,
char * file_name,
int size )

◆ get_first_lbs_with_global_passwd()

LOGBOOK * get_first_lbs_with_global_passwd ( void )

◆ auth_verify_password()

int auth_verify_password ( LOGBOOK * lbs,
const char * user,
const char * password,
char * error_str,
int error_size )

◆ auth_change_password()

int auth_change_password ( LOGBOOK * lbs,
const char * user,
const char * old_pwd,
const char * new_pwd,
char * error_str,
int error_size )

◆ auth_verify_password_krb5()

int auth_verify_password_krb5 ( LOGBOOK * lbs,
const char * user,
const char * password,
char * error_str,
int error_size )

◆ auth_change_password_krb5()

int auth_change_password_krb5 ( LOGBOOK * lbs,
const char * user,
const char * old_pwd,
const char * new_pwd,
char * error,
int error_size )