mirror of
https://github.com/troglobit/libite.git
synced 2026-10-13 10:14:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b69d8a6013 | ||
|
|
e874608b76 | ||
|
|
c1e050f93c | ||
|
|
0e45929323 | ||
|
|
958502d982 | ||
|
|
f0cb0b7bf2 | ||
|
|
ee5788d49b | ||
|
|
9bfe54f959 | ||
|
|
960e7f69ed | ||
|
|
68bc83f08f | ||
|
|
986d29caf0 | ||
|
|
2d9f8f595d |
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
libite (-lite) is a small project, as such we have no possibility to support older versions.
|
||||||
|
The only supported version is the latest released on GitHub:
|
||||||
|
|
||||||
|
<https://github.com/troglobit/libite/releases>
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Contact the project's main author and owner to report and discuss vulnerabilities.
|
||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install tree doxygen
|
sudo apt-get -y install tree doxygen
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
make check || (cat test/test-suite.log; false)
|
make check || (cat test/test-suite.log; false)
|
||||||
- name: Upload Test Results
|
- name: Upload Test Results
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: libite-test-${{ matrix.compiler }}
|
name: libite-test-${{ matrix.compiler }}
|
||||||
path: test/*
|
path: test/*
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MAKEFLAGS: -j3
|
MAKEFLAGS: -j3
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Installing dependencies
|
- name: Installing dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
coverity:
|
coverity:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Fetch latest Coverity Scan MD5
|
- name: Fetch latest Coverity Scan MD5
|
||||||
id: var
|
id: var
|
||||||
env:
|
env:
|
||||||
@@ -25,7 +25,7 @@ jobs:
|
|||||||
--post-data "token=$TOKEN&project=${COVERITY_PROJ}&md5=1" \
|
--post-data "token=$TOKEN&project=${COVERITY_PROJ}&md5=1" \
|
||||||
-O coverity-latest.tar.gz.md5
|
-O coverity-latest.tar.gz.md5
|
||||||
echo "md5=$(cat coverity-latest.tar.gz.md5)" | tee -a $GITHUB_OUTPUT
|
echo "md5=$(cat coverity-latest.tar.gz.md5)" | tee -a $GITHUB_OUTPUT
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v4
|
||||||
id: cache
|
id: cache
|
||||||
with:
|
with:
|
||||||
path: coverity-latest.tar.gz
|
path: coverity-latest.tar.gz
|
||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
--form description="${PROJECT_NAME} $(git rev-parse HEAD)" \
|
--form description="${PROJECT_NAME} $(git rev-parse HEAD)" \
|
||||||
https://scan.coverity.com/builds?project=${COVERITY_PROJ}
|
https://scan.coverity.com/builds?project=${COVERITY_PROJ}
|
||||||
- name: Upload build.log
|
- name: Upload build.log
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: coverity-build.log
|
name: coverity-build.log
|
||||||
path: cov-int/build-log.txt
|
path: cov-int/build-log.txt
|
||||||
@@ -11,7 +11,7 @@ jobs:
|
|||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Installing dependencies ...
|
- name: Installing dependencies ...
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
|
|||||||
+30
-3
@@ -4,8 +4,33 @@ Change Log
|
|||||||
All notable changes to the project are documented in this file.
|
All notable changes to the project are documented in this file.
|
||||||
|
|
||||||
|
|
||||||
[v2.6.0][UNRELEASED]
|
[UNRELEASED][]
|
||||||
--------------------
|
--------------
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix `copyfile()` not preserving the source file mode when the process
|
||||||
|
umask is more restrictive
|
||||||
|
- Fix `mkpath()`, and `fmkpath()`, not applying the given mode when the
|
||||||
|
process umask is more restrictive, e.g., requesting 0755 with umask
|
||||||
|
0027 silently created a 0750 directory
|
||||||
|
|
||||||
|
[v2.6.2][] - 2025-11-22
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix memory leak in `which()` on `realloc()` failure
|
||||||
|
- Fix `pidfile()` to handle missing trailing slash in prefix path
|
||||||
|
|
||||||
|
|
||||||
|
[v2.6.1][] - 2023-10-15
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- FTBFS uClibc and musl libc, `lite.h` missing `stdarg.h` include
|
||||||
|
|
||||||
|
|
||||||
|
[v2.6.0][] - 2023-09-17
|
||||||
|
-----------------------
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
- New APIs from the [Infix Project](https://github.com/kernelkit/infix):
|
- New APIs from the [Infix Project](https://github.com/kernelkit/infix):
|
||||||
@@ -504,7 +529,9 @@ problems this may cause!
|
|||||||
Initial extraction of frog DNA from [Finit][]. See [README][] for API details.
|
Initial extraction of frog DNA from [Finit][]. See [README][] for API details.
|
||||||
|
|
||||||
|
|
||||||
[UNRELEASED]: https://github.com/troglobit/libite/compare/v2.5.3...HEAD
|
[UNRELEASED]: https://github.com/troglobit/libite/compare/v2.6.2...HEAD
|
||||||
|
[v2.6.2]: https://github.com/troglobit/libite/compare/v2.6.1...v2.6.2
|
||||||
|
[v2.6.1]: https://github.com/troglobit/libite/compare/v2.6.0...v2.6.1
|
||||||
[v2.6.0]: https://github.com/troglobit/libite/compare/v2.5.3...v2.6.0
|
[v2.6.0]: https://github.com/troglobit/libite/compare/v2.5.3...v2.6.0
|
||||||
[v2.5.3]: https://github.com/troglobit/libite/compare/v2.5.2...v2.5.3
|
[v2.5.3]: https://github.com/troglobit/libite/compare/v2.5.2...v2.5.3
|
||||||
[v2.5.2]: https://github.com/troglobit/libite/compare/v2.5.1...v2.5.2
|
[v2.5.2]: https://github.com/troglobit/libite/compare/v2.5.1...v2.5.2
|
||||||
|
|||||||
@@ -1 +1,15 @@
|
|||||||
* TODO Write tests for new APIs
|
* TODO Write tests for new APIs
|
||||||
|
|
||||||
|
* More formatted variants?
|
||||||
|
- symlinkf()
|
||||||
|
- accessf()
|
||||||
|
- statf() / lstatf()
|
||||||
|
|
||||||
|
* Relocate from Finit
|
||||||
|
|
||||||
|
- fnread()
|
||||||
|
- fnwrite()
|
||||||
|
- fngetint()
|
||||||
|
- paste()
|
||||||
|
- unquote()
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT(libite, 2.6.0-rc1, https://github.com/troglobit/libite/issues)
|
AC_INIT(libite, 2.6.2, https://github.com/troglobit/libite/issues)
|
||||||
AC_CONFIG_AUX_DIR(aux)
|
AC_CONFIG_AUX_DIR(aux)
|
||||||
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
|
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
# The DX_*_FEATURE macros control the default setting for the given
|
# The DX_*_FEATURE macros control the default setting for the given
|
||||||
# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
|
# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
|
||||||
# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
|
# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
|
||||||
# help (for MS users), 'CHI' for generating a seperate .chi file by the
|
# help (for MS users), 'CHI' for generating a separate .chi file by the
|
||||||
# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
|
# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
|
||||||
# output formats. The environment variable DOXYGEN_PAPER_SIZE may be
|
# output formats. The environment variable DOXYGEN_PAPER_SIZE may be
|
||||||
# specified to override the default 'a4wide' paper size.
|
# specified to override the default 'a4wide' paper size.
|
||||||
@@ -321,8 +321,8 @@ DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
|
|||||||
DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
|
DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
|
||||||
[DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
|
[DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
|
||||||
|
|
||||||
# Seperate CHI file generation.
|
# Separate CHI file generation.
|
||||||
DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
|
DX_ARG_ABLE(chi, [generate doxygen separate compressed HTML help index file],
|
||||||
[DX_CHECK_DEPEND(chm, 1)],
|
[DX_CHECK_DEPEND(chm, 1)],
|
||||||
[DX_CLEAR_DEPEND(chm, 1)],
|
[DX_CLEAR_DEPEND(chm, 1)],
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -208,12 +208,20 @@ ssize_t copyfile(const char *src, const char *dst, int len, int opt)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* open(2) applies umask, we want the source file mode */
|
||||||
|
if (fchmod(out, st.st_mode & 07777)) {
|
||||||
|
saved_errno = errno;
|
||||||
|
size = -1;
|
||||||
|
goto close_exit;
|
||||||
|
}
|
||||||
|
|
||||||
size = do_copy(in, out, num, buffer, BUFSIZ);
|
size = do_copy(in, out, num, buffer, BUFSIZ);
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
else if (keep_mtim)
|
else if (keep_mtim)
|
||||||
set_mtime(in, out);
|
set_mtime(in, out);
|
||||||
|
|
||||||
|
close_exit:
|
||||||
close(out);
|
close(out);
|
||||||
close(in);
|
close(in);
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ extern "C"
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h> /* Definition of AT_* constants for utimensat() */
|
#include <fcntl.h> /* Definition of AT_* constants for utimensat() */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, INT32_MAX, etc. */
|
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, INT32_MAX, etc. */
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
+7
-1
@@ -35,6 +35,9 @@
|
|||||||
* @param dir Directory to created, relative or absolute
|
* @param dir Directory to created, relative or absolute
|
||||||
* @param mode A &mode_t mode to create @a dir with
|
* @param mode A &mode_t mode to create @a dir with
|
||||||
*
|
*
|
||||||
|
* Directories are created with exactly @a mode, the process umask is
|
||||||
|
* not applied like it is for mkdir(2).
|
||||||
|
*
|
||||||
* @returns POSIX OK(0) on success, otherwise -1 with @a errno set.
|
* @returns POSIX OK(0) on success, otherwise -1 with @a errno set.
|
||||||
*/
|
*/
|
||||||
int mkpath(const char *dir, mode_t mode)
|
int mkpath(const char *dir, mode_t mode)
|
||||||
@@ -51,7 +54,10 @@ int mkpath(const char *dir, mode_t mode)
|
|||||||
|
|
||||||
mkpath(dirname(strdupa(dir)), mode);
|
mkpath(dirname(strdupa(dir)), mode);
|
||||||
|
|
||||||
return mkdir(dir, mode);
|
if (mkdir(dir, mode))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return chmod(dir, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+5
-1
@@ -45,6 +45,7 @@
|
|||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifndef pidfile
|
#ifndef pidfile
|
||||||
@@ -93,7 +94,10 @@ int pidfile(const char *basename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (basename[0] != '/') {
|
if (basename[0] != '/') {
|
||||||
if (asprintf(&pidfile_path, "%s%s.pid", __pidfile_path, basename) == -1)
|
size_t len = strlen(__pidfile_path);
|
||||||
|
int slash = __pidfile_path[len > 0 ? len - 1 : 0] != '/';
|
||||||
|
|
||||||
|
if (asprintf(&pidfile_path, "%s%s%s.pid", __pidfile_path, slash ? "/" : "", basename) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
} else {
|
} else {
|
||||||
if (asprintf(&pidfile_path, "%s", basename) == -1)
|
if (asprintf(&pidfile_path, "%s", basename) == -1)
|
||||||
|
|||||||
+9
-6
@@ -53,8 +53,9 @@ static char *strip_args(char *path)
|
|||||||
*/
|
*/
|
||||||
char *which(const char *cmd)
|
char *which(const char *cmd)
|
||||||
{
|
{
|
||||||
|
char *ptr, *env, *path = NULL;
|
||||||
size_t pathlen = 0;
|
size_t pathlen = 0;
|
||||||
char *ptr, *tok, *env, *path = NULL;
|
const char *tok;
|
||||||
|
|
||||||
if (!cmd) {
|
if (!cmd) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@@ -69,9 +70,7 @@ char *which(const char *cmd)
|
|||||||
if (!access(path, X_OK))
|
if (!access(path, X_OK))
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
if (path)
|
free(path);
|
||||||
free(path);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,11 +87,15 @@ char *which(const char *cmd)
|
|||||||
size_t len = strlen(tok) + strlen(cmd) + 2;
|
size_t len = strlen(tok) + strlen(cmd) + 2;
|
||||||
|
|
||||||
if (pathlen < len) {
|
if (pathlen < len) {
|
||||||
path = realloc(path, len);
|
char *tmp = realloc(path, len);
|
||||||
if (!path) {
|
|
||||||
|
if (!tmp) {
|
||||||
|
free(path);
|
||||||
free(env);
|
free(env);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
path = tmp;
|
||||||
pathlen = len;
|
pathlen = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
-1
@@ -123,9 +123,32 @@ static int _copyfile()
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* copyfile() must preserve source mode, even with a restrictive umask */
|
||||||
|
static int _mode(void)
|
||||||
|
{
|
||||||
|
const char *src = "/tmp/libite-mode-src", *dst = "/tmp/libite-mode-dst";
|
||||||
|
struct stat st;
|
||||||
|
mode_t old;
|
||||||
|
int rc = 1;
|
||||||
|
|
||||||
|
if (touch(src) || chmod(src, 0644))
|
||||||
|
return test(1, "copyfile() mode, prepare %s", src);
|
||||||
|
|
||||||
|
old = umask(0077);
|
||||||
|
if (copyfile(src, dst, 0, 0) >= 0 && !stat(dst, &st))
|
||||||
|
rc = (st.st_mode & 07777) != 0644;
|
||||||
|
umask(old);
|
||||||
|
|
||||||
|
erase(src);
|
||||||
|
erase(dst);
|
||||||
|
|
||||||
|
return test(rc, "copyfile() preserves mode 0644 with umask 0077");
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
return _fcopyfile() ||
|
return _fcopyfile() ||
|
||||||
_copyfile() ||
|
_copyfile() ||
|
||||||
_sz();
|
_sz() ||
|
||||||
|
_mode();
|
||||||
}
|
}
|
||||||
+34
-2
@@ -50,6 +50,34 @@ int test_fmkpath(const char *subdir)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* mkpath() must apply mode as given, not mode & ~umask */
|
||||||
|
int test_umask(void)
|
||||||
|
{
|
||||||
|
const char *dirs[] = { BASEDIR "/um", BASEDIR "/um/sub", NULL };
|
||||||
|
mode_t old = umask(0077);
|
||||||
|
struct stat sb;
|
||||||
|
int i, ret;
|
||||||
|
|
||||||
|
ret = mkpath(dirs[1], 0755);
|
||||||
|
umask(old);
|
||||||
|
if (ret) {
|
||||||
|
perror("Failed");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; dirs[i]; i++) {
|
||||||
|
if (checkpath(dirs[i]) || stat(dirs[i], &sb))
|
||||||
|
return 1;
|
||||||
|
if ((sb.st_mode & 07777) != 0755) {
|
||||||
|
fprintf(stderr, "Failed: %s mode %04o, expected 0755\n",
|
||||||
|
dirs[i], sb.st_mode & 07777);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
@@ -66,14 +94,18 @@ int main(void)
|
|||||||
|
|
||||||
mkdir(BASEDIR, 0755);
|
mkdir(BASEDIR, 0755);
|
||||||
|
|
||||||
printf("Pass 1/2: makepath() =========================\n");
|
printf("Pass 1/3: makepath() =========================\n");
|
||||||
for (i = 0; list[i] && !ret; i++)
|
for (i = 0; list[i] && !ret; i++)
|
||||||
ret |= test_makepath(list[i]);
|
ret |= test_makepath(list[i]);
|
||||||
|
|
||||||
printf("Pass 2/2: fmkpath() ==========================\n");
|
printf("Pass 2/3: fmkpath() ==========================\n");
|
||||||
for (i = 0; list[i] && !ret; i++)
|
for (i = 0; list[i] && !ret; i++)
|
||||||
ret |= test_fmkpath(list[i] + strlen(BASEDIR) + 1);
|
ret |= test_fmkpath(list[i] + strlen(BASEDIR) + 1);
|
||||||
|
|
||||||
|
printf("Pass 3/3: mkpath() with umask ================\n");
|
||||||
|
if (!ret)
|
||||||
|
ret |= test_umask();
|
||||||
|
|
||||||
printf("Done: Cleaning up ============================\n");
|
printf("Done: Cleaning up ============================\n");
|
||||||
system("rm -rf " BASEDIR);
|
system("rm -rf " BASEDIR);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user