Commit e6dca4a9 authored by David Byers's avatar David Byers

New RPC calls:

        set-pers-flags

Modified RPC calls
        create-person (new parameter pers-flags)

Removed several hard-coded constants and paths.
        Max texts
        Max conferences
        Nologin file

Support for aux-item validation functions (not just regexps.)
Support for aux-items that can only be created by the server
Support for linking pairs of aux items

Added test cases to improve code coverage

Renamed log to kom_log to avoid conflicts with math function log.

Several bug fixes (code and documentation)
parent dc0393d3
This diff is collapsed.
......@@ -34,8 +34,15 @@ Changes in lyskomd 2.0.0 (Release date TBD)
* There is a call to get the collate table being used by the server.
* The error status field is now set to something semi-useful in all
calls.
* A call to set the flags field in a person structure has been added.
The new version of create-person also takes flags as a parameter.
* Error reporting from the server has been improved. The possible
error codes from each call have been checked and documented. In the
process some calls now return errors they previously did not. Since
the error returns were never defined, this should not present a
problem for existing clients. The error-status field is set to
something semi-useful in all cases.
* There is a new parameter (keep_commented) on conferences for tuning
the garbage collection process. This tuning is not implemented in
......
......@@ -4,6 +4,9 @@ server.
Before the next release
=======================
Dokumentera vad sessionsnummer 0 betyder.
Testfall för sända meddelande till hemligt möte
* Showstoppers
** Make sure that there are no "expected failures" in the test suite.
......@@ -26,6 +29,10 @@ Before the next release
** Documentation Issues
*** Document "%%Unsupported protocol" message
*** Document "%% No connections left" message
*** Remove the text "In all likelihood, the implementation of this flag
is screwed up." from lyskomd.texi after checking that
supervisor-only works properly.
......@@ -82,18 +89,97 @@ Before the next release
** Testing
*** In prot_a_get_token, what is an insane token length?
*** Test validation of regexps containing groups. Try "X\\(YZ\\)?X".
I will do this. --DCB
*** Statement coverage tests for the aux-item-def parser
** Known Bugs
*** Should anyone be able to set their letterbox to secret?
*** There is no way to set the Personal_flags. It's not even obvious
where it gets its initial value! This is Not Good At All.
*** If we try to create a pers or conf and have reached the limit
of how many confs we can create, lyskomd just dies. Nasty. It
should return index-out-of-range, like create-text.
*** Timestamps of various things are not synchronized.
This is seen easily when lyskomd executes really slowly.
Known cases: last-written does not match text-stat (FIXED)
aux-item sent-at don't match created in text&conf
(FIXED)
There might be others.
*** Fixa s{kerhetsbuggen vid read_texts et c. Det b|r vara s} att man
inte f}r veta mappningen s} ofta som nu. Vilka texter som {r l{sta
b|r ocks} vara mer hemligt. Ett nytt anrop, query_unread(), b|r
inf|ras. Resultatet {r antalet ol{sat brev och _kanske_
Local_text_no f|r det h|gsta nummret.
(Det var l{nge sen jag skrev det h{r, och jag minns inte riktigt
vad jag menar, men man borde nog titta p} det h{r s} sm}ningom).
*** Asynchronous messages may not be censored enough. Check all
messages that contain conf-nos.
*** difftime is not used everywhere where it should be used. There are
a few places where '-' is still used to get a diff in seconds.
** Improvements
*** We have to be able to limit creation of certain aux-items to users
with special privileges. Most of the import/export items need
this. Put in a new flag in the aux-item-definition file, add it to
the parser, check it in aux_item_check_add_perm or whatever the
hell the function was named. Test it. The biggest problem is to
figure out what permissions should be needed. I suppose it's
possible that we could let the user specify level and bits in the
aux-items.conf file, but that would mean mucking more with the
parser.
I will do this. --DCB
*** We have to be able to specify that some aux-items can only be
created by the server. It's possible that admins should be allowed
to create them as well. Perhaps this point and the previous point
can be solved as one.
*** When creating an FAQ item create a reverse item on the text. Make
sure that they are always added and removed as a pair. Accomplish
this with the add, delete and undelete triggers.
*** Add triggers have to have the capability of preventing addition.
This is difficult since we check the validity of addition before
adding the items. The prevention would have to happen in the check
phase, when the triggers are not called. The correct solution is
probably to implement validation functions in addition to
validation strings and let the validation function take care of
checking if the item can be added.
*** The mark text trigger has to cause add failure if the text does
not exist.
*** Fine-tune the Text_mapping data type (3623903, 3624144, 3624179, 3624173).
*** The Info structure should contain statistics about the server
(uptime, other interesting stuff.) (from 1991) Implement, reject
or postpone.
*** Read all texts in LysKOM (-) Systemet, protokollet mm created
after 1991 (start at text 170527) and incorporate selected
information in this document.
*** Improve the file format for local-to-global.c.
*** Improve the file format for local-to-global.c. Warning: this will
cause an incompatible change in the database format.
*** Use libisc 1.0.
I will do this --ceder
......@@ -115,6 +201,21 @@ Before the next release
* High priority, but they can wait until after the next release.
** Fix all bitfield parsers to deal with arbitrary lengths. Maybe...
** Call to s_fcrea_str in prot_a_get_token should be removed. There is
really no reason why we can't us a statically allocated string
instead (I know, this is microoptimization, but this function gets
called a *lot*)
** Change log.c to something better.
** Look over all places where restart_kom is called. Frequently the
error is not severe enough to warrant panicing (or so I think.) For
example, if cached_create_person fails it is very serious, but all
code that calls this function is prepared to deal with the
problems.
** Actually remove all man pages. This must wait till after the next release.
** We have to be able to limit creation of certain aux-items to users
......@@ -479,6 +580,10 @@ Before the next release
*** Integrate doc/Bugrapporter into this document.
DONE.
*** Get rid of tmp-limits.h
I'll do this --DCB
DONE.
** Let the author of a text add other people's texts as footnotes.
(from 1991)
REJECT. (ceder & DCB 1999-03-28)
......@@ -566,6 +671,7 @@ Before the next release
removed. (1108039).
REJECT: too much work to be worth it.
* In progress
** Document aux-items for mail import/export. (3229403)
......@@ -662,8 +768,8 @@ Before the next release
eller något väsensskillt?)
(3228045) ------------------------------------------
Local variables:
mode: outline
End:
/*
* $Id: acconfig.h,v 1.2 1999/01/14 11:49:07 byers Exp $
* $Id: acconfig.h,v 1.3 1999/05/12 13:24:00 byers Exp $
* Copyright (C) 1998 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -24,6 +24,11 @@
*/
/* This should be defined if you want gcov statistics.
It replaces some aborts with exits so coverage data
is output */
#undef AVOID_ABORTS
/* Define if you want to define special debugging calls.
If you don't know if you need this, you don't. */
#undef DEBUG_CALLS
......
dnl $Id: configure.in,v 1.58 1999/04/28 22:04:50 ceder Exp $
dnl $Id: configure.in,v 1.59 1999/05/12 13:24:01 byers Exp $
dnl Configuration for LysKOM
dnl Copyright (C) 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
dnl
......@@ -18,7 +18,7 @@ dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl Please mail bug reports to bug-lyskom@lysator.liu.se.
dnl
AC_REVISION($Revision: 1.58 $)
AC_REVISION($Revision: 1.59 $)
AC_INIT(src/server/lyskomd.h)
AM_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR(scripts)
......@@ -34,6 +34,11 @@ AC_ARG_WITH([efence],
[use_efence=$withval],
[use_efence=no])
AC_ARG_WITH([insure++],
[ --with-insure++ compile with ParaSoft Insure++],
[use_insure=$withval],
[use_insure=no])
AC_ARG_WITH([checker],
[ --with-checker compile with Gnu Checker],
[use_checker=$withval],
......@@ -110,6 +115,7 @@ then]
[if test "$use_gcov" = "yes" -a -n "$GCC"; then]
CMOD_COMPILER_CC_ACCEPTS([-ftest-coverage])
CMOD_COMPILER_CC_ACCEPTS([-fprofile-arcs])
AC_DEFINE(AVOID_ABORTS)
[fi]
[if test -n "$opt_level" -a "$opt_level" != "yes" ; then
......@@ -241,6 +247,13 @@ dnl
dnl Check for use of Gnu checker
dnl
[if test "$use_insure" = "yes"
then]
AC_CHECK_PROGS(INSURE, insure)
[ CC="insure"
LDFLAGS="-Zsl $LDFLAGS" ]
[fi]
[if test "$use_checker" = "yes"
then]
AC_CHECK_PROGS(CHECKER, checker)
......
This diff is collapsed.
\input texinfo
@c $Id: hacking.texi,v 1.5 1999/01/18 11:55:13 byers Exp $
@c $Id: hacking.texi,v 1.6 1999/05/12 13:24:14 byers Exp $
@c %**start of header
@setfilename hacking.info
@settitle Hacking lyskomd
......@@ -430,18 +430,20 @@ in the protocol.
@item Bump the database version number by one for the next release of
the server.
@item Write a function in @code{ram-output.c} to output the new format.
Update all old functions in @code{ram-output.c} that are database
@item Write a function in @file{ram-output.c} to output the new format.
Update all old functions in @file{ram-output.c} that are database
version dependent so that they can deal with the new database format.
@item Write a function in @code{ram-parse.c} to read the new format.
Update all old functions in @code{ram-parse.c} that are database version
@item Write a function in @file{ram-parse.c} to read the new format.
Update all old functions in @file{ram-parse.c} that are database version
dependent so that they can deal with the new database format.
@item Set the default database format in @code{ram-parse.c} and
@item Set the default database format in @file{ram-parse.c} and
@code{ram-output.c}. The variables to change are @code{input_format} and
@code{output_format}, respectively.
@item Don't forget to update the functions in @file{memory.c}
@end enumerate
@menu
......@@ -569,12 +571,62 @@ case 1.
@chapter Notes
@menu
* Parsing Bit Fields::
* Membership Notes::
* Linking Pairs of Aux Items::
* Notes for fncdef.txt::
* Traversing Connections::
@end menu
@node Membership Notes, Notes for fncdef.txt, Notes, Notes
@node Parsing Bit Fields, Membership Notes, Notes, Notes
@comment node-name, next, previous, up
@section Parsing Bit Fields
The parser for a bit field parameter type should be very tolerant of the
length of the token. Anything from a single bit and up should be
permitted. The parser should use default values for bits that are not
provided and ignore extra bits.
Here is a model function:
@example
void
prot_a_parse_bitfield(Connection *client,
Bitfield *res)
@{
String token;
String_size len;
token = prot_a_get_token(client);
len = s_strlen(token);
if (len <= 0)
longjmp(parse_env, ISC_PROTOCOL_ERR);
init_bitfield(res);
switch (len = s_strlen(token))
@{
default:
case 8: res->bit_8 = token.string[ 7 ];
case 7: res->bit_7 = token.string[ 6 ];
case 6: res->bit_6 = token.string[ 5 ];
case 5: res->bit_5 = token.string[ 4 ];
case 4: res->bit_4 = token.string[ 3 ];
case 3: res->bit_3 = token.string[ 2 ];
case 2: res->bit_2 = token.string[ 1 ];
case 1: res->bit_1 = token.string[ 0 ];
@}
@}
@end example
The function gets the token, checks the sanity of the length, then
initialized the result to its default values. Then it does a switch on
all token lengths that are equal to or smaller than the number of bits
the server knows about. The fall-through ensures that all bits in the
token are read.
@node Membership Notes, Linking Pairs of Aux Items, Parsing Bit Fields, Notes
@comment node-name, next, previous, up
@section Membership Notes
......@@ -582,7 +634,52 @@ The @code{position} field in the membership is @i{not} stored. It has to
be set every time a membership is requested for transmission to the
client.
@node Notes for fncdef.txt, Traversing Connections, Membership Notes, Notes
@node Linking Pairs of Aux Items, Notes for fncdef.txt, Membership Notes, Notes
@comment node-name, next, previous, up
@section Linking Pairs of Aux Items
Sometimes two aux items need to work in tandem. The first instance of
this was the FAQ and FAQ-for-conference items. The FAQ item contains the
text number of a text that is a FAQ for a conference. The
FAQ-for-conference item contains the conference for which a text is a
FAQ. This is needed so that deletion of the text properly removes the
aux-item on the conf (plus, it's nice to be able to see that a text is a
FAQ.)
The @code{linked_item} field in the Aux_item structure is for linking
items. The linking must be managed through the use of triggers. This
field is not visible in the protocol. It is saved in the database. It is
not possible to have more than one link per item.
Please remember the following points.
@itemize
@item The target of a link should have a link back. All links need to go
both ways.
@item In the add trigger for one end, create the other end of the link
and set the @code{linked_item} field in both items. Don't forget to mark
the objects at both ends as changed.
@item Deletion and undeletion of the other side of the link will be
managed automatically. You don't need delete and undelete triggers
simply to destroy the other side of a link.
@item Don't kill the server because one end is missing. It is possible
for the administrator to remove an item manually. Log a message and
continue working.
@end itemize
@node Notes for fncdef.txt, Traversing Connections, Linking Pairs of Aux Items, Notes
@comment node-name, next, previous, up
@section Notes for fncdef.txt
......
\input texinfo
@c $Id: lyskomd.texi,v 1.13 1999/04/28 22:14:44 ceder Exp $
@c $Id: lyskomd.texi,v 1.14 1999/05/12 13:24:15 byers Exp $
@c %**start of header
@setfilename lyskomd.info
@include version.texi
......@@ -200,6 +200,16 @@ text number or perhaps a timeout.
@table @code
@item Max conferences: @var{int}
The maximum number of conferences possible in the server. This number
must be larger than the number of conferences in the database. This
parameter is required. There is no default.
@item Max texts: @var{int}
The maximum number of texts possible in the server. This number
must be larger than the number of texts in the database. This
parameter is required. There is no default.
@item Locale: @var{string}
Use @var{string} as the locale to run in. This parameter is only
available om systems which support the @code{setlocale} call. If this
......@@ -271,10 +281,9 @@ Should the database be automatically purged of old texts? The default
is on.
@item Never save: @var{bool}
Do not use unless you know what you are doing. (Note: there is currently
no-one in the LysKOM development group which knows exactly what this
option does, so if you @i{do} know what you're doing, by all means let
us know!) The default is off.
Completely disables saving the database while the server is running. Do
not use this unless you really know what you're doing. The default is
@code{false}.
@item Log accesses: @var{path}
This parameter can only be set if the server has been compiled with
......@@ -337,15 +346,19 @@ should handle them. @xref{Aux-Item Definition File} for more details.
The path is relative to the installation prefix. Default is
@file{etc/aux-items.conf}.
@item Core directory: @var{path}
The Directory where core dumps are written. This path is relative to the
installation prefix. Default is @file{cores}.
@item Status file: @var{path}
This file is created by @code{komrunning} to indicate that lyskomd
should currently not be running. When this file exists
@code{updateLysKOM} will send it a @code{SIGHUP} signal, so that it
saves the database and dies. Default is @file{etc/status}.
@item Core directory: @var{path}
The Directory where core dumps are written. This path is relative to the
installation prefix. Default is @file{cores}.
@item Nologin file: @var{path}
If this file exists, the server will not allow any connections at all.
Default is @code{/etc/nologin}.
@item Idle timeout: @var{int}
Number of milliseconds to sleep when there is nothing for lyskomd
......@@ -380,6 +393,10 @@ If anything goes wrong while trying to dump the data base (such as if
the disk is full), lyskomd will wait for this many minutes before trying
again. Default is @code{1}.
@item Max client data length: @var{int}
The maxiumum allowed length for client name and version data. The
default is @code{60}.
@item Max conference name length: @var{int}
The maximum length of conference names. The default is @code{60}.
......@@ -420,7 +437,6 @@ The maximum number of recipients of a text. The default is 512.
@item Max comments per text: @var{int}
The maximum number of comments a text can have. The default is 128.
@item Max footnotes per text: @var{int}
The maximum number of footnotes a text can have. The default is 32.
......@@ -668,7 +684,12 @@ supervisor of a conference can create items with this tag.
@item supervisor-only
Boolean, default false. When true, only the supervisors of the author or
letterbox can create items with this tag. In all likelihood, the
implementation of this flag is screwed up.
implementation of this flag is screwed up in version 2.0 of lyskomd.
@item system-only
Boolean, default false. When true, only the server can initiate creation
of items with this tag. This is normally used for items that are created
automatically in response to events in the system.
@item permanent
Boolean, default false. When true, aux-items with this tag cannot be
......@@ -710,10 +731,24 @@ bits in the aux-item flags field. These should only be used by lyskomd
developers, and then only very carefully.
@item validate
String, default none. When set, this specifies a regexp that must match
the data field in newly created items with this tag. If the regexp fails
to match, then the item will not be created. The syntax for strings is
essentially the same as the syntax used in C files.
String or function, default none. When set to a string, this specifies a
regexp that must match the data field in newly created items with this
tag. If the regexp fails to match, then the item will not be created.
The syntax for strings is essentially the same as the syntax used in C
files. When set to a function, this specified a built-in validation
function to call.
The following validator functions are currently implemented:
@table @code
@item existing-readable-text
Creation is only allowed if the item contains the number of an existing
text that the item creator has permission to read.
@end table
@end table
......@@ -739,6 +774,28 @@ deletion is unscheduled. It should undo the effects of the delete
trigger.
@end table
The following trigger functions are currently defined:
@table @code
@item mark-text
Increase the mark count for the text the item refers to. The item must
contain the number of a text. This trigger should be combined with the
existing-readable-text validation function.
@item unmark-text
Decrease the mark count for the text the item refers to. The item must
contain the number of a text. This trigger should be combined with the
existing-readable-text validation function.
@item link-faq
Create a faq-for-conf item linked to a faq-text item. This trigger is
used exclusively for faq-text items. The item must contain the number of
a text. This trigger must be combined with the existing-readable-text
validation function.
@end table
@node Running lyskomd, Administration, Configuration, Top
......@@ -837,6 +894,11 @@ It can be used for detecting memory leaks.
This file contains definitions of the aux-items that the server should
support. It is read by @code{lyskomd} at startup.
@item /etc/nologin
If this file exists, lyskomd will not allow anyone to connect to the
server. This path can be set with the @code{Nologin file} parameter in
the server configuration file.
@end table
......
#
# $Id: aux-items.conf,v 1.6 1999/01/14 11:49:08 byers Exp $
# $Id: aux-items.conf,v 1.7 1999/05/12 13:24:20 byers Exp $
# Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -220,13 +220,11 @@
author-only = true;
hide-creator = false;
secret = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger= mark-text();
add-trigger = link-faq();
validate = "^[0-9][0-9]*$";
validate = existing-readable-text();
}
#
......@@ -244,10 +242,10 @@
}
#
# Name of actual author. This should require some special privileges.
# Name of actual author.
#
16 : mx-author (text)
16 : mx-author (create text)
{
author-only = true;
unique = true;
......@@ -369,4 +367,15 @@
{
author-only = true;
validate = "^[0-9]+$";
validate = existing-readable-text();
}
#
# Mirror of FAQ-text
#
28 : faq-for-conf (text)
{
system-only = true;
dont-garb = true;
}
# Sample config file for lyskomd.
# $Id: config,v 1.3 1996/08/02 23:45:48 ceder Exp $
# $Id: config,v 1.4 1999/05/12 13:24:21 byers Exp $
# This file is placed in the public domain.
# Mandatory options:
Client port: 4894
Mux port: 4895
Max conferences: 4765
Max texts: 2000000
# Default overrides:
Log login: yes
......
/*
* $Id: kom-errno.h,v 0.16 1998/10/22 22:03:37 ceder Exp $
* $Id: kom-errno.h,v 0.17 1999/05/12 13:24:26 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -56,8 +56,7 @@ typedef enum
KOM_BAD_NAME = 18, /* Too short/long or contains illegal chars */
KOM_INDEX_OUT_OF_RANGE = 19, /* */
KOM_CONF_EXISTS = 20, /* Already exists */
/* This is not used.
KOM_PERS_EXISTS = 21, Already exists */
KOM_PERS_EXISTS = 21, /* Already exists */
KOM_SECRET_PUBLIC = 22, /* Cannot be secret and !rd_prot */
KOM_LETTER_BOX = 23, /* Cannot change letter_box flag */
KOM_LDB_ERR = 24, /* Database is corrupted. */
......
/*
* $Id: kom-types.h,v 0.33 1999/04/05 16:05:53 ceder Exp $
* $Id: kom-types.h,v 0.34 1999/05/12 13:24:27 byers Exp $
* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -60,6 +60,20 @@
# error This file no longer supports CLIENT
#endif