mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-08 03:42:12 +03:00
The OpenSSH as part of the new test torture_request_pty_modes attempts to chown the pty to the faked user, which is obviously not permitted when the test does not run as a root. But since all the permissions for SSH are faked, just ignoring these requests should be safe enough giving expected results. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
22 lines
566 B
C
22 lines
566 B
C
#define _GNU_SOURCE
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <dlfcn.h>
|
|
|
|
typedef int (*__libc_chown)(const char *pathname, uid_t owner, gid_t group);
|
|
|
|
/* silent gcc */
|
|
int chown(const char *pathname, uid_t owner, gid_t group);
|
|
|
|
int chown(const char *pathname, uid_t owner, gid_t group)
|
|
{
|
|
__libc_chown original_chown;
|
|
if (strlen(pathname) > 7 && strncmp(pathname, "/dev/pt", 7) == 0) {
|
|
/* fake it! */
|
|
return 0;
|
|
}
|
|
|
|
original_chown = (__libc_chown)dlsym(RTLD_NEXT, "chown");
|
|
return (*original_chown)(pathname, owner, group);
|
|
}
|