1. 08 Jul, 2010 9 commits
    • Per Cederqvist's avatar
      This file adds 3 source files from · ad28f74a
      Per Cederqvist authored
      http://www.lysator.liu.se/~nisse/archive/nettle-1.15.tar.gz under
      different names.
      
          Original name	lyskomd name
      
          macros.h 		src/server/nettle-macros.h
          sha.h		src/server/nettle-sha.h
          sha256.c		src/server/nettle-sha256.c
      ad28f74a
    • Per Cederqvist's avatar
      8903b938
    • Per Cederqvist's avatar
      patch refactor-cached_get_text.patch · 560a74da
      Per Cederqvist authored
      560a74da
    • Per Cederqvist's avatar
      patch introduce-generation_position.patch · de22d96e
      Per Cederqvist authored
      de22d96e
    • Per Cederqvist's avatar
      Create empty files text-store.h and text-store.c, and include them · 26d67f86
      Per Cederqvist authored
      	in the link.
      	* src/server/text-store.h: New file, currently empty.
      	* src/server/text-store.c: New file.  Include text-store.h, but do
      	not yet do anything.
      	* src/server/Makefile.am (DISKOBJS): Added text-store.c and
      	text-store.h.
      	(DBCK): Added text-store.c.
      26d67f86
    • Per Cederqvist's avatar
      Remove the reclamation field of Text_stat. · 46ec1c8b
      Per Cederqvist authored
      	* src/include/kom-types.h (Text_stat): Remove the reclamation
      	field.  It was a mistake to add it 2006-11-06.
      	* src/server/dbck-cache.c (cached_flush_text): Don't touch
      	reclamation.
      	* src/server/memory.c (copy_text_stat): Ditto.
      	(init_text_stat): Ditto.
      	* src/server/ram-output.c (foutput_text_stat_3): Ditto.
      	* src/server/ram-parse.c (fparse_text_stat_3): Ditto.
      	(fparse_text_stat_2): Ditto.
      	(fparse_text_stat_0): Ditto.
      	* src/server/simple-cache.c (cached_create_text): Ditto.
      46ec1c8b
    • Per Cederqvist's avatar
      Write dbfiles atomically, renaming them once complete. · 50e88538
      Per Cederqvist authored
      Added support for renaming a datafile once it has been completely
      written, and to write it using a temporary extension.
      
      * src/server/ram-io.h (struct dbfile): Added fields fn,
      tmp_extension and tmp_fn.  Added documentation.
      (dbfile_open_write): New argument: tmp_extension.
      (dbfile_rename): New function.
      (dbfile_abort): New function.
      * src/server/ram-io.c (dbfile_new): Initialize fn, tmp_extension
      and tmp_fn.
      (current_fn): New static function.  Return tmp_fn if non-NULL,
      otherwise fn.
      (dbfile_delete): Free the new fields fn, tmp_extension and
      tmp_fn.
      (dbfile_open_write): New argument: tmp_extension.  Store a copy of
      the supplied filename.  If tmp_extension is non-NULL, store a copy
      of it, and compute the actual file name to open as the filname
      followed by the tmp_extension.
      (fsync_dirname): New static function.
      (dbfile_rename): New function.  Rename the file from tmp_fn to the
      wanted final filename, and sync the directory.
      (dbfile_abort): New function.
      * src/server/dbck-cache.c (cache_sync_all): Pass a NULL pointer as
      tmp_extension of dbfile_open_write(), to get the old behavior.
      * src/server/simple-cache.c (pre_sync): Ditto.
      50e88538
    • Per Cederqvist's avatar
      Created the utility function sstrdup. · 0cb622ac
      Per Cederqvist authored
      * src/server/ram-smalloc.c, src/include/server/smalloc.h:
      (sstrdup): New function.
      0cb622ac
    • Per Cederqvist's avatar
      Check the magic cookie when opening database files. · b7c6921e
      Per Cederqvist authored
      * src/server/ram-io.c (dbfile_open_read): New argument:
      wanted_magic.  Log a message and return NULL if the file contains
      the wrong magic cookie.  All callers updated to supply "CLEAN" as
      the magic cookie.
      b7c6921e
  2. 19 Jun, 2010 1 commit
    • Per Cederqvist's avatar
      Refuse to run the test suite if expect is broken. · 7f11c20f
      Per Cederqvist authored
      This causes "make check" to fail quickly if running on an expect that
      has broken handling of zero-lenght writes, or if expect is really,
      really slow due to broken glob gate.
      
      * src/server/testsuite/Makefile.am (check-l2g): Depend on
      working-dejagnu.
      (check-lyskomd): Ditto.
      (check-leaks): Ditto.
      (working-dejagnu): New target.
      (EXTRA_DIST): Added dejagnu.0/00-zero-length-write.exp and
      dejagnu.0/90-slow-glob-gate.exp.
      
      * src/server/testsuite/dejagnu.0/00-zero-length-write.exp: New
      test, that fails on known bad versions of expect.
      
      * src/server/testsuite/dejagnu.0/90-slow-glob-gate.exp: New test,
      that fails if a simple regexp pattern causes expect to run too
      slow, indicating that it is converted to a glob pattern that
      causes a lot of backtracking.
      
      * src/server/testsuite/.gitignore: Ignore dejagnu.log and
      dejagnu.sum.
      7f11c20f
  3. 23 May, 2010 1 commit
    • Per Cederqvist's avatar
      Don't attempt to use DNS when no nameserver is available. · 0deaed08
      Per Cederqvist authored
      * src/server/testsuite/Makefile.am (site.exp): Set use_dns to yes
      or no depending on if adnshost can resolve 127.0.0.1 or not.
      * src/server/testsuite/config/unix.exp (lyskomd_start): Set the
      "Use DNS" configuration depending on the use_dns setting from
      site.exp.
      0deaed08
  4. 22 May, 2010 1 commit
  5. 18 Apr, 2010 1 commit
    • Per Cederqvist's avatar
      Texinfo syntax compatibility. · 1573f370
      Per Cederqvist authored
      * doc/Protocol-A.texi: Don't use "@begin tex" instead of "@tex".  That
      construct worked in texinfo.tex version 2003-11-16.09, but support was
      removed in 2003-11-29.14.
      1573f370
  6. 31 Mar, 2010 3 commits
  7. 30 Mar, 2010 3 commits
  8. 12 Oct, 2009 1 commit
  9. 06 Oct, 2009 1 commit
  10. 31 May, 2009 7 commits
  11. 31 Mar, 2008 1 commit
    • Per Cederqvist's avatar
      Turn off the garb by default, due to popular request. · 12a5f63e
      Per Cederqvist authored
      * doc/lyskomd.texi (Parameters): Changed "Garb" from "on" to
      "off".
      (Administration): Suggest that the administrator may want to turn
      on the garb.
      * src/server/server-config.c (parameters): Changed "Garb" from
      "on" to "off".
      12a5f63e
  12. 14 Jul, 2007 1 commit
  13. 03 Jul, 2007 4 commits
    • Per Cederqvist's avatar
      Implement dbfile wrappers for putc, fputs, feof and ferror, and · 6de208fe
      Per Cederqvist authored
      use them.
      * src/server/ram-io.c, src/server/ram-io.h
      (dbfile_putc): New function.
      (dbfile_fputs): New function.
      (dbfile_feof): New function.
      (dbfile_ferror): New function.
      * src/server/simple-cache.c (save_one_text): Use dbfile_ferror.
      (sync_part): Ditto.
      * src/server/ram-output.c (foutput_string): Use dbfile_putc.
      (foutput_ulong): Ditto.
      (foutput_atsign): Ditto.
      (foutput_newline): Ditto.
      (foutput_space): Ditto.
      (foutput_bool): Ditto.
      (foutput_array_start): Use dbfile_fputs.
      (foutput_array_end): Ditto.
      (foutput_array_nodata): Ditto.
      * src/server/ram-io.c (dbfile_change_magic): Use dbfile_ferror.
      * src/server/local-to-global.c (l2g_write): Use dbfile_putc.
      * src/server/dbck-cache.c (init_cache): Use dbfile_feof().
      6de208fe
    • Per Cederqvist's avatar
      Let dbfile_open_write() write the file header. Extract the code · 39b34b6a
      Per Cederqvist authored
      that changes the state to dbfile_change_magic().  Reduce code
      duplication by teaching foutput_header() to handle old file
      formats.
      * src/server/simple-cache.c (pre_sync): Adjusted to new API of
      dbfile_open_write(), including removing calls to foutput_header().
      (save_one_text): Extracted parts of the functionality to
      dbfile_change_magic().
      * src/server/ram-output.c (foutput_header): Moved support for file
      formats 0, 1 and 2 here from sync_output_header().
      * src/server/ram-io.c, src/server/ram-io.h
      (dbfile_open_write): New argument: magic.  Write a file header
      with the specified state.
      (dbfile_change_magic): New function, extracted from
      cache_sync_all() in dbck-cache.c and save_one_text().
      * src/server/dbck-cache.c (sync_output_header): Removed.
      The ability to emit old-style headers moved to foutput_header().
      (cache_sync_all): Adjusted to new API of dbfile_open_write,
      including removing calls to sync_output_header().  Use
      dbfile_change_magic() instead of rewind() and
      sync_output_header().
      * src/server/Makefile.am (libcheck_a_SOURCES): Added
      server-time.c.
      39b34b6a
    • Per Cederqvist's avatar
      Stop Emacs from asking questions about local variables. · c1eb1fc5
      Per Cederqvist authored
      * regex.c: Removed local variables setting for Emacs.
      c1eb1fc5
    • Per Cederqvist's avatar
      Use a modern autoconf. · 4de39df2
      Per Cederqvist authored
      * mkmi (WANT_AUTOCONF): Set to 2.5, not 1.5.
      4de39df2
  14. 01 Mar, 2007 1 commit
  15. 06 Nov, 2006 1 commit
    • Per Cederqvist's avatar
      Introduce datafile format version 3. A textstat contains · c1ef8d5b
      Per Cederqvist authored
      "generation" and "reclamation" fields.
      * src/include/kom-types.h (Text_stat): Added fields generation
      and reclamation.
      * src/server/simple-cache.c (cached_get_text): Handle text file
      generation 0 in the old-fashioned way.  Added a #warning about
      other generations.  Check return value of fseek.
      (cached_create_text): Added a #warning about nonzero generations
      of the text file.
      (cached_create_text): Initialize generation and reclamation.
      (save_one_conf): Do a file copy only if the formats of file A and
      B are the same.  Otherwise, parse the object into a temporary
      object and re-serialize it.
      (save_one_pers): Ditto.
      (save_one_text): Ditto.
      (init_cache): Handle data file format 3.
      * src/server/ram-parse.c (fparse_text_stat_3): New static function.
      (fparse_text_stat_2): Set generation and reclamation to 0.
      (fparse_text_stat_0): Ditto.
      (fparse_info): Handle data file format 3.
      (fparse_conference): Ditto.
      (fparse_person): Ditto.
      (fparse_membership): Ditto.
      (fparse_membership_list): Ditto.
      (fparse_text_stat): Ditto.
      (fparse_member): Ditto.
      * src/server/ram-output.c (foutput_info): Handle data file format 3.
      (foutput_text_stat_3): New static function.
      (foutput_person): Ditto.
      (foutput_conference): Ditto.
      (foutput_text_stat): Ditto.
      (foutput_membership): Ditto.
      (foutput_membership_list): Ditto.
      (foutput_member): Ditto.
      (foutput_conf_type): Ditto.
      * src/server/ram-io.c (output_format): Initialize it to 3.
      (dbfile_open_read): Handle data file format 3.
      * src/server/memory.c (copy_text_stat): Handle generation and
      reclamation.
      (init_text_stat): Initialize generation and reclamation.
      * src/server/membership.c (read_ranges_postcondition): Use data
      file format 3 when dumping a membership to stderr.
      * src/server/dbck.c (main): Handle data file format 3.
      * src/server/dbck-cache.c (cached_get_text): Handle text file
      generation 0 in the old-fashioned way.  Added a #warning about
      other generations.
      (cached_flush_text): Flush a generation 0 text file.  Added a
      #warning about other generations.
      (sync_output_header): Handle data file format 3.
      (cache_sync_all): Ditto.
      (init_cache): Ditto.
      * src/server/testsuite/test-l2g.c (main): Use data
      file format 3 when reading an Local2Global structure from stdin,
      or writing it to stdout.
      c1ef8d5b
  16. 20 Oct, 2006 1 commit
    • Per Cederqvist's avatar
      Wrap all file pointers that refer to the database files inside a · 554e4c59
      Per Cederqvist authored
      "struct dbfile".  Add a database version field to that struct, and
      remove the global database format variables.  This allows lyskomd
      to have files in different versions open at the same time, so that
      it can convert format X to format X+1 on the fly.  (This is more
      preparation for bug 1616.)
      * src/server/ram-io.h (struct dbfile): New struct.
      (dbfile_delete): New function.
      (set_output_format): New function.
      (dbfile_open_write): New function.
      (dbfile_open_read): New function.
      (dump_dbfile_stats): New function.
      (dbfile_ftell): The argument is now a struct dbfile*, not FILE*.
      (dbfile_getc): Ditto.
      (dbfile_ungetc): Ditto.
      * src/server/ram-io.c (output_format): Moved from ram-output.c and
      made static variable.  This defines the output format of all
      struct dbfile objects created after a change to the variable.
      (nr_dbfile_objects): New static statistics variable.
      (nr_dbfile_files): New static statistics variable.
      (dbfile_new): New static function.
      (dbfile_delete): New function.
      (set_output_format): Moved from ram-output.c.
      (get_version): Moved from simple-cache.c.  Changed return type to
      int.  The argument is an open dbfile, not a file name.  Use
      dbfile_getc() instead of getc().
      (dbfile_open_read): New function.
      (dbfile_open_write): New function.
      (dump_dbfile_stats): New function.
      (dbfile_ftell): The argument is now a struct dbfile*, not FILE*.
      (dbfile_getc): Ditto.
      (dbfile_ungetc): Ditto.
      * src/server/conference.c: Include ram-io.h, since
      local-to-global.h needs it.
      * src/server/memory.c: Ditto.
      * src/server/person.c: Ditto.
      * src/server/prot-a-output.c: Ditto.
      * src/server/text.c: Ditto.
      * src/server/membership.c: Include ram-io.h.
      (read_ranges_postcondition): Set up a dbfile wrapper around stderr
      for the report created if check_membership() fails.
      * src/server/local-to-global.h, src/server/local-to-global.c
      (l2g_read): The fp argument is now a struct dbfile*, not a FILE*.
      * src/server/dbck.c (oformat): Removed.  The format is stored
      inside the dbfile struct instead.
      (main): Report an error message if an attempt to use an undefined
      output format is detected.
      * src/server/dbck-cache.c: Change all FILE* that refer to the
      status files to struct dbfile* in all functions, and made
      appropriate changes.  Use fp->format instead of the global
      variable oformat or data_file_version.
      (get_version): Moved to ram-io.c.
      (sync_output_header): Removed the oformat argument.  Use
      fp->format instead.  All callers updated.
      (cache_sync_all): Use dbfile_open_write() instead of i_fopen(),
      and dbfile_delete() instead of i_fclose().
      (init_cache): Removed the data_file_version variable, as the
      format is now stored inside the dbfile struct.  Use
      dbfile_open_read() instead of i_fopen(), and dbfile_delete()
      instead of i_fclose().
      * doc/lyskomd.texi (Modifying Stored Types): The default database
      format is now defined in ram-io.c, and nowhere else.  It is
      preferrable if lyskomd is able to convert an old format to a new
      one after an upgrade.
      * src/server/testsuite/test-l2g.c (main): Added a dbfile wrapper
      around stdin in call to l2g_read(), and another around stderr in
      call to l2g_write().
      * src/server/testsuite/Makefile.am (test_l2g_LDADD): Include
      libeintr.a.
      * src/server/simple-cache.c: Change all FILE* that refer to the
      status files to struct dbfile* in all functions, and made
      appropriate changes.
      (pre_sync): Use dbfile_delete() instead of i_fclose(), and
      dbfile_open_write() instead of i_fopen().
      (post_sync): Use dbfile_delete() instead of i_fclose(), and
      dbfile_open_read() instead of i_fopen().
      (save_one_text): Use dbfile_delete() instead of i_fclose(), and
      dbfile_open_read() instead of i_fopen().
      (sync_part): Use dbfile_delete() instead of i_fclose().
      (init_cache): Removed local variable datafile_version; use
      fp->format instead.  Use dbfile_open_read() instead of i_fopen().
      Removed call to set_input_format(), as dbfile_open_read() does
      the same thing.
      (free_all_cache): Use dbfile_delete() instead of i_fclose().
      * src/server/ramkomd.c (dump_exit_statistics): Dump dbfile stats.
      * src/server/ram-parse.h, src/server/ram-parse.c: Change all
      FILE* that refer to the status files to struct dbfile* in all
      functions, and made appropriate changes.
      (set_input_format): Removed.
      * src/server/ram-parse.c (input_format): Removed.  All users
      changed to use fp->format instead, so that lyskomd can read files
      with different versions at the same time.
      (fparse_text_stat_2): Code cleanup.
      (fparse_text_stat_0): Use dbfile_ungetc() instead of ungetc().
      * src/server/ram-output.h, src/server/ram-output.c: Change all
      FILE* that refer to the status files to struct dbfile* in all
      functions, and made appropriate changes.
      (output_format): Moved to ram-io.c and made static.
      (set_output_format): Moved to ram-io.c.
      554e4c59
  17. 19 Oct, 2006 3 commits
    • Per Cederqvist's avatar
      Fixed more missed opportunities to use fparse_set_pos() and · 0a162ece
      Per Cederqvist authored
      foutput_newline().
      * src/server/dbck-cache.c (get_version): Use fparse_set_pos()
      intead of fseek() where appropriate.
      (init_cache): Ditto.
      * src/server/simple-cache.c (get_version): Ditto.
      (pre_sync): Removed dead code.  Use foutput_newline() and
      fparse_set_pos() where appropriate.
      (save_one_conf): Use foutput_newline() where appropriate.
      (save_one_pers): Ditto.
      (save_one_text): Ditto.
      (init_cache): Use fparse_set_pos() where appropriate.
      0a162ece
    • Per Cederqvist's avatar
      Improve logging and error messages. · 1b06e63f
      Per Cederqvist authored
      * src/server/simple-cache.c (read_person): Use restart_kom instead
      of kom_log when there is a size mismatch.
      (read_conference): Ditto.
      (pre_sync): Log the file name and error message when the file to
      save in cannot be opened.
      (init_cache): Improve the error message when the database is in
      the wrong format.
      1b06e63f
    • Per Cederqvist's avatar
      Fixed a missing opportunity to use foutput_newline. · d622ef86
      Per Cederqvist authored
      * src/server/dbck-cache.c (cache_sync_all): Replaced another
      fprintf call with a call to foutput_newline.
      d622ef86