Hello community, here is the log from the commit of package libeconf for openSUSE:Factory checked in at 2019-09-27 14:43:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libeconf (Old) and /work/SRC/openSUSE:Factory/.libeconf.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libeconf" Fri Sep 27 14:43:59 2019 rev:4 rq:733498 version:0.3.2+git20190926.fea4a03 Changes: -------- --- /work/SRC/openSUSE:Factory/libeconf/libeconf.changes 2019-09-17 13:36:41.577849710 +0200 +++ /work/SRC/openSUSE:Factory/.libeconf.new.2352/libeconf.changes 2019-09-27 14:44:02.629451971 +0200 @@ -1,0 +2,17 @@ +Thu Sep 26 17:43:54 UTC 2019 - ku...@suse.com + +- Update to version 0.3.2+git20190926.fea4a03: + * Release version 0.3.2 + * Fix merging an empty file (#105) + * Add test cases for merge function + +------------------------------------------------------------------- +Tue Sep 24 12:52:52 UTC 2019 - rbr...@suse.com + +- Update to version 0.3.1+git20190924.822cf5b: + * release version 0.3.1 + * Set delimiter in readFile + * Change parser interface to store file name and line numbers per key + * Update ccpp.yml + +------------------------------------------------------------------- Old: ---- libeconf-0.3.0+git20190906.0e60a88.tar.xz New: ---- libeconf-0.3.2+git20190926.fea4a03.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libeconf.spec ++++++ --- /var/tmp/diff_new_pack.wXzxXU/_old 2019-09-27 14:44:03.065450837 +0200 +++ /var/tmp/diff_new_pack.wXzxXU/_new 2019-09-27 14:44:03.065450837 +0200 @@ -18,17 +18,17 @@ %define lname libeconf0 Name: libeconf -Version: 0.3.0+git20190906.0e60a88 +Version: 0.3.2+git20190926.fea4a03 Release: 0 Summary: Enhanced config file parser ala systemd License: LGPL-2.1-or-later -Url: https://github.com/openSUSE/libeconf Group: Development/Libraries/C and C++ +Url: https://github.com/openSUSE/libeconf Source: libeconf-%{version}.tar.xz Source2: baselibs.conf BuildRequires: autoconf -BuildRequires: libtool BuildRequires: automake +BuildRequires: libtool BuildRequires: pkgconfig %description @@ -37,6 +37,7 @@ %package -n %{lname} Summary: Enhanced config file parser ala systemd +Group: Development/Libraries/C and C++ %description -n %{lname} Enhanced config file parser, which merges config files placed ++++++ _service ++++++ --- /var/tmp/diff_new_pack.wXzxXU/_old 2019-09-27 14:44:03.089450774 +0200 +++ /var/tmp/diff_new_pack.wXzxXU/_new 2019-09-27 14:44:03.089450774 +0200 @@ -1,11 +1,10 @@ <services> <service name="tar_scm" mode="disabled"> - <param name="version">0.3.0</param> - <param name="versionformat">0.3.0+git%cd.%h</param> + <param name="version">0.3.2</param> + <param name="versionformat">0.3.2+git%cd.%h</param> <param name="url">git://github.com/openSUSE/libeconf.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> - <param name="changesauthor">ku...@suse.de</param> </service> <service name="recompress" mode="disabled"> <param name="compression">xz</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.wXzxXU/_old 2019-09-27 14:44:03.109450722 +0200 +++ /var/tmp/diff_new_pack.wXzxXU/_new 2019-09-27 14:44:03.109450722 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/openSUSE/libeconf.git</param> - <param name="changesrevision">82dae5154f1a386ec4e5147da8c166d2236e568e</param> + <param name="changesrevision">fea4a03631c42bd4edc7ac94bbab5675d2dc54a9</param> </service> </servicedata> \ No newline at end of file ++++++ libeconf-0.3.0+git20190906.0e60a88.tar.xz -> libeconf-0.3.2+git20190926.fea4a03.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/.github/workflows/ccpp.yml new/libeconf-0.3.2+git20190926.fea4a03/.github/workflows/ccpp.yml --- old/libeconf-0.3.0+git20190906.0e60a88/.github/workflows/ccpp.yml 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/.github/workflows/ccpp.yml 2019-09-26 19:38:46.000000000 +0200 @@ -11,9 +11,9 @@ - uses: actions/checkout@v1 - name: autogen.sh run: ./autogen.sh - - name: configure + - name: configure with checks run: ./configure --enable-compiler-checks - - name: make + - name: make with compiler checks run: make - name: make check run: make check diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/NEWS new/libeconf-0.3.2+git20190926.fea4a03/NEWS --- old/libeconf-0.3.0+git20190906.0e60a88/NEWS 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/NEWS 2019-09-26 19:38:46.000000000 +0200 @@ -1,3 +1,9 @@ +Version 0.3.2 +* Bugfix for merging empty configuration files + +Version 0.3.1 +* Bugfix for writing files (Set delimiter in readFile) + Version 0.3.0 * New parser * Add econf_get*ValueDef functions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/configure.ac new/libeconf-0.3.2+git20190926.fea4a03/configure.ac --- old/libeconf-0.3.0+git20190906.0e60a88/configure.ac 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/configure.ac 2019-09-26 19:38:46.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([libeconf], [0.3.0]) +AC_INIT([libeconf], [0.3.2]) AC_SUBST(PACKAGE) AC_SUBST(VERSION) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/include/getfilecontents.h new/libeconf-0.3.2+git20190926.fea4a03/include/getfilecontents.h --- old/libeconf-0.3.0+git20190906.0e60a88/include/getfilecontents.h 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/include/getfilecontents.h 2019-09-26 19:38:46.000000000 +0200 @@ -23,10 +23,9 @@ #pragma once -#include <stdio.h> - #include "libeconf.h" #include "keyfile.h" -/* Fill the econf_file struct with values from the given file handle */ -extern econf_err fill_key_file(econf_file *read_file, FILE *kf, const char *delim, const char *comment); +/* Fill the econf_file struct with values from the given file */ +extern econf_err read_file(econf_file *read_file, const char *file, + const char *delim, const char *comment); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/include/keyfile.h new/libeconf-0.3.2+git20190926.fea4a03/include/keyfile.h --- old/libeconf-0.3.0+git20190906.0e60a88/include/keyfile.h 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/include/keyfile.h 2019-09-26 19:38:46.000000000 +0200 @@ -42,6 +42,7 @@ group is found or provided the group is set to KEY_FILE_NULL_VALUE. */ struct file_entry { char *group, *key, *value; + uint64_t line_number; } * file_entry; /* length represents the current amount of key/value entries in econf_file and alloc_length the the amount of currently allocated file_entry elements @@ -57,6 +58,7 @@ /* Binary variable to determine whether econf_file should be freed after being merged with another econf_file. */ bool on_merge_delete; + char *path; } econf_file; /* Increases both length and alloc_length of key_file by one and initializes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/lib/Makefile.am new/libeconf-0.3.2+git20190926.fea4a03/lib/Makefile.am --- old/libeconf-0.3.0+git20190906.0e60a88/lib/Makefile.am 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/lib/Makefile.am 2019-09-26 19:38:46.000000000 +0200 @@ -4,7 +4,7 @@ libeconf_la_CFLAGS = -D_REENTRANT=1 @CFLAGS_CHECKS@ @CFLAGS_WARNINGS@ libeconf_la_CPPFLAGS = -I$(top_srcdir)/include libeconf_la_LDFLAGS = @LDFLAGS_CHECKS@ @CFLAGS_WARNINGS@ \ - -version-info 3:0:3 -Wl,--no-undefined \ + -version-info 3:1:3 -Wl,--no-undefined \ -Wl,--version-script=$(top_srcdir)/lib/libeconf.map CLEANFILES = *~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/lib/getfilecontents.c new/libeconf-0.3.2+git20190926.fea4a03/lib/getfilecontents.c --- old/libeconf-0.3.0+git20190906.0e60a88/lib/getfilecontents.c 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/lib/getfilecontents.c 2019-09-26 19:38:46.000000000 +0200 @@ -32,184 +32,68 @@ #include <string.h> #include <ctype.h> -#if 0 - -// Check whether the key file has enough memory allocated, if not realloc -static void new_kf_line(struct file_entry **fe, size_t *file_length, size_t *lnum) { - if (++(*file_length) >= *lnum) { - *fe = realloc(*fe, *lnum * 2 * sizeof(struct file_entry)); /* XXX ENOMEM check missing */ - (*lnum) *= 2; - } - (*fe)[*file_length].group = KEY_FILE_NULL_VALUE; - (*fe)[*file_length].key = KEY_FILE_NULL_VALUE; -} - -// Write the group/value entry to the given file_entry -static void end_of_line(struct file_entry **fe, size_t *len, size_t *lnum, size_t vlen, - char *buffer) { - // Remove potential whitespaces from beginning and end - buffer = clearblank(&vlen, buffer); - // If a newline char is encountered and the line had no delimiter - // the line is expected to be a group - // In this case key is not set - if (!strcmp((*fe)[*len].key, KEY_FILE_NULL_VALUE)) { - if(!*len) { free((*fe)->group); } - (*fe)[*len].group = strndup(buffer, vlen); /* XXX ENOMEM check missing */ - } else { - // If the line is no new group copy the group from the previous line - if (*len && !strcmp((*fe)[*len].group, KEY_FILE_NULL_VALUE)) { - (*fe)[*len].group = strdup((*fe)[*len - 1].group); /* XXX ENOMEM check missing */ - } - // If the line had a delimiter everything after the delimiter is - // considered to be a value - (*fe)[*len].value = strndup(buffer, vlen); /* XXX ENOMEM check missing */ - // Perform memory check and increase len by one - new_kf_line(fe, len, lnum); - } -} - -// Fill the Key File struct with values from the given file handle -econf_err -fill_key_file(econf_file *read_file, FILE *kf, const char *delim, const char *comments) { - // KEY_FILE_DEFAULT_LENGTH: Default number of key-value pairs to be - // allocated in key_file - // LLEN: Base number of chars in a key, value or group name - // Once the value of these is exceeded memory space of double the value - // is allocated - const size_t LLEN = 8; - size_t file_length = 0, lnum = KEY_FILE_DEFAULT_LENGTH, llen = LLEN, vlen = 0; - int ch; - - // Allocate memory for the econf_file based on KEY_FILE_DEFAULT_LENGTH - struct file_entry *fe = malloc(KEY_FILE_DEFAULT_LENGTH * sizeof(struct file_entry)); - if (fe == NULL) - return ECONF_NOMEM; - - char *buffer = malloc(LLEN); - if (buffer == NULL) - { - free (fe); - return ECONF_NOMEM; - } - - fe->group = strdup(KEY_FILE_NULL_VALUE); - if (fe->group == NULL) - { - free (buffer); - free (fe); - return ECONF_NOMEM; - } - fe->key = KEY_FILE_NULL_VALUE; - - while ((ch = getc(kf)) != EOF) { - if (vlen >= llen) { - char *tmp = realloc(buffer, llen * 2); - if (!tmp) { - free (buffer); - free (fe->group); - free (fe); - return ECONF_NOMEM; - } - buffer = tmp; - llen *= 2; - } - if (ch == '\n') { - if (vlen == 0 && !strcmp(fe[file_length].key, KEY_FILE_NULL_VALUE)) - continue; - end_of_line(&fe, &file_length, &lnum, vlen, buffer); - } - // If the current char is the delimiter consider the part before to - // be a key. - else if (strchr(delim, ch) != NULL && - !strcmp(fe[file_length].key, KEY_FILE_NULL_VALUE)) { - if(!file_length) - read_file->delimiter = ch; - buffer = clearblank(&vlen, buffer); - fe[file_length].key = strndup(buffer, vlen); - if (fe[file_length].key == NULL) - return ECONF_NOMEM; /* TODO: try to cleanup memory */ - } - // If the line contains the given comment char ignore the rest - // of the line and proceed with the next - else if (ch == comments[0]) { - if (vlen != 0) { end_of_line(&fe, &file_length, &lnum, vlen, buffer); } - vlen = getline(&buffer, &llen, kf); - } - // Default case: append the char to the buffer - else { - buffer[vlen++] = ch; - continue; - } - vlen = 0; - } - free(buffer); - - // Check if the file is really at its end after EOF is encountered. - if (!feof(kf)) { - return ECONF_ERROR; - } - if (!strcmp(fe->key, KEY_FILE_NULL_VALUE)) { - fe->key = NULL; - free(fe->group); - return ECONF_ERROR; - } - read_file->length = file_length; - read_file->alloc_length = file_length; - struct file_entry *tmp = realloc(fe, file_length * sizeof(struct file_entry)); - if (!tmp) { - free(fe); - return ECONF_NOMEM; - } - read_file->file_entry = tmp; - - return ECONF_SUCCESS; -} - -#else - static econf_err -store (econf_file *file, const char *group, const char *key, const char *value) +store (econf_file *ef, const char *group, const char *key, + const char *value, uint64_t line_number) { - if (file->alloc_length == file->length) { + if (ef->alloc_length == ef->length) { struct file_entry *tmp; - tmp = realloc(file->file_entry, (file->length + 1) * sizeof(struct file_entry)); + tmp = realloc(ef->file_entry, (ef->length + 1) * sizeof(struct file_entry)); if (!tmp) return ECONF_NOMEM; - file->file_entry = tmp; - file->length++; - file->alloc_length = file->length; + ef->file_entry = tmp; + ef->length++; + ef->alloc_length = ef->length; } + ef->file_entry[ef->length-1].line_number = line_number; + if (group) - file->file_entry[file->length-1].group = strdup(group); + ef->file_entry[ef->length-1].group = strdup(group); else - file->file_entry[file->length-1].group = strdup(KEY_FILE_NULL_VALUE); + ef->file_entry[ef->length-1].group = strdup(KEY_FILE_NULL_VALUE); if (key) - file->file_entry[file->length-1].key = strdup(key); + ef->file_entry[ef->length-1].key = strdup(key); else - file->file_entry[file->length-1].key = strdup(KEY_FILE_NULL_VALUE); + ef->file_entry[ef->length-1].key = strdup(KEY_FILE_NULL_VALUE); if (value) - file->file_entry[file->length-1].value = strdup(value); + ef->file_entry[ef->length-1].value = strdup(value); else - file->file_entry[file->length-1].value = NULL; + ef->file_entry[ef->length-1].value = NULL; return ECONF_SUCCESS; } -// Fill the Key File struct with values from the given file handle +/* Read the file line by line and parse for comments, keys and values */ econf_err -fill_key_file(econf_file *read_file, FILE *kf, const char *delim, const char *comment) +read_file(econf_file *ef, const char *file, + const char *delim, const char *comment) { char buf[BUFSIZ]; char *current_group = NULL; econf_err retval = ECONF_SUCCESS; + uint64_t line = 0; + + FILE *kf = fopen(file, "rbe"); + + if (kf == NULL) + return ECONF_NOFILE; + + ef->path = strdup (file); + if (ef->path == NULL) { + fclose (kf); + return ECONF_NOMEM; + } + ef->delimiter = *delim; while (fgets(buf, sizeof(buf), kf)) { char *p, *name, *data = NULL; + line++; + if (*buf == '\n') continue; /* ignore empty lines */ @@ -280,16 +164,15 @@ *p-- = '\0'; } - retval = store(read_file, current_group, name, data); + retval = store(ef, current_group, name, data, line); if (retval) goto out; } out: + fclose (kf); if (current_group) free (current_group); return retval; } - -#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/lib/libeconf.c new/libeconf-0.3.2+git20190926.fea4a03/lib/libeconf.c --- old/libeconf-0.3.0+git20190906.0e60a88/lib/libeconf.c 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/lib/libeconf.c 2019-09-26 19:38:46.000000000 +0200 @@ -39,7 +39,7 @@ econf_err econf_newKeyFile(econf_file **result, char delimiter, char comment) { - econf_file *key_file = malloc(sizeof(econf_file)); + econf_file *key_file = calloc(1, sizeof(econf_file)); if (key_file == NULL) return ECONF_NOMEM; @@ -82,15 +82,9 @@ if (absolute_path == NULL) return t_err; - // File handle for the given file_name - FILE *kf = fopen(absolute_path, "rb"); - free(absolute_path); - if (kf == NULL) - return ECONF_NOFILE; - *key_file = calloc(1, sizeof(econf_file)); if (*key_file == NULL) { - fclose (kf); + free (absolute_path); return ECONF_NOMEM; } @@ -99,8 +93,8 @@ else (*key_file)->comment = '#'; - t_err = fill_key_file(*key_file, kf, delim, comment); - fclose(kf); + t_err = read_file(*key_file, absolute_path, delim, comment); + free (absolute_path); if(t_err) { econf_free(*key_file); @@ -116,7 +110,7 @@ if (merged_file == NULL || usr_file == NULL || etc_file == NULL) return ECONF_ERROR; - *merged_file = malloc(sizeof(econf_file)); + *merged_file = calloc(1, sizeof(econf_file)); if (*merged_file == NULL) return ECONF_NOMEM; @@ -133,8 +127,10 @@ size_t merge_length = 0; - if (!strcmp(etc_file->file_entry->group, KEY_FILE_NULL_VALUE) && - strcmp(usr_file->file_entry->group, KEY_FILE_NULL_VALUE)) { + if ((etc_file->file_entry == NULL || + !strcmp(etc_file->file_entry->group, KEY_FILE_NULL_VALUE)) && + (usr_file->file_entry == NULL || + strcmp(usr_file->file_entry->group, KEY_FILE_NULL_VALUE))) { merge_length = insert_nogroup(&fe, etc_file); } merge_length = merge_existing_groups(&fe, usr_file, etc_file, merge_length); @@ -235,7 +231,7 @@ adds additional directories to look at, e.g. XDG or home directory */ /* create space to store the econf_files for merging */ - key_files = malloc((++size) * sizeof(econf_file*)); + key_files = calloc((++size), sizeof(econf_file*)); if (key_files == NULL) return ECONF_NOMEM; @@ -487,5 +483,8 @@ if (key_file->file_entry) free(key_file->file_entry); + if (key_file->path) + free(key_file->path); + free(key_file); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/Makefile.am new/libeconf-0.3.2+git20190926.fea4a03/tests/Makefile.am --- old/libeconf-0.3.0+git20190906.0e60a88/tests/Makefile.am 2019-09-06 08:18:06.000000000 +0200 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/Makefile.am 2019-09-26 19:38:46.000000000 +0200 @@ -5,12 +5,14 @@ CLEANFILES = *~ EXTRA_DIST = tst-arguments-data tst-logindefs1-data tst-logindefs2-data \ - tst-merge1-data tst-merge2-data \ + tst-merge1-data tst-merge2-data tst-merge3-data tst-merge4-data \ + tst-merge5-data \ tst-getconfdirs1-data tst-getconfdirs3-data \ tst-getconfdirs4-data tst-getconfdirs5-data tst-getconfdirs6-data \ tst-arguments5-data tst-groups3-data tst-parseconfig-data -TESTS = tst-filedoesnotexit1 tst-merge1 tst-merge2 \ +TESTS = tst-filedoesnotexit1 tst-merge1 tst-merge2 tst-merge3 tst-merge4 \ + tst-merge5 \ tst-logindefs1 tst-logindefs2 \ tst-arguments1 tst-arguments2 tst-arguments3 tst-arguments4 \ tst-arguments5 \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge3-data/etc/default/su new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge3-data/etc/default/su --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge3-data/etc/default/su 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge3-data/etc/default/su 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1,6 @@ +# /etc/default/su is an override of /etc/login.defs for su. +# See /etc/login.defs and su(1) for more. +# +# List of supported variables: +# ALWAYS_SET_PATH, ENV_PATH, ENV_ROOTPATH, ENV_SUPATH, FAIL_DELAY +# diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge3-data/etc/login.defs new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge3-data/etc/login.defs --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge3-data/etc/login.defs 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge3-data/etc/login.defs 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1,301 @@ +# +# /etc/login.defs - Configuration control definitions for the shadow package. +# Some variables are used by login(1), su(1) and runuser(1) from util-linux +# package as well pam pam_unix(8) from pam package. +# +# For more, see login.defs(5). Please note that SUSE supports only variables +# listed here! Not listed variables from login.defs(5) have no effect. +# + +# +# Delay in seconds before being allowed another attempt after a login failure +# Note: When PAM is used, some modules may enforce a minimum delay (e.g. +# pam_unix(8) enforces a 2s delay) +# +FAIL_DELAY 3 + +# +# Enable display of unknown usernames when login(1) failures are recorded. +# +LOG_UNKFAIL_ENAB no + +# +# Enable "syslog" logging of newgrp(1) and sg(1) activity. +# +SYSLOG_SG_ENAB yes + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# from these devices. +# +CONSOLE /etc/securetty +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# If defined, all su(1) activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, ":" delimited list of "message of the day" files to +# be displayed upon login. +# +MOTD_FILE /etc/motd +#MOTD_FILE /etc/motd:/usr/lib/news/news-motd + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format similar to "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +#HUSHLOGIN_FILE .hushlogin +HUSHLOGIN_FILE /etc/hushlogins + +# If this variable is set to "yes", hostname will be suppressed in the +# login: prompt. +#LOGIN_PLAIN_PROMPT no + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +# +# ENV_PATH: The default PATH settings for non-root. +# +# ENV_ROOTPATH: The default PATH settings for root +# (used by login, su and runuser). +# +# ENV_SUPATH is an ENV_ROOTPATH override for su and runuser +# (and falback for login). +# +ENV_PATH /usr/local/bin:/bin:/usr/bin +ENV_ROOTPATH /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +#ENV_SUPATH /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +# If this variable is set to "yes" (default is "no"), su will always set +# path. every su call will overwrite the PATH variable. +# +# Per default, only "su -" will set a new PATH. +# +# The recommended value is "yes". The default "no" behavior could have +# a security implication in applications that use commands without path. +# +ALWAYS_SET_PATH yes + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a write(1) program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP as the number of such group +# and TTYPERM as 0620. Otherwise leave TTYGROUP commented out and +# set TTYPERM to either 622 or 600. +# +TTYGROUP tty +TTYPERM 0620 + +# Default initial "umask" value used by login(1) on non-PAM enabled systems. +# Default "umask" value for pam_umask(8) on PAM enabled systems. +# UMASK is also used by useradd(8) and newusers(8) to set the mode for new +# home directories. +# 022 is the default value, but 027, or even 077, could be considered +# for increased privacy. There is no One True Answer here: each sysadmin +# must make up their mind. +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd(8) +# +# SYS_UID_MIN to SYS_UID_MAX inclusive is the range for +# UIDs for dynamically allocated administrative and system accounts. +# UID_MIN to UID_MAX inclusive is the range of UIDs of dynamically +# allocated user accounts. +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +SYS_UID_MIN 100 +SYS_UID_MAX 499 +# Extra per user uids +SUB_UID_MIN 100000 +SUB_UID_MAX 600100000 +SUB_UID_COUNT 65536 + +# +# Min/max values for automatic gid selection in groupadd(8) +# +# SYS_GID_MIN to SYS_GID_MAX inclusive is the range for +# GIDs for dynamically allocated administrative and system groups. +# GID_MIN to GID_MAX inclusive is the range of GIDs of dynamically +# allocated groups. +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +SYS_GID_MIN 100 +SYS_GID_MAX 499 +# Extra per user group ids +SUB_GID_MIN 100000 +SUB_GID_MAX 600100000 +SUB_GID_COUNT 65536 + +# +# Max number of login(1) retries if password is bad +# +LOGIN_RETRIES 3 + +# +# Max time in seconds for login(1) +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn(1) - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# This variable is deprecated. Use ENCRYPT_METHOD instead! +# +#MD5_CRYPT_ENAB DO_NOT_USE + +# +# If set to MD5, MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# ENCRYPT_METHOD_NIS is used by pam_unix_passwd.so. +# +# Note: If you use PAM, it is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 +ENCRYPT_METHOD_NIS DES + +# +# Number of rounds for salt. +# Default values: +# Minimum number of rounds. +#SHA_CRYPT_MIN_ROUNDS 1000 +# Maximum number of rounds. +#SHA_CRYPT_MAX_ROUNDS 999999999 + +# +# Only works if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute-force the password. +# However, more CPU resources will be needed to authenticate users if +# this value is increased. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be within the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +# +# Should login be allowed if we can't cd to the home directory? +# Default is no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when adding a user. +# It should rebuild any NIS database etc. to add the +# new created account. +# +USERADD_CMD /usr/sbin/useradd.local + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +# See also USERDEL_PRECMD and USERDEL_POSTCMD below. +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# If defined, this command is run before removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed. +# +USERDEL_PRECMD /usr/sbin/userdel-pre.local + +# +# If defined, this command is run after removing a user. +# It should rebuild any NIS database etc. to remove the +# account from it. +# +USERDEL_POSTCMD /usr/sbin/userdel-post.local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# This also enables userdel(8) to remove user groups if no members exist. +# +USERGROUPS_ENAB no + +# +# If set to a non-zero number, the shadow utilities will make sure that +# groups never have more than this number of users on one line. +# This permits to support split groups (groups split into multiple lines, +# with the same group ID, to avoid limitation of the line length in the +# group file). +# +# 0 is the default value and disables this feature. +# +#MAX_MEMBERS_PER_GROUP 0 + +# +# If useradd(8) should create home directories for users by default (non +# system users only). +# This option is overridden with the -M or -m flags on the useradd(8) +# command-line. +# +CREATE_HOME no + +# +# Force use shadow, even if shadow passwd & shadow group files are +# missing. +# +FORCE_SHADOW no + +# +# User/group names must match the following regex expression. +# The default is [A-Za-z_][A-Za-z0-9_.-]*[A-Za-z0-9_.$-]\?, +# but be aware that the result could depend on the locale settings. +# +#CHARACTER_CLASS [A-Za-z_][A-Za-z0-9_.-]*[A-Za-z0-9_.$-]\? +CHARACTER_CLASS [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_][ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-]*[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.$-]\? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge3.c new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge3.c --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge3.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge3.c 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1,50 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> + +#include "libeconf.h" + +/* Test case: + * Try to open two files, where one only contains comments + * Call econf_mergeFiles with this. + * Application should not crash. +*/ + +int +main(void) +{ + econf_file *key_file_1 = NULL, *key_file_2 = NULL, *key_file_m = NULL; + econf_err error; + + error = econf_readFile (&key_file_1, TESTSDIR"tst-merge3-data/etc/login.defs", " \t=", "#"); + if (error || key_file_1 == NULL) + { + fprintf (stderr, "ERROR: couldn't read /etc/login.defs: %s\n", econf_errString(error)); + return 1; + } + error = econf_readFile (&key_file_2, TESTSDIR"tst-merge3-data/etc/default/su", " \t=", "#"); + if (error || key_file_2 == NULL) + { + fprintf (stderr, "ERROR: coudln't read /etc/default/su: %s\n", econf_errString(error)); + return 1; + } + + error = econf_mergeFiles (&key_file_m, key_file_2, key_file_1); + if (error || key_file_m == NULL) + { + fprintf (stderr, "ERROR: error merging configuration files: %s\n", econf_errString(error)); + return 1; + } + + + if (key_file_1) + econf_free (key_file_1); + if (key_file_2) + econf_free (key_file_2); + if (key_file_m) + econf_free (key_file_m); + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge4-data/data1.conf new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge4-data/data1.conf --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge4-data/data1.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge4-data/data1.conf 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1,5 @@ +[global] +KEY1=global + +[default] +KEY1=default diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge4-data/data2.conf new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge4-data/data2.conf --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge4-data/data2.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge4-data/data2.conf 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1 @@ +KEY1=data2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge4.c new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge4.c --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge4.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge4.c 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1,80 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> + +#include "libeconf.h" + +/* Test case: + * Try to open two files, where one has group entries, the other not + * Call econf_mergeFiles with this. + * Application should not crash and return correct key values +*/ + + +static bool +check_string (econf_file *key_file, const char *group, const char *key, + const char *value) +{ + econf_err error; + + char *val_String; + if ((error = econf_getStringValue(key_file, group, key, &val_String))) + { + fprintf (stderr, "ERROR: reading (%s,%s): %s\n", group, key, econf_errString(error)); + return false; + } + /* NULL means empty string */ + printf ("reading (%s,%s): got '%s', expected '%s'\n", group, key, value, val_String); + if (strcmp(val_String, value?value:"") != 0) + { + fprintf (stderr, "ERROR: reading (%s,%s): expected '%s', got: '%s'\n", + group, key, value, val_String); + return false; + } + free(val_String); + return true; +} + +int +main(void) +{ + econf_file *key_file_1 = NULL, *key_file_2 = NULL, *key_file_m = NULL; + econf_err error; + int retval = 0; + + error = econf_readFile (&key_file_1, TESTSDIR"tst-merge4-data/data1.conf", "=", "#"); + if (error || key_file_1 == NULL) + { + fprintf (stderr, "ERROR: couldn't read data1.conf: %s\n", econf_errString(error)); + return 1; + } + error = econf_readFile (&key_file_2, TESTSDIR"tst-merge4-data/data2.conf", " \t=", "#"); + if (error || key_file_2 == NULL) + { + fprintf (stderr, "ERROR: coudln't read data2.conf: %s\n", econf_errString(error)); + return 1; + } + + error = econf_mergeFiles (&key_file_m, key_file_2, key_file_1); + if (error || key_file_m == NULL) + { + fprintf (stderr, "ERROR: error merging configuration files: %s\n", econf_errString(error)); + return 1; + } + + if (!check_string (key_file_m, "global", "KEY1", "global")) retval = 1; + if (!check_string (key_file_m, "default", "KEY1", "default")) retval = 1; + if (!check_string (key_file_m, NULL, "KEY1", "data2")) retval = 1; + + if (key_file_1) + econf_free (key_file_1); + if (key_file_2) + econf_free (key_file_2); + if (key_file_m) + econf_free (key_file_m); + + return retval; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge5-data/data1.conf new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge5-data/data1.conf --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge5-data/data1.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge5-data/data1.conf 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1 @@ +KEY1=data1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge5-data/data2.conf new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge5-data/data2.conf --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge5-data/data2.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge5-data/data2.conf 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1,5 @@ +[global] +KEY1=global + +[default] +KEY1=default diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge5.c new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge5.c --- old/libeconf-0.3.0+git20190906.0e60a88/tests/tst-merge5.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.2+git20190926.fea4a03/tests/tst-merge5.c 2019-09-26 19:38:46.000000000 +0200 @@ -0,0 +1,80 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> + +#include "libeconf.h" + +/* Test case: + * Try to open two files, where one has group entries, the other not + * Call econf_mergeFiles with this. + * Application should not crash and return correct key values +*/ + + +static bool +check_string (econf_file *key_file, const char *group, const char *key, + const char *value) +{ + econf_err error; + + char *val_String; + if ((error = econf_getStringValue(key_file, group, key, &val_String))) + { + fprintf (stderr, "ERROR: reading (%s,%s): %s\n", group, key, econf_errString(error)); + return false; + } + /* NULL means empty string */ + printf ("reading (%s,%s): got '%s', expected '%s'\n", group, key, value, val_String); + if (strcmp(val_String, value?value:"") != 0) + { + fprintf (stderr, "ERROR: reading (%s,%s): expected '%s', got: '%s'\n", + group, key, value, val_String); + return false; + } + free(val_String); + return true; +} + +int +main(void) +{ + econf_file *key_file_1 = NULL, *key_file_2 = NULL, *key_file_m = NULL; + econf_err error; + int retval = 0; + + error = econf_readFile (&key_file_1, TESTSDIR"tst-merge5-data/data1.conf", "=", "#"); + if (error || key_file_1 == NULL) + { + fprintf (stderr, "ERROR: couldn't read data1.conf: %s\n", econf_errString(error)); + return 1; + } + error = econf_readFile (&key_file_2, TESTSDIR"tst-merge5-data/data2.conf", " \t=", "#"); + if (error || key_file_2 == NULL) + { + fprintf (stderr, "ERROR: coudln't read data2.conf: %s\n", econf_errString(error)); + return 1; + } + + error = econf_mergeFiles (&key_file_m, key_file_2, key_file_1); + if (error || key_file_m == NULL) + { + fprintf (stderr, "ERROR: error merging configuration files: %s\n", econf_errString(error)); + return 1; + } + + if (!check_string (key_file_m, "global", "KEY1", "global")) retval = 1; + if (!check_string (key_file_m, "default", "KEY1", "default")) retval = 1; + if (!check_string (key_file_m, NULL, "KEY1", "data1")) retval = 1; + + if (key_file_1) + econf_free (key_file_1); + if (key_file_2) + econf_free (key_file_2); + if (key_file_m) + econf_free (key_file_m); + + return retval; +}