diff --git a/ChangeLog b/ChangeLog index 53fd79e85a1e0803531f60920170424dd5f43dfd..37213ed3152fe357c3482d108fb095de1429c60a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,97 @@ +1998-12-26 David Byers <davby@ida.liu.se> + + * doc/man/lyskomd.8 (value): Documented regexps use collate + table. + + * src/server/param.h: Added regex_use_collate_table. + + * src/server/server-config.c: Added regexps use collate table. + + * src/server/regex-match.c (lookup_regexp): Set translation table + for regex according to regex_use_collate_table option. + + * src/server/manipulate.h: New function declaration. + + * src/server/membership.c (locate_membership_and_position): New + function. + (locate_membership): Use it. + + * src/server/person.c (do_query_read_texts): New function. + (query_read_texts_old): Use it. (query_read_texts): Use it. + + * src/server/prot-a-output.h(prot_a_output_extended_membership): + New function declaration. + + * src/server/prot-a-output.c (prot_a_output_extended_membership): + New function. + + * src/server/prot-a.c (prot_a_reply): Added + rt_extended_membership. + + * src/include/kom-types.h: New type Extended_Membership. + + * src/server/connections.h: Added extended_membership to + Result_holder. Added rt_extended_membership to Res_type + + * src/include/services.h: Declare query_read_texts to take an + Extended_Membership + + * doc/Protocol-A.texi (query-read-texts): Documented that this + function returns the position as well as the membership. + +1998-12-25 David Byers <davby@ida.liu.se> + + * README: Updated clients information. + + * src/server/membership.c (set_membership_type): Removed F-word + from comment. Inserted F-abbreviation instead :-) + + * src/server/conference.c (get_uconf_stat): Removed FIXME after + fixing fast_access_perm. + + * src/server/membership.c (fast_access_perm): Set kom_errno if we + can't find the conference conf_no. + + * src/server/membership.c (do_get_members): Don't filter secret + memberships if we have privilege bits set. + + * doc/Protocol-A.texi (Error Codes): Fixed error in documentation + of secret-public + +1998-12-24 David Byers <davby@ida.liu.se> + + * src/server/aux-items.c (system_add_aux_item_list): Call add + triggers + (check_delete_aux_item_list): Return KOM_AUX_PERM if an item to + delete is mission. This is in accordance with the documentation. + + * src/server/aux-items.h (INFO_OBJECT_TYPE): New constant. + +1998-12-23 David Byers <davby@ida.liu.se> + + * src/server/testsuite/lyskomd.0/03.exp: Updated test 1010 for + item 27. + Updated test 1017 for asyncs 16, 17 and 18 + Updated test 1020 for asyncs 16, 17 and 18 + Updated test 1022 for asyncs 16, 17 and 18 + Updated test 1024 for asyncs 16, 17 and 18 + In test 1032 updated async messages to show the bcc recpt. This is + because of the change to make bcc recpts visible to the creator + and to all when target is an open conference. + Added sleep 2 before test 1310. Otherwise test 1311 may fail since + one of the clients has not been idle for long enough (lyskomd is + OK.) + Updated test 1333 to not show deleted items + Similar in 1334, 1335 and 1339. + + * src/server/testsuite/lyskomd.0/01.exp: Updated + query-predefined-aux-items test for item 27 + +1998-12-22 David Byers <davby@ida.liu.se> + + * src/server/conf-file.c (MAXLINE): Increased line length limit to + 1000 characters + 1998-12-22 Per Cederqvist <ceder@gratia> One more test. @@ -21,6 +115,22 @@ * doc/Protocol-A.texi (modify-system-info): Remove whitespace to avoid too long lines in the generated info file. +1998-12-17 David Byers <davby@ida.liu.se> + + * src/server/testsuite/config/Makefile.am (lyskomd-config): Use + aux-items.conf in this directory instead of in run-support. + + * src/server/text.c (modify_text_info): Call commit_aux_item_list. + + * src/server/conference.c (modify_conf_info): Call + commit_auc_item_list. + + * src/server/admin.c (modify_server_info): Call + commit_aux_item_list. + + * src/server/aux-items.c (commit_aux_item_list): New function to + really delete aux_items. + 1998-11-14 Per Cederqvist <ceder@gratia> Fixed another uninitialized memory problem: the allow_anon, @@ -152,6 +262,11 @@ current wording makes more sense, and it was also the implemented behavior, so update the specification rather than the program. +1998-10-12 David Byers <davby@anton9.ida.liu.se> + + * src/libraries/libcommon/Makefile.am (INCLUDES): Added -DSERVER + as in src/server + 1998-10-11 Jonas S Karlsson <jsk@lysator.liu.se> Aux-info defined for import/export of emails. @@ -200,6 +315,41 @@ * doc/Protocol-A.texi (login-old): The error-status indicates the person number when invalid-password is returned. +1998-10-08 David Byers <davby@ida.liu.se> + + * src/server/prot-a-output.c (prot_a_output_membership): Output + break_type. + + * src/server/ram-output.c (foutput_membership_2): Output + break_type. + + * src/server/ram-parse.c (fparse_membership_2): Parse break_type. + +1998-10-07 David Byers <davby@ida.liu.se> + + * src/server/text.c (recp_sent_by): New function. + (filter_secret_info): Let the sender of a bcc see a bcc and + let bccs to open conferences be visible to all. + +1998-10-06 David Byers <davby@ida.liu.se> + + * src/server/send-async.c (async_new_membership): New function. + (async_sub_recipient): Ditto. + (async_new_recipient): Ditto. + + * src/server/prot-a-send-async.c (prot_a_async_new_membership): + New function. + (prot_a_async_sub_recipient): Ditto. + (prot_a_async_new_recipient): Ditto. + + * src/server/text.c (send_async_add_recipient): New function. + (add_recipient): Send async-new-recipient + (send_async_sub_recipient): New function. + (do_sub_recpt): Send async-sub-recipient. + + * src/server/membership.c (send_async_new_membership): New function. + (add_member_common): Send async-new-membership + 1998-10-06 Per Cederqvist <ceder@gratia> Document bcc-recpt. A created person is a member of his mailbox. @@ -239,6 +389,55 @@ unused. Removed. * src/include/config.h (kom_errout): Was unused. Removed. +1998-10-04 David Byers <davby@ida.liu.se> + + * configure.in: Output to include/config.h + + * src/server/aux-items.c (delete_aux_item_list): Call undelete + triggers. + + * src/server/dbck.c: Moved BUGDECL to top level. + + * src/server/internal-connections.c (init_connection): Cast in + comparisons to get rid of compiler warnings. + + * src/server/text-garb.c: Moved BUGDECL to top level. + + * src/server/person.c: Moved BUGDECL to top level. + + * src/server/conference.c: Moved BUGDECL to top level. + + * src/server/membership.c (do_change_priority): Only fake the + passive flag when fake_passive is true. + + * src/server/connections.c (dump_statistics): Remove compiler + warnings by casting in comparisons. + + * src/include/kom-types.h: Declared fields of + Version_info_internal const to get rid of compiler warnings (plus, + it makes sense.) + + * src/server/simple-cache.c (cached_get_text): Remove compiler + warnings by casting in comparisons. + + * src/include/server/smalloc.h (SMALLOC_MAGIC_FREE): Declare + constants as unsigned to avoid compiler warnings. + + * src/server/ram-parse.c (fparse_string): Remove compiler warnings + by casting in comparisons. + + * src/server/local-to-global.c (find_block): Removed const + declarations to get rid of compiler warnings (it was cast away + anyway.) + + * src/libraries/libcommon/kom-errno.c: Include kom-config + + * src/server/admin.c: Conditionally include config.h + + * src/server/dbck.c (check_membership): Check duplicated info + between member and membership records. Redeclared mship param + as non-const. + 1998-10-04 Per Cederqvist <ceder@lysator.liu.se> * TODO: New file. @@ -1435,6 +1634,36 @@ * doc/Protocol-A.texi: Minor errata. * doc/security-levels.txt: Converted from swascii to latin1. +1998-06-14 David Byers <davby@ida.liu.se> + + * src/server/membership.c (copy_public_confs): The supervisor of a + conference can now see secret parts of member's memberships. + (get_members): Ditto. + (set_membership_type): Don't allow secret memberships if the + conference forbids it. + (add_member): Ditto. + (add_member): Pretend that addition worked if the person is + already a secret member. + (do_get_membership): Renamed from get_membership_old. + (get_membership_old): New function. + (get_membership): Call do_get_membership + (do_get_members): Renamed from get_members. + (copy_public_confs): New argument want_passive. + + * src/server/prot-a-output.c (prot_a_output_extended_conf_type): + Added output of forbid_secret. + + * src/server/prot-a-parse.c (prot_a_parse_conf_type): Added parse + of forbid_secret. + + * src/server/ram-parse.c (fparse_conf_type): Added parse of + forbid_secret. + + * src/server/ram-output.c (foutput_conf_type_1): Added output of + forbid_secret. + + * src/include/kom-types.h: Added forbid_secret conf_type. + 1998-06-10 David Byers <davby@ida.liu.se> * src/server/membership.c (sub_member): Return KOM_NOT_MEMBER for diff --git a/README b/README index 8c4d260c713ea98b74d4277146e4c2b4cf784a8e..17392e643d467167453ae6e3852d8521350e6af0 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ -- LysKOM server -- - Copyright (C) 1991, 1992, 1994 Lysator Academic Computer Association + Copyright (C) 1991-1998 Lysator Academic Computer Association ================================================================ @@ -26,14 +26,10 @@ like in netnews the articles are saved so that you don't have to be logged in to receive the news. As mentioned above, you need a client to be able to do something -useful with LysKOM. As of now, there is only one client that has been -released. It is written in elisp (and thus requires GNU Emacs to run) -and its language is Swedish. It should be easy to translate to -english since all text strings are collected in one source file. The -client is available via anonymous ftp from ftp.lysator.liu.se in the -directory pub/lyskom. Don't forget to fetch the documentation for it -at the same time - it is well worth reading it! (If you know -Swedish... :-) +useful with LysKOM. At this time there are several clients avaliable. +The most popular client is written in elisp and requires Gnu Emacs or +XEmacs to run. There are also web clients and a MS Windows client. See +<URL:http://www.lysator.liu.se/lyskom/> for availability of clients. A LysKOM server has been running at Lysator since July 25th 1990. You can connect to it and test it out if you like to get a feel for @@ -67,7 +63,7 @@ The testsuite ============= You should be able to compile, install and run lyskomd in almost any -reasonably modern Unix environment. The test suite, however, require +reasonably modern Unix environment. The test suite, however, requires that some special software is installed on your system. In the list below we give the location for the version that was used to run the test suite prior to release of the LysKOM server. Later versions may diff --git a/TODO b/TODO index 1bdbb7a7db42fdf1a7e5a94e0d85fd65a631401a..588a039b81986b01f15c0f326a10a81c2dd770a7 100644 --- a/TODO +++ b/TODO @@ -6,11 +6,14 @@ Before the next release These are show-stoppers that prevent a new release. -* Should the error message be named conference-zero or - zero-conference? (Protocol-A.texi) +* Missinc test cases in 03.exp + +* 89=create-person should probably not do an automatic login. (Wasn't + this discussed in KOM?) + + I think the current behavior is so deeply entrenched that we + shouldn't change the it. Leave it alone. -* 52=get-unread-confs should ignore conferences where you are a - passive member. * Read 45110, 45121, 45284 again and incorporate selected comments in this document. @@ -19,19 +22,9 @@ These are show-stoppers that prevent a new release. 1991 (start at text 170527) and incorporate selected information in this document. -* The Membership that is returned by 98=query-read-texts should - include the position of the Membership. - -* Mention explicitly in the protocol spec that the cient cannot send - "0 *" to the server. - -* Ability to have a callback function when an aux-item is created, - removed, changed or resurrected. (This is according to 3053346 - critical. Why?) - * Test the code for memory leaks. -* Fix dbck so that it can repair Member<->Membership inconsistencies. +* 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. @@ -45,55 +38,66 @@ These are show-stoppers that prevent a new release. * Document 104=map_created_texts -* Implement a test suite that tests all calls successfully at least once. - * Use libisc 1.0. * Update/rewrite README. -* Protocol-A.texi contains both INT32 and INTEGER. (3228850) - -* Protocol-A.texi uses mailbox and letterbox interchangeably. Use one - term only, or at least state explicitly that they are the same thing. - -* 89=create-person should probably not do an automatic login. (Wasn't - this discussed in KOM?) - -* String-Size is used but not defined in Protocol-A.texi. (3228850) - -* Session-No is defined twice in Protocol-A.texi. (3228850) - * Fix aux-item 13, 14 and 15 according to 3228006 and 3228045. * Fix the node structure of Protocol-A.texi (3228867). * Document aux-items for mail import/export. (3229403) -* Check the unused static function regarding aux-infos. - * Check that Async 13 is sent at the proper times (see 79208). * Integrate doc/Bugrapporter into this document. * The protocol revision section of Protocol-A.info is incomplete. +* The redirect aux-info needs more documentation. See FIXME comment + in Protocol-A.texi. + +* Check that texinfo.tex is included in a proper place by automake. + + + + +* Fix dbck so that it can repair Member<->Membership inconsistencies. + + DONE. Needs to be tested though. + +* Implement a test suite that tests all calls successfully at least + once. + + RESOLVED. + +* Should the error message be named conference-zero or + zero-conference? (Protocol-A.texi) + + RESOLVED: conference-zero + +* 52=get-unread-confs should ignore conferences where you are a + passive member. + + DONE. + * ceder thinks that the sender of a BCC recipient group should be allowed to see it, so that the sender can see when the recipient has read the text. (3380375, 3381048) + RESOLVED. + * ceder suspects that a BCC recipient group should be visible to anybody that may become a member of the BCC recipient (as opposed to all members and all administrators), lest everybody starts to be passive members of every conference just to be able to see BCC recipients. (3380375, 3381048) -* The redirect aux-info needs more documentation. See FIXME comment - in Protocol-A.texi. + RESOLVED. + -* Check that texinfo.tex is included in a proper place by automake. As soon as possible -=================== High priority, but they can wait until after the next release. @@ -107,8 +111,6 @@ High priority, but they can wait until after the next release. * Define and implement asynchronous messages for cache inconsitency. -* Validation of aux-items. - * Add a checksum on each object in the database. * The text-mass file should contain some redundancy. At a minimum, it @@ -148,3 +150,74 @@ Lower priority than the above-mentioned things. * Don't include so much information in the Person and Conference structures internally in the server. A Conference is (probably) used much more often than the large internal lists within it. + + +Fixed +===== + +* Mention explicitly in the protocol spec that the cient cannot send + "0 *" to the server. + + Already there. + +* Fix dbck so that it can repair Member<->Membership inconsistencies. + + Done. + +* Protocol-A.texi contains both INT32 and INTEGER. (3228850) + + Changed all INTEGER to INT32 + +* Protocol-A.texi uses mailbox and letterbox interchangeably. Use one + term only, or at least state explicitly that they are the same + thing. + + Letterbox used in structures, mailbox in text. It's safe to + replace all mailboxes with letterbox. + +* String-Size is used but not defined in Protocol-A.texi. (3228850) + + Use INT32 instead + +* Session-No is defined twice in Protocol-A.texi. (3228850) + + Removed second definition. + +* Check the unused static function regarding aux-infos. + + Done. + +* ceder thinks that the sender of a BCC recipient group should be + allowed to see it, so that the sender can see when the recipient has + read the text. (3380375, 3381048) + + Done. + +* ceder thinks that a BCC recipient group should be visible to anybody + that may become a member of the BCC recipient (as opposed to all + members and all administrators), lest everybody starts to be passive + members of every conference just to be able to see BCC recipients. + (3380375, 3381048) + + Done. + +* The redirect aux-info needs more documentation. See FIXME comment + in Protocol-A.texi. + + Fixed. + +* Validation of aux-items. + + Regexp validation done. + +* Ability to have a callback function when an aux-item is created, + removed, changed or resurrected. (This is according to 3053346 + critical. Why?) + + Done. + +* The Membership that is returned by 98=query-read-texts should + include the position of the Membership. + + Whatever. Done. + diff --git a/configure.in b/configure.in index 340d6b1ab1432c7402c8ad8cbc3bee1aec61e202..d544bfb48f06878e66d01971417f4854f2257a3f 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.50 1998/08/09 11:29:32 ceder Exp $ +dnl $Id: configure.in,v 1.51 1998/12/26 22:40:10 byers Exp $ dnl Configuration for LysKOM dnl Copyright (C) 1993, 1994, 1995, 1996 Lysator Academic Computer Association. dnl @@ -18,8 +18,9 @@ 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.50 $) +AC_REVISION($Revision: 1.51 $) AC_INIT(src/server/lyskomd.h) +AM_CONFIG_HEADER(config.h) AC_CONFIG_AUX_DIR(scripts) AM_INIT_AUTOMAKE(lyskom-server, 2.0.0.pcl.2) diff --git a/doc/Protocol-A.texi b/doc/Protocol-A.texi index ab487d3622ec0251e274bd719e89d47f9ec7b874..8268ba67e8e4849a9105b958f7b676abb436b4ce 100644 --- a/doc/Protocol-A.texi +++ b/doc/Protocol-A.texi @@ -1,5 +1,5 @@ \input texinfo @c -*-texinfo-*- -@c $Id: Protocol-A.texi,v 1.43 1998/12/20 19:31:57 ceder Exp $ +@c $Id: Protocol-A.texi,v 1.44 1998/12/26 22:40:12 byers Exp $ @c %**start of header @setfilename protocol-a.info @settitle LysKOM Protocol A @@ -461,7 +461,7 @@ Conferences hold articles. They are represented in the protocol as a data type called @code{Conference}. Each conference has a @emph{creator}, the person who created the conference, and a @emph{supervisor}, a conference whose members can modify the conference. -If the supervisor is a person, the members of that person's letterbox +If the supervisor is a person, the members of that person's mailbox are supervisors, which in most cases is only that person. We have also introduced a type called @code{UConference} (pronounced micro-conf-stat) which holds a subset of the information contained in the full @@ -484,18 +484,21 @@ restriction is currently not enforced by the server; clients must implement this functionality. @item letterbox Conferences of this type are connected to persons. Letters to a person -are sent to the letterbox and the name of the letterbox is synchronized +are sent to the mailbox and the name of the mailbox is synchronized with the person name. It is currently not possible to explicitly set or clear this flag on a conference. @item secret Conferences of this type are secret. The server will not divulge any information of the existence of the conference to persons who are not -members or supervisors of the conference. If a letterbox is made secret, +members or supervisors of the conference. If a mailbox is made secret, that person cannot log in using the person name, but must specify a person number instead. @item allow-anonymous Conferences of this type accept anonymous articles. Other conferences will reject anonymous articles. +@item forbid-secret +Conferences of this type do not allow secret members. If a conference is +changed to this type, preexisting secret members remain secret. @end table @@ -687,7 +690,7 @@ server and in protocol A. Aux-items were introduced in protocol version 10 as a mechanism for extending the conference, text and server information structures without changing the protocol. Persons were excluded since nobody could figure -out a case where setting an aux-item on the letterbox wasn't as good as +out a case where setting an aux-item on the mailbox wasn't as good as setting it on the person (another reason was that I was fed up writing aux-item code by the time they were working on texts and conferences.) @@ -748,17 +751,22 @@ created per creator. Data is a string that constitutes a brief comment to the text. This comment should be displayed immediately after the text body. -The inherit bit is automatically cleared. +An item of this type will never be inherited, can always be deleted, is +never anonymous and is never secret. @item cross-reference [3] (text, conference) -Data is a cross-reference to something else. The contents must match -"\(T\|C\|P\)\([0-9]+\) \(.*\)", where \1 specifies if the cross -reference leads to a text, conference or person, \2 specified the number -of the target (text-no, conf-no or pers-no) and \3 is simply descriptive -text. +Data is a cross-reference to something else. The contents consist of a +letter, a number, a space and a descriptive text. The letter must be one +of T, C or P. T specifies that the cross-reference points to a text; C +that it points to a conference; and P that it points to a person. The +number is the id of the target of the cross reference. The descriptive +text is simly that, a text that describes the cross-reference. For +example, "T15 Check this out!" is a cross reference to text 15 with a +description that reads "Check this out!". -The inherit bit is automatically cleared. +The inherit bit is automatically cleared and the item can always be +deleted. @item no-comments [4] (text) @@ -797,37 +805,42 @@ this item without an explicit confirmation from the user that the text has indeed been read. The hide-creator, secret and inherit bits are automatically cleared. +Once created an item of this type cannot be deleted. @item redirect [8] (conference) - -When set, messages sent directly to the conference should really be -sent elsewhere. Data is PROTOCOL:ADDRESS where PROTOCOL is either -"E-mail" or "LysKOM", and ADDRESS is either an e-mail address or a -LysKOM conference. Hopefully we'll be able to replace this with a -forwarding mechanism later. +This item indicates that texts should not be sent to the conference, +but be directed to some other target instead. Clients should notify +users that attempt to send texts to the conference of the redirect and +offer to send the text to the target of the redirect instead. A typical +use of this item would be a user that does not read LysKOM very often +and would like to advise other users to send e-mail instead. + +Data is PROTOCOL:ADDRESS where PROTOCOL is either "E-mail" or "LysKOM", +and ADDRESS is either an e-mail address or a LysKOM conference. +Hopefully we'll be able to replace this with a forwarding mechanism +later. This item can only be set by the conference supervisor or in the case of -a letterbox, the person attached to the letterbox. The hide-creator and +a mailbox, the person attached to the mailbox. The hide-creator and secret bits are cleared automatically. Only one redirect can be specified. -@c FIXME: who is responsible for the redirect? The client? The server? -@c A magic redirecting client? - @item x-face [9] (conference) Data is the face of the person in compface format. Cool, innit? This item can only be set by the conference supervisor or in the case of -a letterbox, the person attached to the letterbox. The hide-creator and +a mailbox, the person attached to the mailbox. The hide-creator and secret bits are cleared automatically. @item alternate-name [10] (text, conference) Data is a string that the client may use as an alternate to the name of -a conference or the subject of a text. +a conference or the subject of a text. Note that the server does not +match against this name when performing name lookups. Clients should +only display alternate names created by the user currently logged on. The inherit flag is automatically cleared. @@ -835,7 +848,7 @@ The inherit flag is automatically cleared. @item pgp-signature [11] (text) Data is a PGP signature of the text. The signature should be the -equivalent of what "pgp -sba" generates. +equivalent of what "pgp -sba" in PGP 2.6.2 generates. The secret, hide-creator and inherit bits are automatically cleared. Signatures cannot be deleted once they have been created. @@ -846,31 +859,40 @@ Signatures cannot be deleted once they have been created. Data is the public key of the person. It is desirable that the public key contains a userid of the format "LysKOM <p\([0-9]\)@@\(.*\)>+", where \1 is the number of the person in the LysKOM server specified in \2. +This rule is currently not enforced. This item can only be set by the person himself. The hide-creator, secret and inherit bits are automatically cleared. + @item e-mail-address [13] (conference, letterbox, server) -Data is an RFC 822-style email address. When set on a letterbox, it -should be the email address of the person. If the person has multiple +Data is an RFC 822-style email address. When set on a mailbox, it +should be the email address of the person. If the person has multiple email addresses he may set serveral e-mail-address aux-items. The meaning of this aux-item when set on a conference that isn't a -letterbox is... vague. For a conference that is used as to import a -mailing list this should be the email address of the list (or the -subscription address? FIXME.). +mailbox is vague. For a conference that is used as to import a mailing +list this should be the email address of the list. For other conferences +we haven't really defined a sensible use. When this aux-item is set on the server it shold contain the email address of the administrator (or administrators). -This aux-item can only be set by the administrator. The creator cannot -be hidden. +This aux-item can only be set by the supervisor of a conference or the +server administrator. The creator cannot be hidden. + @item faq-text [14] (conference, server) Data is a decimal text number, which is a FAQ for the conference (or -server). This aux-item can only be set by the administrator. +server). This aux-item can only be set by the administrator. Adding +this item to a conference or to the server automatically marks the text. +Deleting the item unmarks the text. + +This item can only be set by the supervisor or server administrator. The +hide-creator, secret, and inherit bits are automatically cleared. + @item creating-software [15] (text) @@ -980,9 +1002,20 @@ Data is a string with either an email name on the same format as aux-info rediret [8]. The mail is forwarded to this address if it was rejected by "x-import-filter". -@end table +@item notify-comments [27] (letterbox) + +Data is a decimal text number that the user is interested in. Clients +should monitor this text for unread comments and present these to the +user in some convenient manner. This is typically used by users that +want to read comments to some text of theirs as soon as they arrive, +rather than in the normal reading order. + +This item can only be set by the owner of the letterbox. No flags are +forced or cleared. +@end table + @node Client-Specific Aux-Item Types, Experimental Aux-Item Types, Predefined Aux-Item Types, The Aux-Item List @subsubsection Client-Specific Aux-Item Types @@ -1294,6 +1327,46 @@ most peoples idea of @code{shape-of-world} would be sent as @code{0101} (round and three-dimensional.) +@subsection Enumerations + +@tindex ENUMERATION +@dfn{ENUMERATION} is an integer constant. It is transmitted as an INT32, +but only fixed values are permitted. Clients should be prepared to +receive numbers outside the enumeration and either handle this +gracefully as an error or use a reasonable default value in place of an +invalid enumeration value. + +An enumeration is specified as + +@example + ENUMERATION ( + name-1=value-1; + name-2=value-2; + name-3=value-3; + ... + ) +@end example + +This specification states that name-1 is represented by the integer +value-1, name-2 is represented by value-2 and name-3 is represented by +value-3. + +For example, in the following specification, the constant guwal will be +transmitted as the integer 2, ciokwe as the integer 3, and hopi as the +integer 5. + +@example + language : ENUMERATION ( hakka = 1; + guwal = 2; + ciokwe = 3; + yoruba = 4; + hopi = 5; + ) +@end example + + + + @subsection Arrays @tindex ARRAY @@ -1593,7 +1666,7 @@ The object the item is set on will not be garbage-collected. secret; letterbox; allow-anonymous; - reserved1; + forbid-secret; reserved2; reserved3; ) @@ -1627,6 +1700,10 @@ Set if the conference is a person's mailbox. @item allow-anonymous Set if anonymous articles are allowed in the conference. +@item forbid-secret +If set, secret members cannot be added to the conference. + + @item reserved1 @itemx reserved2 @itemx reserved3 @@ -1674,7 +1751,7 @@ conferences based on their names. nice : Garb-Nice; no-of-members : INT16; first-local-no : Local-Text-No; - no-of-texts : INTEGER; + no-of-texts : INT32; ) Conference ::= @@ -1691,7 +1768,7 @@ conferences based on their names. nice : Garb-Nice; no-of-members : INT16; first-local-no : Local-Text-No; - no-of-texts : INTEGER; + no-of-texts : INT32; expire : Garb-Nice; aux-items : ARRAY Aux-Item; ) @@ -1728,12 +1805,12 @@ The article containing the conference presentation or zero if the conference has no presentation. @item supervisor The conference@footnote{The @code{supervisor} may be a person, in which -case the members of that person's letterbox become supervisors.} who +case the members of that person's mailbox become supervisors.} who supervises this conference. @item permitted-submitters The conference whose members@footnote{@code{permitted-submitters} can be a person, in which case all persons who are members of the associated -letterbox are allowed to submit articles to the conference.} may submit +mailbox are allowed to submit articles to the conference.} may submit articles to the conference, or zero if anyone may do so. @item super-conf The conference that receives comments if this conference does not accept @@ -2084,7 +2161,7 @@ to see the contents of the structure. read-texts : ARRAY Local-Text-No; added-by : Pers-No; added-at : Time; - type : Membership-Type; + type : Membership-Type; ) @end example @@ -2170,8 +2247,8 @@ values. Text-Stat-Old ::= ( creation-time : Time; author : Pers-No; - no-of-lines : INTEGER; - no-of-chars : String-Size; + no-of-lines : INT32; + no-of-chars : INT32; no-of-marks : INT16; misc-info : ARRAY Misc-Info; ) @@ -2179,8 +2256,8 @@ values. Text-Stat ::= ( creation-time : Time; author : Pers-No; - no-of-lines : INTEGER; - no-of-chars : String-Size; + no-of-lines : INT32; + no-of-chars : INT32; no-of-marks : INT16; misc-info : ARRAY Misc-Info; aux-items : ARRAY Aux-Item; @@ -2359,7 +2436,7 @@ d@ae{}mon session : Session-No; what-am-i-doing : HOLLERITH; username : HOLLERITH; - idle-time : INTEGER; + idle-time : INT32; connection-time : Time; ) @@ -2371,12 +2448,10 @@ d@ae{}mon username : HOLLERITH; hostname : HOLLERITH; ident-user : HOLLERITH; - idle-time : INTEGER; + idle-time : INT32; connection-time : Time; ) - Session-No ::= INTEGER; - Static-Session-Info ::= ( username : HOLLERITH; @@ -2400,7 +2475,7 @@ d@ae{}mon ( session : Session-No; person : Pers-No; working-conference : Conf-No; - idle-time : INTEGER; + idle-time : INT32; flags : Session-Flags; what-am-i-doing : HOLLERITH; ) @@ -2780,7 +2855,7 @@ The session is not logged in yet. @item undefined-conference Conference @code{conference} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item not-member @@ -2813,7 +2888,7 @@ The session is not logged in yet. @item undefined-conference Conference @code{conference} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied @@ -2931,7 +3006,7 @@ Person @code{person} does not exist. @item undefined-conference Conference @code{person} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @end table @@ -3068,7 +3143,7 @@ articles 135, 136 and 137 have been read. @code{person} does not exist, or no access to person. @item undefined-conference Conference @code{conference} does not exist, or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item not-member @code{person} is not a member of @code{conference}. @@ -3197,14 +3272,14 @@ Login required before issuing this call. @item undefined-conference @code{conf} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied Not supervisor of @code{conf} and not enough privileges enabled. @item undefined-person -@code{conf} is a letterbox but does not exist as a person (the database +@code{conf} is a mailbox but does not exist as a person (the database is corrupt.) @end table @@ -3252,7 +3327,7 @@ This call always succeeds. @findex get-conf-stat-older @example get-conf-stat-older [13] (( conf-no : Conf-No; - mask : INTEGER )) + mask : INT32 )) -> ( Conference-Old ); @end example @@ -3270,7 +3345,7 @@ returned instead of the name. @table @code @item undefined-conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @end table @@ -3324,7 +3399,7 @@ Login required before issuing this call. @item undefined-conference Conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item undefined-person @@ -3381,7 +3456,7 @@ Login required before issuing this call. @item undefined-conference Conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item undefined-person @@ -3447,7 +3522,7 @@ Login required before issuing this call. @item undefined-conference Conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied @@ -3513,7 +3588,7 @@ Login required before issuing this call. @item undefined-conference Conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied @@ -3540,7 +3615,7 @@ marks. The set-supervisor call changes the supervisor of an existing conference. The result is that all members of the conference @code{admin} become supervisors of the conference @code{conf-no}. -Typically, but not always, @code{admin} will be a letterbox. +Typically, but not always, @code{admin} will be a mailbox. @i{Example:} @example @@ -3577,7 +3652,7 @@ Login required before issuing this call. Conference @code{conf-no} or conference @code{admin} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied @@ -3640,7 +3715,7 @@ Login required before issuing this call. Conference @code{conf-no} or conference @code{perm-sub} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied @@ -3682,7 +3757,7 @@ Login required before issuing this call. @item undefined-conference Conference @code{conf-no} or conference @code{super-conf} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied Not enough permissions to change super-conference of conference @@ -3726,7 +3801,7 @@ the conference type before and after the set-conf-type call. Login required before issuing this call. @item undefined-conference Conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item secret-public @code{type} has both the @code{secret} bit and @code{rd-prot} bits set. @@ -3772,7 +3847,7 @@ from 77 to just seven days. Login required before issuing this call. @item undefined-conference Conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied Not enough permissions to change the expiration time for conference @@ -3856,8 +3931,8 @@ many marks, or cause the text to have too many marks. @findex get-text @example get-text [25] (( text : Text-No; - start-char : INTEGER; - end-char : INTEGER; )) + start-char : INT32; + end-char : INT32; )) -> ( HOLLERITH ); @end example @@ -3990,7 +4065,7 @@ Text-Stat and calling mark-as-read once for each recipient. Login required before issuing this call. @item undefined-conference The conference @code{conference} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item not-member The person logged on is not a member of conference @code{conference}. @@ -4169,7 +4244,7 @@ Login required before issuing this call. @item undefined-conference The conference @code{conf-no} does not exist. -@item zero-conference +@item conference-zero @code{conference} is zero. @item no-such-text @@ -4243,7 +4318,7 @@ The conference @code{conf-no} is not a recipient of text @code{text-no}. @item undefined-conference The conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item permission-denied @@ -4365,7 +4440,7 @@ anyway. @example get-map [34] (( conf-no : Conf-No; first-local-no : Local-Text-No; - no-of-texts : INTEGER; )) + no-of-texts : INT32; )) -> ( Text-List ); @end example @@ -4446,7 +4521,7 @@ exist, and 4 corresponds to 480, and 5 to 485. Login required before issuing this call. @item undefined-conference Conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conf-no} is zero. @item access-denied Conference @code{conf-no} is read protected. @@ -4660,7 +4735,7 @@ This call always succeeds. @findex set-unread @example set-unread [40] (( conf-no : Conf-No; - no-of-unread : INTEGER; )) + no-of-unread : INT32; )) -> ( ); @end example @@ -4943,7 +5018,7 @@ person's membership list. @example get-created-texts [47] (( person : Pers-No; first : Local-Text-No; - no-of-texts : INTEGER; )) + no-of-texts : INT32; )) ( Text-List ); @end example @@ -5124,7 +5199,7 @@ future. @end example This simple example retrieves conferences 1 and 8 from the server. -Conference 1 is a regular conference, and conference 8 is a letterbox. +Conference 1 is a regular conference, and conference 8 is a mailbox. @unnumberedsubsubsec Error codes @@ -5970,8 +6045,8 @@ The text @code{text-no} was not marked. This call returns a list of those conferences and/or persons matching the regular expression @code{regexp}. If @code{want-confs} is true, then -the result will include non-letterbox conferences. If -@code{want-persons} is true, then the result will include letterbox +the result will include non-mailbox conferences. If +@code{want-persons} is true, then the result will include mailbox conferences. See also @pxref{lookup-z-name} for an alternative way to look up names. @@ -6051,8 +6126,8 @@ This call always succeeds. This call looks up the name @code{name} in the server, and returns a list of all matching conferences and/or persons. If @code{want-confs} is true, then the result will include conferences that are not -letterboxes. If @code{want-pers} is true, then the result will include -conferences that are letterboxes. +mailboxes. If @code{want-pers} is true, then the result will include +conferences that are mailboxes. See also @pxref{re-z-lookup} for an alternative way to look up names. @@ -6165,7 +6240,7 @@ person, is retrieved. Note the difference in length of the flag field. @table @code @item undefined-conference The conference @code{conference} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @end table @@ -6587,10 +6662,10 @@ This call requests that the server create a new person with the name and password given as arguments. To create a person the session must be logged in as a person with sufficient privileges. The list @code{aux-items} contains the aux items that are to be attached to the -new person's letterbox conference. +new person's mailbox conference. The new person will be a member of exactly one conference: the -associated letterbox. That membership will have priority 255 and (of +associated mailbox. That membership will have priority 255 and (of course) position 0. All flags of the membership will be 0. @@ -6614,7 +6689,7 @@ The string @code{passwd} is not a valid password. @item illegal-aux-item One of the aux-items in @code{aux-items} is illegal. The tag might be -out of range, the item not applicable to conferences or letterboxes or +out of range, the item not applicable to conferences or mailboxes or whatever. @item aux-item-permission @@ -6842,7 +6917,8 @@ complete the call anyway. @example query-read-texts [98] (( person : Pers-No; conference : Conf-No; )) - -> ( Membership ); + -> (( position : INT32; + mship : Membership )); @end example This call is used to find the number of unread texts in a conference. @@ -6878,7 +6954,7 @@ person 5, and it is passive. @code{person} does not exist, or no access to person. @item undefined-conference Conference @code{conference} does not exist, or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item not-member @code{person} is not a member of @code{conference} or insufficient @@ -7000,7 +7076,7 @@ Login required before issuing this call. @item undefined-conference Conference @code{conf-no} does not exist or is secret. -@item zero-conference +@item conference-zero @code{conference} is zero. @item undefined-person @@ -7102,7 +7178,7 @@ Login required before issuing this call. @example local-to-global [103] (( conf-no : Conf-No; first-local-no : Local-Text-No; - no-of-existing-texts : INTEGER; )) + no-of-existing-texts : INT32; )) -> ( Text-Mapping ); @end example @@ -7125,7 +7201,7 @@ Login required before issuing this call. @example map-created-texts [104] (( author : Pers-No; first-local-no : Local-Text-No; - no-of-existing-texts : INTEGER; )) + no-of-existing-texts : INT32; )) -> ( Text-Mapping ); @end example @@ -7195,6 +7271,9 @@ reject them if a client uses it as an argument to * async-logout:: A person has logged out (13) * async-deleted-text:: A text was deleted (14) * async-new-text:: A text has been created (15) +* async-new-recipient:: A new recipient has been added to a text (16) +* async-sub-recipient:: A recipient has been removed from a text (17) +* async-new-membership:: A user has been added to a conference (18) ------------------------------------------------------------------------------- @end menu @@ -7370,8 +7449,8 @@ This message is sent when someone sends a message string. The recipient of the message is sent in @code{recipient}. If it is zero, then the message was sent to all connections. If it is a conference, then the message is being sent to all logged-in members of that conference. If it -is a letterbox then the message is personal and is only sent to members -of the letterbox conference. +is a mailbox then the message is personal and is only sent to members +of the mailbox conference. @@ -7403,7 +7482,7 @@ deleted is sent in @code{text-no} and the text stat in @code{text-stat.} -@node async-new-text, , async-deleted-text, Asynchronous Messages +@node async-new-text, async-new-recipient, async-deleted-text, Asynchronous Messages @subsection async-new-text (10) Recommended @example @@ -7416,6 +7495,54 @@ number @code{text-no}, and the text stat is @code{text-stat}. The message is sent to all logged-in members of any recipient of the text. +@node async-new-recipient, async-sub-recipient, async-new-text, Asynchronous Messages +@subsection async-new-recipient (10) Recommended + +@example + async-new-recipient [16] (( text-no : Text-No; + conf-no : Conf-No; + type : Misc-Info; )); +@end example + +This message indicates that a new recipient has been added to text +@code{text-no}. The recipient added is @code{conf-no} and the type of +recipient is indicated by @code{type}. This message is sent to all +recipients of the text that are permitted to know about the new +recipient. + + + +@node async-sub-recipient, async-new-membership, async-new-recipient, Asynchronous Messages +@subsection async-sub-recipient (10) Recommended + +@example + async-sub-recipient [17] (( text-no : Text-No; + conf-no : Conf-No; + type : Misc-Info; )); +@end example + +This message indicates that a recipient has been removed from text +@code{text-no}. The recipient removed is @code{conf-no} and the type of +recipient is indicated by @code{type}. This message is sent to all +recipients of the text that are permitted to know about the new +recipient. + + +@node async-new-membership, , async-sub-recipient, Asynchronous Messages +@subsection async-new-membership (10) Recommended + +@example + async-new-membership [18] (( pers-no : Pers-No; + conf-no : Conf-No; )); +@end example + +This message indicates that the membership for @code{pers-no} in +conference @code{conf-no} has been added or reprioritized. This message +is currently sent only to @code{pers-no}, but that may change in the +future. + +See also @pxref{async-leave-conf}. + @node Error Codes, , , Top @@ -7549,9 +7676,9 @@ Attempt to create a person with a name that's already occupied. but you never know for sure. @item secret-public (22) -Attempt to give a conference a type with both the @code{secret} and -@code{rd-prot} bits set at the same time. This is an error since such a -conference type is inconsistent. @code{error-status} is undefined. +Attempt to give a conference a type with @code{secret} bit set and the +@code{rd-prot} bit unset. This is an error since such a conference type +is inconsistent. @code{error-status} is undefined. @item letterbox (23) Attempt to change the @code{letterbox} flag of a conference. diff --git a/doc/aux-info.doc b/doc/aux-info.doc index 94c85c78daaefd8503ff94b4ec562e48e1b27d02..3bb003abad4cbcbf86374f659be1da0169e116c7 100644 --- a/doc/aux-info.doc +++ b/doc/aux-info.doc @@ -21,17 +21,21 @@ Each entry in this file has the following format: Tag is an integer, the aux-item's tag. The last definition of a tag overrides all previous definitions of that tag. Each target is one of -`server', `text', `conference' or `letterbox', and defines which kind -of object the item can be attached to. If `server' is listed, items -with this tag can be attached to the server information. If `text' is -listed, items with this tag can be attached to texts; if `conference' -is listed, they can be attached to conferences; if `letterbox' is -listed, but `conference' is not, they can be attached to letterbox -conferences. Field is an identifier (see below). Value is a boolean -constant (`true', `false', `yes', `no', `on' or `off'); an integer; or -a string enclosed in double quotes (C-style escapes are probably -supported.) Some items have trillian values. They can be set to -boolean values in the file, but the default is some other value. +`server', `text', `conference', `letterbox' or `any�, and defines +which kind of object the item can be attached to. If `server' is +listed, items with this tag can be attached to the server +information. If `text' is listed, items with this tag can be attached +to texts; if `conference' is listed, they can be attached to +conferences that are not letterboxes; if `letterbox' is listed, but +`conference' is not, they can be attached to letterbox +conferences. The special target `any' specifies that the item can be +attached to any kind of object in the database (it is equivalent to +`server,conference,text,letterbox'.) Field is an identifier (see +below). Value is a boolean constant (`true', `false', `yes', `no', +`on' or `off'); an integer; or a string enclosed in double quotes +(C-style escapes are probably supported.) Some items have trillian +values. They can be set to boolean values in the file, but the default +is some other value. The following fields can be assigned to: @@ -68,10 +72,11 @@ hide-creator Trillian. When set, the hide-creator bit on new items with this tag is forced to the specified value. +dont-garb Trillian. When set, the dont-garb bit on new + items will be forced to the specified value. + 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. -dont-garb Trillian. When set, the dont-garb bit on new - items will be forced to the specified value. diff --git a/doc/man/lyskomd.8 b/doc/man/lyskomd.8 index 620ff7b75258dadbffba8f0ed81f93ff1f445ab9..a789f4abc46717153a708ffe711480a56fdd20ed 100644 --- a/doc/man/lyskomd.8 +++ b/doc/man/lyskomd.8 @@ -1,4 +1,4 @@ -.\" $Id: lyskomd.8,v 1.30 1998/10/11 17:20:12 ceder Exp $ +.\" $Id: lyskomd.8,v 1.31 1998/12/26 22:40:16 byers Exp $ .\" Copyright (C) 1991, 1994 Lysator Academic Computer Association. .\" .\" This file is part of the LysKOM server. @@ -21,8 +21,8 @@ .\" .\" Please mail bug reports to bug-lyskom@lysator.liu.se. .\" -.\" $Id: lyskomd.8,v 1.30 1998/10/11 17:20:12 ceder Exp $ -.\" $Date: 1998/10/11 17:20:12 $ +.\" $Id: lyskomd.8,v 1.31 1998/12/26 22:40:16 byers Exp $ +.\" $Date: 1998/12/26 22:40:16 $ .TH lyskomd 8 "January 12, 1994" "Lysator" .SH NAME lyskomd - LysKOM server @@ -429,6 +429,12 @@ membership even after it has been cleared. If it is not set, then the invitation bit of a conference type can only be set when the membership is created. It can be cleared at any time. This is off by default. +.TP +.B regexps use collate table: bool +If this is set, regexp matching of conference names uses the same +collate table used by regular matching. This usually implies that the +regexp "foo" will match "foo", "Foo", "fOo" and several other +variants. The defalt is on. .SH SIGNALS There are some signals that have a special meaning to the LysKOM server. diff --git a/mkmi b/mkmi index c5082a14c54e0032782e9056489f37bc0cba4c31..265a476bad717d4545251096e2f10b4beb2777ff 100755 --- a/mkmi +++ b/mkmi @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: mkmi,v 1.11 1998/08/09 12:11:32 ceder Exp $ +# $Id: mkmi,v 1.12 1998/12/26 22:40:10 byers Exp $ # Generate Makefile.in from Makefile.src template # Copyright (C) 1994, 1995 Lysator Academic Computer Association. # @@ -36,6 +36,7 @@ rm -f \ INSTALL aclocal +autoheader automake -a autoconf diff --git a/run-support/aux-items.conf b/run-support/aux-items.conf index 59adeee72cea979b7d085dd43f5289e1a2d8c61d..29c3bed99eb25eba37950316ada166e25c975888 100644 --- a/run-support/aux-items.conf +++ b/run-support/aux-items.conf @@ -1,5 +1,5 @@ # -# $Id: aux-items.conf,v 1.4 1998/08/14 18:34:48 ceder Exp $ +# $Id: aux-items.conf,v 1.5 1998/12/26 22:40:17 byers Exp $ # Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association. # # This file is part of the LysKOM server. @@ -64,7 +64,7 @@ # Cross reference from one object to another # -3 : cross-reference (text, conference) +3 : cross-reference (text, conference, letterbox) { dont-garb = false; inherit = false; @@ -136,7 +136,7 @@ # Request redirect of texts from one conference to another or to e-mail # -8 : redirect (conference) +8 : redirect (conference, letterbox) { dont-garb = false; supervisor-only = true; @@ -148,7 +148,7 @@ # Graphics in compface format # -9 : x-face (conference, server) +9 : x-face (conference, letterbox, server) { secret = false; hide-creator = false; @@ -163,7 +163,7 @@ # Alternate name (subject or name) selected by the creator # -10 : alternate-name (text, conference) +10 : alternate-name (text, conference, letterbox) { dont-garb = false; inherit = false; @@ -226,8 +226,13 @@ add-trigger = mark-text(); delete-trigger = unmark-text(); undelete-trigger= mark-text(); + validate = "^[0-9][0-9]*$"; } +# +# Name of the creating software +# + 15 : creating-software (text) { author-only = true; @@ -237,3 +242,13 @@ dont-garb = false; inherit = false; } + +# +# Notify user about comments to text +# + +27 : notify-comments (letterbox) +{ + author-only = true; + validate = "^[0-9]+$"; +} diff --git a/src/include/kom-types.h b/src/include/kom-types.h index 9b4221c0eeec63948f4d1067bfdae275b77aca50..0f55bb4dfcf1ce08ca94ec483db124ce4ed5ae19 100644 --- a/src/include/kom-types.h +++ b/src/include/kom-types.h @@ -1,5 +1,5 @@ /* - * $Id: kom-types.h,v 0.28 1998/08/05 16:12:36 ceder Exp $ + * $Id: kom-types.h,v 0.29 1998/12/26 22:40:18 byers Exp $ * Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -283,7 +283,7 @@ typedef struct { */ unsigned int letter_box : 1; /* Is this a letter box? */ unsigned int allow_anon : 1; /* do we accept anonymous messages */ - unsigned int reserved1 : 1; + unsigned int forbid_secret : 1; /* do we allow secret members */ unsigned int reserved2 : 1; unsigned int reserved3 : 1; } Conf_type; @@ -335,6 +335,13 @@ typedef struct { Membership_type type; } Membership; +/* Information about a membership and its location */ + +typedef struct { + unsigned long position; + Membership membership; +} Extended_Membership; + /* Some structs to handle variable-sized arrays. */ diff --git a/src/include/server/smalloc.h b/src/include/server/smalloc.h index 012934d703f27bd9614838118d27837291a3fefc..880227fe8dd105666d373ab06a7d2a8b5ba42150 100644 --- a/src/include/server/smalloc.h +++ b/src/include/server/smalloc.h @@ -1,5 +1,5 @@ /* - * $Id: smalloc.h,v 0.6 1995/01/01 20:17:09 ceder Exp $ + * $Id: smalloc.h,v 0.7 1998/12/26 22:40:20 byers Exp $ * Copyright (C) 1991, 1992, 1994, 1995 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -34,8 +34,8 @@ */ -#define SMALLOC_MAGIC_ALLOC 0x12FE56A0 -#define SMALLOC_MAGIC_FREE 0xCA348E63 +#define SMALLOC_MAGIC_ALLOC 0x12FE56A0u +#define SMALLOC_MAGIC_FREE 0xCA348E63u /* * "safe" malloc. Handles the case when malloc returns NULL. diff --git a/src/include/services.h b/src/include/services.h index 60d16ab569dc325c51b4efe7c4711892785e1d37..576f50b694c96437e4f5939914bf05a169195512 100644 --- a/src/include/services.h +++ b/src/include/services.h @@ -1,5 +1,5 @@ /* - * $Id: services.h,v 0.37 1998/08/22 17:40:19 ceder Exp $ + * $Id: services.h,v 0.38 1998/12/26 22:40:19 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -216,7 +216,7 @@ KOM_( query_read_texts_old (Pers_no pers_no, extern Success KOM_( query_read_texts (Pers_no pers_no, Conf_no conf_no, - Membership * result )); + Extended_Membership * result )); extern Success diff --git a/src/libraries/libcommon/Makefile.am b/src/libraries/libcommon/Makefile.am index 476ad66a812015e5b0bedf72d51abf73ed93f676..12dccc9ffb8e48e95a3b8dbd80796c349581e41e 100644 --- a/src/libraries/libcommon/Makefile.am +++ b/src/libraries/libcommon/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.2 1998/07/11 23:28:40 ceder Exp $ +# $Id: Makefile.am,v 1.3 1998/12/26 22:40:21 byers Exp $ # Copyright (C) 1998 Lysator Academic Computer Association. # # This file is part of the LysKOM server. @@ -29,4 +29,4 @@ liblyskom_server_a_SOURCES = kom-errno.c misc-parser.c parser.c \ EXTRA_DIST = .cvsignore ChangeLog.1 -INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/../libmisc +INCLUDES = -DSERVER -I$(srcdir)/../../include -I$(srcdir)/../libmisc diff --git a/src/server/admin.c b/src/server/admin.c index e46b8c73b8d40b381b06870c59860bea571f6b84..affe92c11a97e2cca8c9eeb66f4093f6b46572dd 100644 --- a/src/server/admin.c +++ b/src/server/admin.c @@ -1,5 +1,5 @@ /* - * $Id: admin.c,v 0.28 1998/10/22 22:10:15 ceder Exp $ + * $Id: admin.c,v 0.29 1998/12/26 22:40:22 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,12 @@ * Administrative calls. */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: admin.c,v 0.28 1998/10/22 22:10:15 ceder Exp $"; +rcsid = "$Id: admin.c,v 0.29 1998/12/26 22:40:22 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -50,7 +54,7 @@ USE(rcsid); #include "connections.h" #include "kom-errno.h" #include "cache.h" -#include "config.h" +#include "kom-config.h" #include "log.h" #include "send-async.h" #include "param.h" @@ -376,6 +380,7 @@ modify_server_info(Number_list *items_to_delete, } system_add_aux_item_list(&kom_info, items_to_add, ACTPERS); + commit_aux_item_list(&kom_info.aux_item_list); return OK; } diff --git a/src/server/async.h b/src/server/async.h index 5d1d537a11d62f9f25bdc884d50b836aa8fbb9ba..501dfbcb01adf59f412f8f23b262b631dd1337e4 100644 --- a/src/server/async.h +++ b/src/server/async.h @@ -1,5 +1,5 @@ /* - * $Id: async.h,v 0.12 1998/08/07 23:30:47 ceder Exp $ + * $Id: async.h,v 0.13 1998/12/26 22:40:23 byers Exp $ * Copyright (C) 1991, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,7 +23,7 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ /* - * $Id: async.h,v 0.12 1998/08/07 23:30:47 ceder Exp $ + * $Id: async.h,v 0.13 1998/12/26 22:40:23 byers Exp $ * * This file contains the parts of the async protocol that are common * to the server and the client. @@ -59,6 +59,13 @@ typedef enum { ay_logout = 13, /* Someone logs out. */ ay_deleted_text = 14, /* A text is deleted */ ay_new_text = 15, /* New format created text */ + ay_new_recipient = 16, /* New recipient added */ + ay_sub_recipient = 17, /* Recipient removed */ + ay_new_membership = 18, /* Membership added or modified */ + + /* When you add stuff here, don't forget to add it to the + switch in accept_async in session.c */ + ay_dummy_last /* Keep this last in the list. When adding new async messages you might want to increase the default value for diff --git a/src/server/aux-item-def.l b/src/server/aux-item-def.l index 9fcd6c3a0c8cd97bdc121bef9709b7bf62291d86..65822d2406ef619ee7f46763143e252a16c71897 100644 --- a/src/server/aux-item-def.l +++ b/src/server/aux-item-def.l @@ -1,6 +1,6 @@ %{ /* - * $Id: aux-item-def.l,v 1.2 1998/06/14 14:50:35 byers Exp $ + * $Id: aux-item-def.l,v 1.3 1998/12/26 22:40:24 byers Exp $ * Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -24,6 +24,9 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif #include <ctype.h> @@ -89,6 +92,10 @@ server { yylloc.first_line = yylineno; RETURN TOK_SERVER; } +any { + yylloc.first_line = yylineno; + RETURN TOK_ANY; + } create { yylloc.first_line = yylineno; RETURN CREATE; diff --git a/src/server/aux-item-def.tab.c b/src/server/aux-item-def.tab.c new file mode 100644 index 0000000000000000000000000000000000000000..7ec7d5014e65ea492476025e769df29b14e841b7 --- /dev/null +++ b/src/server/aux-item-def.tab.c @@ -0,0 +1,1373 @@ + +/* A Bison parser, made from ./aux-item-def.y + by GNU Bison version 1.25 + */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define yyparse aux_item_def_parse +#define yylex aux_item_def_lex +#define yyerror aux_item_def_error +#define yylval aux_item_def_lval +#define yychar aux_item_def_char +#define yydebug aux_item_def_debug +#define yynerrs aux_item_def_nerrs +#define YYLSP_NEEDED + +#define NUMBER 258 +#define BOOLEAN 259 +#define ID 260 +#define STRING 261 +#define DISABLED 262 +#define TEXT 263 +#define CONFERENCE 264 +#define LETTERBOX 265 +#define TOK_SERVER 266 +#define TOK_ANY 267 +#define VOID 268 +#define CREATE 269 +#define MODIFY 270 + +#line 1 "./aux-item-def.y" + +/* + * $Id: aux-item-def.tab.c,v 1.4 1998/12/26 22:40:25 byers Exp $ + * Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association. + * + * This file is part of the LysKOM server. + * + * LysKOM is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * LysKOM is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * along with LysKOM; see the file COPYING. If not, write to + * Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN, + * or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + * MA 02139, USA. + * + * Please mail bug reports to bug-lyskom@lysator.liu.se. + */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#ifdef HAVE_STRING_H +# include <string.h> +#endif +#if STDC_HEADERS || HAVE_STRING_H +# include <string.h> +#else +# include <strings.h> +#endif +#ifdef HAVE_STDARG_H +# include <stdarg.h> +#endif +#include <malloc.h> + +#include "kom-types.h" +#include "aux-items.h" +#include "s-string.h" +#include "server/smalloc.h" +#include "lyskomd.h" +#include "debug.h" +#include "log.h" + +BUGDECL; + +#define YYDEBUG 1 + +static Aux_item_definition def; +static Bool errorFlag = FALSE; + +#define CHK_ASSIGN(_i_, _f_, _t_, _d_, _e_, _l_) \ + found = found || aux_item_def_check_assign(_i_,_d_,&def._f_,_t_,&(_e_),_l_) + +#define CHK_FLAG_A(_i_, _f_, _d_, _e_, _l_) \ + if (!s_strcmp(s_fcrea_str(_i_),_d_)) \ + { \ + found = 1; \ + if (_e_.type != BOOLEAN ) \ + { \ + aux_item_def_error_line = _l_; \ + yyerror("invalid type: expected %s, got %s", \ + aux_item_def_typename(BOOLEAN), \ + aux_item_def_typename(_e_.type)); \ + } \ + if (_e_.val.num) { def.set_flags._f_ = 1; } \ + else { def.clear_flags._f_ = 1; } \ + } + +#define yyin aux_item_def_in +#define yylineno aux_item_def_lineno + +extern int yylex(void); + +static char *inputFile; +int aux_item_def_error_line; +extern int yylineno; + +#if defined(HAVE_VFPRINTF) && defined(HAVE_STDARG_H) +void yyerror(const char * format, ...) +# if HAVE_ATTRIBUTE_FORMAT_PRINTF + __attribute__ ((format (printf, 1, 2))) +# endif + ; +#else +void yyerror(); +#endif + +struct aux_item_def_value_type; +static int aux_item_def_check_assign(const char *, + String, + void *, + int, + struct aux_item_def_value_type *, + int); +static const char *aux_item_def_typename(int); +short aux_item_def_check_trigger(const char *check_name, + int type, + String trigger_name, + String function_name, + unsigned long *counter, + Aux_item_trigger **triggers); + + +#define YYERROR_VERBOSE + +#line 116 "./aux-item-def.y" +typedef union +{ + String str; + unsigned long num; + struct aux_item_def_value_type + { + int type; + union + { + String str; + unsigned long num; + } val; + } value; +} YYSTYPE; + +#ifndef YYLTYPE +typedef + struct yyltype + { + int timestamp; + int first_line; + int first_column; + int last_line; + int last_column; + char *text; + } + yyltype; + +#define YYLTYPE yyltype +#endif + +#include <stdio.h> + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 39 +#define YYFLAG -32768 +#define YYNTBASE 24 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 33) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 19, + 20, 2, 2, 21, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 18, 23, 2, + 22, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 16, 2, 17, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 3, 4, 9, 16, 24, 28, 30, 33, 36, + 39, 41, 44, 47, 50, 51, 54, 57, 58, 63, + 65, 67, 69, 73 +}; + +static const short yyrhs[] = { 24, + 25, 0, 0, 26, 16, 30, 17, 0, 3, 18, + 5, 19, 27, 20, 0, 3, 18, 5, 19, 27, + 20, 7, 0, 27, 21, 28, 0, 28, 0, 29, + 8, 0, 29, 9, 0, 29, 10, 0, 11, 0, + 29, 12, 0, 29, 14, 0, 29, 15, 0, 0, + 30, 31, 0, 30, 1, 0, 0, 5, 22, 32, + 23, 0, 4, 0, 6, 0, 3, 0, 5, 19, + 20, 0, 13, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 141, 142, 145, 152, 165, 175, 176, 179, 180, 181, + 183, 184, 193, 194, 195, 197, 198, 199, 202, 277, + 278, 279, 280, 281 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","NUMBER", +"BOOLEAN","ID","STRING","DISABLED","TEXT","CONFERENCE","LETTERBOX","TOK_SERVER", +"TOK_ANY","VOID","CREATE","MODIFY","'{'","'}'","':'","'('","')'","','","'='", +"';'","items","item","head","targets","target","action","body","assign","value", NULL +}; +#endif + +static const short yyr1[] = { 0, + 24, 24, 25, 26, 26, 27, 27, 28, 28, 28, + 28, 28, 29, 29, 29, 30, 30, 30, 31, 32, + 32, 32, 32, 32 +}; + +static const short yyr2[] = { 0, + 2, 0, 4, 6, 7, 3, 1, 2, 2, 2, + 1, 2, 2, 2, 0, 2, 2, 0, 4, 1, + 1, 1, 3, 1 +}; + +static const short yydefact[] = { 2, + 0, 0, 1, 0, 0, 18, 0, 0, 15, 17, + 0, 3, 16, 11, 0, 7, 0, 0, 4, 15, + 8, 9, 10, 12, 13, 14, 22, 20, 0, 21, + 24, 0, 5, 6, 0, 19, 23, 0, 0 +}; + +static const short yydefgoto[] = { 1, + 3, 4, 15, 16, 17, 8, 13, 32 +}; + +static const short yypact[] = {-32768, + 10, -15,-32768, -7, 6,-32768, -5, -1, 1,-32768, + -2,-32768,-32768,-32768, -19,-32768, 9, 2, 15, 1, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 7,-32768, +-32768, 4,-32768,-32768, 5,-32768,-32768, 28,-32768 +}; + +static const short yypgoto[] = {-32768, +-32768,-32768,-32768, 11,-32768,-32768,-32768,-32768 +}; + + +#define YYLAST 31 + + +static const short yytable[] = { 10, + 19, 20, 5, 11, 27, 28, 29, 30, 6, 38, + 7, 14, 2, 9, 31, 12, 21, 22, 23, 18, + 24, 33, 25, 26, 37, 35, 36, 39, 0, 0, + 34 +}; + +static const short yycheck[] = { 1, + 20, 21, 18, 5, 3, 4, 5, 6, 16, 0, + 5, 11, 3, 19, 13, 17, 8, 9, 10, 22, + 12, 7, 14, 15, 20, 19, 23, 0, -1, -1, + 20 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/lib/bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include <alloca.h> +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include <malloc.h> +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include <malloc.h> + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); +#endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 196 "/usr/lib/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 3: +#line 146 "./aux-item-def.y" +{ + aux_item_definition_add(&def); + def = empty_aux_item_definition; + ; + break;} +case 4: +#line 153 "./aux-item-def.y" +{ + def.tag = yyvsp[-5].num; + def.name = s_crea_c_str(yyvsp[-3].str); + if (buglevel) + { + log("Parsing definition of aux-iem %ld (%s)\n", + def.tag, def.name); + } + s_clear(&(yyvsp[-3].str)); + yyvsp[-3].str = EMPTY_STRING; + yylval.str = EMPTY_STRING; + ; + break;} +case 5: +#line 166 "./aux-item-def.y" +{ + def.tag = 0; + def.name = s_crea_c_str(yyvsp[-4].str); + s_clear(&(yyvsp[-4].str)); + yyvsp[-4].str = EMPTY_STRING; + yylval.str = EMPTY_STRING; + ; + break;} +case 8: +#line 179 "./aux-item-def.y" +{ def.texts = TRUE; def.text_a = yyvsp[-1].num; ; + break;} +case 9: +#line 180 "./aux-item-def.y" +{ def.confs = TRUE; def.conf_a = yyvsp[-1].num; ; + break;} +case 10: +#line 181 "./aux-item-def.y" +{ def.letterboxes = TRUE; + def.conf_a = yyvsp[-1].num; ; + break;} +case 11: +#line 183 "./aux-item-def.y" +{ def.system = TRUE; ; + break;} +case 12: +#line 185 "./aux-item-def.y" +{ + def.texts = TRUE; def.text_a = yyvsp[-1].num; + def.confs = TRUE; def.conf_a = yyvsp[-1].num; + def.letterboxes = TRUE; + def.system = TRUE; + ; + break;} +case 13: +#line 193 "./aux-item-def.y" +{ yyval.num = yyvsp[-1].num | AUX_ITEM_ADD_ON_CREATE; ; + break;} +case 14: +#line 194 "./aux-item-def.y" +{ yyval.num = yyvsp[-1].num | AUX_ITEM_ADD_ON_MODIFY; ; + break;} +case 15: +#line 195 "./aux-item-def.y" +{ yyval.num = 0; ; + break;} +case 19: +#line 203 "./aux-item-def.y" +{ + int found = 0; + + CHK_ASSIGN("author-only", author_only, BOOLEAN, + yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_ASSIGN("supervisor-only", supervisor_only, + BOOLEAN, yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_ASSIGN("inherit-limit", inherit_limit, NUMBER, + yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_ASSIGN("unique", one_per_person, BOOLEAN, + yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_ASSIGN("validate", validate_regexp, STRING, + yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_ASSIGN("permanent", may_not_delete, BOOLEAN, + yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_FLAG_A("inherit", inherit, yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_FLAG_A("secret", secret, yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_FLAG_A("hide-creator", hide_creator, + yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_FLAG_A("dont-garb", dont_garb, yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_FLAG_A("reserved-2", reserved3, yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_FLAG_A("reserved-3", reserved4, yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + CHK_FLAG_A("reserved-4", reserved5, yyvsp[-3].str, yyvsp[-1].value, yylsp[-1].first_line); + + + found = found ? 1 : + aux_item_def_check_trigger("delete-trigger", + yyvsp[-1].value.type, + yyvsp[-3].str, + yyvsp[-1].value.val.str, + &def.num_delete_triggers, + &def.delete_triggers); + + + found = found ? 1 : + aux_item_def_check_trigger("undelete-trigger", + yyvsp[-1].value.type, + yyvsp[-3].str, + yyvsp[-1].value.val.str, + &def.num_undelete_triggers, + &def.undelete_triggers); + + + found = found ? 1 : + aux_item_def_check_trigger("add-trigger", + yyvsp[-1].value.type, + yyvsp[-3].str, + yyvsp[-1].value.val.str, + &def.num_add_triggers, + &def.add_triggers); + + + if (found == 0) + { + char *tmp; + + tmp = s_crea_c_str(yyvsp[-3].str); + aux_item_def_error_line = yylsp[-3].first_line; + yyerror("invalid field name: %s", tmp); + free(tmp); + } + + if (yyvsp[-1].value.type == STRING) + { + s_clear(&(yyvsp[-1].value).val.str); + yyvsp[-1].value.val.str = EMPTY_STRING; + yylval.value.val.str = EMPTY_STRING; + } + s_clear(&(yyvsp[-3].str)); + yyvsp[-3].str = EMPTY_STRING; + yylval.str = EMPTY_STRING; + ; + break;} +case 20: +#line 277 "./aux-item-def.y" +{ yyval.value.val.num = yyvsp[0].num; yyval.value.type = BOOLEAN; ; + break;} +case 21: +#line 278 "./aux-item-def.y" +{ yyval.value.val.str = yyvsp[0].str; yyval.value.type = STRING; ; + break;} +case 22: +#line 279 "./aux-item-def.y" +{ yyval.value.val.num = yyvsp[0].num; yyval.value.type = NUMBER; ; + break;} +case 23: +#line 280 "./aux-item-def.y" +{ yyval.value.val.str = yyvsp[-2].str; yyval.value.type = ID;; + break;} +case 24: +#line 281 "./aux-item-def.y" +{ YYERROR; ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 498 "/usr/lib/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} +#line 284 "./aux-item-def.y" + + +extern FILE *yyin; + +#if defined(HAVE_VFPRINTF) && defined(HAVE_STDARG_H) +void yyerror(const char *format, ...) +{ + va_list AP; + + va_start(AP, format); + fprintf(stderr, "%s: %d: ", inputFile, aux_item_def_error_line); + vfprintf(stderr, format, AP); + fprintf(stderr, "\n"); + fflush(stderr); + + errorFlag = TRUE; + va_end(AP); +} +#else +void yyerror(const char *s, + int a, int b, int c, int d, int e, int f, int g) +{ + fprintf(stderr, "%s: %d: ", inputFile, aux_item_def_error_line); + fprintf(stderr, format, a, b, c, d, e, f, g); + fprintf(stderr, "\n"); + fflush(stderr); + + errorFlag = TRUE; +} +#endif + +static const char *aux_item_def_typename(int type) +{ + switch (type) + { + case STRING: return "string"; + case NUMBER: return "number"; + case BOOLEAN: return "boolean"; + case ID: return "identifier"; + default: + return "unknown"; + } +} + +static int aux_item_def_check_assign(const char *id, + String field, + void *data, + int type, + struct aux_item_def_value_type *val, + int lineno) +{ + if (!s_strcmp(s_fcrea_str(id), field)) + { + if (type != val->type) + { + aux_item_def_error_line = lineno; + yyerror("invalid type: expected %s, got %s", + aux_item_def_typename(type), + aux_item_def_typename(val->type)); + return 0; + } + else if (type == STRING) + { + *((char **)data) = s_crea_c_str(val->val.str); + } + else if (type == NUMBER) + { + *((unsigned long *)data) = val->val.num; + } + else if (type == BOOLEAN) + { + *((Bool *)data) = val->val.num ? TRUE : FALSE; + } + else + { + restart_kom("Internal error: bad type in aux-item definition " + "assignment (can't happen.)\n"); + } + return 1; + } + else + { + return 0; + } +} + +short aux_item_def_check_trigger(const char *check_name, + int type, + String trigger_name, + String function_name, + unsigned long *counter, + Aux_item_trigger **triggers) +{ + Aux_item_trigger trigger; + char *tmp_string; + + if (s_strcmp(s_fcrea_str(check_name), trigger_name) == 0) + { + if (type != ID) + { + yyerror("invalid type: expected %s, got %s", + aux_item_def_typename(ID), + aux_item_def_typename(type)); + return 0; + } + + tmp_string = s_crea_c_str(function_name); + trigger = aux_item_find_trigger(tmp_string); + + if (trigger == NULL) + { + yyerror("undefined function: %s", + tmp_string); + sfree(tmp_string); + return 1; + } + + sfree(tmp_string); + + *counter += 1; + *triggers = + srealloc(*triggers, + *counter * + sizeof(Aux_item_trigger)); + *triggers[*counter-1] = trigger; + + return 1; + } + return 0; +} + +void parse_aux_item_definitions(char *file) +{ + inputFile = file; + yyin = fopen(file, "r"); + if (yyin == NULL) + { + perror(file); + restart_kom("Unable to open aux-item definition file\n"); + } + + def = empty_aux_item_definition; + yyparse(); + + if (errorFlag == TRUE) + { + restart_kom("Errors reading aux-item definition file\n"); + } + + /* + { + extern Aux_item_definition *aux_item_definition_list; + extern unsigned long num_aux_item_definitions; + Aux_item_definition *def; + + fprintf(stderr, "Number of defs: %ld\n", num_aux_item_definitions); + def = aux_item_definition_list; + + while (def != NULL) + { + fprintf(stderr, "Name: '%s'\n", def->name); + fprintf(stderr, "Tag: %ld\n", def->tag); + fprintf(stderr, "Clear flags: "); + if (def->clear_flags.deleted) fprintf(stderr, "deleted "); + if (def->clear_flags.inherit) fprintf(stderr, "inherit "); + if (def->clear_flags.secret) fprintf(stderr, "secret "); + if (def->clear_flags.hide_creator) fprintf(stderr,"hide_creator "); + if (def->clear_flags.reserved2) fprintf(stderr, "reserved2 "); + if (def->clear_flags.reserved3) fprintf(stderr, "reserved3 "); + if (def->clear_flags.reserved4) fprintf(stderr, "reserved4 "); + if (def->clear_flags.reserved5) fprintf(stderr, "reserved5 "); + fprintf(stderr, "\n"); + fprintf(stderr, "Set flags: "); + if (def->set_flags.deleted) fprintf(stderr, "deleted "); + if (def->set_flags.inherit) fprintf(stderr, "inherit "); + if (def->set_flags.secret) fprintf(stderr, "secret "); + if (def->set_flags.hide_creator) fprintf(stderr,"hide_creator "); + if (def->set_flags.reserved2) fprintf(stderr, "reserved2 "); + if (def->set_flags.reserved3) fprintf(stderr, "reserved3 "); + if (def->set_flags.reserved4) fprintf(stderr, "reserved4 "); + if (def->set_flags.reserved5) fprintf(stderr, "reserved5 "); + fprintf(stderr, "\n"); + fprintf(stderr, "Author only: %d\n", def->author_only); + fprintf(stderr, "Supervisor only: %d\n", def->supervisor_only); + fprintf(stderr, "Unique: %d\n", def->one_per_person); + fprintf(stderr, "Permanent: %d\n", def->may_not_delete); + fprintf(stderr, "Inherit limit: %ld\n", def->inherit_limit); + fprintf(stderr, "Texts: %d\n", def->texts); + fprintf(stderr, "Conferences: %d\n", def->confs); + fprintf(stderr, "Letterboxes: %d\n", def->letterboxes); + fprintf(stderr, "Validate regexp: '%s'\n", + def->validate_regexp?def->validate_regexp:"0x0"); + def = def->next; + } + } + */ +} + + diff --git a/src/server/aux-item-def.y b/src/server/aux-item-def.y index eb509c9ddb7f810f5b248a04d9ed5ab326de8f91..ab8a8634629e82ae72037d45f0b958351813503b 100644 --- a/src/server/aux-item-def.y +++ b/src/server/aux-item-def.y @@ -1,6 +1,6 @@ %{ /* - * $Id: aux-item-def.y,v 1.4 1998/07/20 20:02:51 ceder Exp $ + * $Id: aux-item-def.y,v 1.5 1998/12/26 22:40:26 byers Exp $ * Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -25,6 +25,10 @@ */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #ifdef HAVE_STRING_H # include <string.h> #endif @@ -126,7 +130,7 @@ short aux_item_def_check_trigger(const char *check_name, %token <num> NUMBER BOOLEAN %token <str> ID STRING -%token DISABLED TEXT CONFERENCE LETTERBOX TOK_SERVER +%token DISABLED TEXT CONFERENCE LETTERBOX TOK_SERVER TOK_ANY %token VOID CREATE MODIFY %type <value> value @@ -177,6 +181,13 @@ target : action TEXT { def.texts = TRUE; def.text_a = $1; } | action LETTERBOX { def.letterboxes = TRUE; def.conf_a = $1; } | TOK_SERVER { def.system = TRUE; } + | action TOK_ANY + { + def.texts = TRUE; def.text_a = $1; + def.confs = TRUE; def.conf_a = $1; + def.letterboxes = TRUE; + def.system = TRUE; + } ; action : action CREATE { $$ = $1 | AUX_ITEM_ADD_ON_CREATE; } @@ -213,30 +224,6 @@ assign : ID '=' value ';' CHK_FLAG_A("reserved-3", reserved4, $1, $3, @3.first_line); CHK_FLAG_A("reserved-4", reserved5, $1, $3, @3.first_line); - if (s_strcmp(s_fcrea_str("add-trigger"), $1) == 0) - { - found = 1; - if ($3.type != ID) - { - yyerror("invalid type: expected %s, got %s", \ - aux_item_def_typename(BOOLEAN), \ - aux_item_def_typename(ID)); \ - found = 0; - } - } - - if (s_strcmp(s_fcrea_str("delete-trigger"), $1) == 0) - { - found = 1; - if ($3.type != ID) - { - yyerror("invalid type: expected %s, got %s", \ - aux_item_def_typename(BOOLEAN), \ - aux_item_def_typename(ID)); \ - found = 0; - } - } - found = found ? 1 : aux_item_def_check_trigger("delete-trigger", @@ -296,6 +283,8 @@ value : BOOLEAN { $$.val.num = $1; $$.type = BOOLEAN; } %% +extern FILE *yyin; + #if defined(HAVE_VFPRINTF) && defined(HAVE_STDARG_H) void yyerror(const char *format, ...) { @@ -425,8 +414,6 @@ short aux_item_def_check_trigger(const char *check_name, void parse_aux_item_definitions(char *file) { - extern FILE *yyin; - inputFile = file; yyin = fopen(file, "r"); if (yyin == NULL) diff --git a/src/server/aux-items.c b/src/server/aux-items.c index ff35de47a95aac278172388e128ec6c16401c9e0..ad6143d56bb2a22b388b587cd07f70778eb60d76 100644 --- a/src/server/aux-items.c +++ b/src/server/aux-items.c @@ -1,5 +1,5 @@ /* - * $Id: aux-items.c,v 1.6 1998/11/09 22:31:09 ceder Exp $ + * $Id: aux-items.c,v 1.7 1998/12/26 22:40:27 byers Exp $ * Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,6 +23,11 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <stdio.h> #ifdef HAVE_STDLIB_H # include <stdlib.h> @@ -45,7 +50,7 @@ #include "cache.h" #include "s-string.h" #include "lyskomd.h" -#include "config.h" +#include "kom-config.h" #include "regex.h" #include "log.h" #include "services.h" @@ -148,10 +153,6 @@ aux_item_check_unique(Aux_item *item, static Aux_item_definition * aux_item_default_definition(Aux_item *item) { - unsigned long tmp; - unsigned long extended; - static Aux_item_definition def_s; - /* A predefined aux_item that we didn't find a definition for is illegal. */ @@ -169,35 +170,39 @@ aux_item_default_definition(Aux_item *item) masking would. */ /* MMMM XFUP SSSS CCCC NNNN NNNN NNNN NNNN */ - tmp = item->tag; - - extended = (tmp & 0x07000000) ? 1 : 0; - def_s.author_only = (tmp & 0x04000000) ? 1 : 0; - def_s.one_per_person = (tmp & 0x02000000) ? 1 : 0; - def_s.may_not_delete = (tmp & 0x01000000) ? 1 : 0; - def_s.set_flags.deleted = (tmp & 0x00700000) ? 1 : 0; - def_s.set_flags.inherit = (tmp & 0x00400000) ? 1 : 0; - def_s.set_flags.secret = (tmp & 0x00200000) ? 1 : 0; - def_s.set_flags.hide_creator = (tmp & 0x00100000) ? 1 : 0; - def_s.clear_flags.deleted = (tmp & 0x00070000) ? 1 : 0; - def_s.clear_flags.inherit = (tmp & 0x00040000) ? 1 : 0; - def_s.clear_flags.secret = (tmp & 0x00020000) ? 1 : 0; - def_s.clear_flags.hide_creator = (tmp & 0x00010000) ? 1 : 0; - - def_s.tag = item->tag; - def_s.inherit_limit = 0; - def_s.name = "extended-default"; - - - /* If it wasn't extended, then it was simple, because it sure - wasn't predefined. */ - - if (!extended) - { - return &simple_aux_item; - } - - return &def_s; +/* + tmp = item->tag; + + extended = (tmp & 0x07000000) ? 1 : 0; + def_s.author_only = (tmp & 0x04000000) ? 1 : 0; + def_s.one_per_person = (tmp & 0x02000000) ? 1 : 0; + def_s.may_not_delete = (tmp & 0x01000000) ? 1 : 0; + def_s.set_flags.deleted = (tmp & 0x00700000) ? 1 : 0; + def_s.set_flags.inherit = (tmp & 0x00400000) ? 1 : 0; + def_s.set_flags.secret = (tmp & 0x00200000) ? 1 : 0; + def_s.set_flags.hide_creator = (tmp & 0x00100000) ? 1 : 0; + def_s.clear_flags.deleted = (tmp & 0x00070000) ? 1 : 0; + def_s.clear_flags.inherit = (tmp & 0x00040000) ? 1 : 0; + def_s.clear_flags.secret = (tmp & 0x00020000) ? 1 : 0; + def_s.clear_flags.hide_creator = (tmp & 0x00010000) ? 1 : 0; + + def_s.tag = item->tag; + def_s.inherit_limit = 0; + def_s.name = "extended-default"; + + + / * If it wasn't extended, then it was simple, because it sure + wasn't predefined. * / + + if (!extended) + { + return &simple_aux_item; + } + + return &def_s; +*/ + + return &simple_aux_item; } @@ -272,6 +277,13 @@ aux_item_definition_add(Aux_item_definition *def) aux_item_definition_list = new_definition; } + + +/* + * Compile the verification regexp for the definition in DEF + * and put the result somewhere convenient. + */ + static void aux_item_definition_cache_regexp(Aux_item_definition *def) { @@ -364,7 +376,7 @@ aux_item_call_add_triggers(Aux_item_definition *def, for (i = 0; i < def->num_add_triggers; i++) { - (*def->add_triggers[i])(&data); + (*(def->add_triggers[i]))(&data); } } @@ -386,7 +398,7 @@ aux_item_call_delete_triggers(Aux_item_definition *def, for (i = 0; i < def->num_delete_triggers; i++) { - (*def->delete_triggers[i])(&data); + (*(def->delete_triggers[i]))(&data); } } @@ -408,7 +420,7 @@ aux_item_call_undelete_triggers(Aux_item_definition *def, for (i = 0; i < def->num_undelete_triggers; i++) { - (*def->undelete_triggers[i])(&data); + (*(def->undelete_triggers[i]))(&data); } } @@ -501,12 +513,17 @@ aux_item_add_perm(Aux_item *item, { short can_add_when = 0; + kom_errno = KOM_NO_ERROR; + def = def ? def : def = find_aux_item_definition(item); /* Can't create an item with no definition */ if (def == NULL) + { + kom_errno = KOM_ILL_AUX; return FALSE; + } switch (object_type) { @@ -520,52 +537,52 @@ aux_item_add_perm(Aux_item *item, if (!((creating && (can_add_when & AUX_ITEM_ADD_ON_CREATE)) || (!creating && (can_add_when & AUX_ITEM_ADD_ON_MODIFY)))) { + kom_errno = KOM_AUX_PERM; return FALSE; } } - /* Check the author_only flag, which really is author-or-supervisor - * How do we handle newly created confs, where we want this to - * ALWAYS succeed? FIXME +++ - */ - if (def->author_only && owner_check && object_creator != item_creator && !is_strictly_supervisor(object_creator, NULL, item_creator, NULL) && !(item_creator == ACTPERS && ENA(wheel, 8))) { - return FALSE; + kom_errno = KOM_AUX_PERM; + return FALSE; } - /* Check the supervisor_only flag - * Check using is_strictly_supervisor. - * How do we handle newly created confs, where we want this to - * ALWAYS succeed? FIXME +++ - */ - if (def->supervisor_only && owner_check && !is_strictly_supervisor(object_creator, NULL, item_creator, NULL) && !(item_creator == ACTPERS && ENA(wheel,8))) { + kom_errno = KOM_AUX_PERM; return FALSE; } /* Even the administrator can't override this */ if (!aux_item_check_unique(item, def, add_to_list, start_looking_at)) + { + kom_errno = KOM_AUX_PERM; return FALSE; + } /* Check the contents */ if (def->validate_regexp) { + /* If regexp is not cached, cache it */ if (def->cached_re_buf == NULL) aux_item_definition_cache_regexp(def); + /* If it's still not cached, then ignore it. Can't add item. */ if (def->cached_re_buf == NULL) + { + kom_errno = KOM_ILL_AUX; return FALSE; + } switch ( re_search (def->cached_re_buf, item->data.string, s_strlen(item->data), @@ -573,6 +590,7 @@ aux_item_add_perm(Aux_item *item, NULL) ) { case -1: + kom_errno = KOM_ILL_AUX; return FALSE; case -2: log("Internal error in regex matching aux-item data."); @@ -740,7 +758,7 @@ Success check_delete_aux_item_list(Number_list *items_to_delete, Aux_item_list *list_to_delete_from) { - unsigned long i; + long i; Aux_item *item; Aux_item_definition *def; @@ -755,7 +773,7 @@ check_delete_aux_item_list(Number_list *items_to_delete, if ((item = find_aux_item(list_to_delete_from, items_to_delete->data[i])) == NULL) { - kom_errno = KOM_ILL_AUX; + kom_errno = KOM_AUX_PERM; err_stat = i; return FAILURE; } @@ -793,6 +811,8 @@ check_delete_aux_item_list(Number_list *items_to_delete, * * Mark ITEM as deleted. LIST is the list we're deleting * the item from. + * + * Call commit_aux_item_list to make the changes permanent */ void @@ -802,26 +822,35 @@ delete_aux_item_list(Number_list *items_to_delete, unsigned long object_no, void *object) { - unsigned long i; + long i; Aux_item *item; + long item_index; for (i = 0; i < items_to_delete->length; i++) { if (items_to_delete->data[i] == 0) continue; - item = find_aux_item(list_to_delete_from, - items_to_delete->data[i]); + item_index = find_aux_item_index(list_to_delete_from, + items_to_delete->data[i]); + if (item_index == -1) + restart_kom("Call to delete_aux_item_list without call to check_delete_aux_item_list"); + item = &list_to_delete_from->items[item_index]; item->flags.deleted = 1; - aux_item_call_delete_triggers( - find_aux_item_definition(item), - object_type, - items_to_delete->data[i], - object_no, - object); + aux_item_call_delete_triggers(find_aux_item_definition(item), + object_type, + item_index, + object_no, + object); } } +/* + * Reverse tentative deletions from an aux-item-list + * This must be called before commit_aux_item_list is + * called + */ + void undelete_aux_item_list(Number_list *items_to_undelete, Aux_item_list *list_to_undelete_from, @@ -829,25 +858,80 @@ undelete_aux_item_list(Number_list *items_to_undelete, unsigned long object_no, void *object) { - unsigned long i; + long i; Aux_item *item; + long item_index; for (i = 0; i < items_to_undelete->length; i++) { if (items_to_undelete->data[i] == 0) continue; - item = find_aux_item(list_to_undelete_from, - items_to_undelete->data[i]); + item_index = find_aux_item_index(list_to_undelete_from, + items_to_undelete->data[i]); + if (item_index == -1) + restart_kom("Call to undelete_aux_item_list without call to check_delete_aux_item_list"); + item = &list_to_undelete_from->items[item_index]; item->flags.deleted = 0; - aux_item_call_delete_triggers(find_aux_item_definition(item), - object_type, - items_to_undelete->data[i], - object_no, - object); + aux_item_call_undelete_triggers(find_aux_item_definition(item), + object_type, + item_index, + object_no, + object); } } +/* + * Commit deletions in the aux-item-list. After this has been called + * undelete_aux_item_list has no effect. The memory associated with + * the deleted items is not released until the entire list is + * released from memory or reallocated. + */ + +void +commit_aux_item_list(Aux_item_list *list_to_commit) +{ + long i; /* Loop index */ + long target; /* Where to move items when compacting */ + + target = 0; + for (i = 0; i < list_to_commit->length; i++) + { + if (list_to_commit->items[i].flags.deleted) + { + /* If the item we're looking at is deleted + release the memory associated with its + data and then skip it */ + s_clear(&list_to_commit->items[i].data); + continue; + } + else if (target != i) + { + /* If we have deleted an item earlier, compact the list */ + list_to_commit->items[target] = list_to_commit->items[i]; + list_to_commit->items[i].data = EMPTY_STRING; + target += 1; + } + else + { + /* If we have not deleted an item, bump target up one */ + target += 1; + } + } + + /* + Zero out all the unused slots in the array. This is not + strictly necessary but looks better and makes finding + bugs a bit easier + */ + + memset(&list_to_commit->items[target], 0, + (list_to_commit->length - target) * sizeof(Aux_item)); + + /* Target points to one index more than the last non-deleted item */ + list_to_commit->length = target; +} + /* @@ -858,16 +942,27 @@ undelete_aux_item_list(Number_list *items_to_undelete, Aux_item * find_aux_item(Aux_item_list *list, unsigned long aux_no) +{ + long item_index = find_aux_item_index(list, aux_no); + + if (item_index == -1) + return NULL; + + return &list->items[item_index]; +} + +long +find_aux_item_index(Aux_item_list *list, unsigned long aux_no) { unsigned long i; for (i = 0; i < list->length; i++) { if (list->items[i].aux_no == aux_no) - return &list->items[i]; + return i; } - return NULL; + return -1; } @@ -913,6 +1008,8 @@ text_stat_check_add_aux_item_list(Text_stat *text_s, if (list == NULL) return OK; + kom_errno = KOM_NO_ERROR; + for (i = 0; i < list->length; i++) { item = &list->items[i]; @@ -937,7 +1034,7 @@ text_stat_check_add_aux_item_list(Text_stat *text_s, !aux_item_check_unique(item, def, list, i + 1) || !def->texts) { - kom_errno = KOM_AUX_PERM; + kom_errno = kom_errno?kom_errno:KOM_AUX_PERM; err_stat = i; return FAILURE; } @@ -974,7 +1071,7 @@ void text_stat_add_aux_item_list(Text_stat *text_s, aux_item_call_add_triggers( find_aux_item_definition(&item_list->items[i]), TEXT_OBJECT_TYPE, - text_s->highest_aux, + text_s->aux_item_list.length - 1, text_no, text_s); } @@ -998,6 +1095,8 @@ conf_stat_check_add_aux_item_list(Conference *conf, if (list == NULL) return OK; + kom_errno = KOM_NO_ERROR; + for (i = 0; i < list->length; i++) { item = &list->items[i]; @@ -1025,11 +1124,12 @@ conf_stat_check_add_aux_item_list(Conference *conf, &conf->aux_item_list, 0, creating, - CONF_OBJECT_TYPE) || - !aux_item_check_unique(item, def, list, i + 1) || - !(def->confs || (def->letterboxes && conf->type.letter_box))) + CONF_OBJECT_TYPE) || + !aux_item_check_unique(item, def, list, i + 1) || + (!conf->type.letter_box && !def->confs) || + (conf->type.letter_box && !def->letterboxes)) { - kom_errno = KOM_AUX_PERM; + kom_errno = kom_errno?kom_errno:KOM_AUX_PERM; err_stat = i; return FAILURE; } @@ -1065,7 +1165,7 @@ conf_stat_add_aux_item_list(Conference *conf, aux_item_call_add_triggers( find_aux_item_definition(&item_list->items[i]), CONF_OBJECT_TYPE, - conf->highest_aux, + conf->aux_item_list.length - 1, conf_no, conf); } @@ -1082,6 +1182,8 @@ Success system_check_add_aux_item_list(Info *info, if (list == NULL) return OK; + kom_errno = KOM_NO_ERROR; + for (i = 0; i < list->length; i++) { item = &list->items[i]; @@ -1105,7 +1207,7 @@ Success system_check_add_aux_item_list(Info *info, !aux_item_check_unique(item, def, list, i + 1) || !def->system) { - kom_errno = KOM_AUX_PERM; + kom_errno = kom_errno?kom_errno:KOM_AUX_PERM; err_stat = i; return FAILURE; } @@ -1138,6 +1240,13 @@ system_add_aux_item_list(Info *info, copy_aux_item(&info->aux_item_list.items[info->aux_item_list.length], &item_list->items[i]); info->aux_item_list.length += 1; + + aux_item_call_add_triggers( + find_aux_item_definition(&item_list->items[i]), + INFO_OBJECT_TYPE, + info->aux_item_list.length - 1, + 0, + info); } } @@ -1158,7 +1267,7 @@ query_predefined_aux_items(Number_list *result) { if (def->tag != 0) { - assert(result->length < num_aux_item_definitions); + assert((unsigned long)result->length < num_aux_item_definitions); result->data[result->length] = def->tag; result->length += 1; } @@ -1171,12 +1280,47 @@ query_predefined_aux_items(Number_list *result) void aux_item_trigger_mark_text(Aux_item_trigger_data *data) { - if (data->object_type != TEXT_OBJECT_TYPE) + Text_no text_no; + Text_stat *text_stat; + Conference *conf_stat; + String_size ill_char; + + if (data->object_type != CONF_OBJECT_TYPE) + return; + + conf_stat = (Conference *)data->object; + text_no = s_strtol(conf_stat->aux_item_list.items[data->item_index].data, + &ill_char, + 10); + + text_stat = cached_get_text_stat(text_no); + + if (text_stat == NULL) return; + text_stat->no_of_marks += 1; + mark_text_as_changed(text_no); } void aux_item_trigger_unmark_text(Aux_item_trigger_data *data) { - if (data->object_type != TEXT_OBJECT_TYPE) + Text_no text_no; + Text_stat *text_stat; + Conference *conf_stat; + String_size ill_char; + + if (data->object_type != CONF_OBJECT_TYPE) + return; + + conf_stat = (Conference *)data->object; + text_no = s_strtol(conf_stat->aux_item_list.items[data->item_index].data, + &ill_char, + 10); + + + + text_stat = cached_get_text_stat(text_no); + if (text_stat == NULL) return; + text_stat->no_of_marks -= 1; + mark_text_as_changed(text_no); } diff --git a/src/server/aux-items.h b/src/server/aux-items.h index dc1d73c7c6271cc67b763e1914e4d31adf9312e8..521f861143393190a5b9317cb1b1b7bf0e79f32d 100644 --- a/src/server/aux-items.h +++ b/src/server/aux-items.h @@ -1,5 +1,5 @@ /* - * $Id: aux-items.h,v 1.4 1998/07/08 15:58:58 ceder Exp $ + * $Id: aux-items.h,v 1.5 1998/12/26 22:40:28 byers Exp $ * Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -71,6 +71,7 @@ #define OTHER_OBJECT_TYPE 0 #define TEXT_OBJECT_TYPE 1 #define CONF_OBJECT_TYPE 2 +#define INFO_OBJECT_TYPE 3 typedef struct Aux_item_trigger_data_s { @@ -189,6 +190,7 @@ Aux_item_trigger aux_item_find_trigger(char *trigger_name); /* Get a pointer to the item in list with aux-no aux_no. Returns * NULL if there is no such item */ +long find_aux_item_index(Aux_item_list *list, unsigned long aux_no); Aux_item *find_aux_item(Aux_item_list *list, unsigned long aux_no); @@ -225,6 +227,9 @@ void undelete_aux_item_list(Number_list *items_to_undelete, void *object); +void +commit_aux_item_list(Aux_item_list *list_to_commit); + /* Check if we may delete items_to_delete from list_to_delete_from * Elements in items_to_delete may be modified. Sets kom_errno, diff --git a/src/server/cache-node.c b/src/server/cache-node.c index d43d58c40b221a9b8cf65ebff8982131b35a9b06..8fcc1178889f163a3ba68de94bbb96bae7cc92b9 100644 --- a/src/server/cache-node.c +++ b/src/server/cache-node.c @@ -1,5 +1,5 @@ /* - * $Id: cache-node.c,v 0.16 1998/07/08 13:41:43 ceder Exp $ + * $Id: cache-node.c,v 0.17 1998/12/26 22:40:29 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,13 @@ * Used in diskomd. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: cache-node.c,v 0.16 1998/07/08 13:41:43 ceder Exp $"; +rcsid = "$Id: cache-node.c,v 0.17 1998/12/26 22:40:29 byers Exp $"; #include "rcs.h" USE(rcsid); diff --git a/src/server/conf-file.c b/src/server/conf-file.c index cbb7c2345824ec3ac0459df1566b75510eb641a4..a03c5057d7942fbb38ddae50ce3aaf5f4d58be50 100644 --- a/src/server/conf-file.c +++ b/src/server/conf-file.c @@ -1,5 +1,5 @@ /* - * $Id: conf-file.c,v 1.10 1998/07/08 16:13:46 ceder Exp $ + * $Id: conf-file.c,v 1.11 1998/12/26 22:40:29 byers Exp $ * Copyright (C) 1994, 1995 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -26,8 +26,14 @@ * Read configuration files. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + + static const char * -rcsid = "$Id: conf-file.c,v 1.10 1998/07/08 16:13:46 ceder Exp $"; +rcsid = "$Id: conf-file.c,v 1.11 1998/12/26 22:40:29 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -59,7 +65,7 @@ USE(rcsid); #include "conf-file.h" #include "lyskomd.h" -#define MAXLINE 80 +#define MAXLINE 1001 static int *assignment_count = NULL; static int npar = 0; diff --git a/src/server/conference.c b/src/server/conference.c index f194a6beb2e8d8c17d78fa1ade354c8cf85fe64e..59167f4aef583f80cc718ef88496fff7b51864ac 100644 --- a/src/server/conference.c +++ b/src/server/conference.c @@ -1,5 +1,5 @@ /* - * $Id: conference.c,v 0.40 1998/11/09 22:34:37 ceder Exp $ + * $Id: conference.c,v 0.41 1998/12/26 22:40:30 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,14 @@ * All atomic calls that deals with conferences. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + + static const char * -rcsid = "$Id: conference.c,v 0.40 1998/11/09 22:34:37 ceder Exp $"; +rcsid = "$Id: conference.c,v 0.41 1998/12/26 22:40:30 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -52,7 +58,7 @@ USE(rcsid); #include "s-collat-tabs.h" #include "manipulate.h" #include "server/smalloc.h" -#include "config.h" +#include "kom-config.h" #include "parser.h" #include "com.h" #include "async.h" @@ -66,6 +72,8 @@ USE(rcsid); #include "aux-items.h" #include "local-to-global.h" +BUGDECL; + /* * Defined in conference.c. This will go away when we use regexp-matching. * This is only temporary. FIXME+++*** @@ -804,7 +812,6 @@ get_uconf_stat (Conf_no conf_no, switch (acc) { case error: - /* FIXME: ERROR: kom_errno may be incorrectly set at this point! */ return FAILURE; case none: err_stat = conf_no; @@ -905,7 +912,6 @@ set_etc_motd( Conf_no conf_no, { Conference * conf_c; Access acc; - BUGDECL; CHK_LOGIN(FAILURE); GET_C_STAT(conf_c, conf_no, FAILURE); @@ -1288,15 +1294,15 @@ modify_conf_info(Conf_no conf_no, FALSE) != OK) { undelete_aux_item_list(items_to_delete, &conf->aux_item_list, - CONF_OBJECT_TYPE, - conf_no, conf); + CONF_OBJECT_TYPE, + conf_no, conf); return FAILURE; } /* Then add the items */ conf_stat_add_aux_item_list(conf, conf_no, aux, ACTPERS); - + commit_aux_item_list(&conf->aux_item_list); /* FIXME: async_conf_changed(conf_no, conf); */ mark_conference_as_changed(conf_no); diff --git a/src/server/connections.c b/src/server/connections.c index 5917a43da15957c3c382c9f0a4c76fc34528ec60..0049fda76658b854d07c289cb0e089423c68bee4 100644 --- a/src/server/connections.c +++ b/src/server/connections.c @@ -1,5 +1,5 @@ /* - * $Id: connections.c,v 0.50 1998/07/08 16:18:51 ceder Exp $ + * $Id: connections.c,v 0.51 1998/12/26 22:40:31 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -30,8 +30,13 @@ * Created by Willf|r 31/3-90. Mostly written by ceder. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: connections.c,v 0.50 1998/07/08 16:18:51 ceder Exp $"; +rcsid = "$Id: connections.c,v 0.51 1998/12/26 22:40:31 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -84,7 +89,7 @@ USE(rcsid); #include "cache.h" #include "rfc931.h" #include "param.h" -#include "config.h" +#include "kom-config.h" #include "kom-errno.h" IscMaster * kom_server_mcb = NULL; @@ -652,7 +657,7 @@ dump_statistics(void) fprintf(fp, "TIME: %s", ctime(&now)); fprintf(fp, "SECONDS: %d\n", (int)ldifftime(now, last_dump)); fprintf(fp, "STATISTICS:"); - for ( i = 0; i < sizeof(service_statistics) / sizeof(unsigned long); i++) + for ( i = 0; (size_t)i < sizeof(service_statistics) / sizeof(unsigned long); i++) { fprintf(fp, " %lu", service_statistics[i]); service_statistics[i]=0; diff --git a/src/server/connections.h b/src/server/connections.h index 07008e04dc682fcc03b0e2e0ef741aaec58283da..f73074ea57366e1ef25185245b8072ebabaaf080 100644 --- a/src/server/connections.h +++ b/src/server/connections.h @@ -1,5 +1,5 @@ /* - * $Id: connections.h,v 0.33 1998/08/05 16:13:08 ceder Exp $ + * $Id: connections.h,v 0.34 1998/12/26 22:40:32 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,7 +23,7 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ /* - * $Id: connections.h,v 0.33 1998/08/05 16:13:08 ceder Exp $ + * $Id: connections.h,v 0.34 1998/12/26 22:40:32 byers Exp $ * * connections.h -- The top level of the communication packet. * @@ -179,7 +179,8 @@ typedef enum { rt_conference, rt_info, rt_l2g_iterator_as_text_list, - rt_text_mapping + rt_text_mapping, + rt_extended_membership } Res_type; /* @@ -196,6 +197,7 @@ typedef union { Person person; Membership membership; Membership membership_old; + Extended_Membership extended_membership; Conf_list_old conf_list; Conf_no_list conf_no_list; Conference conference; diff --git a/src/server/dbck-cache.c b/src/server/dbck-cache.c index d9a1ba021504769fb2bb4c06e76185c7ba434e36..2f386f92819a7c78a5a8123a64c8eeb30a1b474d 100644 --- a/src/server/dbck-cache.c +++ b/src/server/dbck-cache.c @@ -1,5 +1,5 @@ /* - * $Id: dbck-cache.c,v 0.34 1998/10/11 17:20:01 ceder Exp $ + * $Id: dbck-cache.c,v 0.35 1998/12/26 22:40:34 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -32,8 +32,14 @@ * Also save time as a time_t instead of a struct tm. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + + static const char * -rcsid = "$Id: dbck-cache.c,v 0.34 1998/10/11 17:20:01 ceder Exp $"; +rcsid = "$Id: dbck-cache.c,v 0.35 1998/12/26 22:40:34 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -347,7 +353,7 @@ cached_get_text( Text_no text ) the_string.len = text_arr[text]->no_of_chars; fseek(text_file, text_arr[ text ]->file_pos, SEEK_SET); if ( fread(the_string.string, sizeof(char), the_string.len, text_file) - != the_string.len ) + != (size_t)the_string.len ) { log("%s read enough characters of text %lu\n", "WARNING: cached_get_text: couldn't", @@ -433,7 +439,7 @@ cached_flush_text(Text_no text_no, text_arr[ text_no ]->file_pos = ftell(new_text_file); if ( fwrite(message.string, sizeof(char), message.len, new_text_file) - != message.len ) + != (size_t)message.len ) { log("WARNING: cached_flush_text: Couldn't write the text %ld\n", (unsigned long)text_no); @@ -565,7 +571,7 @@ extern void /* Write out everything. */ cache_sync(void) { FILE *fp; - unsigned long i; + long i; #ifdef TIME_SYNC struct rusage start, after_confs, after_persons, after_text_stats, @@ -810,7 +816,7 @@ extern Success init_cache(void) { FILE *fp = NULL; - unsigned long i; + long i; extern int vflag; /* from dbck.c */ extern Bool truncated_texts; /* from dbck.c */ long num; diff --git a/src/server/dbck.c b/src/server/dbck.c index 916966d1b7b62af4dd31492d330c0d943a73a724..436bb711859bd08549c5928359d5f7645599d236 100644 --- a/src/server/dbck.c +++ b/src/server/dbck.c @@ -1,5 +1,5 @@ /* - * $Id: dbck.c,v 0.41 1998/10/11 16:56:26 ceder Exp $ + * $Id: dbck.c,v 0.42 1998/12/26 22:40:35 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,14 @@ * Author: Per Cederqvist. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + + static const char * -rcsid = "$Id: dbck.c,v 0.41 1998/10/11 16:56:26 ceder Exp $"; +rcsid = "$Id: dbck.c,v 0.42 1998/12/26 22:40:35 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -63,7 +69,7 @@ USE(rcsid); #include "server/smalloc.h" #include "misc-parser.h" #include "cache.h" -#include "config.h" +#include "kom-config.h" #include "debug.h" #include "dbck-cache.h" #include "param.h" @@ -154,9 +160,8 @@ static const Person_scratchpad EMPTY_PERSON_SCRATCHPAD = { 0 }; static Person_scratchpad *person_scratchpad[MAX_CONF]; -#ifndef NDEBUG -int buglevel = 0; -#endif +int buglevel = 0; +BUGDECL; struct delete_list { @@ -802,7 +807,7 @@ check_texts(void) log("Checking text_no %ld\n", (unsigned long)ct); bytes += ctp->no_of_chars; - if ( ctp->no_of_chars > max_bytes ) + if ( (unsigned long)ctp->no_of_chars > max_bytes ) { max_bytes = ctp->no_of_chars; max_text = ct; @@ -879,12 +884,13 @@ check_created_texts(Pers_no pno, static int check_membership(Pers_no pno, - const Membership *mship) + Membership *mship) { int errors=0; Conference *conf; int i; Local_text_no last=0; + Member *mem; conf = cached_get_conf_stat(mship->conf_no); if ( conf == NULL ) @@ -923,12 +929,78 @@ check_membership(Pers_no pno, } /* Check that he is a member */ - if ( locate_member(pno, conf) == NULL ) + if ( (mem = locate_member(pno, conf)) == NULL ) { log("Person %lu is a member in %lu in which he isn't a member.\n", (unsigned long)pno, (unsigned long)mship->conf_no); errors++; } + else + { + /* Check duplicated information + Short circuit and in each check sets foo_e + if an error has been detected + */ + + if (mem->type.invitation != mship->type.invitation || + mem->type.passive != mship->type.passive || + mem->type.secret != mship->type.secret || + mem->type.reserved1 != mship->type.reserved1 || + mem->type.reserved2 != mship->type.reserved2 || + mem->type.reserved3 != mship->type.reserved3 || + mem->type.reserved4 != mship->type.reserved4 || + mem->type.reserved5 != mship->type.reserved5 || + mem->added_at != mship->added_at || + mem->added_by != mship->added_by) + { + log("Person %lu membership in %lu does not match member record.\n", + (unsigned long)pno, + (unsigned long)mship->conf_no + ); + + errors++; + + fputs("Membership:", stdout); + printf(" type: %s%s%s%s%s%s%s%s\n", + mship->type.invitation ? "invitation " : "", + mship->type.passive ? "passive " : "", + mship->type.secret ? "secret " : "", + mship->type.reserved1 ? "rsv1 " : "", + mship->type.reserved2 ? "rsv2 " : "", + mship->type.reserved3 ? "rsv3 " : "", + mship->type.reserved4 ? "rsv4 " : "", + mship->type.reserved5 ? "rsv5" : ""); + printf(" added_by: %lu\n", (unsigned long)mship->added_by); + printf(" added_at: %lu\n", (unsigned long)mship->added_at); + fputs("Member:", stdout); + printf(" type: %s%s%s%s%s%s%s%s\n", + mem->type.invitation ? "invitation " : "", + mem->type.passive ? "passive " : "", + mem->type.secret ? "secret " : "", + mem->type.reserved1 ? "rsv1 " : "", + mem->type.reserved2 ? "rsv2 " : "", + mem->type.reserved3 ? "rsv3 " : "", + mem->type.reserved4 ? "rsv4 " : "", + mem->type.reserved5 ? "rsv5" : ""); + printf(" added_by: %lu\n", (unsigned long)mem->added_by); + printf(" added_at: %lu\n", (unsigned long)mem->added_at); + + if (confirm("Copy membership to member")) + { + mem->added_at = mship->added_at; + mem->added_by = mship->added_by; + mem->type = mship->type; + modifications++; + } + else if (confirm("Copy member to membership")) + { + mship->added_at = mem->added_at; + mship->added_by = mem->added_by; + mship->type = mem->type; + modifications++; + } + } + } } return errors; @@ -1439,7 +1511,6 @@ main (int argc, char *default_config_file; char *config_file; char optc; - BUGDECL; while ((optc = getopt_long(argc, argv, "girvstdcP:G:Fo:", longopts, (int *) 0)) != EOF) diff --git a/src/server/disk-end-of-atomic.c b/src/server/disk-end-of-atomic.c index a4a4b456a0067d806fc5f2f4022e5285bafac262..1d6eab7f69ac61f3b9fa27cc4dd68d3d8bb286b0 100644 --- a/src/server/disk-end-of-atomic.c +++ b/src/server/disk-end-of-atomic.c @@ -1,5 +1,5 @@ /* - * $Id: disk-end-of-atomic.c,v 0.16 1998/07/11 23:35:43 ceder Exp $ + * $Id: disk-end-of-atomic.c,v 0.17 1998/12/26 22:40:36 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -36,8 +36,14 @@ * to forget old texts. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + + static const char * -rcsid = "$Id: disk-end-of-atomic.c,v 0.16 1998/07/11 23:35:43 ceder Exp $"; +rcsid = "$Id: disk-end-of-atomic.c,v 0.17 1998/12/26 22:40:36 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -52,7 +58,7 @@ USE(rcsid); #include "end-of-atomic.h" #include "cache.h" #include "server/smalloc.h" -#include "config.h" +#include "kom-config.h" #include "text-garb.h" #include "param.h" diff --git a/src/server/fncdef.txt b/src/server/fncdef.txt index add3a00f4b1c1fabf9d752cf4b4149496c948278..c67c4a224e19bb903fd785ed1a2e0fef1e808423 100644 --- a/src/server/fncdef.txt +++ b/src/server/fncdef.txt @@ -1,5 +1,5 @@ # -# $Id: fncdef.txt,v 0.33 1998/08/25 21:21:58 ceder Exp $ +# $Id: fncdef.txt,v 0.34 1998/12/26 22:40:37 byers Exp $ # Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997 # Lysator Academic Computer Association. # @@ -23,7 +23,7 @@ # # Please mail bug reports to bug-lyskom@lysator.liu.se. # -# $Id: fncdef.txt,v 0.33 1998/08/25 21:21:58 ceder Exp $ +# $Id: fncdef.txt,v 0.34 1998/12/26 22:40:37 byers Exp $ # # This file is used to describe the functions in services.c. All # functions that are reachable from the clients are listed here, together @@ -165,7 +165,7 @@ success get_info : info success modify_server_info num_list (param.max_delete_aux) aux_item_list (param.max_add_aux) success query_predefined_aux_items : num_list success set_expire num num -success query_read_texts num num : membership +success query_read_texts num num : extended_membership success get_membership num num num num : membership_list success add_member num num num num membership_type success get_members num num num : member_list diff --git a/src/server/internal-connections.c b/src/server/internal-connections.c index 1d9ae7033a3bfb81b1d4cf199b1e36c28424d40a..22c3e97ace868598886881e15072d974e9ead1a5 100644 --- a/src/server/internal-connections.c +++ b/src/server/internal-connections.c @@ -1,5 +1,5 @@ /* - * $Id: internal-connections.c,v 0.31 1998/07/08 13:41:46 ceder Exp $ + * $Id: internal-connections.c,v 0.32 1998/12/26 22:40:37 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,14 @@ * Abstract routines on the data type Connection. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + + static const char * -rcsid = "$Id: internal-connections.c,v 0.31 1998/07/08 13:41:46 ceder Exp $"; +rcsid = "$Id: internal-connections.c,v 0.32 1998/12/26 22:40:37 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -48,7 +54,7 @@ USE(rcsid); #include "async.h" #include "connections.h" #include "internal-connections.h" -#include "config.h" +#include "kom-config.h" #include "server/smalloc.h" #include "lyskomd.h" #include "log.h" @@ -138,7 +144,7 @@ init_connection(Connection *conn) conn->want_async[i] = FALSE; for (i = 0; - i < sizeof(default_want_async)/sizeof(*default_want_async); + (size_t)i < sizeof(default_want_async)/sizeof(*default_want_async); i++) conn->want_async[default_want_async[i]] = TRUE; diff --git a/src/server/isc-malloc.c b/src/server/isc-malloc.c index 960b5b3a5053bb5fd11b7c35582ecfeba0ee384c..3184ec981378dfd0fdedf49615a5525565284128 100644 --- a/src/server/isc-malloc.c +++ b/src/server/isc-malloc.c @@ -1,5 +1,5 @@ /* - * $Id: isc-malloc.c,v 1.9 1998/07/08 13:41:47 ceder Exp $ + * $Id: isc-malloc.c,v 1.10 1998/12/26 22:40:38 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -29,8 +29,14 @@ * how many allocated blocks there are. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + + static const char * -rcsid = "$Id: isc-malloc.c,v 1.9 1998/07/08 13:41:47 ceder Exp $"; +rcsid = "$Id: isc-malloc.c,v 1.10 1998/12/26 22:40:38 byers Exp $"; #include "rcs.h" USE(rcsid); diff --git a/src/server/isc-parse.c b/src/server/isc-parse.c index 126cd1b6dc610de6f4076f90da1e3db3d7cd509b..1bf0f225540c4ff4bb8fd4ecaec6be97c9db73aa 100644 --- a/src/server/isc-parse.c +++ b/src/server/isc-parse.c @@ -1,5 +1,5 @@ /* - * $Id: isc-parse.c,v 0.12 1998/07/08 13:41:49 ceder Exp $ + * $Id: isc-parse.c,v 0.13 1998/12/26 22:40:39 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -26,8 +26,13 @@ * Generic parse routines. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: isc-parse.c,v 0.12 1998/07/08 13:41:49 ceder Exp $"; +rcsid = "$Id: isc-parse.c,v 0.13 1998/12/26 22:40:39 byers Exp $"; #include "rcs.h" USE(rcsid); diff --git a/src/server/local-to-global.c b/src/server/local-to-global.c index aefb4fc8a3dcc496df65b73cb11d4f24d8c6b99c..d7400fbc7b71a1698964a0e51477e84fcbe2e8eb 100644 --- a/src/server/local-to-global.c +++ b/src/server/local-to-global.c @@ -5,6 +5,12 @@ */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <assert.h> #ifdef HAVE_STDLIB_H # include <stdlib.h> @@ -176,14 +182,14 @@ add_block(Local_to_global *l2g) binfo->first_free = 0; binfo->zeroes = L2G_BLOCKSIZE; #ifndef NDEBUG - binfo->start = 0xdeadbeef; + binfo->start = (Local_text_no)0xdeadbeefUL; #endif binfo->key_block = NULL; binfo->value_block = smalloc(L2G_BLOCKSIZE * sizeof(Text_no)); #ifndef NDEBUG for (i = 0; i < L2G_BLOCKSIZE; ++i) - binfo->value_block[i] = 0xdeadbeef; + binfo->value_block[i] = (Local_text_no)0xdeadbeefUL; #endif return binfo; @@ -230,7 +236,7 @@ make_sparse(struct l2g_block_info *binfo) binfo->key_block = smalloc(L2G_BLOCKSIZE * sizeof(Local_text_no)); #ifndef NDEBUG for (i = 0; i < L2G_BLOCKSIZE; ++i) - binfo->key_block[i] = 0xdeadbeef; + binfo->key_block[i] = (Local_text_no)0xdeadbeefUL; #endif /* Compact the block. */ @@ -260,10 +266,10 @@ make_sparse(struct l2g_block_info *binfo) * structure, or if the structure is empty. */ -static const struct l2g_block_info * +static struct l2g_block_info * find_block(const Local_to_global *l2g, Local_text_no lno) { - const struct l2g_block_info * binfo; + struct l2g_block_info * binfo; /* If empty, the number can not be in here. */ if (l2g->num_blocks == 0) @@ -679,7 +685,7 @@ l2g_delete(Local_to_global *l2g, int i; /* Find block where LNO might be and return if not there. */ - binfo = /*const_cast*/(struct l2g_block_info*)find_block(l2g, lno); + binfo = find_block(l2g, lno); if (binfo == NULL) return; diff --git a/src/server/log.c b/src/server/log.c index c06f191ece2e2f953c053b40defda94dd0913e32..6556d9bc18625e4d9f88a79bb8a7417d6d69c4fc 100644 --- a/src/server/log.c +++ b/src/server/log.c @@ -1,5 +1,5 @@ /* - * $Id: log.c,v 0.17 1998/07/12 01:23:47 ceder Exp $ + * $Id: log.c,v 0.18 1998/12/26 22:40:41 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,14 @@ * File created by ceder 1990-05-25. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: log.c,v 0.17 1998/07/12 01:23:47 ceder Exp $"; +rcsid = "$Id: log.c,v 0.18 1998/12/26 22:40:41 byers Exp $"; #include "rcs.h" USE(rcsid); diff --git a/src/server/logII.c b/src/server/logII.c index 2916c05ce9953bae02c325ae6a624bdb6e5608d6..5f1f574f5a2cda977a48093ccf2e27ca3c6139a7 100644 --- a/src/server/logII.c +++ b/src/server/logII.c @@ -1,5 +1,5 @@ /* - * $Id: logII.c,v 0.8 1995/01/01 20:17:22 ceder Exp $ + * $Id: logII.c,v 0.9 1998/12/26 22:40:41 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,6 +28,12 @@ * File created by ceder 1990-05-25. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <stdio.h> #ifdef HAVE_STDARG_H # include <stdarg.h> diff --git a/src/server/manipulate.h b/src/server/manipulate.h index 46ad3ae7acb67c98882d6a6246e5cfca8cedee1e..8d705fcc9b988055a69daaaf79bc0670873f56fd 100644 --- a/src/server/manipulate.h +++ b/src/server/manipulate.h @@ -1,5 +1,5 @@ /* - * $Id: manipulate.h,v 0.16 1998/07/08 16:33:32 ceder Exp $ + * $Id: manipulate.h,v 0.17 1998/12/26 22:40:42 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,7 +23,7 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ /* - * $Id: manipulate.h,v 0.16 1998/07/08 16:33:32 ceder Exp $ + * $Id: manipulate.h,v 0.17 1998/12/26 22:40:42 byers Exp $ * * manipulate.h * @@ -294,6 +294,10 @@ extern Membership * locate_membership(Conf_no conf_no, Person * pers_p); +extern Membership * +locate_membership_and_position(Conf_no conf_no, + Person *pers_p, + unsigned long *position); /* @@ -322,7 +326,8 @@ do_add_member(Conf_no conf_no, /* Conference to add a new member to. */ Person * pers_p, /* Pers. status. Must NOT be NULL. */ unsigned char priority, /* Priority to assign to this conf */ unsigned short where, /* Sequence number in the list */ - Membership_type * type /* Membership type */ + Membership_type * type, /* Membership type */ + Bool fake_priority ); /* diff --git a/src/server/membership.c b/src/server/membership.c index 8a6f47cfb9fad12050d12c485a6a96c4910b04b4..1f706a71b1b6618670c038da5ed83be719895b54 100644 --- a/src/server/membership.c +++ b/src/server/membership.c @@ -1,5 +1,5 @@ /* - * $Id: membership.c,v 0.37 1998/12/20 19:39:48 ceder Exp $ + * $Id: membership.c,v 0.38 1998/12/26 22:40:43 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -29,10 +29,16 @@ * (The person/conf relation). */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #define DEBUG_MARK_AS_READ static const char * -rcsid = "$Id: membership.c,v 0.37 1998/12/20 19:39:48 ceder Exp $"; +rcsid = "$Id: membership.c,v 0.38 1998/12/26 22:40:43 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -99,12 +105,12 @@ static void copy_public_confs (Person * censor_p, /* The censored Person-struct */ Person * orig_p, /* The uncensored Person-struct */ Bool want_read, - Bool copy_secret) /* Does ACTPERS want to know - * which texts are read?*/ + Bool copy_secret) { int i; /* Number of mships lefte in ORIG_P */ Membership * censor_m; /* Pointer in CENSOR_P */ Membership * orig_m; /* Pointer in ORIG_P */ + Bool is_super; /* Copy all information except the secret. */ @@ -118,18 +124,24 @@ copy_public_confs (Person * censor_p, /* The censored Person-struct */ for ( i = 0; i < orig_p->conferences.no_of_confs; i++, orig_m++ ) { + is_super = is_supervisor(orig_m->conf_no, NULL, ACTPERS, ACT_P); + if ( fast_access_perm (orig_m->conf_no, ACTPERS, ACT_P) > none && - (copy_secret || !orig_m->type.secret) ) + (copy_secret || !orig_m->type.secret || + is_super || ENA(admin,2) || ENA(wheel,8)) + ) { *censor_m = *orig_m; - if ( orig_p->flags.unread_is_secret || !want_read ) + if ((orig_p->flags.unread_is_secret || !want_read) && + !is_super) { censor_m->no_of_read = 0; censor_m->read_texts = NULL; } - if ( orig_p->flags.unread_is_secret ) + if (orig_p->flags.unread_is_secret && + !is_super) { censor_m->last_time_read = NO_TIME; censor_m->last_text_read = 0; @@ -144,6 +156,7 @@ copy_public_confs (Person * censor_p, /* The censored Person-struct */ /* * Change the priority of a certain conference in a person. */ + static void do_change_priority (Membership * mship, Conf_no conf_no, @@ -152,11 +165,15 @@ do_change_priority (Membership * mship, unsigned short where, Pers_no pers_no, Person * pers_p, - Membership_type * type) + Membership_type * type, + Bool fake_passive) { Membership tmp_conf; - unsigned short i; + Member *mem; + if (priority == 0 && fake_passive) + type->passive = 1; + mship->priority = priority; mship->type = *type; @@ -190,14 +207,12 @@ do_change_priority (Membership * mship, *mship = tmp_conf; } - - for (i = 0; i < conf_c->members.no_of_members; i++) + /* Sync the change with the corresponding member list */ + mem = locate_member(pers_no, conf_c); + if (mem != NULL) { - if (conf_c->members.members[i].member == pers_no) - { - conf_c->members.members[i].type = *type; - mark_conference_as_changed( conf_no ); - } + mem->type = *type; + mark_conference_as_changed( conf_no ); } mark_person_as_changed( pers_no ); @@ -499,11 +514,19 @@ do_add_member(Conf_no conf_no, /* Conference to add a new member to. */ Person * pers_p, /* Pers. status. Must NOT be NULL. */ unsigned char priority, /* Prioritylevel to assign to this conf */ unsigned short where, /* Sequence number in the list */ - Membership_type * type + Membership_type * type, /* Type of the membership */ + Bool fake_passive ) { Membership * mship; - Member * mbr; + Member * mem; + + + if (fake_passive && priority == 0) + { + type->passive = 1; + } + /* First add the conference in the person-struct. * Make room for it. @@ -545,11 +568,11 @@ do_add_member(Conf_no conf_no, /* Conference to add a new member to. */ /* New members go to the end of the list */ - mbr = (conf_c->members.members + conf_c->members.no_of_members - 1); - mbr->member = pers_no; - mbr->added_by = ACTPERS; - mbr->added_at = time(NULL); - mbr->type = *type; + mem = (conf_c->members.members + conf_c->members.no_of_members - 1); + mem->member = pers_no; + mem->added_by = ACTPERS; + mem->added_at = time(NULL); + mem->type = *type; mark_conference_as_changed( conf_no ); mark_person_as_changed( pers_no ); @@ -711,7 +734,11 @@ fast_access_perm(Conf_no victim, Conf_type conf_type; if ( !cached_conf_exists(victim) ) + { + kom_errno = KOM_UNDEF_CONF; + err_stat = victim; return error; + } if ( viewer != 0 && (ENA(admin, 2) || ENA(wheel,8) || viewer == victim) ) return unlimited; @@ -766,8 +793,16 @@ locate_member(Pers_no pers_no, */ Membership * -locate_membership(Conf_no conf_no, - Person * pers_p) +locate_membership(Conf_no conf_no, + Person *pers_p) +{ + return locate_membership_and_position(conf_no, pers_p, NULL); +} + +Membership * +locate_membership_and_position(Conf_no conf_no, + Person * pers_p, + unsigned long * position) { Membership * confp; int i; @@ -777,10 +812,18 @@ locate_membership(Conf_no conf_no, { if ( confp->conf_no == conf_no ) { + if (position != NULL) + { + *position = i; + } return confp; } } + if (position != NULL) + { + *position = 0; + } return NULL; } @@ -822,16 +865,33 @@ sub_member( Conf_no conf_no, { err_stat = conf_no; if (conf_c->type.secret) - kom_errno = KOM_UNDEF_CONF; + kom_errno = KOM_UNDEF_CONF; else if (mship->type.secret) - kom_errno = KOM_NOT_MEMBER; + kom_errno = KOM_NOT_MEMBER; else - kom_errno = KOM_PERM; + kom_errno = KOM_PERM; return FAILURE; } - return do_sub_member(conf_no, conf_c, NULL, pers_no, pers_p, mship); + return do_sub_member(conf_no, conf_c, NULL, pers_no, pers_p, mship); +} + + +static void send_async_new_membership(Pers_no pers_no, + Conf_no conf_no) +{ + Connection *cptr = NULL; + Session_no i = 0; + + while ((i = traverse_connections(i)) != 0) + { + cptr = get_conn_by_number(i); + if (is_supervisor(pers_no, NULL, ACTPERS, ACT_P)) + { + async_new_membership(cptr, pers_no, conf_no); + } + } } @@ -851,28 +911,14 @@ sub_member( Conf_no conf_no, * You can only re-prioritize if you are supervisor of pers_no. */ -extern Success -add_member_old(Conf_no conf_no, - Pers_no pers_no, - unsigned char priority, - unsigned short where) -{ - Membership_type type; - - set_membership_type_bits(&type, param.invite_by_default,0,0,0,0,0,0,0); - if (pers_no == ACTPERS) - type.invitation = 0; - return add_member(conf_no, pers_no, priority, where, &type); -} - - -extern Success -add_member(Conf_no conf_no, - Pers_no pers_no, - unsigned char priority, - unsigned short where, /* Range of where is [0..] */ - Membership_type *type - ) +static Success +add_member_common(Conf_no conf_no, + Pers_no pers_no, + unsigned char priority, + unsigned short where, /* Range of where is [0..] */ + Membership_type *type, + Bool fake_passive + ) { Conference * conf_c, * pers_c; Person * pers_p; @@ -883,20 +929,24 @@ add_member(Conf_no conf_no, GET_C_STAT(pers_c, pers_no, FAILURE); GET_P_STAT(pers_p, pers_no, FAILURE); + /* Force invitation bit if not adding as admin or supervisor */ if (param.invite_by_default && !is_supervisor(pers_no, pers_c, ACTPERS, ACT_P) && - !ENA(admin, 4)) + !ENA(admin, 2)) { type->invitation = 1; } - if (!param.secret_memberships && type->secret) + /* Check if secret membership bit is set and allowed */ + if (type->secret && + (!param.secret_memberships || conf_c->type.forbid_secret)) { err_stat = 0; kom_errno = KOM_INVALID_MEMBERSHIP_TYPE; return FAILURE; } + /* Check access to the conference. We need limited access or more */ if ( access_perm(conf_no, conf_c, ACTPERS, ACT_P) < limited && !ENA(wheel, 8) ) { @@ -909,11 +959,27 @@ add_member(Conf_no conf_no, if ( (mship = locate_membership( conf_no, pers_p )) != NULL) { - /* He is already a member. Only change the priority. */ + Bool pers_supervisor; + Bool conf_supervisor; GET_C_STAT(pers_c, pers_no, FAILURE); - if( !is_supervisor (pers_no, pers_c , ACTPERS, ACT_P) && - !ENA(wheel, 8) ) + pers_supervisor = is_supervisor(pers_no, pers_c, ACTPERS, ACT_P); + conf_supervisor = is_supervisor(conf_no, conf_c, ACTPERS, ACT_P); + + /* Already a member, but a secret member? */ + if (!pers_supervisor && !conf_supervisor && + !ENA(admin,2) && !ENA(wheel,8)) + { + /* FIXME: This leaks secret information */ + /* The person is already a member, but we are not allowed + to know this. Pretend that the addition worked, and hope + that the user does not double-check */ + + return OK; + } + + /* He is already a member. Only change the priority. */ + if( !pers_supervisor && !ENA(admin,2) && !ENA(wheel, 8) ) { /* Noone else can change one's priorities. */ err_stat = pers_no; @@ -921,7 +987,11 @@ add_member(Conf_no conf_no, return FAILURE; } - do_change_priority( mship, conf_no, conf_c, priority, where, pers_no, pers_p, type); + do_change_priority( mship, conf_no, conf_c, + priority, where, pers_no, pers_p, + type, fake_passive ); + + send_async_new_membership(pers_no, conf_no); } else { @@ -931,12 +1001,43 @@ add_member(Conf_no conf_no, (unsigned long)conf_no, (unsigned long)ACTPERS); - do_add_member(conf_no, conf_c, pers_no, pers_p, priority, where, type); + do_add_member(conf_no, conf_c, pers_no, pers_p, + priority, where, type, fake_passive); + + send_async_new_membership(pers_no, conf_no); } return OK; } + +extern Success +add_member_old(Conf_no conf_no, + Pers_no pers_no, + unsigned char priority, + unsigned short where) +{ + Membership_type type; + + set_membership_type_bits(&type, param.invite_by_default,0,0,0,0,0,0,0); + if (pers_no == ACTPERS) + type.invitation = 0; + return add_member_common(conf_no, pers_no, priority, where, &type, TRUE); +} + + +extern Success +add_member(Conf_no conf_no, + Pers_no pers_no, + unsigned char priority, + unsigned short where, /* Range of where is [0..] */ + Membership_type *type + ) +{ + return add_member_common(conf_no, pers_no, priority, where, type, FALSE); +} + + #ifdef DEBUG_MARK_AS_READ static int check_membership(Pers_no pno, @@ -1147,27 +1248,14 @@ mark_as_read (Conf_no conference, * /// */ -extern Success -get_membership (Pers_no pers_no, - unsigned short first, - unsigned short no_of_confs, - Bool want_read_texts, - Membership_list * memberships ) -{ - return get_membership_old (pers_no, - first, - no_of_confs, - want_read_texts, - memberships ); -} - -extern Success -get_membership_old (Pers_no pers_no, - unsigned short first, - unsigned short no_of_confs, - Bool want_read_texts, - Membership_list * memberships ) +static Success +do_get_membership (Pers_no pers_no, + unsigned short first, + unsigned short no_of_confs, + Bool want_read_texts, + Membership_list *memberships + ) { Person * p_orig; Person temp_pers; @@ -1196,10 +1284,13 @@ get_membership_old (Pers_no pers_no, temp_pers = *p_orig; - /* Delete all secret information. */ + /* Delete all secret and filtered information. */ if ( acc != unlimited ) - copy_public_confs (&temp_pers, p_orig, want_read_texts, FALSE); + { + copy_public_confs (&temp_pers, p_orig, + want_read_texts, FALSE); + } else if ( !want_read_texts ) { /* Delete info about read texts. */ @@ -1233,33 +1324,70 @@ get_membership_old (Pers_no pers_no, return OK; } +extern Success +get_membership_old (Pers_no pers_no, + unsigned short first, + unsigned short no_of_confs, + Bool want_read_texts, + Membership_list * memberships ) +{ + Success result; + long i; + + + result = do_get_membership (pers_no, + first, + no_of_confs, + want_read_texts, + memberships + ); + + if (result == OK) + { + /* Munge passive conferences */ + for (i = 0; i < memberships->no_of_confs; i++) + { + if (memberships->confs[i].type.passive) + { + memberships->confs[i].priority = 0; + } + } + } + + return result; +} + +extern Success +get_membership (Pers_no pers_no, + unsigned short first, + unsigned short no_of_confs, + Bool want_read_texts, + Membership_list * memberships + ) +{ + return do_get_membership (pers_no, + first, + no_of_confs, + want_read_texts, + memberships); +} + /* * +++/// * * first starts at 0. */ -extern Success -get_members_old (Conf_no conf_no, - unsigned short first, - unsigned short no_of_members, - Member_list * members) -{ - return get_members (conf_no, - first, - no_of_members, - members); -} - -extern Success -get_members (Conf_no conf_no, - unsigned short first, - unsigned short no_of_members, - Member_list * members ) +static Success +do_get_members (Conf_no conf_no, + unsigned short first, + unsigned short no_of_members, + Member_list *members) { Conference * conf_c; Access acc; unsigned long src, dst; + Bool is_supervisor_of_conf; GET_C_STAT(conf_c, conf_no, FAILURE); @@ -1292,13 +1420,17 @@ get_members (Conf_no conf_no, src = first; dst = 0; + is_supervisor_of_conf = is_supervisor(conf_no, conf_c, ACTPERS, ACT_P); while (dst < members->no_of_members) { - if (!(conf_c->members).members[src].type.secret || - is_supervisor((conf_c->members).members[src].member, - NULL, - ACTPERS, - ACT_P)) + if ((!(conf_c->members).members[src].type.secret || + is_supervisor_of_conf || + ENA(admin,2) || + ENA(wheel,8) || + is_supervisor((conf_c->members).members[src].member, + NULL, + ACTPERS, + ACT_P))) { members->members[dst] = (conf_c->members).members[src]; } @@ -1308,7 +1440,7 @@ get_members (Conf_no conf_no, members->members[dst].added_by = 0; members->members[dst].added_at = 0; set_membership_type_bits(&members->members[dst].type, - 0,0,0,0,0,0,0,0); + 0,0,1,0,0,0,0,0); } src += 1; @@ -1318,6 +1450,33 @@ get_members (Conf_no conf_no, return OK; } + +extern Success +get_members (Conf_no conf_no, + unsigned short first, + unsigned short no_of_members, + Member_list *members + ) +{ + return do_get_members(conf_no, + first, + no_of_members, + members); +} + +extern Success +get_members_old (Conf_no conf_no, + unsigned short first, + unsigned short no_of_members, + Member_list * members) +{ + return do_get_members (conf_no, + first, + no_of_members, + members); +} + + /* * Get a list of all conferences where it is possible that a person has * unread articles. @@ -1342,10 +1501,11 @@ get_unread_confs(Pers_no pers_no, n < pers_p->conferences.no_of_confs; n++, confs++ ) { - if ((confs->last_text_read - < cached_get_highest_local_no (confs->conf_no)) - && (fast_access_perm(confs->conf_no, ACTPERS, ACT_P) - > read_protected)) + if ((confs->type.passive == 0) && + (confs->last_text_read < + cached_get_highest_local_no(confs->conf_no)) && + (fast_access_perm(confs->conf_no, ACTPERS, ACT_P) > + read_protected)) { result->conf_nos[ result->no_of_confs++ ] = confs->conf_no; } @@ -1478,19 +1638,25 @@ extern Success set_membership_type(Pers_no pers_no, } /* Find entry in conference's member list */ - /* FIXME: If this happens we should do something more drastic - since it indicates that the database is fucked up. */ mbr = locate_member(pers_no, conf_c); if (mbr == NULL) { + /* FIXME: If this happens we should do something more drastic + FIXME: since it indicates that the database is FUBAR. + FIXME: The problem is that the member list and the + FIXME: membership list are not in sync. We could add the + FIXME: membership record. + */ + err_stat = conf_no; kom_errno = KOM_NOT_MEMBER; return FAILURE; } /* Check type restrictions */ - if ((!param.secret_memberships && type->secret) || + if ((type->secret && !param.secret_memberships) || + (type->secret && conf_c->type.forbid_secret) || (!param.allow_reinvite && type->invitation && !membership->type.invitation)) { err_stat = 0; @@ -1498,6 +1664,7 @@ extern Success set_membership_type(Pers_no pers_no, return FAILURE; } + /* Modify member and membership */ membership->type = *type; mbr->type = *type; diff --git a/src/server/memory.c b/src/server/memory.c index 169ff5ccadeb20cea16c858cefe2affb18728109..fd5dd3248d0c82ef5c1dc9791fc9894882adf0cc 100644 --- a/src/server/memory.c +++ b/src/server/memory.c @@ -1,5 +1,5 @@ /* - * $Id: memory.c,v 0.27 1998/11/14 17:33:33 ceder Exp $ + * $Id: memory.c,v 0.28 1998/12/26 22:40:44 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,12 @@ * These functions should be used instead of smalloc/srealloc. */ +#if HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: memory.c,v 0.27 1998/11/14 17:33:33 ceder Exp $"; +rcsid = "$Id: memory.c,v 0.28 1998/12/26 22:40:44 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -78,7 +82,7 @@ init_conf_type(Conf_type *ct) ct->secret = 0; ct->letter_box = 0; ct->allow_anon = 1; - ct->reserved1 = 0; + ct->forbid_secret = 0; ct->reserved2 = 0; ct->reserved3 = 0; } diff --git a/src/server/mux-parse.c b/src/server/mux-parse.c index 99862d1e2fe4a3110b969bcbc2c97e22195c9f0a..36dd7989fb3ee1b3b5be1e7ec4216237dba603dd 100644 --- a/src/server/mux-parse.c +++ b/src/server/mux-parse.c @@ -1,5 +1,5 @@ /* - * $Id: mux-parse.c,v 0.20 1998/07/08 13:41:52 ceder Exp $ + * $Id: mux-parse.c,v 0.21 1998/12/26 22:40:45 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -27,8 +27,14 @@ * This is a hack. Clean this mess up with lacgen. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: mux-parse.c,v 0.20 1998/07/08 13:41:52 ceder Exp $"; +rcsid = "$Id: mux-parse.c,v 0.21 1998/12/26 22:40:45 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -47,7 +53,7 @@ USE(rcsid); #include "async.h" #include "connections.h" #include "isc-interface.h" -#include "config.h" +#include "kom-config.h" #include "log.h" #include "minmax.h" #include "mux.h" diff --git a/src/server/mux.c b/src/server/mux.c index 2a13f3b6ed7a98dda821bf9da4126f1c3fb7344e..ce31af0cc5ae58cfd9975ce791434d1f7a71fec0 100644 --- a/src/server/mux.c +++ b/src/server/mux.c @@ -1,5 +1,5 @@ /* - * $Id: mux.c,v 0.20 1998/07/08 16:36:30 ceder Exp $ + * $Id: mux.c,v 0.21 1998/12/26 22:40:46 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -26,8 +26,14 @@ ** mux.c */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: mux.c,v 0.20 1998/07/08 16:36:30 ceder Exp $"; +rcsid = "$Id: mux.c,v 0.21 1998/12/26 22:40:46 byers Exp $"; #include "rcs.h" USE(rcsid); diff --git a/src/server/mux.h b/src/server/mux.h index ab90fe0fe162790f46f31efc5b3916e1f60bf01b..7c3f6f389d95d9b5833c362cdc534780bf1b370d 100644 --- a/src/server/mux.h +++ b/src/server/mux.h @@ -1,5 +1,5 @@ /* - * $Id: mux.h,v 0.10 1996/08/03 01:31:30 ceder Exp $ + * $Id: mux.h,v 0.11 1998/12/26 22:40:47 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,7 +23,7 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ /* - * $Id: mux.h,v 0.10 1996/08/03 01:31:30 ceder Exp $ + * $Id: mux.h,v 0.11 1998/12/26 22:40:47 byers Exp $ * ** mux.h */ @@ -33,8 +33,8 @@ #define MUX_OUTMSGSIZE 1024 -#define MUX_MAGIC_ALLOC 0x56AE17DB -#define MUX_MAGIC_FREE 0xF24A6BE7 +#define MUX_MAGIC_ALLOC 0x56AE17DBul +#define MUX_MAGIC_FREE 0xF24A6BE7ul typedef enum { diff --git a/src/server/param.h b/src/server/param.h index c5e31433fa0134f8416978837f782b9c073f166d..d1c72e3d34ae38db32ad1f98a696d0721ffa5b28 100644 --- a/src/server/param.h +++ b/src/server/param.h @@ -1,5 +1,5 @@ /* - * $Id: param.h,v 1.17 1998/10/11 17:19:47 ceder Exp $ + * $Id: param.h,v 1.18 1998/12/26 22:40:48 byers Exp $ * Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -103,6 +103,7 @@ struct kom_par { Bool invite_by_default; Bool secret_memberships; Bool allow_reinvite; + Bool regex_use_collate_table; }; extern struct kom_par param; diff --git a/src/server/person.c b/src/server/person.c index 539cb5dc011cb22ea4d47654b13269e6cf0c1135..ad73efcc6a5d9f340395a1fc96d02b98e82013fd 100644 --- a/src/server/person.c +++ b/src/server/person.c @@ -1,5 +1,5 @@ /* - * $Id: person.c,v 0.43 1998/11/14 17:35:41 ceder Exp $ + * $Id: person.c,v 0.44 1998/12/26 22:40:48 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,14 @@ * All atomic calls that deals with persons. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: person.c,v 0.43 1998/11/14 17:35:41 ceder Exp $"; +rcsid = "$Id: person.c,v 0.44 1998/12/26 22:40:48 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -67,7 +73,7 @@ USE(rcsid); #include "async.h" #include "connections.h" #include "server/smalloc.h" -#include "config.h" +#include "kom-config.h" #include "log.h" #include "minmax.h" #include "lyskomd.h" @@ -75,6 +81,8 @@ USE(rcsid); #include "aux-items.h" #include "local-to-global.h" +BUGDECL; + /* * Static functions. */ @@ -151,7 +159,6 @@ do_mark_text(Pers_no pers_no, Mark *markp; Mark *old_mark = NULL; int i; - BUGDECL; if ( pers_p == NULL ) GET_P_STAT(pers_p, pers_no, FAILURE); @@ -216,7 +223,6 @@ do_unmark_text(Pers_no pers_no, Mark *markp; Mark *old_mark = NULL; int i; - BUGDECL; if ( pers_p == NULL ) GET_P_STAT(pers_p, pers_no, FAILURE); @@ -466,7 +472,6 @@ mark_text(Text_no text_no, /* Will fail if the user is not */ u_char mark_type) /* allowed to read the text. */ { Text_stat *text_s = NULL; - BUGDECL; CHK_LOGIN(FAILURE); @@ -489,7 +494,6 @@ extern Success unmark_text(Text_no text_no) { Text_stat *text_s = NULL; - BUGDECL; CHK_LOGIN(FAILURE); BUG(("Person %d avmarkerar text %lu\n", ACTPERS, text_no)); @@ -600,7 +604,7 @@ create_person_generic ( const String name, mailbox->type.secret = 0; mailbox->type.letter_box = 1; mailbox->type.allow_anon = 1; - mailbox->type.reserved1 = 0; + mailbox->type.forbid_secret = 0; mailbox->type.reserved2 = 0; mailbox->type.reserved3 = 0; mailbox->last_written = mailbox->creation_time; @@ -644,7 +648,7 @@ create_person_generic ( const String name, mship_type.reserved5 = 0; do_add_member( new_user, mailbox, new_user, pers_p, - UCHAR_MAX, 0, &mship_type ); + UCHAR_MAX, 0, &mship_type, FALSE ); prepare_aux_item_list(conf_aux, new_user); @@ -979,18 +983,11 @@ set_passwd (Pers_no person, * Will fail if VICTIM is not a member of CONF_NO. */ -extern Success -query_read_texts(Pers_no victim, - Conf_no conf_no, - Membership * result) /* Points to area to store result in */ -{ - return query_read_texts_old(victim, conf_no, result); -} - -extern Success -query_read_texts_old(Pers_no victim, - Conf_no conf_no, - Membership * result) /* Points to area to store result in */ +static Success +do_query_read_texts(Pers_no victim, + Conf_no conf_no, + long *position, + Membership * result) { Person * victim_p; Membership * membp; @@ -1013,7 +1010,9 @@ query_read_texts_old(Pers_no victim, return FAILURE; } - if ( (membp = locate_membership (conf_no, victim_p)) == NULL) + membp = locate_membership_and_position (conf_no, victim_p, position); + + if (membp == NULL) { err_stat = conf_no; kom_errno = KOM_NOT_MEMBER; @@ -1044,6 +1043,28 @@ query_read_texts_old(Pers_no victim, } +extern Success +query_read_texts(Pers_no victim, + Conf_no conf_no, + Extended_Membership * result) /* Points to area to store result in */ +{ + return do_query_read_texts(victim, + conf_no, + &result->position, + &result->membership); +} + + +extern Success +query_read_texts_old(Pers_no victim, + Conf_no conf_no, + Membership *result) +{ + return do_query_read_texts(victim, conf_no, NULL, result); +} + + + /* * Set user_area. The text is a text which has previously been created * with create_text(). It typically contains option-settings for the diff --git a/src/server/prot-a-output.c b/src/server/prot-a-output.c index 14a4a1f223810f8cb984495263e16fcd745f0047..42e9ba46ce06301196182fd29b34ff868d6f224b 100644 --- a/src/server/prot-a-output.c +++ b/src/server/prot-a-output.c @@ -1,5 +1,5 @@ /* - * $Id: prot-a-output.c,v 0.36 1998/08/22 21:31:04 ceder Exp $ + * $Id: prot-a-output.c,v 0.37 1998/12/26 22:40:49 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,14 @@ * Written by ceder 1990-07-13 */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: prot-a-output.c,v 0.36 1998/08/22 21:31:04 ceder Exp $"; +rcsid = "$Id: prot-a-output.c,v 0.37 1998/12/26 22:40:49 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -114,6 +120,13 @@ void prot_a_output_membership(Connection *fp, prot_a_output_membership_type(fp, mship->type); } +void prot_a_output_extended_membership(Connection *fp, + const Extended_Membership *mship) +{ + mux_printf(fp, " %lu", mship->position); + prot_a_output_membership (fp, &mship->membership); +} + void prot_a_output_membership_old(Connection *fp, const Membership *mship) @@ -631,7 +644,7 @@ prot_a_output_extended_conf_type(Connection *fp, mux_putc(type.secret + '0', fp); mux_putc(type.letter_box + '0', fp); mux_putc(type.allow_anon + '0', fp); - mux_putc(type.reserved1 + '0', fp); + mux_putc(type.forbid_secret + '0', fp); mux_putc(type.reserved2 + '0', fp); mux_putc(type.reserved3 + '0', fp); } diff --git a/src/server/prot-a-output.h b/src/server/prot-a-output.h index 6ace7f953e8eca559b17de337c1b3f8938ffe33d..53c1a58ad994cf72a8513c7cecf0663845ede94c 100644 --- a/src/server/prot-a-output.h +++ b/src/server/prot-a-output.h @@ -1,5 +1,5 @@ /* - * $Id: prot-a-output.h,v 0.20 1998/08/05 16:13:29 ceder Exp $ + * $Id: prot-a-output.h,v 0.21 1998/12/26 22:40:50 byers Exp $ * Copyright (C) 1991, 1992, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,7 +23,7 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ /* - * $Id: prot-a-output.h,v 0.20 1998/08/05 16:13:29 ceder Exp $ + * $Id: prot-a-output.h,v 0.21 1998/12/26 22:40:50 byers Exp $ * */ extern void @@ -39,6 +39,9 @@ extern void prot_a_output_membership(Connection *fp, const Membership *mship); +extern void prot_a_output_extended_membership(Connection *fp, + const Extended_Membership *mship); + extern void prot_a_output_membership_old(Connection *fp, const Membership *mship); diff --git a/src/server/prot-a-parse-arg-c.awk b/src/server/prot-a-parse-arg-c.awk index 76885d5a8eea11e1d55fc5ce4f234202052ac4c2..89c6a38a68509d7bb0705131462eacef59b6f135 100644 --- a/src/server/prot-a-parse-arg-c.awk +++ b/src/server/prot-a-parse-arg-c.awk @@ -1,5 +1,5 @@ # -# $Id: prot-a-parse-arg-c.awk,v 0.18 1998/06/14 14:51:06 byers Exp $ +# $Id: prot-a-parse-arg-c.awk,v 0.19 1998/12/26 22:40:51 byers Exp $ # Copyright (C) 1991, 1992, 1993, 1994, 1996 Lysator Academic Computer Association. # # This file is part of the LysKOM server. @@ -22,10 +22,13 @@ # # Please mail bug reports to bug-lyskom@lysator.liu.se. # -# $Id: prot-a-parse-arg-c.awk,v 0.18 1998/06/14 14:51:06 byers Exp $ +# $Id: prot-a-parse-arg-c.awk,v 0.19 1998/12/26 22:40:51 byers Exp $ BEGIN { printf("/* Don't edit this file - it is generated automatically"); printf(" from\n prot-a-parse-arg-c.awk and fncdef.txt */\n\n"); + printf("#ifdef HAVE_CONFIG_H\n"); + printf("# include <config.h>\n"); + printf("#endif\n"); printf("#include <sys/types.h>\n"); printf("#include <sys/socket.h>\n"); printf("#include <stdarg.h>\n"); @@ -42,7 +45,7 @@ BEGIN { printf("#include \"prot-a.h\"\n"); printf("#include \"prot-a-parse.h\"\n"); printf("#include \"prot-a-parse-arg.h\"\n"); - printf("#include \"config.h\"\n"); + printf("#include \"kom-config.h\"\n"); printf("#include \"param.h\"\n\n"); } $1 != "#" { diff --git a/src/server/prot-a-parse.c b/src/server/prot-a-parse.c index 5a9c20526d17fa401f0f9cb3f0eb9a27c1a83946..fe19fd911bc31c21a66907c0269ca7ed1aada83f 100644 --- a/src/server/prot-a-parse.c +++ b/src/server/prot-a-parse.c @@ -1,5 +1,5 @@ /* - * $Id: prot-a-parse.c,v 0.34 1998/11/14 17:37:21 ceder Exp $ + * $Id: prot-a-parse.c,v 0.35 1998/12/26 22:40:52 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,13 @@ * BUG: Not all functions are used, I think. /ceder */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: prot-a-parse.c,v 0.34 1998/11/14 17:37:21 ceder Exp $"; +rcsid = "$Id: prot-a-parse.c,v 0.35 1998/12/26 22:40:52 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -55,7 +60,7 @@ USE(rcsid); #include "connections.h" #include "prot-a-parse.h" #include "isc-parse.h" -#include "config.h" +#include "kom-config.h" #include "isc-interface.h" #include "mux.h" #include "log.h" @@ -246,18 +251,17 @@ prot_a_parse_conf_type(Connection *client, res->letter_box = token.string[ 3 ] != '0'; if (s_strlen(token) != 8) { - /* FIXME: have an "unset" value here? */ - res->allow_anon = 1; - res->reserved1 = 0; - res->reserved2 = 0; - res->reserved3 = 0; + res->allow_anon = 1; + res->forbid_secret = 0; + res->reserved2 = 0; + res->reserved3 = 0; } else { - res->allow_anon = token.string[ 4 ] != '0'; - res->reserved1 = token.string[ 5 ] != '0'; - res->reserved2 = token.string[ 6 ] != '0'; - res->reserved3 = token.string[ 7 ] != '0'; + res->allow_anon = token.string[ 4 ] != '0'; + res->forbid_secret = token.string[ 5 ] != '0'; + res->reserved2 = token.string[ 6 ] != '0'; + res->reserved3 = token.string[ 7 ] != '0'; } } @@ -472,7 +476,14 @@ prot_a_parse_misc_info(Connection *client, switch ( client->struct_parse_pos ) { case 0: - result->type = (Info_type)prot_a_parse_long(client); + /* + FIXME: Omigawd this is ugly. Stupid compiler complains + FIXME: about casting the result of a prot_a_parse_long + FIXME: to an Info_type, but it won't complain if I cast + FIXME: it to an int first. + */ + + result->type = (Info_type)(int)prot_a_parse_long(client); client->struct_parse_pos = 1; /* Fall through */ case 1: diff --git a/src/server/prot-a-send-async.c b/src/server/prot-a-send-async.c index 69eb3e8f4a549a24dbb6b77d0ac51d0234b89aca..ff239b509eee847a6f7e4925d9942543487d9de7 100644 --- a/src/server/prot-a-send-async.c +++ b/src/server/prot-a-send-async.c @@ -1,5 +1,5 @@ /* - * $Id: prot-a-send-async.c,v 0.19 1998/08/08 21:41:44 ceder Exp $ + * $Id: prot-a-send-async.c,v 0.20 1998/12/26 22:40:53 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -26,8 +26,13 @@ * Asynchronous messages in protocol A. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: prot-a-send-async.c,v 0.19 1998/08/08 21:41:44 ceder Exp $"; +rcsid = "$Id: prot-a-send-async.c,v 0.20 1998/12/26 22:40:53 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -197,3 +202,46 @@ prot_a_async_deleted_text(Connection *cptr, async_trailer(cptr); } +void +prot_a_async_new_recipient(Connection *cptr, + Text_no text_no, + Conf_no conf_no, + Info_type type) +{ + ASYNC_CHECK_ACCEPT(cptr, ay_new_recipient); + async_header(cptr, 3, ay_new_recipient); + mux_printf(cptr, " %lu %lu %lu", + (unsigned long)text_no, + (unsigned long)conf_no, + (unsigned long)type); + async_trailer(cptr); +} + +void +prot_a_async_sub_recipient(Connection *cptr, + Text_no text_no, + Conf_no conf_no, + Info_type type) +{ + ASYNC_CHECK_ACCEPT(cptr, ay_sub_recipient); + async_header(cptr, 3, ay_sub_recipient); + mux_printf(cptr, " %lu %lu %lu", + (unsigned long)text_no, + (unsigned long)conf_no, + (unsigned long)type); + async_trailer(cptr); +} + + +void +prot_a_async_new_membership(Connection *cptr, + Pers_no pers_no, + Conf_no conf_no) +{ + ASYNC_CHECK_ACCEPT(cptr, ay_new_membership); + async_header(cptr, 3, ay_new_membership); + mux_printf(cptr, " %lu %lu", + (unsigned long)pers_no, + (unsigned long)conf_no); + async_trailer(cptr); +} diff --git a/src/server/prot-a-send-async.h b/src/server/prot-a-send-async.h index bed568775dc8c4190e87b120039b5ea9d2de2f4f..08294048c6ae51be8d123f68ff3c3c206ad66298 100644 --- a/src/server/prot-a-send-async.h +++ b/src/server/prot-a-send-async.h @@ -1,5 +1,5 @@ /* - * $Id: prot-a-send-async.h,v 0.10 1997/09/13 15:32:24 byers Exp $ + * $Id: prot-a-send-async.h,v 0.11 1998/12/26 22:40:54 byers Exp $ * Copyright (C) 1991, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,7 +23,7 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ /* - * $Id: prot-a-send-async.h,v 0.10 1997/09/13 15:32:24 byers Exp $ + * $Id: prot-a-send-async.h,v 0.11 1998/12/26 22:40:54 byers Exp $ * * Asynchronous messages in protocol A. */ @@ -88,3 +88,22 @@ void prot_a_async_deleted_text(Connection *cptr, Text_no text_no, Text_stat *text_s); + +void +prot_a_async_new_recipient(Connection *cptr, + Text_no text_no, + Conf_no conf_no, + Info_type type); + +void +prot_a_async_sub_recipient(Connection *cptr, + Text_no text_no, + Conf_no conf_no, + Info_type type); + + + +void +prot_a_async_new_membership(Connection *cptr, + Pers_no pers_no, + Conf_no conf_no); diff --git a/src/server/prot-a.c b/src/server/prot-a.c index 7801a75120667242a51cf5b7be5dabff59d3aa8b..2673e803cea981ba1a61abae2a642136ec598942 100644 --- a/src/server/prot-a.c +++ b/src/server/prot-a.c @@ -1,5 +1,5 @@ /* - * $Id: prot-a.c,v 0.50 1998/08/22 17:41:03 ceder Exp $ + * $Id: prot-a.c,v 0.51 1998/12/26 22:40:55 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -26,8 +26,13 @@ * Protocol A. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: prot-a.c,v 0.50 1998/08/22 17:41:03 ceder Exp $"; +rcsid = "$Id: prot-a.c,v 0.51 1998/12/26 22:40:55 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -101,6 +106,12 @@ prot_a_reply(Connection *client, BUG(("={Membership struct not listed}\n")); break; + case rt_extended_membership: + prot_a_output_extended_membership(client, + &res->extended_membership); + BUG(("={Extended Membership struct not listed}\n")); + break; + case rt_conf_list: prot_a_output_conf_list(client, res->conf_list); BUG(("={Conf_list not listed}\n")); @@ -485,7 +496,12 @@ prot_a_parse_packet(Connection *client) client->parse_pos = 1; /* Fall through */ case 1: /* Get fnc_no */ - client->function = (enum call_header)prot_a_parse_long(client); + /* + FIXME: Omigawd this is ugly. The stupid compiler will complain + FIXME: if I try to cast to a call_header directly, but I can + FIXME: cast it to an int first. Jeez... + */ + client->function = (enum call_header)(int)prot_a_parse_long(client); if ( !prot_a_is_legal_fnc(client->function) ) client->function = illegal_fnc; client->parse_pos = 2; diff --git a/src/server/ram-output.c b/src/server/ram-output.c index 47437cee44ffe048336d1a95e93eb0fa8e100695..1a8c33eb9a4157028d4004f9b02f0ed20194b5e5 100644 --- a/src/server/ram-output.c +++ b/src/server/ram-output.c @@ -1,5 +1,5 @@ /* - * $Id: ram-output.c,v 0.26 1998/08/22 21:31:43 ceder Exp $ + * $Id: ram-output.c,v 0.27 1998/12/26 22:40:56 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -33,8 +33,13 @@ * (It worked - now saving is twice as fast.) */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: ram-output.c,v 0.26 1998/08/22 21:31:43 ceder Exp $"; +rcsid = "$Id: ram-output.c,v 0.27 1998/12/26 22:40:56 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -746,7 +751,7 @@ foutput_conf_type_1(FILE *fp, putc(type.secret + '0', fp); putc(type.letter_box + '0', fp); putc(type.allow_anon + '0', fp); - putc(type.reserved1 + '0', fp); + putc(type.forbid_secret + '0', fp); putc(type.reserved2 + '0', fp); putc(type.reserved3 + '0', fp); } diff --git a/src/server/ram-parse.c b/src/server/ram-parse.c index 9e83fa620f7f2e627b00ec8b0548e5d2fce462aa..f3331895fd34baa20098ab82dd4364893ff3f936 100644 --- a/src/server/ram-parse.c +++ b/src/server/ram-parse.c @@ -1,5 +1,5 @@ /* - * $Id: ram-parse.c,v 0.29 1998/07/26 16:43:11 ceder Exp $ + * $Id: ram-parse.c,v 0.30 1998/12/26 22:40:57 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -29,8 +29,13 @@ * ram-parse.c -- parse objects from disk file. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: ram-parse.c,v 0.29 1998/07/26 16:43:11 ceder Exp $"; +rcsid = "$Id: ram-parse.c,v 0.30 1998/12/26 22:40:57 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -1553,7 +1558,7 @@ fparse_string(FILE *fp, } if ( fread(result->string, sizeof(char), result->len, fp) - != result->len ) + != (size_t)result->len ) { log("fparse_string(): unexpected eof at pos %lu.\n", (unsigned long)ftell(fp)); @@ -1753,7 +1758,7 @@ fparse_conf_type(FILE *fp, if (c != '0' && c != '1') { result->allow_anon = 1; - result->reserved1 = 0; + result->forbid_secret = 0; result->reserved2 = 0; result->reserved3 = 0; ungetc(c, fp); @@ -1761,7 +1766,7 @@ fparse_conf_type(FILE *fp, } result->allow_anon = ( c != '0' ); - result->reserved1 = ( getc(fp) != '0' ); + result->forbid_secret = ( getc(fp) != '0' ); result->reserved2 = ( getc(fp) != '0' ); result->reserved3 = ( getc(fp) != '0' ); diff --git a/src/server/ram-smalloc.c b/src/server/ram-smalloc.c index 084306bc0ccf96f509fd5c3b340e97f1d8b49ae0..4c5b3ffc1726fccd21abcf4dfc3dda83b3974ee4 100644 --- a/src/server/ram-smalloc.c +++ b/src/server/ram-smalloc.c @@ -1,5 +1,5 @@ /* - * $Id: ram-smalloc.c,v 0.24 1998/07/08 13:42:00 ceder Exp $ + * $Id: ram-smalloc.c,v 0.25 1998/12/26 22:40:58 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -30,6 +30,11 @@ * TEST VERSION by ceder */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + /* * Define DEBUG_MALLOC to get traces from smalloc, srealloc and sfree. * Run the resulting lyskomd under gdb. Source trace-mem.gdb. Run @@ -38,7 +43,7 @@ /* #define DEBUG_MALLOC */ static const char * -rcsid = "$Id: ram-smalloc.c,v 0.24 1998/07/08 13:42:00 ceder Exp $"; +rcsid = "$Id: ram-smalloc.c,v 0.25 1998/12/26 22:40:58 byers Exp $"; #include "rcs.h" USE(rcsid); diff --git a/src/server/ramkomd.c b/src/server/ramkomd.c index 8e6b87499c8ae07e6e98c7cb0411736ac2e98818..4764d29daa57702ab276bd53ff5ea574944cd4ae 100644 --- a/src/server/ramkomd.c +++ b/src/server/ramkomd.c @@ -1,5 +1,5 @@ /* - * $Id: ramkomd.c,v 0.69 1998/10/11 17:19:35 ceder Exp $ + * $Id: ramkomd.c,v 0.70 1998/12/26 22:40:59 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -38,8 +38,13 @@ * It has grown! /ceder */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: ramkomd.c,v 0.69 1998/10/11 17:19:35 ceder Exp $"; +rcsid = "$Id: ramkomd.c,v 0.70 1998/12/26 22:40:59 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -84,7 +89,7 @@ USE(rcsid); #include "kom-errno.h" #include "isc-malloc.h" #include "isc-interface.h" -#include "config.h" +#include "kom-config.h" #include "cache.h" #include "string-malloc.h" #include "lyskomd.h" diff --git a/src/server/regex-match.c b/src/server/regex-match.c index 1b42991b07e7609209ad7a49c216a365a9f3b800..9a8f68d27a5a334482ffe6e4f027392c83f853bf 100644 --- a/src/server/regex-match.c +++ b/src/server/regex-match.c @@ -1,5 +1,5 @@ /* - * $Id: regex-match.c,v 1.18 1998/12/20 19:45:04 ceder Exp $ + * $Id: regex-match.c,v 1.19 1998/12/26 22:41:00 byers Exp $ * Copyright (C) 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -27,8 +27,13 @@ * Regexp matching */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: regex-match.c,v 1.18 1998/12/20 19:45:04 ceder Exp $"; +rcsid = "$Id: regex-match.c,v 1.19 1998/12/26 22:41:00 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -39,6 +44,9 @@ USE(rcsid); # include <stdarg.h> #endif #include <time.h> +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif #include "s-string.h" #include "misc-types.h" @@ -53,7 +61,8 @@ USE(rcsid); #include "connections.h" #include "manipulate.h" #include "log.h" -#include "config.h" +#include "kom-config.h" +#include "param.h" static Success lookup_regexp (const String regexp, @@ -67,15 +76,23 @@ lookup_regexp (const String regexp, const char *errmsg; Conf_type type; - /* +++ Unnecessary to allocate this much if only one conference matches. */ + /* FIXME: Unnecessary to allocate this much if only one conference matches. */ result->confs = tmp_alloc (cached_no_of_existing_conferences() * sizeof(Conf_z_info)); result->no_of_confs = 0; re_syntax_options = RE_SYNTAX_GREP; - pat_buf.translate = DEFAULT_COLLAT_TAB; - pat_buf.translate = NULL; + if (param.regex_use_collate_table) + { + pat_buf.translate = NULL; + } + else + { + pat_buf.translate = DEFAULT_COLLAT_TAB; + } + pat_buf.fastmap = 0; + /* We have to use malloc() instead of smalloc() when allocating the fastmap, since regfree will use free() to free the memory. If malloc fails here we simply continue without a fastmap. The diff --git a/src/server/rfc931.c b/src/server/rfc931.c index 48e950850dbfb93bf06288377287cc6ecb24d3dd..a57b029373d54b5278a04f3567dedb4f97481eaa 100644 --- a/src/server/rfc931.c +++ b/src/server/rfc931.c @@ -1,5 +1,5 @@ /* - * $Id: rfc931.c,v 1.16 1998/08/07 23:32:20 ceder Exp $ + * $Id: rfc931.c,v 1.17 1998/12/26 22:41:01 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -31,6 +31,11 @@ * Link with "-lauthuser". */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <errno.h> #include <stdio.h> #ifdef HAVE_LIBAUTHUSER diff --git a/src/server/send-async.c b/src/server/send-async.c index 6d3ae94d630efd467cb66e5c46302ec33f640851..82a8c2a5a412c1e8b2b855d1583c147048fc8b75 100644 --- a/src/server/send-async.c +++ b/src/server/send-async.c @@ -1,5 +1,5 @@ /* - * $Id: send-async.c,v 0.23 1998/08/07 23:14:07 ceder Exp $ + * $Id: send-async.c,v 0.24 1998/12/26 22:41:02 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,13 @@ * Written by Per Cederqvist 1990-07-22--23 */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: send-async.c,v 0.23 1998/08/07 23:14:07 ceder Exp $"; +rcsid = "$Id: send-async.c,v 0.24 1998/12/26 22:41:02 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -461,3 +466,74 @@ async_deleted_text(struct connection *cptr, break; } } + + +void +async_new_recipient(struct connection *cptr, + Text_no text_no, + Conf_no conf_no, + Info_type type) +{ + if (!param.send_async_messages) + return; + + switch(cptr->protocol) + { + case 0: + break; + case 'A': + if (cptr->username_valid == TRUE) + prot_a_async_new_recipient(cptr, text_no, conf_no, type); + break; + default: + restart_kom("async_new_recipient(): bad protocol.\n"); + break; + } +} + + +void +async_sub_recipient(struct connection *cptr, + Text_no text_no, + Conf_no conf_no, + Info_type type) +{ + if (!param.send_async_messages) + return; + + switch(cptr->protocol) + { + case 0: + break; + case 'A': + if (cptr->username_valid == TRUE) + prot_a_async_sub_recipient(cptr, text_no, conf_no, type); + break; + default: + restart_kom("async_sub_recipient(): bad protocol.\n"); + break; + } +} + + +void +async_new_membership(struct connection *cptr, + Pers_no pers_no, + Conf_no conf_no) +{ + if (!param.send_async_messages) + return; + + switch(cptr->protocol) + { + case 0: + break; + case 'A': + if (cptr->username_valid == TRUE) + prot_a_async_new_membership(cptr, pers_no, conf_no); + break; + default: + restart_kom("async_new_membership(): bad protocol.\n"); + break; + } +} diff --git a/src/server/send-async.h b/src/server/send-async.h index 0e0166428e8002898e65f3650b1425c0ab30343c..3122d6bed0899cfcd8d8c60a56dcc2eeeccb0955 100644 --- a/src/server/send-async.h +++ b/src/server/send-async.h @@ -1,5 +1,5 @@ /* - * $Id: send-async.h,v 0.11 1997/09/13 15:32:35 byers Exp $ + * $Id: send-async.h,v 0.12 1998/12/26 22:41:03 byers Exp $ * Copyright (C) 1991, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,7 +23,7 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ /* - * $Id: send-async.h,v 0.11 1997/09/13 15:32:35 byers Exp $ + * $Id: send-async.h,v 0.12 1998/12/26 22:41:03 byers Exp $ * */ extern void @@ -82,3 +82,19 @@ async_deleted_text(Connection *cptr, Text_no text_no, Text_stat *text_s); +extern void +async_new_recipient(struct connection *cptr, + Text_no text_no, + Conf_no conf_no, + Info_type type); + +extern void +async_sub_recipient(struct connection *cptr, + Text_no text_no, + Conf_no conf_no, + Info_type type); + +void +async_new_membership(struct connection *cptr, + Pers_no pers_no, + Conf_no conf_no); diff --git a/src/server/server-config.c b/src/server/server-config.c index c583235078a7f3fa70cede02774ec73d0c9a6c0c..a4ecb142d3ebcd48cbe401af74f8000dd21fee1d 100644 --- a/src/server/server-config.c +++ b/src/server/server-config.c @@ -1,5 +1,5 @@ /* - * $Id: server-config.c,v 0.49 1998/10/11 17:19:22 ceder Exp $ + * $Id: server-config.c,v 0.50 1998/12/26 22:41:04 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -31,8 +31,13 @@ * Compile with -DDEFAULT_PREFIX='"/usr/lyskom"' or something similar. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: server-config.c,v 0.49 1998/10/11 17:19:22 ceder Exp $"; +rcsid = "$Id: server-config.c,v 0.50 1998/12/26 22:41:04 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -47,7 +52,7 @@ USE(rcsid); #include <assert.h> #include "server/smalloc.h" -#include "config.h" +#include "kom-config.h" #include "server-config.h" #include "misc-types.h" #include "s-string.h" @@ -225,6 +230,8 @@ static const struct parameter parameters[] = { assign_bool, 0, 1, "on", ¶m.secret_memberships}, {"Allow reinvitations", assign_bool, 0, 1, "off", ¶m.allow_reinvite}, + {"Regexps use collate table", + assign_bool, 0, 1, "on", ¶m.regex_use_collate_table}, /* end marker */ {NULL, NULL, 0, 0, NULL, NULL}}; diff --git a/src/server/session.c b/src/server/session.c index af733916bb189fa036d0dff9675de158b7f82216..c31e3dcd36ea59409929133aed1cefc2ce62d565 100644 --- a/src/server/session.c +++ b/src/server/session.c @@ -1,5 +1,5 @@ /* - * $Id: session.c,v 0.41 1998/10/22 22:07:40 ceder Exp $ + * $Id: session.c,v 0.42 1998/12/26 22:41:04 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,13 @@ * Session control and miscellaneous. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: session.c,v 0.41 1998/10/22 22:07:40 ceder Exp $"; +rcsid = "$Id: session.c,v 0.42 1998/12/26 22:41:04 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -55,7 +60,7 @@ USE(rcsid); #include "log.h" #include "cache.h" #include "send-async.h" -#include "config.h" +#include "kom-config.h" #include "server/smalloc.h" #include "param.h" #include "kom-memory.h" @@ -947,6 +952,9 @@ accept_async(Number_list *num_list) case ay_logout: case ay_deleted_text: case ay_new_text: + case ay_new_recipient: + case ay_sub_recipient: + case ay_new_membership: found = 1; active_connection->want_async[num_list->data[i]] = TRUE; break; diff --git a/src/server/simple-cache.c b/src/server/simple-cache.c index d83a417d9318564850971bfac0c65482f85f5eff..836e299366c2be387bc271fc7fc2dc7b039499cb 100644 --- a/src/server/simple-cache.c +++ b/src/server/simple-cache.c @@ -1,5 +1,5 @@ /* - * $Id: simple-cache.c,v 0.70 1998/12/20 19:50:16 ceder Exp $ + * $Id: simple-cache.c,v 0.71 1998/12/26 22:41:06 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -34,8 +34,13 @@ * Attempt at newer algorithm by byers (FASTSAVE) */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: simple-cache.c,v 0.70 1998/12/20 19:50:16 ceder Exp $"; +rcsid = "$Id: simple-cache.c,v 0.71 1998/12/26 22:41:06 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -83,7 +88,7 @@ USE(rcsid); #include "connections.h" #include "send-async.h" #include "param.h" -#include "config.h" +#include "kom-config.h" #include "admin.h" #include "unused.h" #include "local-to-global.h" @@ -892,7 +897,7 @@ cached_get_text( Text_no text ) fseek(text_file, t_stat->file_pos, SEEK_SET); if ( fread(the_string.string, sizeof(char), the_string.len, text_file) - != the_string.len ) + != (size_t)the_string.len ) { log("WARNING: cached_get_text: premature end on text %lu\n", text); @@ -992,7 +997,8 @@ cached_create_text(const String message) file_pos = ftell(text_file); - if (fwrite(message.string, 1, message.len, text_file) != message.len) + if (fwrite(message.string, 1, message.len, text_file) + != (size_t)message.len) { if (errno != ENOSPC) log("WARNING: cached_create_text: Couldn't write text %lu: %s\n", @@ -1695,7 +1701,7 @@ copy_file(FILE *from, return; } - if ( fwrite(buf, 1, len, to) != len ) + if ( fwrite(buf, 1, len, to) != (size_t)len ) { sync_state = sync_error; log("sync: copy_file(): fwrite failed.\n"); @@ -2503,7 +2509,7 @@ cache_sync_all(void) void free_all_cache (void) { - int i; + unsigned int i; Cache_node *node; #ifdef LOGACCESSES @@ -2751,6 +2757,10 @@ tell_cache_garb_text(int running) { #ifdef LOGACCESSES garb_running = running; +#else + /* Kluge to remove compiler warning + The compiler should be able to optimize this away */ + running = running; #endif } diff --git a/src/server/string-malloc.c b/src/server/string-malloc.c index d59a0818dda062ea327770456a789d3dc8014e61..424cf0d0e3c5f6ef6206ad407a5bf40d13c1f8dc 100644 --- a/src/server/string-malloc.c +++ b/src/server/string-malloc.c @@ -1,5 +1,5 @@ /* - * $Id: string-malloc.c,v 0.13 1998/07/08 13:42:04 ceder Exp $ + * $Id: string-malloc.c,v 0.14 1998/12/26 22:41:07 byers Exp $ * Copyright (C) 1991, 1993, 1994, 1995 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -29,8 +29,13 @@ * how many allocated strings there are. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: string-malloc.c,v 0.13 1998/07/08 13:42:04 ceder Exp $"; +rcsid = "$Id: string-malloc.c,v 0.14 1998/12/26 22:41:07 byers Exp $"; #include "rcs.h" USE(rcsid); diff --git a/src/server/testsuite/config/Makefile.am b/src/server/testsuite/config/Makefile.am index c578a8492b553de533a96f2b796d01a0cf149dd9..f30c2930f1b45eb537ae925d8f4defa57ab2c142 100644 --- a/src/server/testsuite/config/Makefile.am +++ b/src/server/testsuite/config/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.4 1998/08/10 11:19:48 ceder Exp $ +# $Id: Makefile.am,v 1.5 1998/12/26 22:41:11 byers Exp $ # Copyright (C) 1998 Lysator Academic Computer Association. # # This file is part of the LysKOM server. @@ -33,7 +33,7 @@ lyskomd-config: Makefile echo 'Mux port: 53263' >> lyskomd-config.1 echo 'Prefix:' `cd ..;pwd` >> lyskomd-config.1 echo 'Aux-item definition file:' \ - `echo $(top_srcdir)|sed 's/\.\.\///'`/run-support/aux-items.conf \ + `pwd`/aux-items.conf \ >> lyskomd-config.1 chmod 444 lyskomd-config.1 mv lyskomd-config.1 lyskomd-config diff --git a/src/server/testsuite/config/prot-a.exp b/src/server/testsuite/config/prot-a.exp new file mode 100644 index 0000000000000000000000000000000000000000..fd288d5b570de2038458bfd36283b0a53f622017 --- /dev/null +++ b/src/server/testsuite/config/prot-a.exp @@ -0,0 +1,101 @@ + +# +# Functions to make protocol A a little simpler +# + +set ref_no 0 + +proc kom_next_call {} { + global ref_no + + set ref_no [expr $ref_no + 1] +} + +proc cres { result dflt} { + if { $result == "" } { + return $dflt + } else { + return eval $result + } +} + + +proc kom_connect { user {result ""} {testname ""}} { + global ref_no + + send "A[holl $user]\n" + set result [cres $result "LysKOM"] + simple_expect $result $testname +} + +proc kom_accept_async { str {result ""} {testname ""}} { + global ref_no + + kom_next_call + send "$ref_no 80 $str\n" + set result [cres $result "=$ref_no"] + + simple_expect $result $testname +} + +proc kom_create_person { name password aux {result ""} {testname ""}} { + global ref_no + global any_num + global pers_no + + kom_next_call + send "$ref_no 89 [holl "$name"] [holl "$password"] $aux\n" + set result [cres $result "=$ref_no ($any_num)" ] + extracting_expect $result pers_no 1 + + return $pers_no +} + +proc kom_logout {{result ""} {testname ""}} { + global ref_no + + kom_next_call + send "$ref_no 1\n" + set result [cres $result "=$ref_no"] + simple_expect $result $testname +} + +proc kom_login {person password invisible {result ""} {testname ""}} { + global ref_no + + kom_next_call + send "$ref_no 62 $person [holl "$password"] $invisible\n" + set result [cres $result "=$ref_no"] + simple_expect $result $testname +} + +proc kom_create_conference { name type aux {result ""} {testname ""}} { + global ref_no + global any_num + global conf_no + + kom_next_call + send "$ref_no 88 [holl "$name"] $type $aux\n" + set result [cres $result "=$ref_no ($any_num)"] + extracting_expect $result conf_no 1 + + return $conf_no +} + +proc kom_enable { value {result ""} {testname ""} } { + global ref_no + + kom_next_call + send "$ref_no 42 $value\n" + set result [cres $result "=$ref_no"] + simple_expect $result $testname +} + +proc kom_set_supervisor { conf admin {result ""} {testname ""} } { + global ref_no + + kom_next_call + send "$ref_no 18 $conf $admin\n" + set result [cres $result "=$ref_no"] + simple_expect $result $testname +} diff --git a/src/server/testsuite/config/unix.exp b/src/server/testsuite/config/unix.exp index cb39783870b93b886676bec7d189342751d856b4..e34db7cf725f6dd237c3cc77475db35759c161da 100644 --- a/src/server/testsuite/config/unix.exp +++ b/src/server/testsuite/config/unix.exp @@ -167,7 +167,7 @@ proc unanchored_expect {regex testname} { unset test } -proc lyskomd_start {} { +proc lyskomd_start {{aux_item_conf_file "../../../run-support/aux-items.conf"}} { global spawn_id global server_id global test @@ -177,6 +177,8 @@ proc lyskomd_start {} { global expect_active global expect_always global srcdir + global clientport + global muxport # Check that we are in in the correct directory before removing # directories... @@ -187,7 +189,19 @@ proc lyskomd_start {} { system "cp $srcdir/../../../db-crypt/db/lyskomd-data db/" system "cp $srcdir/../../../db-crypt/db/lyskomd-texts db/" - set pid [spawn ../lyskomd -d config/lyskomd-config] + set cf [open "$srcdir/config/lyskomd-config" "w"] + set cwd [pwd] + cd $srcdir + set wd [pwd] + cd $cwd + puts $cf "Client port: $clientport" + puts $cf "Mux port: $muxport" + puts $cf "Prefix: $wd" + puts $cf "Aux-item definition file: $wd/$aux_item_conf_file" + close $cf + + set pid [spawn ../lyskomd -d $srcdir/config/lyskomd-config] + set server_id $spawn_id set expect_active($server_id) \ " -i $server_id eof { fail \"\$test (eof on lyskomd); wait\" }" diff --git a/src/server/testsuite/lyskomd.0/01.exp b/src/server/testsuite/lyskomd.0/01.exp index b75443b0a041e66f0bb11f61d646cf7ad2e07c10..55490cac10f9aed40ea28163841d5f3c6c82bf15 100644 --- a/src/server/testsuite/lyskomd.0/01.exp +++ b/src/server/testsuite/lyskomd.0/01.exp @@ -35,350 +35,349 @@ simple_expect "=1005" # 0:login-old may succeed # 1:logout always succeeds send "1006 1\n" -simple_expect "=1006" +simple_expect "=1006" "logout" # 2:change-conference send "1007 2 4\n" -simple_expect "%1007 6 0" +simple_expect "%1007 6 0" "change-conference" # 3:change-name send "1008 3 1 [holl "new name"]\n" -simple_expect "%1008 6 0" +simple_expect "%1008 6 0" "change-name" # 4:change-what-i-am-doing send "1009 4 [holl "testing lyskomd"]\n" -simple_expect "=1009" +simple_expect "=1009" "change-what-i-am-doing" # 5:create-person-old send "1010 5 [holl "new person"] [holl "mypasswd"]\n" -simple_expect "=1010 6" +simple_expect "=1010 6" "create-person-old" send "1011 39\n" -simple_expect "=1011 1 { 6 0 [holl ""] }" +simple_expect "=1011 1 { 6 0 [holl ""] }" "create-person-old" send "1012 1\n" -simple_expect "=1012" +simple_expect "=1012" "create-person-old" # 6:get-person-stat-old send "1013 6 6 1\n" -simple_expect "%1013 6 0" +simple_expect "%1013 6 0" "get-person-stat-old" # 7:set-priv-bits send "1014 7 6 0000000000000000\n" -simple_expect "%1014 6 0" +simple_expect "%1014 6 0" "set-priv-bits" # 8:set-passwd send "1015 8 5 [holl "old"] [holl "new"]\n" -simple_expect "%1015 6 0" +simple_expect "%1015 6 0" "set-passwd" # 9:query-read-texts-old send "1016 9 6 6\n" -simple_expect "=1016 $any_time 6 255 0 0 \\*" +simple_expect "=1016 $any_time 6 255 0 0 \\*" "query-read-texts-old" # 10:create-conf-old -send "1017 10 [holl "no way"] 0000\n" -simple_expect "%1017 6 0" +send "1017 10 [holl "no way"] 0000\n" +simple_expect "%1017 6 0" "create-conf-old" # 11:delete-conf send "1018 11 1\n" -simple_expect "%1018 6 0" +simple_expect "%1018 6 0" "delete-conf" # 12:lookup-name send "1019 12 [holl "pres"]\n" -simple_expect "=1019 2 { 1 2 } { 0000 0000 }" +simple_expect "=1019 2 { 1 2 } { 0000 0000 }" "lookup-name" send "1020 12 [holl "xyzzy does not exist"]\n" -simple_expect "=1020 0 \\* \\*" +simple_expect "=1020 0 \\* \\*" "lookup-name" # 13:get-conf-stat-older send "1021 13 1 0\n" -simple_expect "=1021 0H 0000 $any_time $any_time 0 0 0 0 0 0 77 0 1 0" +simple_expect "=1021 0H 0000 $any_time $any_time 0 0 0 0 0 0 77 0 1 0" "get-conf-stat-older" send "1022 13 1 1\n" -simple_expect "=1022 [holl "Presentation .av nya. m�ten"] 0000 $any_time $any_time 0 0 0 0 0 0 77 0 1 0" +simple_expect "=1022 [holl "Presentation .av nya. m�ten"] 0000 $any_time $any_time 0 0 0 0 0 0 77 0 1 0" "get-conf-stat-older" # 14:add-member-old send "1023 14 4 5 255 1\n" -simple_expect "%1023 6 0" +simple_expect "%1023 6 0" "add-member-old" # 15:sub-member send "1024 15 4 5\n" -simple_expect "%1024 6 0" +simple_expect "%1024 6 0" "sub-member" # 16:set-presentation send "1025 16 4 1\n" -simple_expect "%1025 6 0" +simple_expect "%1025 6 0" "set-presentation" # 17:set-etc-motd send "1026 17 4 1\n" -simple_expect "%1026 6 0" +simple_expect "%1026 6 0" "set-etc-motd" # 18:set-supervisor send "1027 18 4 1\n" -simple_expect "%1027 6 0" +simple_expect "%1027 6 0" "set-supervisor" # 19:set-permitted-submitters send "1028 19 4 1\n" -simple_expect "%1028 6 0" +simple_expect "%1028 6 0" "set-permitted-submitters" # 20:set-super-conf send "1029 20 4 1\n" -simple_expect "%1029 6 0" +simple_expect "%1029 6 0" "set-super-conf" # 21:set-conf-type send "1030 21 4 0000\n" -simple_expect "%1030 6 0" +simple_expect "%1030 6 0" "set-conf-type" send "1031 21 4 00000000\n" -simple_expect "%1031 6 0" +simple_expect "%1031 6 0" "set-conf-type" # 22:set-garb-nice send "1032 22 4 17\n" -simple_expect "%1032 6 0" +simple_expect "%1032 6 0" "set-garb-nice" # 23:get-marks send "1033 23\n" -simple_expect "%1033 6 0" +simple_expect "%1033 6 0" "get-marks" # 24:mark-text-old send "1034 24 1 243\n" -simple_expect "%1034 6 0" +simple_expect "%1034 6 0" "mark-text-old" # 25:get-text send "1035 25 1 0 999\n" -simple_expect "%1035 14 1" +simple_expect "%1035 14 1" "get-text" # 26:get-text-stat-old send "1036 26 1\n" -simple_expect "%1036 14 1" +simple_expect "%1036 14 1" "get-text-stat-old" # 27:mark-as-read send "1037 27 3 1 { 1 }\n" -simple_expect "%1037 6 0" +simple_expect "%1037 6 0" "mark-as-read" # 28:create-text-old send "1038 28 [holl "A sample text"] 1 { 0 2 }\n" -simple_expect "%1038 6 0" +simple_expect "%1038 6 0" "create-text-old" # 29:delete-text send "1039 29 1\n" -simple_expect "%1039 6 0" +simple_expect "%1039 6 0" "delete-text" # 30:add-recipient send "1040 30 1 4 0\n" -simple_expect "%1040 6 0" +simple_expect "%1040 6 0" "add-recipient" # 31:sub-recipient send "1041 31 1 4\n" -simple_expect "%1041 6 0" +simple_expect "%1041 6 0" "sub-recipient" # 32:add-comment send "1042 32 2 1\n" -simple_expect "%1042 6 0" +simple_expect "%1042 6 0" "add-comment" # 33:sub-comment send "1043 33 2 1\n" -simple_expect "%1043 6 0" +simple_expect "%1043 6 0" "sub-comment" # 34:get-map send "1044 34 1 0 99\n" -simple_expect "%1044 6 0" +simple_expect "%1044 6 0" "get-map" # 35:get-time send "1045 35\n" -simple_expect "=1045 $any_time" +simple_expect "=1045 $any_time" "get-time" # 36:get-info-old send "1046 36\n" -simple_expect "=1046 $server_compat_version 1 2 3 4 0" +simple_expect "=1046 $server_compat_version 1 2 3 4 0" "get-info-old" # 37:add-footnote send "1047 37 1 2\n" -simple_expect "%1047 6 0" +simple_expect "%1047 6 0" "add-footnote" # 38:sub-footnote send "1048 38 1 2\n" -simple_expect "%1048 6 0" +simple_expect "%1048 6 0" "sub-footnote" # 39:who-is-on-old send "1049 39\n" -simple_expect "=1049 0 \\*" +simple_expect "=1049 0 \\*" "who-is-on-old" # 40:set-unread send "1050 40 1 3\n" -simple_expect "%1050 6 0" +simple_expect "%1050 6 0" "set-unread" # 41:set-motd-of-lyskom send "1051 41 1\n" -simple_expect "%1051 6 0" +simple_expect "%1051 6 0" "set-motd-of-lyskom" # 42:enable send "1052 42 255\n" -simple_expect "%1052 6 0" +simple_expect "%1052 6 0" "enable" # 43:sync-kom send "1053 43\n" -simple_expect "%1053 6 0" +simple_expect "%1053 6 0" "sync-kom" # 44:shutdown-kom send "1054 44 2\n" -simple_expect "%1054 6 0" +simple_expect "%1054 6 0" "shutdown-kom" # 45:broadcast send "1055 45 [holl "broadcast-message"]\n" -simple_expect "%1055 6 0" +simple_expect "%1055 6 0" "broadcast" # 46:get-membership-old send "1056 46 5 1 3 1\n" -simple_expect "%1056 6 0" +simple_expect "%1056 6 0" "get-membership-old" # 47:get-created-texts send "1057 47 5 1 3\n" -simple_expect "%1057 6 0" +simple_expect "%1057 6 0" "get-created-text" # 48:get-members-old send "1058 48 5 0 1\n" -simple_expect "=1058 1 { 5 }" +simple_expect "=1058 1 { 5 }" "get-members-old" send "1059 48 5 0 2\n" -simple_expect "=1059 1 { 5 }" +simple_expect "=1059 1 { 5 }" "get-members-old" send "1060 48 5 0 10\n" -simple_expect "=1060 1 { 5 }" +simple_expect "=1060 1 { 5 }" "get-members-old" send "1061 49 5\n" -simple_expect "=1061 [holl "X.unknown.@localhost"] 1111111111111111 00000000 $any_time 0 482 4 0 0 0 0 0 0 1 0 0 1" +simple_expect "=1061 [holl "X.unknown.@localhost"] 1111111111111111 00000000 $any_time 0 482 4 0 0 0 0 0 0 1 0 0 1" "get-members-old" # 50:get-conf-stat-old send "1062 50 1\n" -simple_expect "=1062 [holl "Presentation .av nya. m�ten"] 0000 $any_time $any_time 0 0 0 0 0 0 77 0 1 0" +simple_expect "=1062 [holl "Presentation .av nya. m�ten"] 0000 $any_time $any_time 0 0 0 0 0 0 77 0 1 0" "get-conf-stat-old" # 51:who-is-on send "1063 51\n" -simple_expect "=1063 0 \\*" +simple_expect "=1063 0 \\*" "who-is-on" # 52:get-unread-confs send "1064 52 5\n" -simple_expect "%1064 6 0" +simple_expect "%1064 6 0" "get-unread-confs" # 53:send-message send "1065 53 1 [holl "holler"]\n" -simple_expect "%1065 6 0" +simple_expect "%1065 6 0" "send-message" # 54:get-session-info send "1066 54 1\n" -simple_expect "%1066 6 0" +simple_expect "%1066 6 0" "get-session-info" # 55:disconnect send "1067 55 2\n" -simple_expect "%1067 6 0" +simple_expect "%1067 6 0" "disconnect" # 56:who-am-i send "1068 56\n" -simple_expect "=1068 1" +simple_expect "=1068 1" "who-am-i" # 57:set-user-area send "1069 57 5 2\n" -simple_expect "%1069 6 0" +simple_expect "%1069 6 0" "set-user-area" # 58:get-last-text send "1070 58 0 0 12 1 0 90 0 0 0\n" -simple_expect "=1070 0" +simple_expect "=1070 0" "get-last-text" # 59:create-anonymous-text-old send "1071 59 [holl "anon-txt"] 1 { 0 2 }\n" -simple_expect "%1071 6 0" +simple_expect "%1071 6 0" "create-anonymous-text-old" # 60:find-next-text-no send "1072 60 0\n" -simple_expect "%1072 14 0" +simple_expect "%1072 14 0" "find-next-text-no" send "1073 60 1\n" -simple_expect "%1073 14 1" +simple_expect "%1073 14 1" "find-next-text-no" send "1074 60 3\n" -simple_expect "%1074 14 3" +simple_expect "%1074 14 3" "find-next-text-no" # 61:find-previous-text-no send "1075 61 18\n" -simple_expect "%1075 14 18" +simple_expect "%1075 14 18" "find-previous-text-no" # 62:login send "1076 62 0 [holl "broken"] 1\n" -simple_expect "%1076 8 0" +simple_expect "%1076 8 0" "login" # 63:who-is-on-ident send "1077 63\n" -simple_expect "=1077 0 \\*" +simple_expect "=1077 0 \\*" "who-is-on-ident" # 64:get-session-info-ident send "1078 64 1\n" -simple_expect "%1078 6 0" +simple_expect "%1078 6 0" "get-session-info-ident" # 65:re-lookup-person send "1079 65 [holl "."]\n" -simple_expect "=1079 2 { 5 6 }" +simple_expect "=1079 2 { 5 6 }" "re-lookup-person" # 66:re-lookup-conf send "1080 66 [holl "Pre.*m.*"]\n" -simple_expect "=1080 2 { 1 2 }" +simple_expect "=1080 2 { 1 2 }" "re-lookup-conf" # 67:lookup-person send "1081 67 [holl "ad"]\n" -simple_expect "=1081 1 { 5 }" +simple_expect "=1081 1 { 5 }" "lookup-person" # 68:lookup-conf send "1082 68 [holl "n o lys"]\n" -simple_expect "=1082 1 { 4 }" +simple_expect "=1082 1 { 4 }" "lookup-conf" # 69:set-client-version send "1083 69 [holl "DejaGnu"] [holl "1.3"]\n" -simple_expect "=1083" +simple_expect "=1083" "set-client-version" # 70:get-client-name send "1084 70 1\n" -simple_expect "%1084 6 0" +simple_expect "%1084 6 0" "get-client-name" # 71:get-client-version send "1085 71 1\n" -simple_expect "%1085 6 0" +simple_expect "%1085 6 0" "get-clien-version" # 72:mark-text send "1086 72 1 239\n" -simple_expect "%1086 6 0" +simple_expect "%1086 6 0" "mark-text" # 73:unmark-text send "1087 73 1\n" -simple_expect "%1087 6 0" +simple_expect "%1087 6 0" "unmark-text" # 74:re-z-lookup send "1088 74 [holl "LysKOM"] 1 1\n" -simple_expect "=1088 2 { [holl "Nyheter om LysKOM"] 0000 4 [holl "Administrat�r .f�r. LysKOM"] 1001 5 }" +simple_expect "=1088 2 { [holl "Nyheter om LysKOM"] 0000 4 [holl "Administrat�r .f�r. LysKOM"] 1001 5 }" "re-z-lookup" # 75:get-version-info send "1089 75\n" -simple_expect "=1089 $protocol_a_level [holl "$server_software"] [holl "$server_version"]" +simple_expect "=1089 $protocol_a_level [holl "$server_software"] [holl "$server_version"]" "get-version-info" # 76:lookup-z-name send "1090 76 [holl "pre m"] 1 1\n" -simple_expect "=1090 2 { [holl "Presentation .av nya. m�ten"] 0000 1 [holl "Presentation .av nya. medlemmar"] 0000 2 }" +simple_expect "=1090 2 { [holl "Presentation .av nya. m�ten"] 0000 1 [holl "Presentation .av nya. medlemmar"] 0000 2 }" "lookup-z-name" # 77:set-last-read send "1091 77 3 4\n" -simple_expect "%1091 6 0" +simple_expect "%1091 6 0" "set-last-read" # 78:get-uconf-stat send "1092 78 3\n" -simple_expect "=1092 [holl "Lappar .p�. d�rren"] 00001000 0 77" +simple_expect "=1092 [holl "Lappar .p�. d�rren"] 00001000 0 77" "get-uconf-stat" # 79:set-info send "1093 79 10901 1 2 3 4 1080\n" -simple_expect "%1093 6 0" +simple_expect "%1093 6 0" "set-info" # 80:accept-async send "1094 80 0 { }\n" -simple_expect "=1094" +simple_expect "=1094" "accept-async" # 81:query-async send "1095 81\n" -simple_expect "=1095 0 \\*" +simple_expect "=1095 0 \\*" "query-async" # 82:user-active send "1096 82\n" -simple_expect "=1096" +simple_expect "=1096" "user-active" # 83:who-is-on-dynamic send "1097 83 1 1 0\n" -simple_expect "=1097 1 { 1 0 0 $any_num 11000000 [holl ""] }" +simple_expect "=1097 1 { 1 0 0 $any_num 11000000 [holl ""] }" "who-is-on-dynamic" # 84:get-static-session-info send "1098 84 1\n" -simple_expect "%1098 6 0" +simple_expect "%1098 6 0" "get-static-session-info" # 85:get-collate-table send "1099 85\n" -unanchored_expect "^MRK:client0: =1099 256H" "collate-table start" -unanchored_expect "0123456789" "collate digits" -unanchored_expect "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "collate upper" -unanchored_expect "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "collate lower" +unanchored_expect "^MRK:client0: =1099 256H" "get-collate-table start" +unanchored_expect "0123456789" "get-collate-table digits" +unanchored_expect "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "get-collate-table upper" +unanchored_expect "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "get-collate-table lower" unanchored_expect "\377$nl" "collate end" # 86:create-text send "1100 86 [holl "some text"] 1 { 0 4 } 0 { }\n" -simple_expect "%1100 6 0" +simple_expect "%1100 6 0" "create-text" # 87:create-anonymous-text send "1101 87 [holl "some text"] 1 { 0 4 } 0 { }\n" -simple_expect "%1101 6 0" +simple_expect "%1101 6 0" "create-anonymous-text" # 88:create-conf -send "1102 88 [holl "new conf"] 0000 0 { }\n" -simple_expect "%1102 6 0" +send "1102 88 [holl "new conf"] 0000 0 { }\n" +simple_expect "%1102 6 0" "create-conf" send "1103 88 [holl "new conf"] 00000000 0 { }\n" -simple_expect "%1103 6 0" +simple_expect "%1103 6 0" "create-conf" # 89:create-person send "1104 89 [holl "new 89 person"] [holl "89pwd"] 0 { }\n" -simple_expect "=1104 7" +simple_expect "=1104 7" "create-person" send "1105 83 1 1 0\n" -simple_expect "=1105 1 { 1 7 0 $any_num 01000000 [holl ""] }" +simple_expect "=1105 1 { 1 7 0 $any_num 01000000 [holl ""] }" "create-person" send "1106 1\n" -simple_expect "=1106" +simple_expect "=1106" "create-person" send "1107 83 1 1 0\n" -simple_expect "=1107 1 { 1 0 0 $any_num 11000000 [holl ""] }" +simple_expect "=1107 1 { 1 0 0 $any_num 11000000 [holl ""] }" "create-person" # 90:get-text-stat send "1108 90 1\n" -simple_expect "%1108 14 1" +simple_expect "%1108 14 1" "get-text-stat" # 91:get-conf-stat send "1109 91 1\n" -simple_expect "=1109 [holl "Presentation .av nya. m�ten"] 00001000 $any_time $any_time 0 0 0 0 0 0 77 0 1 0 0 0 \\*" +simple_expect "=1109 [holl "Presentation .av nya. m�ten"] 00001000 $any_time $any_time 0 0 0 0 0 0 77 0 1 0 0 0 \\*" "get-conf-stat" # 92:modify-text-info send "1110 92 1 0 { } 0 { }\n" -simple_expect "%1110 6 0" +simple_expect "%1110 6 0" "modify-text-info" # 93:modify-conf-info send "1111 93 1 0 { } 0 { }\n" -simple_expect "%1111 6 0" +simple_expect "%1111 6 0" "modify-conf-info" # 94:get-info send "1112 94\n" -simple_expect "=1112 $server_compat_version 1 2 3 4 0 0 \\*" +simple_expect "=1112 $server_compat_version 1 2 3 4 0 0 \\*" "get-info" # 95:modify-system-info send "1113 95 0 { } 0 { }\n" -simple_expect "%1113 6 0" +simple_expect "%1113 6 0" "modify-system-info" # 96:query-predefined-aux-items send "1114 96\n" -simple_expect "=1114 15 { 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 }" +simple_expect "=1114 16 { 27 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 }" "query-predefined-aux-items" # 97:set-expire send "1115 97 1 76\n" -simple_expect "%1115 6 0" +simple_expect "%1115 6 0" "set-expire" # 98:query-read-texts send "1116 98 6 6\n" -# FIXME: sould return position as well -simple_expect "=1116 $any_time 6 255 0 0 \\* 0 $any_time 00000000" +simple_expect "=1116 1 $any_time 6 255 0 0 \\* 0 $any_time 00000000" "query-read-texts" # 99:get-membership send "1117 99 6 0 10 1\n" -simple_expect "%1117 6 0" +simple_expect "%1117 6 0" "get-membership" # 100:add-member send "1118 100 5 3 250 1 00000000\n" -simple_expect "%1118 6 0" +simple_expect "%1118 6 0" "add-member" # 101:get-members send "1119 101 5 0 10\n" -simple_expect "=1119 1 { 5 5 $any_time 00000000 }" +simple_expect "=1119 1 { 5 5 $any_time 00000000 }" "get-members" # 102:set-membership-type send "1120 102 5 5 01000000\n" -simple_expect "%1120 6 0" +simple_expect "%1120 6 0" "set-membership-type" # 103:local-to-global send "1121 103 1 1 20\n" -simple_expect "%1121 6 0" +simple_expect "%1121 6 0" "local-to-global" # 104:map_created_texts send "1122 104 5 1 20\n" -simple_expect "%1122 6 0" +simple_expect "%1122 6 0" "map-created-texts" # finally, check that 55=disconnect actually works without logging in. send "1123 55 1\n" -simple_expect "=1123" +simple_expect "=1123" "disconnect (no login)" client_death 0 client_start 0 diff --git a/src/server/testsuite/lyskomd.0/03.exp b/src/server/testsuite/lyskomd.0/03.exp index bcbe727bda01ffaa33aa098c5c89ef9545d23dbd..b294250143c913a03b7bd508f7b2c8c818233524 100644 --- a/src/server/testsuite/lyskomd.0/03.exp +++ b/src/server/testsuite/lyskomd.0/03.exp @@ -114,7 +114,7 @@ simple_expect "=1009" # exactly these aux-items. It shouldn't be hard to fix the test suite # when more items are added. send "1010 96\n" -simple_expect "=1010 15 { 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 }" +simple_expect "=1010 16 { 27 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 }" send "1011 82\n" simple_expect "=1011" @@ -135,7 +135,7 @@ send "1016 80 128 { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 simple_expect "%1016 50 1" send "1017 81\n" -simple_expect "=1017 11 { 0 5 6 7 8 9 11 12 13 14 15 }" +simple_expect "=1017 14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }" send "1018 80 127 { 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 129 }\n" simple_expect "%1018 50 2" @@ -144,22 +144,22 @@ send "1019 80 126 { 0 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 simple_expect "%1019 50 3" send "1020 81\n" -simple_expect "=1020 11 { 0 5 6 7 8 9 11 12 13 14 15 }" +simple_expect "=1020 14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }" send "1021 80 126 { 0 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 3923 }\n" simple_expect "%1021 50 4" send "1022 81\n" -simple_expect "=1022 11 { 0 5 6 7 8 9 11 12 13 14 15 }" +simple_expect "=1022 14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }" send "1023 80 125 { 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 0 }\n" simple_expect "%1023 50 128" send "1024 80 124 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 }\n" -simple_expect "%1024 50 16" +simple_expect "%1024 50 19" send "1025 81\n" -simple_expect "=1025 11 { 0 5 6 7 8 9 11 12 13 14 15 }" +simple_expect "=1025 14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }" send "1026 80 12 { 0 5 6 7 8 9 10 11 12 13 14 15 }\n" simple_expect "%1026 50 10" @@ -191,8 +191,8 @@ send "1031 100 7 8 100 0 00000000\n" simple_expect "=1031" send "1032 86 [holl "New-style text 5"] 2 { 0 7 15 6 } 0 { }\n" -simple_expect ":16 0 5 $any_time 8 0 16 0 2 { 0 7 6 5 }" -simple_expect ":18 15 5 $any_time 8 0 16 0 2 { 0 7 6 5 } 0 \\*" +simple_expect ":16 0 5 $any_time 8 0 16 0 4 { 0 7 6 5 1 6 6 2 }" +simple_expect ":18 15 5 $any_time 8 0 16 0 4 { 0 7 6 5 15 6 6 2 } 0 \\*" simple_expect "=1032 5" talk_to client 0 @@ -634,7 +634,7 @@ simple_expect "=1169 $any_time 7 100 6 0 \\*" send "1170 58 $time_3\n" simple_expect "=1170 2" send "1171 98 6 7\n" -simple_expect "=1171 $any_time 7 100 6 0 \\* 6 $any_time 00000000" +simple_expect "=1171 1 $any_time 7 100 6 0 \\* 6 $any_time 00000000" send "1172 29 2\n" # No new'n'fancy async message here. simple_expect "=1172" @@ -1095,6 +1095,9 @@ while {"$user_active_2" == "$user_active_1"} { send "999 35\n" extracting_expect "=999 ($any_time)" user_active_2 1 } + +sleep 2 + send "1310 83 1 1 0\n" simple_expect "=1310 3 { 4 5 0 $any_num 10000000 [holl ""] 2 8 0 $any_num 01000000 [holl "Accepting i-am-on"] 1 6 6 $any_num 00000000 [holl "Running a test suite"] }" send "1311 83 1 1 2\n" @@ -1168,14 +1171,14 @@ simple_expect "=1326 12" # test call 90 (get-text-stat) send "1327 90 10\n" # Text 10 should have two marks since it is the FAQ of conferences 10 and 11. -extracting_expect "=1327 $time_10 0 0 17 (0|2) 2 { 0 7 6 8 } 1 { 1 1 0 $time_10 00000111 1 [holl "text/plain"] }" n_marks 1 +simple_expect "=1327 $time_10 0 0 17 2 2 { 0 7 6 8 } 1 { 1 1 0 $time_10 00000111 1 [holl "text/plain"] }" -setup_xfail "*" -if {$n_marks == 2} { - pass "correct number of marks on text 10" -} else { - fail "correct number of marks on text 10" -} +# setup_xfail "*" +# if {$n_marks == 2} { +# pass "correct number of marks on text 10" +# } else { +# fail "correct number of marks on text 10" +# } # test call 91 (get-conf-stat) send "1328 91 10\n" @@ -1193,19 +1196,18 @@ send "1331 90 3\n" simple_expect "=1331 $time_3 6 0 16 2 2 { 0 7 6 3 } 1 { 1 2 8 $any_time 00000000 1 [holl "Du har fel"] }" # Remove it. -# FIXME: should we really be allowed to see the value? send "1332 92 3 1 { 1 } 0 { }\n" simple_expect "=1332" send "1333 90 3\n" # This text is marked twice: user area of person 6, presentation for 7. -simple_expect "=1333 $time_3 6 0 16 2 2 { 0 7 6 3 } 1 { 1 2 8 $any_time 10000000 1 [holl "Du har fel"] }" +simple_expect "=1333 $time_3 6 0 16 2 2 { 0 7 6 3 } 0 \\*" # Add a couple of more comments send "1334 92 3 0 { } 2 { 2 00000000 1 [holl "Du har massor fel"] 2 00000000 1 [holl "Du har felast av alla"] }\n" simple_expect "=1334" send "1335 90 3\n" # This text is marked twice: user area of person 6, presentation for 7. -simple_expect "=1335 $time_3 6 0 16 2 2 { 0 7 6 3 } 3 { 1 2 8 $any_time 10000000 1 [holl "Du har fel"] 2 2 8 $any_time 00000000 1 [holl "Du har massor fel"] 3 2 8 $any_time 00000000 1 [holl "Du har felast av alla"] }" +simple_expect "=1335 $time_3 6 0 16 2 2 { 0 7 6 3 } 2 { 2 2 8 $any_time 00000000 1 [holl "Du har massor fel"] 3 2 8 $any_time 00000000 1 [holl "Du har felast av alla"] }" # test call 93 (modify-conf-info) send "1336 91 8\n" @@ -1218,7 +1220,7 @@ simple_expect "=1337 [holl "Kelly Talisman"] 10011000 $time_c_8 $time_7 8 0 8 0 send "1338 93 8 2 { 7 1 } 1 { 13 00000000 1 [holl "kelly@lysator.liu.se"] }\n" simple_expect "=1338" send "1339 91 8\n" -simple_expect "=1339 [holl "Kelly Talisman"] 10011000 $time_c_8 $time_7 8 0 8 0 0 0 77 1 1 2 0 8 { 1 3 8 $time_c_8 10000000 1 [holl "C6 My Creator"] 2 3 8 $time_c_8 00000000 1 [holl "C7 Slightly offensive name, huh"] 3 8 8 $time_c_8 00000000 0 [holl "E-mail:kelly@hotbox.com"] 4 9 8 $time_c_8 00000000 1 [holl "compface must die"] 5 10 8 $time_c_8 00000000 0 [holl "Air"] 6 12 8 $time_c_8 00000000 1 [holl "PGP public key"] 7 13 8 $time_c_8 10000000 1 [holl "kelly@hotbox.com"] 8 13 8 $any_time 00000000 1 [holl "kelly@lysator.liu.se"] }" +simple_expect "=1339 [holl "Kelly Talisman"] 10011000 $time_c_8 $time_7 8 0 8 0 0 0 77 1 1 2 0 6 { 2 3 8 $time_c_8 00000000 1 [holl "C7 Slightly offensive name, huh"] 3 8 8 $time_c_8 00000000 0 [holl "E-mail:kelly@hotbox.com"] 4 9 8 $time_c_8 00000000 1 [holl "compface must die"] 5 10 8 $time_c_8 00000000 0 [holl "Air"] 6 12 8 $time_c_8 00000000 1 [holl "PGP public key"] 8 13 8 $any_time 00000000 1 [holl "kelly@lysator.liu.se"] }" # test call 94 (get-info) send "1340 94\n" @@ -1244,16 +1246,13 @@ send "1344 95 1 { 2 } 0 { }\n" simple_expect "=1344" send "1345 94\n" -# This test assumes that the deleted bit is set, but the item is still -# visible. -simple_expect "=1345 $server_compat_version 1 2 3 4 0 3 { 1 9 5 $any_time 00000000 1 [holl "compface must die"] 2 13 5 $any_time 10000000 1 [holl "maint@kom"] 3 14 5 $any_time 00000000 1 [holl "999"] }" -setup_xfail "*" -fail "the deleted bit is used on a global aux-item" +simple_expect "=1345 $server_compat_version 1 2 3 4 0 2 { 1 9 5 $any_time 00000000 1 [holl "compface must die"] 3 14 5 $any_time 00000000 1 [holl "999"] }" + # test call 96 (query-predefined-aux-items) talk_to client 1 send "1346 96\n" -simple_expect "=1346 15 { 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 }" +simple_expect "=1346 16 { 27 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 }" # test call 97 (set-expire) send "1347 97 10 7123123\n" @@ -1263,7 +1262,7 @@ simple_expect "=1348 [holl "aux in general"] 01001000 $time_c_10 $time_c_10 8 0 # test call 98 (query-read-texts) send "1349 98 6 7\n" -simple_expect "=1349 $any_time 7 100 6 0 \\* 6 $any_time 00000000" +simple_expect "=1349 1 $any_time 7 100 6 0 \\* 6 $any_time 00000000" # test call 99 (get-membership) send "1350 99 6 0 100 1\n" diff --git a/src/server/testsuite/lyskomd.0/04.exp b/src/server/testsuite/lyskomd.0/04.exp new file mode 100644 index 0000000000000000000000000000000000000000..98789367a6a6dd292d47aae5e051064beee5022a --- /dev/null +++ b/src/server/testsuite/lyskomd.0/04.exp @@ -0,0 +1,961 @@ +# Test of aux-item functonality +# +# It's assumed that person 5 is privileged and has +# the password "gazonk" + +read_versions +source "config/prot-a.exp" +lyskomd_start "lyskomd.0/aux-items.conf" + + +client_start 0 +talk_to client 0 +kom_connect "DejaGnu test suite" "" "AIX: Client connected" + +kom_accept_async "0 { }" "" "AIX: Accept-async" + +set pers_6 [ kom_create_person "User 1" "pw1" "0 { }" "" "AIX: Create P6" ] +set pers_7 [ kom_create_person "User 2" "pw2" "0 { }" "" "AIX: Create P7" ] + +kom_logout "" "AIX: Logout P7" +set pers_8 [ kom_create_person "User 3" "pw3" "0 { }" "" "AIX: Create P8" ] + +kom_login 7 "pw2" 0 "" "AIX: Login P7" +set conf_9 [ kom_create_conference "Conference 9" "00001000" "0 { }" "" "AIX: Create C9" ] + + +# ============================================================ +# Basic checks on texts +# + +send "1000 86 [holl "Text 1"] 1 { 0 9 } 3 { 1000 01000000 2 [holl "A1"] 1001 00100000 0 [holl "A2" ] 1002 00010000 0 [holl "A3"] }\n" +simple_expect "=1000 1" "AI Create text with items" + +# Create a comment + +send "1001 86 [holl "Text 2"] 2 { 0 9 2 1 } 0 { }\n" +simple_expect "=1001 2" "AI Create comment without items" + +# Create a second comment +send "1002 86 [holl "Text 3"] 2 { 0 9 2 2 } 0 { }\n" +simple_expect "=1002 3" "AI Create comment without items" + + +# Check that secret items can be read by creator +# Check that hide-author item can be read by creator" + +send "2000 90 1\n" +simple_expect "=2000 $any_time 7 0 6 0 3 { 0 9 6 1 3 2 } 3 { 1 1000 7 $any_time 01000000 2 [holl "A1"] 2 1001 7 $any_time 00100000 0 [holl "A2"] 3 1002 7 $any_time 00010000 0 [holl "A3"] }" "AIT: Permissions when seen by creator" + +# Check that inheritance works + +send "2001 90 2\n" +simple_expect "=2001 $any_time 7 0 6 0 4 { 0 9 6 2 2 1 3 3 } 1 { 1 1000 7 $any_time 01000000 1 [holl "A1"] }" "AIT: Inheritance works" + +# Check that inherit-limit works + +send "2002 90 3\n" +simple_expect "=2002 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 0 \\*" "AIT: Inherit limit works" + +# Add one item + +send "2003 92 3 0 { } 1 { 1010 00000000 0 [holl "D1"] }\n" +simple_expect "=2003" "AIT: Add one item to text (add)" + +send "2004 90 3\n" +simple_expect "=2004 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 1 { 1 1010 7 $any_time 00000000 0 [holl "D1"] }" "AIT: Add one item to text (read)" + +# Add three items at once + +send "2005 92 3 0 { } 3 { 1011 00000000 0 [holl "D2"] 1012 00000000 0 [holl "D3"] 1013 00000000 0 [holl "D4"] }\n" +simple_expect "=2005" "AIT: Add three items to text (add)" + +send "2006 90 3\n" +simple_expect "=2006 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 4 { 1 1010 7 $any_time 00000000 0 [holl "D1"] 2 1011 7 $any_time 00000000 0 [holl "D2"] 3 1012 7 $any_time 00000000 0 [holl "D3"] 4 1013 7 $any_time 00000000 0 [holl "D4"] }" "AIT: Add three items to text (read)" + + +# Creator deleting an item + +send "2007 92 3 1 { 1 } 0 { }\n" +simple_expect "=2007" "AIT: Creator deleting item (delete)" + +send "2008 90 3\n" +simple_expect "=2008 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 3 { 2 1011 7 $any_time 00000000 0 [holl "D2"] 3 1012 7 $any_time 00000000 0 [holl "D3"] 4 1013 7 $any_time 00000000 0 [holl "D4"] }" "AIT: Creator deleting item (read)" + +# Creator deleting three items at once + +send "2009 92 3 3 { 2 3 4 } 0 { }\n" +simple_expect "=2009" "AIT: Creator deleting three items (delete)" + +send "2010 90 3\n" +simple_expect "=2010 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 0 \\*" "aux-items: three items can be deleted" "AIT: Creator deleting three items (read)" + +# Creator attempting to delete a non-existant item + +send "2011 92 3 1 { 1 } 0 { }\n" +simple_expect "%2011 49 0" "AIT: Creator attempting to delete nonexistant item" + +# Add an item after deleted items + +send "2012 92 3 0 { } 2 { 1014 00000000 0 [holl "D5"] 1015 00000000 0 [holl "D6"] }\n" +simple_expect "=2012" "AIT: Add item after deleted items (add)" + +send "2013 90 3\n" +simple_expect "=2013 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 2 { 5 1014 7 $any_time 00000000 0 [holl "D5"] 6 1015 7 $any_time 00000000 0 [holl "D6"] }" "AIT: Add item after deleted item (read)" + +# Non-related person attempting to delete an item + +kom_logout +kom_login 8 "pw3" 0 + +send "2014 92 3 1 { 5 } 0 { }\n" +simple_expect "%2014 49 0" "AIT: Nonrelated person deleting item (delete)" + +send "2014 90 3\n" +simple_expect "=2014 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 2 { 5 1014 7 $any_time 00000000 0 [holl "D5"] 6 1015 7 $any_time 00000000 0 [holl "D6"] }" "AIT: Nonrelated person deleting item (read)" + + +# Supervisor of creator deleting one item + +kom_logout +kom_login 6 "pw1" 0 + +send "2015 92 3 1 { 5 } 0 { }\n" +simple_expect "=2015" "AIT: Supervisor deleting one item (delete)" + +send "2016 90 3\n" +simple_expect "=2016 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 1 { 6 1015 7 $any_time 00000000 0 [holl "D6"] }" "AIT: Supervisor deleting one item (read)" + + +# Admin deleting one item + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "2017 92 3 1 { 6 } 0 { }\n" +simple_expect "=2017" "AIT: Admin deleting one item (delete)" + +send "2018 90 3\n" +simple_expect "=2018 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 0 \\*" "AIT: Admin deleting one item (read)" + + +# Add and delete items at the same time + +kom_logout +kom_login 7 "pw2" 0 + +send "2019 92 3 0 { } 2 { 1016 00000000 0 [holl "D7"] 1017 00000000 0 [holl "D8"] }\n" +simple_expect "=2019" "AIT: Creator adding and deleting at once (prepare)" + +send "2020 90 3\n" +simple_expect "=2020 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 2 { 7 1016 7 $any_time 00000000 0 [holl "D7"] 8 1017 7 $any_time 00000000 0 [holl "D8"] }" "AIT: Creator adding and deleting at once (prepare/read)" + +send "2021 92 3 1 { 7 } 1 { 1018 00000000 0 [holl "D9"] }\n" +simple_expect "=2021" "AIT: Creator adding and deleting (add/delete)" + +send "2022 90 3\n" +simple_expect "=2022 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 2 { 8 1017 7 $any_time 00000000 0 [holl "D8"] 9 1018 7 $any_time 00000000 0 [holl "D9"] }" "AIT: Creator adding and deleting at once (read)" + +# Attempt to add and delete items where add fails + +send "2023 92 3 1 { 8 } 1 { 10000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2023 49 0" "AIT: Creator adding and deleting with add fail (add)" + +send "2024 90 3\n" +simple_expect "=2024 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 2 { 8 1017 7 $any_time 00000000 0 [holl "D8"] 9 1018 7 $any_time 00000000 0 [holl "D9"] }" "AIT: Creator adding and deleting with add fail (read)" + + +# Attempt to add and delete items where delete fails + +send "2025 92 3 1 { 100 } 1 { 1018 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2025 49 0" "AIT: Creator adding and deleting with delete fail (add)" + +send "2026 90 3\n" +simple_expect "=2026 $any_time 7 0 6 0 3 { 0 9 6 3 2 2 } 2 { 8 1017 7 $any_time 00000000 0 [holl "D8"] 9 1018 7 $any_time 00000000 0 [holl "D9"] }" "AIT: Creator adding and deleting with delete fail (read)" + + +# Check that supervisor can see secret item +# Check that supervisor can see author-only item + +kom_logout "" "AIX: Logging out" +kom_login 6 "pw1" 0 "" "AIX: Logging in P6" + +send "2026 90 1\n" +simple_expect "=2026 $any_time 7 0 6 0 3 { 0 9 6 1 3 2 } 3 { 1 1000 7 $any_time 01000000 2 [holl "A1"] 2 1001 7 $any_time 00100000 0 [holl "A2"] 3 1002 7 $any_time 00010000 0 [holl "A3"] }" "AIT: Secret and hide author permissions wrt supervisor" + +# Check that admin can see secret item +# Check that admin can see author-only item + +kom_logout "" "AIX: Logging out" +kom_login 5 "gazonk" 0 "" "AIX: Logging in P5" +kom_enable 255 "" "AIX: Enabling" + +send "2027 90 1\n" +simple_expect "=2027 $any_time 7 0 6 0 3 { 0 9 6 1 3 2 } 3 { 1 1000 7 $any_time 01000000 2 [holl "A1"] 2 1001 7 $any_time 00100000 0 [holl "A2"] 3 1002 7 $any_time 00010000 0 [holl "A3"] }" "AIT: Secret and hide author permissions wrt admin" + + +# Check that non-related person cannot see secret item +# Check that non-related person cannot see author-only item + +kom_logout "" "AIX: Logging out" +kom_login 8 "pw3" 0 "" "AIX: Logging in as P8" + +send "2028 90 1\n" +simple_expect "=2028 $any_time 7 0 6 0 3 { 0 9 6 1 3 2 } 2 { 1 1000 7 $any_time 01000000 2 [holl "A1"] 3 1002 0 $any_time 00010000 0 [holl "A3"] }" "AIT: Secret and hide author permissions wrt others" + + +# ============================================================ +# Basic checks on conferences +# + +kom_logout "" "AIX: Logging Out to start checking confs" +kom_login 7 "pw2" 0 "" "AIX: Logging in to start checking confs" + + +# Creator adding a single item + +send "2029 93 $conf_9 0 { } 1 { 1000 00000000 0 [holl "A1"] }\n" +simple_expect "=2029" "AIC: Cretor adding one item (add)" + +send "2030 91 $conf_9\n" +simple_expect "=2030 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 1 { 1 1000 7 $any_time 00000000 0 [holl "A1"] }" "AIC: Creator adding one item (read)" + + +# Creator adding three items + +send "2031 93 $conf_9 0 { } 3 { 1001 00000000 0 [holl "A2"] 1002 00100000 0 [holl "A3"] 1003 00010000 0 [holl "A4"] }\n" +simple_expect "=2031" "AIC: Creator adding three items (add)" + +send "2032 91 $conf_9\n" +simple_expect "=2032 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 4 { 1 1000 7 $any_time 00000000 0 [holl "A1"] 2 1001 7 $any_time 00000000 0 [holl "A2"] 3 1002 7 $any_time 00100000 0 [holl "A3"] 4 1003 7 $any_time 00010000 0 [holl "A4"] }" "AIC: Creator adding three items (read)" + + +# Creator deleting single item from the middle of the list + +send "2033 93 $conf_9 1 { 2 } 0 { }\n" +simple_expect "=2033" "AIC: Creator deleting one item (delete)" + +send "2034 91 $conf_9\n" +simple_expect "=2034 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 3 { 1 1000 7 $any_time 00000000 0 [holl "A1"] 3 1002 7 $any_time 00100000 0 [holl "A3"] 4 1003 7 $any_time 00010000 0 [holl "A4"] }" "AIC: Creator deleting one item (read)" + +# Creator deleting three items from list + +send "2035 93 $conf_9 3 { 1 3 4 } 0 { }\n" +simple_expect "=2035" "AIC: Creator deleting three items (delete)" + +send "2036 91 $conf_9\n" +simple_expect "=2036 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 0 \\*" "AIC: Creator deleting three items (read)" + +# Creator attempting to delete a non-existant item + +send "2037 93 $conf_9 1 { 1 } 0 { }\n" +simple_expect "%2037 49 0" "AIC: Creator deleting nonexistant item (delete)" + +send "2038 91 $conf_9\n" +simple_expect "=2038 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 0 \\*" "AIC: Creator deleting nonexistant item (read)" + +# Add an item after deleted items + +send "2039 93 $conf_9 0 { } 2 { 1004 00000000 0 [holl "A5"] 1005 00000000 0 [holl "A6"] }\n" +simple_expect "=2039" "AIC: Creator adding item after deleted items (add)" + +send "2040 91 $conf_9\n" +simple_expect "=2040 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 2 { 5 1004 7 $any_time 00000000 0 [holl "A5"] 6 1005 7 $any_time 00000000 0 [holl "A6"] }" "AIC: Creator adding item after deleted items (read)" + + +# Non-related person attempting to delete an item + +kom_logout +kom_login 8 "pw3" 0 + +send "2041 93 $conf_9 1 { 5 } 0 { }\n" +simple_expect "%2041 49 0" "AIC: Nonrelated person attempting to delete item (delete" + +send "2041 91 $conf_9\n" +simple_expect "=2041 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 2 { 5 1004 7 $any_time 00000000 0 [holl "A5"] 6 1005 7 $any_time 00000000 0 [holl "A6"] }" "AIC: Nonrelated person attempting to delete item (read)" + + +# Supervisor of creator deleting one item + +kom_logout +kom_login 6 "pw1" 0 + +send "2042 93 $conf_9 1 { 5 } 0 { }\n" +simple_expect "=2042" "AIC: Supervisor deleting one item (delete)" + +send "2043 91 $conf_9\n" +simple_expect "=2043 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 1 { 6 1005 7 $any_time 00000000 0 [holl "A6"] }" "AIC: Supervisor deleting one item (read)" + + +# Admin deleting one item + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "2044 93 $conf_9 1 { 6 } 0 { }\n" +simple_expect "=2044" "AIC: Admin deleting one item (delete)" + +send "2045 91 $conf_9\n" +simple_expect "=2045 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 0 \\*" "AIC: Admin deleting one item (read)" + + +# Add and delete items at the same time + +kom_logout +kom_login 7 "pw2" 0 + + +# Add and delete items at the same time + +kom_logout +kom_login 7 "pw2" 0 + +send "2046 93 $conf_9 0 { } 2 { 1016 00000000 0 [holl "A7"] 1017 00000000 0 [holl "A8"] }\n" +simple_expect "=2046" "AIC: Add and delete items at once (prepare)" + +send "2046 91 $conf_9\n" +simple_expect "=2046 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 2 { 7 1016 7 $any_time 00000000 0 [holl "A7"] 8 1017 7 $any_time 00000000 0 [holl "A8"] }" "AIC: Add and delete items at once (prepare/read)" + +send "2047 93 $conf_9 1 { 7 } 1 { 1018 00000000 0 [holl "A9"] }\n" +simple_expect "=2047" "AIC: Add and delete items at once (add/delete)" + +send "2048 91 $conf_9\n" +simple_expect "=2048 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 2 { 8 1017 7 $any_time 00000000 0 [holl "A8"] 9 1018 7 $any_time 00000000 0 [holl "A9"] }" "AIC: Add and delete items at once (read)" + +# Attempt to add and delete items where add fails + +send "2049 93 $conf_9 1 { 8 } 1 { 10000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2049 49 0" "AIC: Add and delete where add fails (add)" + +send "2050 91 $conf_9\n" +simple_expect "=2050 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 2 { 8 1017 7 $any_time 00000000 0 [holl "A8"] 9 1018 7 $any_time 00000000 0 [holl "A9"] }" "AIC: Add and delete where add fails (read)" + + +# Attempt to add and delete items where delete fails + +send "2051 93 $conf_9 1 { 100 } 1 { 1018 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2051 49 0" "AIC: Add and delete where delete fails (add)" + +send "2052 91 $conf_9\n" +simple_expect "=2052 [holl "Conference 9"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 3 0 2 { 8 1017 7 $any_time 00000000 0 [holl "A8"] 9 1018 7 $any_time 00000000 0 [holl "A9"] }" "AIC: Add and delete where delete fails (read)" + + +# Check that permissions work + +set conf_10 [ kom_create_conference "Conference 10" "00001000" "3 { 1000 01000000 2 [holl "E1"] 1001 00100000 0 [holl "E2" ] 1003 00010000 0 [holl "E3"] }" ] + +send "2053 91 $conf_10\n" +simple_expect "=2053 [holl "Conference 10"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 0 0 3 { 1 1000 7 $any_time 01000000 2 [holl "E1"] 2 1001 7 $any_time 00100000 0 [holl "E2"] 3 1003 7 $any_time 00010000 0 [holl "E3"] }" "AIC: Create conference with items (read)" + + +# Check that supervisor can see secret item +# Check that supervisor can see author-only item + +kom_logout +kom_login 6 "pw1" 0 + +send "2054 91 $conf_10\n" +simple_expect "=2054 [holl "Conference 10"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 0 0 3 { 1 1000 7 $any_time 01000000 2 [holl "E1"] 2 1001 7 $any_time 00100000 0 [holl "E2"] 3 1003 7 $any_time 00010000 0 [holl "E3"] }" "AIC: Secret and hide author permissions wrt supervisor" + + +# Check that admin can see secret item +# Check that admin can see author-only item + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "2055 91 $conf_10\n" +simple_expect "=2055 [holl "Conference 10"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 0 0 3 { 1 1000 7 $any_time 01000000 2 [holl "E1"] 2 1001 7 $any_time 00100000 0 [holl "E2"] 3 1003 7 $any_time 00010000 0 [holl "E3"] }" "AIC: Secret and hide author permissions wrt admin" + +# Check that non-related person cannot see secret item +# Check that non-related person cannot see author-only item + +kom_logout +kom_login 8 "pw3" 0 + +send "2056 91 $conf_10\n" +simple_expect "=2056 [holl "Conference 10"] 00001000 $any_time $any_time 7 0 7 0 7 0 77 0 1 0 0 2 { 1 1000 7 $any_time 01000000 2 [holl "E1"] 3 1003 0 $any_time 00010000 0 [holl "E3"] }" "AIC: Secret and hide author permissions wrt others" + + + +# ============================================================ +# Basic checks on system +# + +# Try to add as normal user + +kom_logout +kom_login 7 "pw2" 0 + +send "2100 95 0 { } 1 { 1000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2100 12 0" "AIS: Add as normal user (add)" + +send "2100 94\n" +simple_expect "=2100 $any_num $any_num $any_num $any_num $any_num $any_num 0 \\*" "AIS: Attempt to add single item as normal user (read)" + + + +# Try to add single item as admin +kom_logout +kom_login 5 "gazonk" 0 + +send "2101 95 0 { } 1 { 1000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2101 12 0" "AIS: Add single item as admin without enable (add)" + +send "2101 94\n" +simple_expect "=2101 $any_num $any_num $any_num $any_num $any_num $any_num 0 \\*" "AIS: Attempt to add single item as admin without enable (read)" + +kom_enable 255 + +send "2101 95 0 { } 1 { 1000 00000000 0 [holl "S1"] }\n" +simple_expect "=2101" "AIS: Add single item as admin with enable (add)" + +send "2102 94\n" +simple_expect "=2102 $any_num $any_num $any_num $any_num $any_num $any_num 1 { 1 1000 5 $any_time 00000000 0 [holl "S1"] }" "AIS: Admin adding single item (read)" + + +# Try to add three items as admin + +send "2103 95 0 { } 3 { 1001 00000000 0 [holl "S2"] 1002 00000000 0 [holl "S3"] 1003 00000000 0 [holl "S4"] }\n" +simple_expect "=2103" "AIS: Add three items as admin with enable (add)" + +send "2104 94\n" +simple_expect "=2104 $any_num $any_num $any_num $any_num $any_num $any_num 4 { 1 1000 5 $any_time 00000000 0 [holl "S1"] 2 1001 5 $any_time 00000000 0 [holl "S2"] 3 1002 5 $any_time 00000000 0 [holl "S3"] 4 1003 5 $any_time 00000000 0 [holl "S4"] }" "AIS: Admin adding three items (read)" + + +# Try to delete as normal person + +kom_logout +kom_login 7 "pw2" 0 + +send "2105 95 1 { 1 } 0 { }\n" +simple_expect "%2105 12 0" "AIS: Attempt to delete as normal user" + +send "2106 94\n" +simple_expect "=2106 $any_num $any_num $any_num $any_num $any_num $any_num 4 { 1 1000 5 $any_time 00000000 0 [holl "S1"] 2 1001 5 $any_time 00000000 0 [holl "S2"] 3 1002 5 $any_time 00000000 0 [holl "S3"] 4 1003 5 $any_time 00000000 0 [holl "S4"] }" "AIS: Attempt to delete as normal user (read)" + + +# Try to delete single item as admin + +kom_logout +kom_login 5 "gazonk" 0 + +send "2107 95 1 { 1 } 0 { }\n" +simple_expect "%2107 12 0" "AIS: Attempt to delete as admin without enable (delete)" + +send "2108 94\n" +simple_expect "=2108 $any_num $any_num $any_num $any_num $any_num $any_num 4 { 1 1000 5 $any_time 00000000 0 [holl "S1"] 2 1001 5 $any_time 00000000 0 [holl "S2"] 3 1002 5 $any_time 00000000 0 [holl "S3"] 4 1003 5 $any_time 00000000 0 [holl "S4"] }" "AIS: Attempt to delete as admin without enable (read)" + +kom_enable 255 + +send "2109 95 1 { 1 } 0 { }\n" +simple_expect "=2109" "AIS: Delete as admin (delete)" + +send "2110 94\n" +simple_expect "=2110 $any_num $any_num $any_num $any_num $any_num $any_num 3 { 2 1001 5 $any_time 00000000 0 [holl "S2"] 3 1002 5 $any_time 00000000 0 [holl "S3"] 4 1003 5 $any_time 00000000 0 [holl "S4"] }" "AIS: Delete as admin (read)" + +send "2111 95 1 { 4 } 0 { }\n" +simple_expect "=2111" "AIS: Delete last item as admin (delete)" + +send "2112 94\n" +simple_expect "=2112 $any_num $any_num $any_num $any_num $any_num $any_num 2 { 2 1001 5 $any_time 00000000 0 [holl "S2"] 3 1002 5 $any_time 00000000 0 [holl "S3"] }" "AIS: Delete last item as admin (read)" + + +# Try to add after delete +# Try to add last, after deleted last item + +send "2113 95 0 { } 1 { 1000 00000000 0 [holl "S5"] }\n" +simple_expect "=2113" "AIS: Add item after deleted item (add)" + +send "2114 94\n" +simple_expect "=2114 $any_num $any_num $any_num $any_num $any_num $any_num 3 { 2 1001 5 $any_time 00000000 0 [holl "S2"] 3 1002 5 $any_time 00000000 0 [holl "S3"] 5 1000 5 $any_time 00000000 0 [holl "S5"] }" "AIS: Add item after deleted item (read)" + + +# Try to delete three items as admin + +send "2115 95 3 { 2 3 5 } 0 { }\n" +simple_expect "=2115" "AIS: Delete three items as admin (delete)" + +send "2116 94\n" +simple_expect "=2116 $any_num $any_num $any_num $any_num $any_num $any_num 0 \\*" "AIS: Delete three items as admin (read)" + +# Try to add and delete at once + +send "2117 95 0 { } 1 { 1000 00000000 0 [holl "S6"] }\n" +simple_expect "=2117" "AIS: Add and delete at once (prepare, add)" + +send "2118 94\n" +simple_expect "=2118 $any_num $any_num $any_num $any_num $any_num $any_num 1 { 6 1000 5 $any_time 00000000 0 [holl "S6"] }" "AIS: Add and delete at once (prepare, read)" + +send "2119 95 1 { 6 } 1 { 1009 00000000 0 [holl "S7"] }\n" +simple_expect "=2119" "AIS: Add and delete at once (add)" + +send "2120 94\n" +simple_expect "=2120 $any_num $any_num $any_num $any_num $any_num $any_num 1 { 7 1009 5 $any_time 00000000 0 [holl "S7"] }" "AIS: Add and delete at once (read)" + + +# Try add and delete with add fail + +send "2121 95 1 { 7 } 1 { 10001 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2121 49 0" "AIS: Add and delete with add fail (add)" + +send "2122 94\n" +simple_expect "=2122 $any_num $any_num $any_num $any_num $any_num $any_num 1 { 7 1009 5 $any_time 00000000 0 [holl "S7"] }" "AIS: Add and delete with add fail (read)" + +# Try add and delete with delete fail + +send "2123 95 1 { 9 } 1 { 1000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2123 49 0" + +send "2124 94\n" +simple_expect "=2124 $any_num $any_num $any_num $any_num $any_num $any_num 1 { 7 1009 5 $any_time 00000000 0 [holl "S7"] }" "AIS: Add and delete with delete fail (read)" + + +# Check hide author and secret permissions wrt admin + +send "2125 95 0 { } 2 { 1010 00100000 0 [holl "SS"] 1011 00010000 0 [holl "HA"] }\n" +simple_expect "=2125" "AIS: Check permissions (prepare)" + +send "2126 94\n" +simple_expect "=2126 $any_num $any_num $any_num $any_num $any_num $any_num 3 { 7 1009 5 $any_time 00000000 0 [holl "S7"] 8 1010 5 $any_time 00100000 0 [holl "SS"] 9 1011 5 $any_time 00010000 0 [holl "HA"] }" "AIS: Check permissions wrt admin (read)" + +kom_enable 0 + +send "2127 94\n" +simple_expect "=2127 $any_num $any_num $any_num $any_num $any_num $any_num 3 { 7 1009 5 $any_time 00000000 0 [holl "S7"] 8 1010 5 $any_time 00100000 0 [holl "SS"] 9 1011 5 $any_time 00010000 0 [holl "HA"] }" "AIS: Check permissions wrt non-enabled admin (read)" + + +# Check hide author and secret permissions wrt other user + +kom_logout +kom_login 7 "pw2" 0 + +send "2128 94\n" +simple_expect "=2128 $any_num $any_num $any_num $any_num $any_num $any_num 2 { 7 1009 5 $any_time 00000000 0 [holl "S7"] 9 1011 0 $any_time 00010000 0 [holl "HA"] }" "AIS: Check permissions wrt normal user (read)" + +# Clear up garbage + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "2129 95 3 { 7 8 9 } 0 { }\n" +simple_expect "=2129" + +send "2130 94\n" +simple_expect "=2130 $any_num $any_num $any_num $any_num $any_num $any_num 0 \\*" + + + + +# ============================================================ +# Check enforcement of restrictions + + +kom_logout +kom_login 7 "pw2" 0 + +send "1999 86 [holl "Text 3"] 2 { 0 9 2 2 } 0 { }\n" +simple_expect "=1999 4" "AI Create comment without items" + +send "2200 90 4\n" +extracting_expect "=2200 (.*) 0 \\*" text_stat 1 + +# Add conf-only to text +# Add letterbox-only to text +# Add system-only to text +# Add text-only to text + +send "2201 92 4 0 { } 1 { 10001 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2201 49 0" "AIR: Add conf-only to text (add)" + +send "2202 90 4\n" +simple_expect "=2202 $text_stat 0 \\*" "AIR: Add conf-only to text (read)" + +send "2203 92 4 0 { } 1 { 10003 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2203 49 0" "AIR: Add letterbox-only to text (add)" + +send "2204 90 4\n" +simple_expect "=2204 $text_stat 0 \\*" "AIR: Add letterbox-only to text (read)" + +send "2205 92 4 0 { } 1 { 10000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2205 49 0" "AIR: Add system-only to text (add)" + +send "2206 90 4\n" +simple_expect "=2206 $text_stat 0 \\*" "AIR: Add system-only to text (read)" + +send "2207 92 4 0 { } 1 { 10002 00000000 0 [holl "R1"] }\n" +simple_expect "=2207" "AIR: Add text-only to text (add)" + +send "2208 90 4\n" +simple_expect "=2208 $text_stat 1 { 1 10002 7 $any_time 00000000 0 [holl "R1"] }" "AIR: Add text-only to text (read)" + + +# Add system-only to letterbox +# Add conf-only to letterbox +# Add text-only to letterbox +# Add letterbox-only to letterbox + +send "2300 91 7\n" +extracting_expect "=2300 (.*) 0 \\*" conf_stat 1 + +send "2301 93 7 0 { } 1 { 10000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2301 49 0" "AIR: Adding system-only to letterbox (add)" + +send "2302 91 7\n" +simple_expect "=2302 $conf_stat 0 \\*" "AIR: Adding system-only to letterbox (read)" + +send "2303 93 7 0 { } 1 { 10001 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2303 49 0" "AIR: Adding conf-only to letterbox (add)" + +send "2304 91 7\n" +simple_expect "=2304 $conf_stat 0 \\*" "AIR: Adding conf-only to letterbox (read)" + +send "2305 93 7 0 { } 1 { 10002 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2305 49 0" "AIR: Adding text-only to letterbox (add)" + +send "2306 91 7\n" +simple_expect "=2306 $conf_stat 0 \\*" "AIR: Adding text-only to letterbox (read)" + +send "2307 93 7 0 { } 1 { 10003 00000000 0 [holl "R2"] }\n" +simple_expect "=2307" "AIR: Adding pers-only to letterbox (add)" + +send "2308 91 7\n" +simple_expect "=2308 $conf_stat 1 { 1 10003 7 $any_time 00000000 0 [holl "R2"] }" "AIR: Adding pers-only to letterbox (read)" + + + +# Add text-only to conf +# Add letterbox-only to conf +# Add system-only to conf +# Add conf-only to conf + +kom_create_conference "Conference 11" "00001000" "0 { }" "" "AIX: Create C11" + +send "2400 91 11\n" +extracting_expect "=2400 (.*) 0 \\*" conf_stat 1 + +send "2401 93 11 0 { } 1 { 10000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2401 49 0" "AIR: Adding system-only to conf (add)" + +send "2402 91 11\n" +simple_expect "=2402 $conf_stat 0 \\*" "AIR: Adding system-only to conf (read)" + +send "2403 93 11 0 { } 1 { 10003 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2403 49 0" "AIR: Adding pers-only to conf (add)" + +send "2404 91 11\n" +simple_expect "=2404 $conf_stat 0 \\*" "AIR: Adding conf-only to conf (read)" + +send "2405 93 11 0 { } 1 { 10002 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2405 49 0" "AIR: Adding text-only to conf (add)" + +send "2406 91 11\n" +simple_expect "=2406 $conf_stat 0 \\*" "AIR: Adding text-only to conf (read)" + +send "2407 93 11 0 { } 1 { 10001 00000000 0 [holl "R3"] }\n" +simple_expect "=2407" "AIR: Adding conf-only to conf (add)" + +send "2408 91 11\n" +simple_expect "=2408 $conf_stat 1 { 1 10001 7 $any_time 00000000 0 [holl "R3"] }" "AIR: Adding conf-only to conf (read)" + + +# Add text-only to system +# Add conf-only to system +# Add letterbox-only to system +# Add system-only to system + + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "2500 94\n" +extracting_expect "=2500 (.*) 0 \\*" info_struct 1 + +send "2501 95 0 { } 1 { 10003 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2501 49 0" "AIR: Adding pers-only to system (add)" + +send "2502 94\n" +simple_expect "=2502 $info_struct 0 \\*" "AIR: Adding pers-only to system (read)" + +send "2503 95 0 { } 1 { 10001 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2503 49 0" "AIR: Adding conf-only to system (add)" + +send "2504 94\n" +simple_expect "=2504 $info_struct 0 \\*" "AIR: Adding conf-only to system (read)" + +send "2505 95 0 { } 1 { 10002 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%2505 49 0" "AIR: Adding text-only to system (add)" + +send "2506 94\n" +simple_expect "=2506 $info_struct 0 \\*" "AIR: Adding text-only to system (read)" + +send "2507 95 0 { } 1 { 10000 00000000 0 [holl "R4"] }\n" +simple_expect "=2507" "AIR: Adding system-only to system (add)" + +send "2508 94\n" +simple_expect "=2508 $info_struct 1 { 10 10000 5 $any_time 00000000 0 [holl "R4"] }" "AIR: Adding system-only to system (read)" + + + +# Check forcing of all bits +# Check forcing of inherit-limit +# Check validation of contents + +kom_logout +kom_login 7 "pw2" 0 + +send "3000 86 [holl "Text 5"] 2 { 0 9 2 2 } 4 { 2000 00000000 1 [holl "SET"] 2001 11111111 0 [holl "CLR"] 2002 00000000 20 [holl "LIM"] 2002 00000000 1 [holl "ULM"] }\n" +simple_expect "=3000 5" + +send "3001 90 5\n" +extracting_expect "=3001 (.*) 4 { 1 2000 7 $any_time 01111111 1 [holl "SET"] 2 2001 7 $any_time 00000000 0 [holl "CLR"] 3 2002 7 $any_time 00000000 10 [holl "LIM"] 4 2002 7 $any_time 00000000 1 [holl "ULM"] }" text_stat 1 + +# Clear out the junk + +send "3002 92 5 4 { 1 2 3 4 } 0 { }\n" +simple_expect "=3002" + +send "3003 90 5\n" +simple_expect "=3003 $text_stat 0 \\*" + +# Check content validation + +send "3004 92 5 0 { } 1 { 2003 00000000 1 [holl "FAIL"] }\n" +simple_expect "%3004 48 0" + +send "3005 90 5\n" +simple_expect "=3005 $text_stat 0 \\*" + +send "3005 92 5 0 { } 1 { 2003 00000000 0 [holl "GOOD"] }\n" +simple_expect "=3005" + +send "3006 90 5\n" +simple_expect "=3006 $text_stat 1 { 5 2003 7 $any_time 00000000 0 [holl "GOOD"] }" + + + +# Add author-only as author +# Add cant-delete item +# Add one-per-person as person A +# Add item restricted to create text can be added on create + +kom_logout +kom_login 7 "pw2" 0 + +send "4000 86 [holl "Text 6"] 2 { 0 9 2 2 } 4 { 2004 00000000 0 [holl "AO"] 2006 00000000 0 [holl "UQ"] 2007 00000000 0 [holl "PM"] 3000 00000000 0 [holl "CT"] }\n" +simple_expect "=4000 6" + +send "4001 90 6\n" +extracting_expect "=4001 (.*) 4 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] }" text_stat 1 + + +# Try to add second one-per-person item as person A + +send "4002 92 6 0 { } 1 { 2006 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%4002 49 0" + +send "4003 90 6\n" +simple_expect "=4003 $text_stat 4 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] }" + +# Try to delete cant-delete item + +send "4004 92 6 1 { 3 } 0 { }\n" +simple_expect "%4004 49 0" + +send "4005 90 6\n" +simple_expect "=4005 $text_stat 4 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] }" + +# Try to add create-restricted item after create + +send "4006 92 6 0 { } 1 { 3000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%4006 49 0" + +send "4007 90 6\n" +simple_expect "=4007 $text_stat 4 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] }" + + +# Log in as person 8 + +kom_logout +kom_login 8 "pw3" 0 + +# Add two one-per-person at once + +send "4100 92 6 0 { } 2 { 2006 00000000 0 [holl "AOB1"] 2006 00000000 0 [holl "AOB2"] }\n" +simple_expect "%4100 49 0" + +send "4101 90 6\n" +simple_expect "=4101 $text_stat 4 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] }" + + +# Add one-per-person as person B + +send "4102 92 6 0 { } 1 { 2006 00000000 0 [holl "AOB1"] }\n" +simple_expect "=4102" + +send "4103 90 6\n" +simple_expect "=4103 $text_stat 5 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] 5 2006 8 $any_time 00000000 0 [holl "AOB1"] }" + + +# Add another one-per-person as person B + +send "4104 92 6 0 { } 1 { 2006 00000000 0 [holl "AOB1"] }\n" +simple_expect "%4104 49 0" + +send "4105 90 6\n" +simple_expect "=4105 $text_stat 5 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] 5 2006 8 $any_time 00000000 0 [holl "AOB1"] }" + + +# Add author-only to item created by person 7 as person 8 (other person) + +send "4200 92 6 0 { } 1 { 2004 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%4200 49 0" + +send "4201 90 6\n" +simple_expect "=4201 $text_stat 5 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] 5 2006 8 $any_time 00000000 0 [holl "AOB1"] }" + + +# Add author-only to item created by person 7 as person 6 (supervisor) + +kom_logout +kom_login 6 "pw1" 0 + +send "4202 92 6 0 { } 1 { 2004 00000000 0 [holl "AO2"] }\n" +simple_expect "=4202" + +send "4203 90 6\n" +simple_expect "=4203 $text_stat 6 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] 5 2006 8 $any_time 00000000 0 [holl "AOB1"] 6 2004 6 $any_time 00000000 0 [holl "AO2"] }" + + +# Add author-only to item created by person 7 as person 5 (admin) + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "4204 92 6 0 { } 1 { 2004 00000000 0 [holl "AO3"] }\n" +simple_expect "=4204" + +send "4205 90 6\n" +simple_expect "=4205 $text_stat 7 { 1 2004 7 $any_time 00000000 0 [holl "AO"] 2 2006 7 $any_time 00000000 0 [holl "UQ"] 3 2007 7 $any_time 00000000 0 [holl "PM"] 4 3000 7 $any_time 00000000 0 [holl "CT"] 5 2006 8 $any_time 00000000 0 [holl "AOB1"] 6 2004 6 $any_time 00000000 0 [holl "AO2"] 7 2004 5 $any_time 00000000 0 [holl "AO3"] }" + + +# Add supervisor-only to conf 7 item as person 7 + +kom_logout +kom_login 7 "pw2" 0 + +send "4300 91 7\n" +extracting_expect "=4300 (.*) 1 { 1 10003 7 $any_time 00000000 0 [holl "R2"] }" conf_stat 1 + +send "4301 93 7 0 { } 1 { 2005 00000000 0 [holl "SO1"] }\n" +simple_expect "%4301 49 0" + +send "4302 91 7\n" +simple_expect "=4302 $conf_stat 1 { 1 10003 7 $any_time 00000000 0 [holl "R2"] }" + + +# Add supervisor-only to conf 7 as person 6 + +kom_logout +kom_login 6 "pw1" 0 + +send "4303 93 7 0 { } 1 { 2005 00000000 0 [holl "SO1"] }\n" +simple_expect "=4303" + +send "4304 91 7\n" +simple_expect "=4304 $conf_stat 2 { 1 10003 7 $any_time 00000000 0 [holl "R2"] 2 2005 6 $any_time 00000000 0 [holl "SO1"] }" + + +# Add supervisor-only to conf 7 as person 5 + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "4305 93 7 0 { } 1 { 2005 00000000 0 [holl "SO2"] }\n" +simple_expect "=4305" + +send "4306 91 7\n" +simple_expect "=4306 $conf_stat 3 { 1 10003 7 $any_time 00000000 0 [holl "R2"] 2 2005 6 $any_time 00000000 0 [holl "SO1"] 3 2005 5 $any_time 00000000 0 [holl "SO2"] }" + + + +kom_logout +kom_login 7 "pw2" 0 + +# Check that item restricted to create conf can be added on create +# Try to add one after create + +kom_create_conference "Conference 12" "00001000" "1 { 3001 00000000 0 [holl "CC1"] }" + +send "4399 91 12\n" +extracting_expect "=4399 (.*)" conf_stat 1 + +send "4400 93 11 0 { } 1 { 3001 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%4400 49 0" + +send "4401 91 12\n" +simple_expect "=4401 $conf_stat" + + +# Check that item restricted to create letterbox can be added on create +# Try to add one after create + +kom_create_person "User 13" "pw13" "1 { 3002 00000000 0 [holl "CP1"] }" + +send "4402 91 13\n" +extracting_expect "=4402 (.*)" conf_stat 1 + +send "4403 93 13 0 { } 1 { 3002 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%4403 49 0" + +send "4404 91 13\n" +simple_expect "=4404 $conf_stat" + + +# Check that add trigger is called when adding an item +# Check that delete trigger is called when deleting an item +# Check that undelete trigger is called when adding and deleting where add fails + +send "4500 86 [holl "Text 7"] 1 { 0 9 } 0 { }\n" +simple_expect "=4500 7" + +send "4501 90 7\n" +simple_expect "=4501 $any_time 7 0 6 0 2 { 0 9 6 7 } 0 \\*" + +kom_create_conference "Conference 14" "00001000" "0 { }" + +send "4502 93 14 0 { } 1 { 4000 00000000 0 [holl "7"] }\n" +simple_expect "=4502" + +send "4503 90 7\n" +simple_expect "=4503 $any_time 7 0 6 1 2 { 0 9 6 7 } 0 \\*" + +send "4504 93 14 1 { 1 } 1 { 10000 00000000 0 [holl "FUBAR" ] }\n" +simple_expect "%4504 49 0" + +send "4505 90 7\n" +simple_expect "=4505 $any_time 7 0 6 1 2 { 0 9 6 7 } 0 \\*" + +send "4506 93 14 1 { 1 } 0 { }\n" +simple_expect "=4506" + +send "4507 90 7\n" +simple_expect "=4507 $any_time 7 0 6 0 2 { 0 9 6 7 } 0 \\*" + + + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "9999 44 0\n" +simple_expect "=9999" +client_death 0 +lyskomd_death diff --git a/src/server/testsuite/lyskomd.0/05.exp b/src/server/testsuite/lyskomd.0/05.exp new file mode 100644 index 0000000000000000000000000000000000000000..af378e568f28ddb3585d274a58a43d9da8fa0ec1 --- /dev/null +++ b/src/server/testsuite/lyskomd.0/05.exp @@ -0,0 +1,209 @@ +# Test of membership functionality +# +# It is assumed that person 5 is admin and has password "gazonk" + +read_versions +source "config/prot-a.exp" + + +lyskomd_start +client_start 0 +talk_to client 0 +send "A[holl "DejaGnu test suite"]\n" +simple_expect "LysKOM" "MSHIP: Connected" + +kom_accept_async "0 { }" "" "MSHIP: accept-async" + +# ---------------------------------------------------------------------- +# The sample database +# +# Person 6 "P6"; supervisor 6; password pw1 +# Person 7 "P7"; supervisor 6; password pw2 +# Person 8 "P8"; supervisor 7; password pw3 +# Person 13 "P13"; supervisor 8; password pw4 +# Person 14 "P14"; supervisor 14; password pw5 +# Set supervisor of P8 to P14 +# +# Conference 9 "C9"; created by 7; rd_prot +# Conference 10 "C10"; created by 7; secret +# Conference 11 "C11"; created by 7; forbid_secret +# Conference 12 "C12"; created by 7; no flags +# ---------------------------------------------------------------------- + +kom_create_person "P6" "pw1" "0 { }" +kom_create_person "P7" "pw2" "0 { }" +kom_logout +kom_create_person "P8" "pw3" "0 { }" + +kom_logout +kom_login 7 "pw2" 0 + +kom_create_conference "C9" "10000000" "0 { }" +kom_create_conference "C10" "10100000" "0 { }" +kom_create_conference "C11" "00000100" "0 { }" +kom_create_conference "C12" "00000000" "0 { }" + +kom_logout +kom_login 8 "pw3" 0 + +kom_create_person "P13" "pw4" "0 { }" +kom_create_person "P14" "pw5" "0 { }" + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 +kom_set_supervisor 8 14 + +# ---------------------------------------------------------------------- +# Basic tests +# +# For each test perform the function then get the membership list for +# the affected person and then the member list for the affected +# conference. +# ---------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# 1. Person 7 becoming member of conference 9. + +kom_logout +kom_login 7 "pw2" 0 + +send "1000 100 9 7 200 0 00000000\n" +simple_expect "=1000" + +send "1001 101 9 0 10000\n" +simple_expect "=1001 1 { 7 7 $any_time 00000000 }" + +send "1002 99 7 0 10000 0\n" +simple_expect "=1002 2 { $any_time 9 200 0 0 \\* 7 $any_time 00000000 $any_time 7 255 0 0 \\* 6 $any_time 00000000 }" + + +# ---------------------------------------------------------------------- +# 2. Person 7 adding person 8 as member of conference 9 as invitation + +kom_logout +kom_login 7 "pw2" 0 + +send "1010 100 9 8 200 0 10000000\n" +simple_expect "=1010" + +send "1011 101 9 0 10000\n" +simple_expect "=1011 2 { 7 7 $any_time 00000000 8 7 $any_time 10000000 }" + +send "1012 99 8 0 10000 0\n" +simple_expect "=1012 2 { $any_time 9 200 0 0 \\* 7 $any_time 10000000 $any_time 8 255 0 0 \\* 0 $any_time 00000000 }" + + +# ---------------------------------------------------------------------- +# 3. Person 8 changing type of membership to 00100000 (secret) + +kom_logout +kom_login 8 "pw3" 0 + +send "1020 102 8 9 00100000\n" +simple_expect "=1020" + +send "1021 101 9 0 10000\n" +simple_expect "=1021 2 { 7 7 $any_time 00000000 8 7 $any_time 00100000 }" + +send "1022 99 8 0 10000 0\n" +simple_expect "=1022 2 { $any_time 9 200 0 0 \\* 7 $any_time 00100000 $any_time 8 255 0 0 \\* 0 $any_time 00000000 }" + + +# ---------------------------------------------------------------------- +# 4. Person 7 looking at membership of conference 9 +# Person 7 looking at members of conference 9 +# Membership of person 8 is not blanked out since person 7 is +# organizer of conference 9 + +kom_logout +kom_login 7 "pw2" 0 + +send "1030 101 9 0 10000\n" +simple_expect "=1030 2 { 7 7 $any_time 00000000 8 7 $any_time 00100000 }" + +send "1031 99 8 0 10000 0\n" +simple_expect "=1031 2 { $any_time 9 200 0 0 \\* 7 $any_time 00100000 $any_time 8 255 0 0 \\* 0 $any_time 00000000 }" + + +# ---------------------------------------------------------------------- +# 5. Person 13 looking at members of conference 9 +# Membership of person 8 is blanked out in get-members +# Person 13 looking at membership of person 8 +# Membership of person 8 is removed in get-membership + +kom_logout +kom_login 13 "pw4" 0 + +send "1040 101 9 0 10000\n" +simple_expect "=1040 2 { 7 7 $any_time 00000000 0 0 0 0 1 1 0 70 4 0 0 00100000 }" + +send "1041 99 8 0 10000 0\n" +simple_expect "=1041 1 { $any_time 8 255 0 0 \\* 0 $any_time 00000000 }" + +# ---------------------------------------------------------------------- +# 6. Admin looking at members of conference 9 +# Admin looking at membership of person 8 + +kom_logout +kom_login 5 "gazonk" 0 + +send "1050 101 9 0 10000\n" +simple_expect "=1050 2 { 7 7 $any_time 00000000 0 0 0 0 1 1 0 70 4 0 0 00100000 }" + +send "1051 99 8 0 10000 0\n" +simple_expect "=1051 1 { $any_time 8 255 0 0 \\* 0 $any_time 00000000 }" + + +kom_enable 255 + +send "1052 101 9 0 10000\n" +simple_expect "=1052 2 { 7 7 $any_time 00000000 8 7 $any_time 00100000 }" + +send "1053 99 8 0 10000 0\n" +simple_expect "=1053 2 { $any_time 9 200 0 0 \\* 7 $any_time 00100000 $any_time 8 255 0 0 \\* 0 $any_time 00000000 }" + + +# ---------------------------------------------------------------------- +# 7. Supervisor of P8 looking at membership of person 8 +# Supervisor of P8 looking at members of conference 9 +# Secret memberships should be visible + +kom_logout +kom_login 14 "pw5" 0 + +send "1060 101 9 0 10000\n" +simple_expect "=1060 2 { 7 7 $any_time 00000000 8 7 $any_time 00100000 }" + +send "1061 99 8 0 10000 0\n" +simple_expect "=1061 2 { $any_time 9 200 0 0 \\* 7 $any_time 00100000 $any_time 8 255 0 0 \\* 0 $any_time 00000000 }" + + +# ====================================================================== +# FIXME +# +# Test that we can't become a secret member of a forbid-secret conf +# Test that we can't set mship-type to secret in a forbid-secret conf +# Test that mship-type can be changed by supervisor +# Test that mship-type can be changed by admin +# Test that mship-type cannot be changed by conf supervisor +# Test that we can force invitation bit +# Test that we can't set the invitation bit to on when it is off +# Test that we can change mship-type retaining invitation bit as 1 +# Test that old-style add-member sets mship-type OK +# Test get-unread-confs vs passive conf (shouldn't be returned) + + +# ---------------------------------------------------------------------- +# We're finished +# ---------------------------------------------------------------------- + + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "9999 44 0\n" +simple_expect "=9999" +client_death 0 +lyskomd_death diff --git a/src/server/testsuite/lyskomd.0/aux-items.conf b/src/server/testsuite/lyskomd.0/aux-items.conf new file mode 100644 index 0000000000000000000000000000000000000000..0d2aae513a9582c71c2041b438366d0fc42690c9 --- /dev/null +++ b/src/server/testsuite/lyskomd.0/aux-items.conf @@ -0,0 +1,119 @@ +# +# Test suite aux items +# + +# Range 1000-9999 are not defined and can be used for anything + +1000 : A (any) { } +1001 : A (any) { } +1002 : A (any) { } +1003 : A (any) { } +1004 : A (any) { } +1005 : A (any) { } +1006 : A (any) { } +1007 : A (any) { } +1008 : A (any) { } +1009 : A (any) { } +1010 : A (any) { } +1011 : A (any) { } +1012 : A (any) { } +1013 : A (any) { } +1014 : A (any) { } +1015 : A (any) { } +1016 : A (any) { } +1017 : A (any) { } +1018 : A (any) { } +1019 : A (any) { } +1020 : A (any) { } +1021 : A (any) { } +1022 : A (any) { } + +2000 : force-all (any) +{ + inherit = true; + secret = true; + hide-creator = true; + dont-garb = true; + reserved-2 = true; + reserved-3 = true; + reserved-4 = true; +} + +2001 : clear-all (any) +{ + inherit = false; + secret = false; + hide-creator = false; + dont-garb = false; + reserved-2 = false; + reserved-3 = false; + reserved-4 = false; +} + +2002 : inherit-limit (any) +{ + inherit-limit = 10; +} + +2003 : validation (any) +{ + validate = "^GOOD$"; +} + +2004 : author-only (any) +{ + author-only = true; +} + +2005 : supervisor-only (any) +{ + supervisor-only = true; +} + +2006 : unique (any) +{ + unique = true; +} + +2007 : permanent (any) +{ + permanent = true; +} + +3000 : create-text (create text) +{ +} + +3001 : create-conf (create conference) +{ +} + +3002 : create-pers (create letterbox) +{ +} + +4000 : mark-text (any) +{ + add-trigger = mark-text(); + delete-trigger = unmark-text(); + undelete-trigger = mark-text(); +} + + +10000 : system-only (server) +{ +} + +10001 : conf-only (conference) +{ +} + +10002 : text-only (text) +{ +} + +10003 : pers-only (letterbox) +{ +} + + diff --git a/src/server/text-garb.c b/src/server/text-garb.c index 39feb042d8499027895436004ba10f0e1c4a18dc..6b2ed19d3095df94d571fd48c68f44d1ce20308e 100644 --- a/src/server/text-garb.c +++ b/src/server/text-garb.c @@ -1,5 +1,5 @@ /* - * $Id: text-garb.c,v 0.23 1998/07/08 13:42:05 ceder Exp $ + * $Id: text-garb.c,v 0.24 1998/12/26 22:41:08 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,13 @@ * Author: Per Cederqvist. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: text-garb.c,v 0.23 1998/07/08 13:42:05 ceder Exp $"; +rcsid = "$Id: text-garb.c,v 0.24 1998/12/26 22:41:08 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -52,6 +57,8 @@ USE(rcsid); #include "internal-services.h" #include "param.h" +BUGDECL; + /* * This comment is a description of how this _could_ be done in a more * efficient way. It is not yet implemented. Design by Inge Wallin @@ -99,7 +106,6 @@ garb_text(void) static Text_no last_checked = 0; static time_t last_start = NO_TIME; static long deleted_texts = 0; - BUGDECL; Text_stat *text_s; Misc_info *misc; diff --git a/src/server/text.c b/src/server/text.c index 0ac71a53c6cc7d8e181b298fc35a321e8816e9cd..0dc8c9bd69e5a5f3b0453175e59fb8a8df06fd39 100644 --- a/src/server/text.c +++ b/src/server/text.c @@ -1,5 +1,5 @@ /* - * $Id: text.c,v 0.56 1998/10/22 22:08:47 ceder Exp $ + * $Id: text.c,v 0.57 1998/12/26 22:41:09 byers Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -28,8 +28,13 @@ * All atomic calls that deals with texts. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + static const char * -rcsid = "$Id: text.c,v 0.56 1998/10/22 22:08:47 ceder Exp $"; +rcsid = "$Id: text.c,v 0.57 1998/12/26 22:41:09 byers Exp $"; #include "rcs.h" USE(rcsid); @@ -51,7 +56,7 @@ USE(rcsid); #include "manipulate.h" #include "lyskomd.h" #include "kom-errno.h" -#include "config.h" +#include "kom-config.h" #include "com.h" #include "async.h" #include "connections.h" @@ -445,6 +450,70 @@ do_add_cc_recpt(Text_no new_text, } + + +/* + * Check if person is a member in any of the recipients or cc_recipients + * of text_s + */ +static Bool +is_member_in_recpt(Person *person, + Text_stat *text_s, + Bool skip_passive) +{ + int i; + Membership *mship; + + for ( i = 0; i < text_s->no_of_misc; i++ ) + { + switch(text_s->misc_items[ i ].type) + { + case recpt: + if ((mship = locate_membership(text_s->misc_items[ i ].datum.recipient, + person)) != NULL ) + { + return !(mship->type.passive && skip_passive); + } + break; + + case cc_recpt: + if ((mship = locate_membership(text_s->misc_items[ i ].datum.cc_recipient, + person)) != NULL ) + { + return !(mship->type.passive && skip_passive); + } + break; + + case bcc_recpt: + if ((mship = locate_membership(text_s->misc_items[ i ].datum.bcc_recipient, + person)) != NULL ) + { + return !(mship->type.passive && skip_passive); + } + break; + + case comm_to: + case comm_in: + case footn_to: + case footn_in: + case loc_no: + case rec_time: + case sent_by: + case sent_at: + break; + +#ifndef COMPILE_CHECKS + default: + log("%s: is_member_in_recpt(): bad misc_item.\n", __FILE__); + break; +#endif + } + } + + return FALSE; +} + + /* * Return number of lines in a text */ @@ -531,6 +600,27 @@ do_delete_misc (u_short * no_of_misc, } } + +static void +send_async_sub_recipient (Text_no text_no, Text_stat *text_s, + Conf_no conf_no, Info_type type) +{ + Connection *cptr; + Session_no i = 0; + + while ((i = traverse_connections(i)) != 0) + { + cptr = get_conn_by_number(i); + if (cptr->person != NULL + && is_member_in_recpt(cptr->person, text_s, TRUE) == TRUE + && fast_access_perm(conf_no, ACTPERS, ACT_P) > none + ) + { + async_sub_recipient(cptr, text_no, conf_no, type); + } + } +} + /* * Delete a recipient from a text. Does not fail if the recipient doesn't * exist - that is not an error. @@ -569,6 +659,10 @@ do_sub_recpt (Text_no text_no, do_delete_misc ( &text_s->no_of_misc, text_s->misc_items, i ); mark_text_as_changed (text_no); + send_async_sub_recipient(text_no, + text_s, + conf_no, + text_s->misc_items[ i ].type); return OK; } break; @@ -586,6 +680,10 @@ do_sub_recpt (Text_no text_no, do_delete_misc( &text_s->no_of_misc, text_s->misc_items, i ); mark_text_as_changed( text_no ); + send_async_sub_recipient(text_no, + text_s, + conf_no, + text_s->misc_items[ i ].type); return OK; } break; @@ -603,6 +701,10 @@ do_sub_recpt (Text_no text_no, do_delete_misc( &text_s->no_of_misc, text_s->misc_items, i ); mark_text_as_changed( text_no ); + send_async_sub_recipient(text_no, + text_s, + conf_no, + text_s->misc_items[ i ].type); return OK; } break; @@ -1031,63 +1133,50 @@ skip_recp (Misc_info ** misc, } - /* - * Check if person is a member in any of the recipients or cc_recipients - * of text_s - */ -static Bool -is_member_in_recpt(Person *person, - Text_stat *text_s) -{ - int i; + Return TRUE if VIEWER sent the misc-item that starts at + MISC. END is a pointer one beyond the end of the misc-info + list. VIEWER_P is the pers-stat of VIEWER or NULL. +*/ - for ( i = 0; i < text_s->no_of_misc; i++ ) +static Bool +recp_sent_by(Misc_info *misc, Misc_info *end, + Pers_no viewer, Person *viewer_p) +{ + misc += 1; + while (misc < end) { - switch(text_s->misc_items[ i ].type) + switch (misc->type) { + case sent_by: + /* Found the sent-by. Check it out. */ + return (is_supervisor(misc->datum.sender, NULL, + viewer, viewer_p)); + break; + case loc_no: + case rec_time: + case sent_at: + /* Just skip this */ + break; case recpt: - if ( locate_membership(text_s->misc_items[ i ].datum.recipient, - person) != NULL ) - { - return TRUE; - } - break; - case cc_recpt: - if ( locate_membership(text_s->misc_items[ i ].datum.cc_recipient, - person) != NULL ) - { - return TRUE; - } - break; - - case bcc_recpt: - if ( locate_membership(text_s->misc_items[ i ].datum.bcc_recipient, - person) != NULL ) - { - return TRUE; - } - break; - + case bcc_recpt: case comm_to: case comm_in: case footn_to: case footn_in: - case loc_no: - case rec_time: - case sent_by: - case sent_at: - break; - + /* Found the next "major" item without finding a sent-by. */ + return FALSE; + break; #ifndef COMPILE_CHECKS default: - log("%s: is_member_in_recpt(): bad misc_item.\n", __FILE__); - break; + restart_kom("skip_recp() - illegal misc\n"); #endif - } + } + misc += 1; } + /* No sent-by found. Return false. */ return FALSE; } @@ -1160,28 +1249,46 @@ filter_secret_info(Text_stat *result, if (viewer_p == NULL) viewer_p = cached_get_person_stat(viewer); - if (viewer_p == NULL || - (!is_supervisor(orig->datum.bcc_recipient, NULL, - viewer, viewer_p) && - locate_membership(orig->datum.bcc_recipient, - viewer_p) == NULL && - !ENA(admin, 4))) - { - - skip_recp ( &orig, original ); - } - else if (!output_bcc) + /* + * We will send this if ... + * The viewer is the recipient or + * The recipient is an open conference + * The viewer sent the BCC + * The viewer is the author + */ + + if (viewer_p != NULL && + (fast_access_perm(orig->datum.bcc_recipient, + viewer, viewer_p) >= limited || + locate_membership(orig->datum.bcc_recipient, viewer_p) || + ENA(admin, 4) || + recp_sent_by(orig, + original->misc_items + original->no_of_misc, + viewer, + viewer_p) || + is_supervisor(original->author, + NULL, + viewer, + viewer_p) + )) { - *copy = *orig; - copy->type = cc_recpt; - copy += 1; - orig += 1; - ++result->no_of_misc; + if (!output_bcc) + { + *copy = *orig; + copy->type = cc_recpt; + copy += 1; + orig += 1; + ++result->no_of_misc; + } + else + { + *copy++ = *orig++; + ++result->no_of_misc; + } } else { - *copy++ = *orig++; - ++result->no_of_misc; + skip_recp ( &orig, original ); } break; @@ -1225,7 +1332,8 @@ send_async_deleted_text (Text_no text_no, Text_stat *text_s) filter_secret_info(&filtered, text_s, cptr->pers_no, cptr->person, TRUE); if (cptr->person != NULL - && is_member_in_recpt(cptr->person, &filtered) == TRUE) + && is_member_in_recpt(cptr->person, &filtered, TRUE) == TRUE + ) { async_deleted_text(cptr, text_no, &filtered); } @@ -2085,7 +2193,7 @@ send_async_new_text_old(Text_no text_no, cptr->pers_no, cptr->person, FALSE); if ( cptr->person != NULL - && is_member_in_recpt (cptr->person, &filtered) == TRUE) + && is_member_in_recpt (cptr->person, &filtered, TRUE) == TRUE) { async_new_text_old (cptr, text_no, &filtered); } @@ -2115,7 +2223,7 @@ send_async_new_text (Text_no text_no, cptr->pers_no, cptr->person, TRUE); if ( cptr->person != NULL - && is_member_in_recpt (cptr->person, &filtered) == TRUE) + && is_member_in_recpt (cptr->person, &filtered, TRUE) == TRUE) { async_new_text (cptr, text_no, &filtered); } @@ -2505,9 +2613,12 @@ get_last_text(struct tm *wanted_time, try = middle; text_stat = NULL; - /* FIXME: Once there is a more efficient structure that maps - Text_nos to the internal cache_node this loop could - probably be rewritten in a more efficient way. */ + /* + FIXME: Once there is a more efficient structure that + FIXME: maps Text_nos to the internal cache_node this + FIXME: loop could probably be rewritten in a more + FIXME: efficient way. + */ while (text_stat == NULL && try <= higher) text_stat = cached_get_text_stat (try++); @@ -2586,6 +2697,26 @@ find_previous_text_no (Text_no start, return FAILURE; } +static void +send_async_add_recipient (Text_no text_no, Text_stat *text_s, + Conf_no conf_no, Info_type type) +{ + Connection *cptr; + Session_no i = 0; + + while ((i = traverse_connections(i)) != 0) + { + cptr = get_conn_by_number(i); + if (cptr->person != NULL + && is_member_in_recpt(cptr->person, text_s, TRUE) == TRUE + && fast_access_perm(conf_no, ACTPERS, ACT_P) > none + ) + { + async_new_recipient(cptr, text_no, conf_no, type); + } + } +} + /* * Add a recipient to a text. */ @@ -2642,11 +2773,13 @@ add_recipient( Text_no text_no, t_stat->misc_items[rcpt_index].type = type; #if 0 - /* This should possibly be done, but differently. - ADD_MISC adds things lasts in the misc-info, and - that is not the correct thing to do. The change is - now performed silently instead. Also note that - these fields may already be present... FIXME. */ + /* + FIXME: This should possibly be done, but differently. + FIXME: ADD_MISC adds things lasts in the misc-info, and + FIXME: that is not the correct thing to do. The change is + FIXME: now performed silently instead. Also note that + FIXME: these fields may already be present... + */ if ( t_stat->author != ACTPERS ) ADD_MISC(t_stat, sent_by, sender, ACTPERS); @@ -2664,8 +2797,10 @@ add_recipient( Text_no text_no, return FAILURE; } - /* FIXME: Should extract the "is allowed to write to this conference" - test from submit_to(). */ + /* + FIXME: Should extract the "is allowed to write to this + FIXME: conference test from submit_to() + */ if (submit_to(conf_no, conf_c) != conf_no) { err_stat = conf_no; @@ -2720,10 +2855,13 @@ add_recipient( Text_no text_no, ADD_MISC(t_stat, sent_at, sent_at, time(NULL)); mark_text_as_changed( text_no ); + send_async_add_recipient( text_no, t_stat, conf_no, type ); + return OK; } + /* * Subtract a recipient from a text. * @@ -2783,10 +2921,12 @@ add_comment(Text_no comment, CHK_LOGIN(FAILURE); - /* The following code can not cope with a text that is a comment - to itself. That is considered to be a bug. Work around it for - now, until a proper misc-info-list handling package is written. - FIXME +++ /// */ + /* + FIXME: The following code can not cope with a text that is + FIXME: a comment to itself. That is considered to be a bug. + FIXME: Work around it for now, until a proper misc-info-list + FIXME: handling package is written. + */ if (comment == comment_to) { err_stat = comment; @@ -2889,10 +3029,12 @@ add_footnote( Text_no footnote, GET_T_STAT(text_s, footnote, FAILURE); GET_T_STAT(parent_s, footnote_to, FAILURE); - /* The following code can not cope with a text that is a footnote - to itself. That is considered to be a bug. Work around it for - now, until a proper misc-info-list handling package is written. - FIXME /// +++ */ + /* + FIXME: The following code can not cope with a text that + FIXME: is a footnote to itself. That is considered to be + FIXME: a bug. Work around it for now, until a proper + FIXME: misc-info-list handling package is written. + */ if (footnote == footnote_to) { err_stat = footnote; @@ -3143,6 +3285,7 @@ modify_text_info(Text_no text, } text_stat_add_aux_item_list(text_s, text, aux, ACTPERS); + commit_aux_item_list(&text_s->aux_item_list); /* FIXME: async_text_changed(text, text_s); */ mark_text_as_changed(text);