mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +03:00
Teach `pkd` a new flag `-L, --temp-dir=<mkdtemp-template>` to enable
behavior whereby `pkd` creates a new temporary directory and uses it
for a workspace while running.
The original design of `pkd` assumed that it could freely use the
current working directory from wherever it happened to be invoked.
But, this could pose a problem when multiple `pkd` instances are run
in parallel from the same working directory, due to the usage of
various temporary files within that directory.
To avoid the problem of multiple `pkd` instances interfering with
each other, expose a `-L` flag for optionally specifying a `mkdtemp`
template string such that a temporary scratch space is used instead.
Testing notes:
- I ran handfuls of iterations locally using the new flag
and observed `pkd` is indeed using scratch space as desired.
Resolves https://gitlab.com/libssh/libssh-mirror/-/issues/143.
Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit b610757e63
)
64 lines
1.0 KiB
C
64 lines
1.0 KiB
C
/*
|
|
* pkd_daemon.h -- tests use this interface to start, stop pkd
|
|
* instances and get results
|
|
*
|
|
* (c) 2014 Jon Simons
|
|
*/
|
|
|
|
#ifndef __PKD_DAEMON_H__
|
|
#define __PKD_DAEMON_H__
|
|
|
|
#include "config.h"
|
|
|
|
enum pkd_hostkey_type_e {
|
|
PKD_RSA,
|
|
#ifdef HAVE_DSA
|
|
PKD_DSA,
|
|
#endif
|
|
PKD_ED25519,
|
|
PKD_ECDSA
|
|
};
|
|
|
|
struct pkd_daemon_args {
|
|
enum pkd_hostkey_type_e type;
|
|
const char *hostkeypath;
|
|
|
|
struct {
|
|
const uint8_t *buf;
|
|
size_t len;
|
|
} payload;
|
|
|
|
uint64_t rekey_data_limit;
|
|
|
|
int original_dir_fd;
|
|
|
|
struct {
|
|
int list;
|
|
|
|
int log_stdout;
|
|
int log_stderr;
|
|
int libssh_log_level;
|
|
|
|
const char *testname;
|
|
const char *testmatch;
|
|
unsigned int iterations;
|
|
|
|
struct {
|
|
char *mkdtemp_str;
|
|
} socket_wrapper;
|
|
|
|
struct {
|
|
char *mkdtemp_str;
|
|
} temp_dir;
|
|
} opts;
|
|
};
|
|
|
|
struct pkd_result {
|
|
int ok;
|
|
};
|
|
|
|
int pkd_start(struct pkd_daemon_args *args);
|
|
void pkd_stop(struct pkd_result *out);
|
|
|
|
#endif /* __PKD_DAEMON_H__ */
|